Skip to content

Commit

Permalink
asm: loongarch64: Implementation of clobber_abi
Browse files Browse the repository at this point in the history
  • Loading branch information
heiher committed May 5, 2023
1 parent 74c4821 commit 08fc451
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions compiler/rustc_target/src/asm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ pub enum InlineAsmClobberAbi {
AArch64,
AArch64NoX18,
RiscV,
LoongArch,
}

impl InlineAsmClobberAbi {
Expand Down Expand Up @@ -880,6 +881,10 @@ impl InlineAsmClobberAbi {
"C" | "system" | "efiapi" => Ok(InlineAsmClobberAbi::RiscV),
_ => Err(&["C", "system", "efiapi"]),
},
InlineAsmArch::LoongArch64 => match name {
"C" | "system" | "efiapi" => Ok(InlineAsmClobberAbi::LoongArch),
_ => Err(&["C", "system", "efiapi"]),
},
_ => Err(&[]),
}
}
Expand Down Expand Up @@ -1022,6 +1027,21 @@ impl InlineAsmClobberAbi {
v24, v25, v26, v27, v28, v29, v30, v31,
}
},
InlineAsmClobberAbi::LoongArch => clobbered_regs! {
LoongArch LoongArchInlineAsmReg {
// ra
r1,
// a0-a7
r4, r5, r6, r7, r8, r9, r10, r11,
// t0-t8
r12, r13, r14, r15, r16, r17, r18, r19, r20,
// fa0-fa7
f0, f1, f2, f3, f4, f5, f6, f7,
// ft0-ft15
f8, f9, f10, f11, f12, f13, f14, f15,
f16, f17, f18, f19, f20, f21, f22, f23,
}
},
}
}
}

0 comments on commit 08fc451

Please sign in to comment.