1 // RUN: not --crash llvm-tblgen -gen-dag-isel -I %p/../../include %s 2>&1 | FileCheck %s
3 // The HwModeSelect class is intended to serve as a base class for other
4 // classes that are then used to select a value based on the HW mode.
5 // It contains a list of HW modes, and a derived class should provide a
6 // list of corresponding values.
7 // These two lists must have the same size. Make sure that a violation of
8 // this requirement is diagnosed.
10 include "llvm/Target/Target.td"
12 def TestTargetInstrInfo : InstrInfo;
14 def TestTarget : Target {
15 let InstructionSet = TestTargetInstrInfo;
18 def TestReg : Register<"testreg">;
19 def TestClass : RegisterClass<"TestTarget", [i32], 32, (add TestReg)>;
21 def HasFeat1 : Predicate<"Subtarget->hasFeat1()">;
22 def HasFeat2 : Predicate<"Subtarget->hasFeat2()">;
24 def TestMode1 : HwMode<"+feat1", [HasFeat1]>;
25 def TestMode2 : HwMode<"+feat2", [HasFeat2]>;
27 def BadDef : ValueTypeByHwMode<[TestMode1, TestMode2, DefaultMode],
30 // CHECK: error: in record BadDef derived from HwModeSelect: the lists Modes and Objects should have the same size