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 Oct 8, 2024
1 parent 3ae715c commit f692ded
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
Expand Up @@ -5,7 +5,7 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_span::Symbol;

use crate::abi::Size;
use crate::abi::{Endian, Size};
use crate::spec::{RelocModel, Target};

pub struct ModifierInfo {
Expand Down Expand Up @@ -893,6 +893,7 @@ pub enum InlineAsmClobberAbi {
RiscV,
LoongArch,
S390x,
PowerPC64ElfV2,
}

impl InlineAsmClobberAbi {
Expand Down Expand Up @@ -946,6 +947,12 @@ impl InlineAsmClobberAbi {
"C" | "system" => Ok(InlineAsmClobberAbi::S390x),
_ => 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 @@ -1125,6 +1132,13 @@ impl InlineAsmClobberAbi {
a8, a9, a10, a11, a12, a13, a14, a15,
}
},
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 f692ded

Please sign in to comment.