Skip to content

Commit 2e8a766

Browse files
committed
Simplify gating of BPF w registers behind the alu32 target feature
This is already handled by supported_types().
1 parent 1103d2e commit 2e8a766

File tree

1 file changed

+12
-26
lines changed
  • compiler/rustc_target/src/asm

1 file changed

+12
-26
lines changed

compiler/rustc_target/src/asm/bpf.rs

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use super::{InlineAsmArch, InlineAsmType, Target};
2-
use rustc_data_structures::stable_set::FxHashSet;
1+
use super::{InlineAsmArch, InlineAsmType};
32
use rustc_macros::HashStable_Generic;
4-
use rustc_span::{sym, Symbol};
3+
use rustc_span::Symbol;
54
use std::fmt;
65

76
def_reg_class! {
@@ -43,19 +42,6 @@ impl BpfInlineAsmRegClass {
4342
}
4443
}
4544

46-
fn only_alu32(
47-
_arch: InlineAsmArch,
48-
target_features: &FxHashSet<Symbol>,
49-
_target: &Target,
50-
_is_clobber: bool,
51-
) -> Result<(), &'static str> {
52-
if !target_features.contains(&sym::alu32) {
53-
Err("register can't be used without the `alu32` target feature")
54-
} else {
55-
Ok(())
56-
}
57-
}
58-
5945
def_regs! {
6046
Bpf BpfInlineAsmReg BpfInlineAsmRegClass {
6147
r0: reg = ["r0"],
@@ -68,16 +54,16 @@ def_regs! {
6854
r7: reg = ["r7"],
6955
r8: reg = ["r8"],
7056
r9: reg = ["r9"],
71-
w0: wreg = ["w0"] % only_alu32,
72-
w1: wreg = ["w1"] % only_alu32,
73-
w2: wreg = ["w2"] % only_alu32,
74-
w3: wreg = ["w3"] % only_alu32,
75-
w4: wreg = ["w4"] % only_alu32,
76-
w5: wreg = ["w5"] % only_alu32,
77-
w6: wreg = ["w6"] % only_alu32,
78-
w7: wreg = ["w7"] % only_alu32,
79-
w8: wreg = ["w8"] % only_alu32,
80-
w9: wreg = ["w9"] % only_alu32,
57+
w0: wreg = ["w0"],
58+
w1: wreg = ["w1"],
59+
w2: wreg = ["w2"],
60+
w3: wreg = ["w3"],
61+
w4: wreg = ["w4"],
62+
w5: wreg = ["w5"],
63+
w6: wreg = ["w6"],
64+
w7: wreg = ["w7"],
65+
w8: wreg = ["w8"],
66+
w9: wreg = ["w9"],
8167

8268
#error = ["r10", "w10"] =>
8369
"the stack pointer cannot be used as an operand for inline asm",

0 commit comments

Comments
 (0)