Skip to content

Commit 6ff72a1

Browse files
AMDGPU call abi info.
1 parent 1558ae7 commit 6ff72a1

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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::call::{ArgType, FnType, };
12+
use abi::{HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods};
13+
14+
fn classify_ret_ty<'a, Ty, C>(_tuncx: C, ret: &mut ArgType<'a, Ty>)
15+
where Ty: TyLayoutMethods<'a, C> + Copy,
16+
C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout
17+
{
18+
ret.extend_integer_width_to(32);
19+
}
20+
21+
fn classify_arg_ty<'a, Ty, C>(_cx: C, arg: &mut ArgType<'a, Ty>)
22+
where Ty: TyLayoutMethods<'a, C> + Copy,
23+
C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout
24+
{
25+
arg.extend_integer_width_to(32);
26+
}
27+
28+
pub fn compute_abi_info<'a, Ty, C>(cx: C, fty: &mut FnType<'a, Ty>)
29+
where Ty: TyLayoutMethods<'a, C> + Copy,
30+
C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout
31+
{
32+
if !fty.ret.is_ignore() {
33+
classify_ret_ty(cx, &mut fty.ret);
34+
}
35+
36+
for arg in &mut fty.args {
37+
if arg.is_ignore() {
38+
continue;
39+
}
40+
classify_arg_ty(cx, arg);
41+
}
42+
}

src/librustc_target/abi/call/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use abi::{HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods};
1313
use spec::HasTargetSpec;
1414

1515
mod aarch64;
16+
mod amdgpu;
1617
mod arm;
1718
mod asmjs;
1819
mod hexagon;
@@ -503,6 +504,7 @@ impl<'a, Ty> FnType<'a, Ty> {
503504
x86_64::compute_abi_info(cx, self);
504505
},
505506
"aarch64" => aarch64::compute_abi_info(cx, self),
507+
"amdgpu" => amdgpu::compute_abi_info(cx, self),
506508
"arm" => arm::compute_abi_info(cx, self),
507509
"mips" => mips::compute_abi_info(cx, self),
508510
"mips64" => mips64::compute_abi_info(cx, self),

0 commit comments

Comments
 (0)