Sam Kolton | e3aa0d9 | 2016-09-08 15:50:52 +0000 | [diff] [blame] | 1 | // RUN: llvm-tblgen -gen-asm-matcher -I %p/../../include %s | FileCheck %s |
| 2 | |
Sam Kolton | 5188cfa | 2017-05-15 10:13:07 +0000 | [diff] [blame] | 3 | // Check that specifying AsmVariant works correctly |
Sam Kolton | e3aa0d9 | 2016-09-08 15:50:52 +0000 | [diff] [blame] | 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"; |
Craig Topper | 2986f47 | 2017-07-07 05:50:45 +0000 | [diff] [blame] | 34 | let Namespace = "Arch"; |
Sam Kolton | e3aa0d9 | 2016-09-08 15:50:52 +0000 | [diff] [blame] | 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: }; |