]> git.lizzy.rs Git - rust.git/blob - src/librustc_trans/cabi_hexagon.rs
Fixes doc important trait display on mobile
[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
15 fn classify_ret_ty(ret: &mut ArgType) {
16     if ret.layout.is_aggregate() && ret.layout.size.bits() > 64 {
17         ret.make_indirect();
18     } else {
19         ret.extend_integer_width_to(32);
20     }
21 }
22
23 fn classify_arg_ty(arg: &mut ArgType) {
24     if arg.layout.is_aggregate() && arg.layout.size.bits() > 64 {
25         arg.make_indirect();
26     } else {
27         arg.extend_integer_width_to(32);
28     }
29 }
30
31 pub fn compute_abi_info(fty: &mut FnType) {
32     if !fty.ret.is_ignore() {
33         classify_ret_ty(&mut fty.ret);
34     }
35
36     for arg in &mut fty.args {
37         if arg.is_ignore() {
38             continue;
39         }
40         classify_arg_ty(arg);
41     }
42 }