• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-tblgen --gen-fast-isel -I %p/../../include %s 2>&1 | FileCheck %s
2
3include "llvm/Target/Target.td"
4
5//===- Define the necessary boilerplate for our test target. --------------===//
6
7def MyTargetISA : InstrInfo;
8def MyTarget : Target { let InstructionSet = MyTargetISA; }
9
10def R0 : Register<"r0"> { let Namespace = "MyTarget"; }
11def R1 : Register<"r0"> { let Namespace = "MyTarget"; }
12def GPR32M : RegisterClass<"MyTarget", [i32], 32, (add R0)>;
13def GPR32MOp : RegisterOperand<GPR32M>;
14
15def GPR32 : RegisterClass<"MyTarget", [i32], 32, (add R0, R1)>;
16def GPR32Op : RegisterOperand<GPR32>;
17
18class I<dag OOps, dag IOps, list<dag> Pat> : Instruction {
19  let Namespace = "MyTarget";
20  let OutOperandList = OOps;
21  let InOperandList = IOps;
22  let Pattern = Pat;
23}
24
25def HasA : Predicate<"Subtarget->hasA()">;
26
27let Predicates = [HasA] in {
28
29  def ADD : I<(outs GPR32Op:$rd), (ins GPR32Op:$rs, GPR32Op:$rt),
30              [(set GPR32Op:$rd, (add GPR32Op:$rs, GPR32Op:$rt))]>;
31
32  let FastISelShouldIgnore = 1 in
33    def ADD_M : I<(outs GPR32MOp:$rd), (ins GPR32MOp:$rs, GPR32MOp:$rt),
34                  [(set GPR32MOp:$rd, (add GPR32MOp:$rs, GPR32MOp:$rt))]>;
35}
36
37// CHECK-NOT: error: Duplicate predicate in FastISel table!
38