Home | History | Annotate | Download | only in TableGen
      1 // RUN: llvm-tblgen -gen-asm-matcher -I %p/../../include %s | FileCheck %s
      2 
      3 // Check that specifying AsmVariant works correctly
      4 
      5 include "llvm/Target/Target.td"
      6 
      7 def ArchInstrInfo : InstrInfo { }
      8 
      9 def FooAsmParserVariant : AsmParserVariant {
     10   let Variant = 0;
     11   let Name = "Foo";
     12 }
     13 
     14 def BarAsmParserVariant : AsmParserVariant {
     15   let Variant = 1;
     16   let Name = "Bar";
     17 }
     18 
     19 def Arch : Target {
     20   let InstructionSet = ArchInstrInfo;
     21   let AssemblyParserVariants = [FooAsmParserVariant, BarAsmParserVariant];
     22 }
     23 
     24 def Reg : Register<"reg">;
     25 
     26 def RegClass : RegisterClass<"foo", [i32], 0, (add Reg)>;
     27 
     28 def foo : Instruction {
     29   let Size = 2;
     30   let OutOperandList = (outs);
     31   let InOperandList = (ins);
     32   let AsmString = "foo";
     33   let AsmVariantName = "Foo";
     34   let Namespace = "Arch";
     35 }
     36 
     37 def BarAlias : InstAlias<"bar", (foo)> {
     38   string AsmVariantName = "Bar";
     39 }
     40 
     41 // CHECK: static const MatchEntry MatchTable0[] = {
     42 // CHECK-NEXT: /* foo */, Arch::foo
     43 // CHECK-NEXT: };
     44 
     45 // CHECK: static const MatchEntry MatchTable1[] = {
     46 // CHECK-NEXT: /* bar */, Arch::foo
     47 // CHECK-NEXT: };
     48