]> git.lizzy.rs Git - rust.git/blob - src/librustc_trans/cabi_wasm32.rs
rustc: Start a custom cabi module for wasm32
[rust.git] / src / librustc_trans / cabi_wasm32.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 use abi::{FnType, ArgType};
12 use context::CodegenCx;
13
14 fn classify_ret_ty<'a, 'tcx>(_cx: &CodegenCx<'a, 'tcx>, ret: &mut ArgType<'tcx>) {
15     ret.extend_integer_width_to(32);
16 }
17
18 fn classify_arg_ty(arg: &mut ArgType) {
19     arg.extend_integer_width_to(32);
20 }
21
22 pub fn compute_abi_info<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
23     if !fty.ret.is_ignore() {
24         classify_ret_ty(cx, &mut fty.ret);
25     }
26
27     for arg in &mut fty.args {
28         if arg.is_ignore() { continue; }
29         classify_arg_ty(arg);
30     }
31 }