]> git.lizzy.rs Git - rust.git/blob - src/librustc_trans/cabi_hexagon.rs
Fix checking for missing stability annotations
[rust.git] / src / librustc_trans / cabi_hexagon.rs
1 // Copyright 2012-2013 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 #![allow(non_upper_case_globals)]
12
13 use abi::{FnType, ArgType, LayoutExt};
14 use context::CrateContext;
15
16 fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tcx>) {
17     if ret.layout.is_aggregate() && ret.layout.size(ccx).bits() > 64 {
18         ret.make_indirect(ccx);
19     } else {
20         ret.extend_integer_width_to(32);
21     }
22 }
23
24 fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) {
25     if arg.layout.is_aggregate() && arg.layout.size(ccx).bits() > 64 {
26         arg.make_indirect(ccx);
27     } else {
28         arg.extend_integer_width_to(32);
29     }
30 }
31
32 pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
33     if !fty.ret.is_ignore() {
34         classify_ret_ty(ccx, &mut fty.ret);
35     }
36
37     for arg in &mut fty.args {
38         if arg.is_ignore() {
39             continue;
40         }
41         classify_arg_ty(ccx, arg);
42     }
43 }