@@ -148,6 +148,7 @@ macro_rules! types {
148148
149149mod aarch64;
150150mod arm;
151+ mod bpf;
151152mod hexagon;
152153mod mips;
153154mod nvptx;
@@ -159,6 +160,7 @@ mod x86;
159160
160161pub use aarch64:: { AArch64InlineAsmReg , AArch64InlineAsmRegClass } ;
161162pub use arm:: { ArmInlineAsmReg , ArmInlineAsmRegClass } ;
163+ pub use bpf:: { BpfInlineAsmReg , BpfInlineAsmRegClass } ;
162164pub use hexagon:: { HexagonInlineAsmReg , HexagonInlineAsmRegClass } ;
163165pub use mips:: { MipsInlineAsmReg , MipsInlineAsmRegClass } ;
164166pub use nvptx:: { NvptxInlineAsmReg , NvptxInlineAsmRegClass } ;
@@ -184,6 +186,7 @@ pub enum InlineAsmArch {
184186 PowerPC64 ,
185187 SpirV ,
186188 Wasm32 ,
189+ Bpf ,
187190}
188191
189192impl FromStr for InlineAsmArch {
@@ -205,6 +208,7 @@ impl FromStr for InlineAsmArch {
205208 "mips64" => Ok ( Self :: Mips64 ) ,
206209 "spirv" => Ok ( Self :: SpirV ) ,
207210 "wasm32" => Ok ( Self :: Wasm32 ) ,
211+ "bpf" => Ok ( Self :: Bpf ) ,
208212 _ => Err ( ( ) ) ,
209213 }
210214 }
@@ -233,6 +237,7 @@ pub enum InlineAsmReg {
233237 Mips ( MipsInlineAsmReg ) ,
234238 SpirV ( SpirVInlineAsmReg ) ,
235239 Wasm ( WasmInlineAsmReg ) ,
240+ Bpf ( BpfInlineAsmReg ) ,
236241 // Placeholder for invalid register constraints for the current target
237242 Err ,
238243}
@@ -247,6 +252,7 @@ impl InlineAsmReg {
247252 Self :: PowerPC ( r) => r. name ( ) ,
248253 Self :: Hexagon ( r) => r. name ( ) ,
249254 Self :: Mips ( r) => r. name ( ) ,
255+ Self :: Bpf ( r) => r. name ( ) ,
250256 Self :: Err => "<reg>" ,
251257 }
252258 }
@@ -260,6 +266,7 @@ impl InlineAsmReg {
260266 Self :: PowerPC ( r) => InlineAsmRegClass :: PowerPC ( r. reg_class ( ) ) ,
261267 Self :: Hexagon ( r) => InlineAsmRegClass :: Hexagon ( r. reg_class ( ) ) ,
262268 Self :: Mips ( r) => InlineAsmRegClass :: Mips ( r. reg_class ( ) ) ,
269+ Self :: Bpf ( r) => InlineAsmRegClass :: Bpf ( r. reg_class ( ) ) ,
263270 Self :: Err => InlineAsmRegClass :: Err ,
264271 }
265272 }
@@ -304,6 +311,9 @@ impl InlineAsmReg {
304311 InlineAsmArch :: Wasm32 => {
305312 Self :: Wasm ( WasmInlineAsmReg :: parse ( arch, has_feature, target, & name) ?)
306313 }
314+ InlineAsmArch :: Bpf => {
315+ Self :: Bpf ( BpfInlineAsmReg :: parse ( arch, has_feature, target, & name) ?)
316+ }
307317 } )
308318 }
309319
@@ -323,6 +333,7 @@ impl InlineAsmReg {
323333 Self :: PowerPC ( r) => r. emit ( out, arch, modifier) ,
324334 Self :: Hexagon ( r) => r. emit ( out, arch, modifier) ,
325335 Self :: Mips ( r) => r. emit ( out, arch, modifier) ,
336+ Self :: Bpf ( r) => r. emit ( out, arch, modifier) ,
326337 Self :: Err => unreachable ! ( "Use of InlineAsmReg::Err" ) ,
327338 }
328339 }
@@ -336,6 +347,7 @@ impl InlineAsmReg {
336347 Self :: PowerPC ( _) => cb ( self ) ,
337348 Self :: Hexagon ( r) => r. overlapping_regs ( |r| cb ( Self :: Hexagon ( r) ) ) ,
338349 Self :: Mips ( _) => cb ( self ) ,
350+ Self :: Bpf ( r) => r. overlapping_regs ( |r| cb ( Self :: Bpf ( r) ) ) ,
339351 Self :: Err => unreachable ! ( "Use of InlineAsmReg::Err" ) ,
340352 }
341353 }
@@ -364,6 +376,7 @@ pub enum InlineAsmRegClass {
364376 Mips ( MipsInlineAsmRegClass ) ,
365377 SpirV ( SpirVInlineAsmRegClass ) ,
366378 Wasm ( WasmInlineAsmRegClass ) ,
379+ Bpf ( BpfInlineAsmRegClass ) ,
367380 // Placeholder for invalid register constraints for the current target
368381 Err ,
369382}
@@ -381,6 +394,7 @@ impl InlineAsmRegClass {
381394 Self :: Mips ( r) => r. name ( ) ,
382395 Self :: SpirV ( r) => r. name ( ) ,
383396 Self :: Wasm ( r) => r. name ( ) ,
397+ Self :: Bpf ( r) => r. name ( ) ,
384398 Self :: Err => rustc_span:: symbol:: sym:: reg,
385399 }
386400 }
@@ -400,6 +414,7 @@ impl InlineAsmRegClass {
400414 Self :: Mips ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Mips ) ,
401415 Self :: SpirV ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: SpirV ) ,
402416 Self :: Wasm ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Wasm ) ,
417+ Self :: Bpf ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Bpf ) ,
403418 Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
404419 }
405420 }
@@ -426,6 +441,7 @@ impl InlineAsmRegClass {
426441 Self :: Mips ( r) => r. suggest_modifier ( arch, ty) ,
427442 Self :: SpirV ( r) => r. suggest_modifier ( arch, ty) ,
428443 Self :: Wasm ( r) => r. suggest_modifier ( arch, ty) ,
444+ Self :: Bpf ( r) => r. suggest_modifier ( arch, ty) ,
429445 Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
430446 }
431447 }
@@ -448,6 +464,7 @@ impl InlineAsmRegClass {
448464 Self :: Mips ( r) => r. default_modifier ( arch) ,
449465 Self :: SpirV ( r) => r. default_modifier ( arch) ,
450466 Self :: Wasm ( r) => r. default_modifier ( arch) ,
467+ Self :: Bpf ( r) => r. default_modifier ( arch) ,
451468 Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
452469 }
453470 }
@@ -469,6 +486,7 @@ impl InlineAsmRegClass {
469486 Self :: Mips ( r) => r. supported_types ( arch) ,
470487 Self :: SpirV ( r) => r. supported_types ( arch) ,
471488 Self :: Wasm ( r) => r. supported_types ( arch) ,
489+ Self :: Bpf ( r) => r. supported_types ( arch) ,
472490 Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
473491 }
474492 }
@@ -493,6 +511,7 @@ impl InlineAsmRegClass {
493511 }
494512 InlineAsmArch :: SpirV => Self :: SpirV ( SpirVInlineAsmRegClass :: parse ( arch, name) ?) ,
495513 InlineAsmArch :: Wasm32 => Self :: Wasm ( WasmInlineAsmRegClass :: parse ( arch, name) ?) ,
514+ InlineAsmArch :: Bpf => Self :: Bpf ( BpfInlineAsmRegClass :: parse ( arch, name) ?) ,
496515 } )
497516 }
498517
@@ -510,6 +529,7 @@ impl InlineAsmRegClass {
510529 Self :: Mips ( r) => r. valid_modifiers ( arch) ,
511530 Self :: SpirV ( r) => r. valid_modifiers ( arch) ,
512531 Self :: Wasm ( r) => r. valid_modifiers ( arch) ,
532+ Self :: Bpf ( r) => r. valid_modifiers ( arch) ,
513533 Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
514534 }
515535 }
@@ -679,5 +699,10 @@ pub fn allocatable_registers(
679699 wasm:: fill_reg_map ( arch, has_feature, target, & mut map) ;
680700 map
681701 }
702+ InlineAsmArch :: Bpf => {
703+ let mut map = bpf:: regclass_map ( ) ;
704+ bpf:: fill_reg_map ( arch, has_feature, target, & mut map) ;
705+ map
706+ }
682707 }
683708}
0 commit comments