diff options
| author | Taiki Endo <te316e89@gmail.com> | 2025-01-29 02:14:25 +0900 |
|---|---|---|
| committer | Taiki Endo <te316e89@gmail.com> | 2025-01-29 02:14:25 +0900 |
| commit | e586382febf7d03ac330595dcf578184fccbd971 (patch) | |
| tree | 3d883ca3fdb86a8792af06bc72bce0d0b7c4e491 /compiler/rustc_target/src/asm/mod.rs | |
| parent | aa6f5ab18e67cb815f73e0d53d217bc54b0da924 (diff) | |
| download | rust-e586382febf7d03ac330595dcf578184fccbd971.tar.gz rust-e586382febf7d03ac330595dcf578184fccbd971.zip | |
Support clobber_abi in BPF inline assembly
Diffstat (limited to 'compiler/rustc_target/src/asm/mod.rs')
| -rw-r--r-- | compiler/rustc_target/src/asm/mod.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/asm/mod.rs b/compiler/rustc_target/src/asm/mod.rs index 1292f46f0c9..f17452b3ba0 100644 --- a/compiler/rustc_target/src/asm/mod.rs +++ b/compiler/rustc_target/src/asm/mod.rs @@ -934,6 +934,7 @@ pub enum InlineAsmClobberAbi { LoongArch, PowerPC, S390x, + Bpf, Msp430, } @@ -1003,6 +1004,10 @@ impl InlineAsmClobberAbi { "C" | "system" => Ok(InlineAsmClobberAbi::S390x), _ => Err(&["C", "system"]), }, + InlineAsmArch::Bpf => match name { + "C" | "system" => Ok(InlineAsmClobberAbi::Bpf), + _ => Err(&["C", "system"]), + }, InlineAsmArch::Msp430 => match name { "C" | "system" => Ok(InlineAsmClobberAbi::Msp430), _ => Err(&["C", "system"]), @@ -1278,6 +1283,14 @@ impl InlineAsmClobberAbi { a8, a9, a10, a11, a12, a13, a14, a15, } }, + InlineAsmClobberAbi::Bpf => clobbered_regs! { + Bpf BpfInlineAsmReg { + // Refs: Section 1.1 "Registers and calling convention" in BPF ABI Recommended Conventions and Guidelines v1.0 + // https://www.kernel.org/doc/html/latest/bpf/standardization/abi.html#registers-and-calling-convention + + r0, r1, r2, r3, r4, r5, + } + }, InlineAsmClobberAbi::Msp430 => clobbered_regs! { Msp430 Msp430InlineAsmReg { r11, r12, r13, r14, r15, |
