@@ -168,6 +168,7 @@ mod arm;
168
168
mod avr;
169
169
mod bpf;
170
170
mod hexagon;
171
+ mod loongarch;
171
172
mod m68k;
172
173
mod mips;
173
174
mod msp430;
@@ -184,6 +185,7 @@ pub use arm::{ArmInlineAsmReg, ArmInlineAsmRegClass};
184
185
pub use avr:: { AvrInlineAsmReg , AvrInlineAsmRegClass } ;
185
186
pub use bpf:: { BpfInlineAsmReg , BpfInlineAsmRegClass } ;
186
187
pub use hexagon:: { HexagonInlineAsmReg , HexagonInlineAsmRegClass } ;
188
+ pub use loongarch:: { LoongArchInlineAsmReg , LoongArchInlineAsmRegClass } ;
187
189
pub use m68k:: { M68kInlineAsmReg , M68kInlineAsmRegClass } ;
188
190
pub use mips:: { MipsInlineAsmReg , MipsInlineAsmRegClass } ;
189
191
pub use msp430:: { Msp430InlineAsmReg , Msp430InlineAsmRegClass } ;
@@ -205,6 +207,7 @@ pub enum InlineAsmArch {
205
207
RiscV64 ,
206
208
Nvptx64 ,
207
209
Hexagon ,
210
+ LoongArch64 ,
208
211
Mips ,
209
212
Mips64 ,
210
213
PowerPC ,
@@ -234,6 +237,7 @@ impl FromStr for InlineAsmArch {
234
237
"powerpc" => Ok ( Self :: PowerPC ) ,
235
238
"powerpc64" => Ok ( Self :: PowerPC64 ) ,
236
239
"hexagon" => Ok ( Self :: Hexagon ) ,
240
+ "loongarch64" => Ok ( Self :: LoongArch64 ) ,
237
241
"mips" => Ok ( Self :: Mips ) ,
238
242
"mips64" => Ok ( Self :: Mips64 ) ,
239
243
"s390x" => Ok ( Self :: S390x ) ,
@@ -259,6 +263,7 @@ pub enum InlineAsmReg {
259
263
Nvptx ( NvptxInlineAsmReg ) ,
260
264
PowerPC ( PowerPCInlineAsmReg ) ,
261
265
Hexagon ( HexagonInlineAsmReg ) ,
266
+ LoongArch ( LoongArchInlineAsmReg ) ,
262
267
Mips ( MipsInlineAsmReg ) ,
263
268
S390x ( S390xInlineAsmReg ) ,
264
269
SpirV ( SpirVInlineAsmReg ) ,
@@ -280,6 +285,7 @@ impl InlineAsmReg {
280
285
Self :: RiscV ( r) => r. name ( ) ,
281
286
Self :: PowerPC ( r) => r. name ( ) ,
282
287
Self :: Hexagon ( r) => r. name ( ) ,
288
+ Self :: LoongArch ( r) => r. name ( ) ,
283
289
Self :: Mips ( r) => r. name ( ) ,
284
290
Self :: S390x ( r) => r. name ( ) ,
285
291
Self :: Bpf ( r) => r. name ( ) ,
@@ -298,6 +304,7 @@ impl InlineAsmReg {
298
304
Self :: RiscV ( r) => InlineAsmRegClass :: RiscV ( r. reg_class ( ) ) ,
299
305
Self :: PowerPC ( r) => InlineAsmRegClass :: PowerPC ( r. reg_class ( ) ) ,
300
306
Self :: Hexagon ( r) => InlineAsmRegClass :: Hexagon ( r. reg_class ( ) ) ,
307
+ Self :: LoongArch ( r) => InlineAsmRegClass :: LoongArch ( r. reg_class ( ) ) ,
301
308
Self :: Mips ( r) => InlineAsmRegClass :: Mips ( r. reg_class ( ) ) ,
302
309
Self :: S390x ( r) => InlineAsmRegClass :: S390x ( r. reg_class ( ) ) ,
303
310
Self :: Bpf ( r) => InlineAsmRegClass :: Bpf ( r. reg_class ( ) ) ,
@@ -324,6 +331,7 @@ impl InlineAsmReg {
324
331
Self :: PowerPC ( PowerPCInlineAsmReg :: parse ( name) ?)
325
332
}
326
333
InlineAsmArch :: Hexagon => Self :: Hexagon ( HexagonInlineAsmReg :: parse ( name) ?) ,
334
+ InlineAsmArch :: LoongArch64 => Self :: LoongArch ( LoongArchInlineAsmReg :: parse ( name) ?) ,
327
335
InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
328
336
Self :: Mips ( MipsInlineAsmReg :: parse ( name) ?)
329
337
}
@@ -354,6 +362,9 @@ impl InlineAsmReg {
354
362
Self :: RiscV ( r) => r. validate ( arch, reloc_model, target_features, target, is_clobber) ,
355
363
Self :: PowerPC ( r) => r. validate ( arch, reloc_model, target_features, target, is_clobber) ,
356
364
Self :: Hexagon ( r) => r. validate ( arch, reloc_model, target_features, target, is_clobber) ,
365
+ Self :: LoongArch ( r) => {
366
+ r. validate ( arch, reloc_model, target_features, target, is_clobber)
367
+ }
357
368
Self :: Mips ( r) => r. validate ( arch, reloc_model, target_features, target, is_clobber) ,
358
369
Self :: S390x ( r) => r. validate ( arch, reloc_model, target_features, target, is_clobber) ,
359
370
Self :: Bpf ( r) => r. validate ( arch, reloc_model, target_features, target, is_clobber) ,
@@ -379,6 +390,7 @@ impl InlineAsmReg {
379
390
Self :: RiscV ( r) => r. emit ( out, arch, modifier) ,
380
391
Self :: PowerPC ( r) => r. emit ( out, arch, modifier) ,
381
392
Self :: Hexagon ( r) => r. emit ( out, arch, modifier) ,
393
+ Self :: LoongArch ( r) => r. emit ( out, arch, modifier) ,
382
394
Self :: Mips ( r) => r. emit ( out, arch, modifier) ,
383
395
Self :: S390x ( r) => r. emit ( out, arch, modifier) ,
384
396
Self :: Bpf ( r) => r. emit ( out, arch, modifier) ,
@@ -397,6 +409,7 @@ impl InlineAsmReg {
397
409
Self :: RiscV ( _) => cb ( self ) ,
398
410
Self :: PowerPC ( r) => r. overlapping_regs ( |r| cb ( Self :: PowerPC ( r) ) ) ,
399
411
Self :: Hexagon ( r) => r. overlapping_regs ( |r| cb ( Self :: Hexagon ( r) ) ) ,
412
+ Self :: LoongArch ( _) => cb ( self ) ,
400
413
Self :: Mips ( _) => cb ( self ) ,
401
414
Self :: S390x ( _) => cb ( self ) ,
402
415
Self :: Bpf ( r) => r. overlapping_regs ( |r| cb ( Self :: Bpf ( r) ) ) ,
@@ -418,6 +431,7 @@ pub enum InlineAsmRegClass {
418
431
Nvptx ( NvptxInlineAsmRegClass ) ,
419
432
PowerPC ( PowerPCInlineAsmRegClass ) ,
420
433
Hexagon ( HexagonInlineAsmRegClass ) ,
434
+ LoongArch ( LoongArchInlineAsmRegClass ) ,
421
435
Mips ( MipsInlineAsmRegClass ) ,
422
436
S390x ( S390xInlineAsmRegClass ) ,
423
437
SpirV ( SpirVInlineAsmRegClass ) ,
@@ -440,6 +454,7 @@ impl InlineAsmRegClass {
440
454
Self :: Nvptx ( r) => r. name ( ) ,
441
455
Self :: PowerPC ( r) => r. name ( ) ,
442
456
Self :: Hexagon ( r) => r. name ( ) ,
457
+ Self :: LoongArch ( r) => r. name ( ) ,
443
458
Self :: Mips ( r) => r. name ( ) ,
444
459
Self :: S390x ( r) => r. name ( ) ,
445
460
Self :: SpirV ( r) => r. name ( ) ,
@@ -464,6 +479,7 @@ impl InlineAsmRegClass {
464
479
Self :: Nvptx ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Nvptx ) ,
465
480
Self :: PowerPC ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: PowerPC ) ,
466
481
Self :: Hexagon ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Hexagon ) ,
482
+ Self :: LoongArch ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: LoongArch ) ,
467
483
Self :: Mips ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Mips ) ,
468
484
Self :: S390x ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: S390x ) ,
469
485
Self :: SpirV ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: SpirV ) ,
@@ -495,6 +511,7 @@ impl InlineAsmRegClass {
495
511
Self :: Nvptx ( r) => r. suggest_modifier ( arch, ty) ,
496
512
Self :: PowerPC ( r) => r. suggest_modifier ( arch, ty) ,
497
513
Self :: Hexagon ( r) => r. suggest_modifier ( arch, ty) ,
514
+ Self :: LoongArch ( r) => r. suggest_modifier ( arch, ty) ,
498
515
Self :: Mips ( r) => r. suggest_modifier ( arch, ty) ,
499
516
Self :: S390x ( r) => r. suggest_modifier ( arch, ty) ,
500
517
Self :: SpirV ( r) => r. suggest_modifier ( arch, ty) ,
@@ -522,6 +539,7 @@ impl InlineAsmRegClass {
522
539
Self :: Nvptx ( r) => r. default_modifier ( arch) ,
523
540
Self :: PowerPC ( r) => r. default_modifier ( arch) ,
524
541
Self :: Hexagon ( r) => r. default_modifier ( arch) ,
542
+ Self :: LoongArch ( r) => r. default_modifier ( arch) ,
525
543
Self :: Mips ( r) => r. default_modifier ( arch) ,
526
544
Self :: S390x ( r) => r. default_modifier ( arch) ,
527
545
Self :: SpirV ( r) => r. default_modifier ( arch) ,
@@ -548,6 +566,7 @@ impl InlineAsmRegClass {
548
566
Self :: Nvptx ( r) => r. supported_types ( arch) ,
549
567
Self :: PowerPC ( r) => r. supported_types ( arch) ,
550
568
Self :: Hexagon ( r) => r. supported_types ( arch) ,
569
+ Self :: LoongArch ( r) => r. supported_types ( arch) ,
551
570
Self :: Mips ( r) => r. supported_types ( arch) ,
552
571
Self :: S390x ( r) => r. supported_types ( arch) ,
553
572
Self :: SpirV ( r) => r. supported_types ( arch) ,
@@ -575,6 +594,7 @@ impl InlineAsmRegClass {
575
594
Self :: PowerPC ( PowerPCInlineAsmRegClass :: parse ( name) ?)
576
595
}
577
596
InlineAsmArch :: Hexagon => Self :: Hexagon ( HexagonInlineAsmRegClass :: parse ( name) ?) ,
597
+ InlineAsmArch :: LoongArch64 => Self :: LoongArch ( LoongArchInlineAsmRegClass :: parse ( name) ?) ,
578
598
InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
579
599
Self :: Mips ( MipsInlineAsmRegClass :: parse ( name) ?)
580
600
}
@@ -601,6 +621,7 @@ impl InlineAsmRegClass {
601
621
Self :: Nvptx ( r) => r. valid_modifiers ( arch) ,
602
622
Self :: PowerPC ( r) => r. valid_modifiers ( arch) ,
603
623
Self :: Hexagon ( r) => r. valid_modifiers ( arch) ,
624
+ Self :: LoongArch ( r) => r. valid_modifiers ( arch) ,
604
625
Self :: Mips ( r) => r. valid_modifiers ( arch) ,
605
626
Self :: S390x ( r) => r. valid_modifiers ( arch) ,
606
627
Self :: SpirV ( r) => r. valid_modifiers ( arch) ,
@@ -760,6 +781,11 @@ pub fn allocatable_registers(
760
781
hexagon:: fill_reg_map ( arch, reloc_model, target_features, target, & mut map) ;
761
782
map
762
783
}
784
+ InlineAsmArch :: LoongArch64 => {
785
+ let mut map = loongarch:: regclass_map ( ) ;
786
+ loongarch:: fill_reg_map ( arch, reloc_model, target_features, target, & mut map) ;
787
+ map
788
+ }
763
789
InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
764
790
let mut map = mips:: regclass_map ( ) ;
765
791
mips:: fill_reg_map ( arch, reloc_model, target_features, target, & mut map) ;
0 commit comments