summaryrefslogtreecommitdiffstats
path: root/llvm/test/TableGen/HwModeSelect.td
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-09-14 16:56:21 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-09-14 16:56:21 +0000
commit779d98e1c008b30a211375a76f3f2c97502a02b5 (patch)
tree1487ccf61f066616188b089b38a1ace6ac1f7637 /llvm/test/TableGen/HwModeSelect.td
parenta0e55b6403b75e6884efc1ab11599e0677d48903 (diff)
downloadbcm5719-llvm-779d98e1c008b30a211375a76f3f2c97502a02b5.tar.gz
bcm5719-llvm-779d98e1c008b30a211375a76f3f2c97502a02b5.zip
TableGen support for parameterized register class information
This replaces TableGen's type inference to operate on parameterized types instead of MVTs, and as a consequence, some interfaces have changed: - Uses of MVTs are replaced by ValueTypeByHwMode. - EEVT::TypeSet is replaced by TypeSetByHwMode. This affects the way that types and type sets are printed, and the tests relying on that have been updated. There are certain users of the inferred types outside of TableGen itself, namely FastISel and GlobalISel. For those users, the way that the types are accessed have changed. For typical scenarios, these replacements can be used: - TreePatternNode::getType(ResNo) -> getSimpleType(ResNo) - TreePatternNode::hasTypeSet(ResNo) -> hasConcreteType(ResNo) - TypeSet::isConcrete -> TypeSetByHwMode::isValueTypeByHwMode(false) For more information, please refer to the review page. Differential Revision: https://reviews.llvm.org/D31951 llvm-svn: 313271
Diffstat (limited to 'llvm/test/TableGen/HwModeSelect.td')
-rw-r--r--llvm/test/TableGen/HwModeSelect.td27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/TableGen/HwModeSelect.td b/llvm/test/TableGen/HwModeSelect.td
new file mode 100644
index 00000000000..6480268f3b3
--- /dev/null
+++ b/llvm/test/TableGen/HwModeSelect.td
@@ -0,0 +1,27 @@
+// RUN: not llvm-tblgen -gen-dag-isel -I %p/../../include %s 2>&1 | FileCheck %s
+
+// The HwModeSelect class is intended to serve as a base class for other
+// classes that are then used to select a value based on the HW mode.
+// It contains a list of HW modes, and a derived class should provide a
+// list of corresponding values.
+// These two lists must have the same size. Make sure that a violation of
+// this requirement is diagnosed.
+
+include "llvm/Target/Target.td"
+
+def TestTargetInstrInfo : InstrInfo;
+
+def TestTarget : Target {
+ let InstructionSet = TestTargetInstrInfo;
+}
+
+def TestReg : Register<"testreg">;
+def TestClass : RegisterClass<"TestTarget", [i32], 32, (add TestReg)>;
+
+def TestMode1 : HwMode<"+feat1">;
+def TestMode2 : HwMode<"+feat2">;
+
+def BadDef : ValueTypeByHwMode<[TestMode1, TestMode2, DefaultMode],
+ [i8, i16, i32, i64]>;
+
+// CHECK: error: in record BadDef derived from HwModeSelect: the lists Modes and Objects should have the same size
OpenPOWER on IntegriCloud