diff options
| author | bors <bors@rust-lang.org> | 2021-09-20 07:21:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-09-20 07:21:05 +0000 |
| commit | db1fb85cff63ad5fffe435e17128f99f9e1d970c (patch) | |
| tree | ca06ae6710ea86d1f428d321a0cafaa5f2dbf083 /compiler/rustc_target/src/abi | |
| parent | e71925aab9e28ce35363e3fdef27ca011ac6a1dc (diff) | |
| parent | 5d22b1afe2ff3adb9903cb71ff386828c16fd805 (diff) | |
| download | rust-db1fb85cff63ad5fffe435e17128f99f9e1d970c.tar.gz rust-db1fb85cff63ad5fffe435e17128f99f9e1d970c.zip | |
Auto merge of #88321 - glaubitz:m68k-linux, r=wesleywiser
Add initial support for m68k This patch series adds initial support for m68k making use of the new M68k backend introduced with LLVM-13. Additional changes will be needed to be able to actually use the backend for this target.
Diffstat (limited to 'compiler/rustc_target/src/abi')
| -rw-r--r-- | compiler/rustc_target/src/abi/call/m68k.rs | 30 | ||||
| -rw-r--r-- | compiler/rustc_target/src/abi/call/mod.rs | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/abi/call/m68k.rs b/compiler/rustc_target/src/abi/call/m68k.rs new file mode 100644 index 00000000000..58fdc00b696 --- /dev/null +++ b/compiler/rustc_target/src/abi/call/m68k.rs @@ -0,0 +1,30 @@ +use crate::abi::call::{ArgAbi, FnAbi}; + +fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) { + if ret.layout.is_aggregate() { + ret.make_indirect(); + } else { + ret.extend_integer_width_to(32); + } +} + +fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) { + if arg.layout.is_aggregate() { + arg.make_indirect_byval(); + } else { + arg.extend_integer_width_to(32); + } +} + +pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) { + if !fn_abi.ret.is_ignore() { + classify_ret(&mut fn_abi.ret); + } + + for arg in &mut fn_abi.args { + if arg.is_ignore() { + continue; + } + classify_arg(arg); + } +} diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index 324278c57bf..d9eb299e2fd 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -9,6 +9,7 @@ mod arm; mod avr; mod bpf; mod hexagon; +mod m68k; mod mips; mod mips64; mod msp430; @@ -656,6 +657,7 @@ impl<'a, Ty> FnAbi<'a, Ty> { "amdgpu" => amdgpu::compute_abi_info(cx, self), "arm" => arm::compute_abi_info(cx, self), "avr" => avr::compute_abi_info(self), + "m68k" => m68k::compute_abi_info(self), "mips" => mips::compute_abi_info(cx, self), "mips64" => mips64::compute_abi_info(cx, self), "powerpc" => powerpc::compute_abi_info(self), |
