Skip to content

Commit

Permalink
Add support for ppc64le clobber_abi
Browse files Browse the repository at this point in the history
  • Loading branch information
ecnelises committed Apr 23, 2024
1 parent aca749e commit bdc8a1a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion compiler/rustc_target/src/asm/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::spec::Target;
use crate::{abi::Size, spec::RelocModel};
use crate::{abi::Endian, abi::Size, spec::RelocModel};
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
use rustc_macros::HashStable_Generic;
use rustc_span::Symbol;
Expand Down Expand Up @@ -878,6 +878,7 @@ pub enum InlineAsmClobberAbi {
AArch64NoX18,
RiscV,
LoongArch,
PowerPC64ElfV2,
}

impl InlineAsmClobberAbi {
Expand Down Expand Up @@ -927,6 +928,12 @@ impl InlineAsmClobberAbi {
"C" | "system" => Ok(InlineAsmClobberAbi::LoongArch),
_ => Err(&["C", "system"]),
},
InlineAsmArch::PowerPC64 => match name {
"C" | "system" if target.endian == Endian::Little => {
Ok(InlineAsmClobberAbi::PowerPC64ElfV2)
}
_ => Err(&["C", "system"]),
},
_ => Err(&[]),
}
}
Expand Down Expand Up @@ -1084,6 +1091,13 @@ impl InlineAsmClobberAbi {
f16, f17, f18, f19, f20, f21, f22, f23,
}
},
InlineAsmClobberAbi::PowerPC64ElfV2 => clobbered_regs! {
PowerPC PowerPCInlineAsmReg {
r0, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12,
xer, cr0, cr1, cr5, cr6, cr7,
f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13,
}
},
}
}
}

0 comments on commit bdc8a1a

Please sign in to comment.