[llvm] r311542 - [globalisel][tablegen] Add tests for FeatureBitsets and ComplexPattern predicates.
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 23 03:09:25 PDT 2017
Author: dsanders
Date: Wed Aug 23 03:09:25 2017
New Revision: 311542
URL: http://llvm.org/viewvc/llvm-project?rev=311542&view=rev
Log:
[globalisel][tablegen] Add tests for FeatureBitsets and ComplexPattern predicates.
Modified:
llvm/trunk/test/TableGen/GlobalISelEmitter.td
llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
Modified: llvm/trunk/test/TableGen/GlobalISelEmitter.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/GlobalISelEmitter.td?rev=311542&r1=311541&r2=311542&view=diff
==============================================================================
--- llvm/trunk/test/TableGen/GlobalISelEmitter.td (original)
+++ llvm/trunk/test/TableGen/GlobalISelEmitter.td Wed Aug 23 03:09:25 2017
@@ -83,13 +83,32 @@ def HasC : Predicate<"Subtarget->hasC()"
// CHECK-NEXT: return Features;
// CHECK-NEXT: }
-// CHECK-LABEL: enum {
+// CHECK-LABEL: // LLT Objects.
+// CHECK-NEXT: enum {
// CHECK-NEXT: GILLT_s32,
// CHECK-NEXT: }
// CHECK-NEXT: const static LLT TypeObjects[] = {
// CHECK-NEXT: LLT::scalar(32),
// CHECK-NEXT: };
+// CHECK-LABEL: // Feature bitsets.
+// CHECK-NEXT: enum {
+// CHECK-NEXT: GIFBS_Invalid,
+// CHECK-NEXT: GIFBS_HasA,
+// CHECK-NEXT: GIFBS_HasA_HasB_HasC,
+// CHECK-NEXT: }
+// CHECK-NEXT: const static PredicateBitset FeatureBitsets[] {
+// CHECK-NEXT: {}, // GIFBS_Invalid
+// CHECK-NEXT: {Feature_HasABit, },
+// CHECK-NEXT: {Feature_HasABit, Feature_HasBBit, Feature_HasCBit, },
+// CHECK-NEXT: };
+
+// CHECK-LABEL: // ComplexPattern predicates.
+// CHECK-NEXT: enum {
+// CHECK-NEXT: GICP_Invalid,
+// CHECK-NEXT: GICP_gi_complex,
+// CHECK-NEXT: };
+
// CHECK: bool MyTargetInstructionSelector::selectImpl(MachineInstr &I) const {
// CHECK-NEXT: MachineFunction &MF = *I.getParent()->getParent();
// CHECK-NEXT: MachineRegisterInfo &MRI = MF.getRegInfo();
Modified: llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp?rev=311542&r1=311541&r2=311542&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp Wed Aug 23 03:09:25 2017
@@ -2567,7 +2567,8 @@ void GlobalISelEmitter::run(raw_ostream
for (const auto &Ty : LLTOperandMatcher::KnownTypes)
TypeObjects.push_back(Ty);
std::sort(TypeObjects.begin(), TypeObjects.end());
- OS << "enum {\n";
+ OS << "// LLT Objects.\n"
+ << "enum {\n";
for (const auto &TypeObject : TypeObjects) {
OS << " ";
TypeObject.emitCxxEnumValue(OS);
@@ -2605,7 +2606,8 @@ void GlobalISelEmitter::run(raw_ostream
FeatureBitsets.erase(
std::unique(FeatureBitsets.begin(), FeatureBitsets.end()),
FeatureBitsets.end());
- OS << "enum {\n"
+ OS << "// Feature bitsets.\n"
+ << "enum {\n"
<< " GIFBS_Invalid,\n";
for (const auto &FeatureBitset : FeatureBitsets) {
if (FeatureBitset.empty())
@@ -2629,7 +2631,8 @@ void GlobalISelEmitter::run(raw_ostream
OS << "};\n\n";
// Emit complex predicate table and an enum to reference them with.
- OS << "enum {\n"
+ OS << "// ComplexPattern predicates.\n"
+ << "enum {\n"
<< " GICP_Invalid,\n";
for (const auto &Record : ComplexPredicates)
OS << " GICP_" << Record->getName() << ",\n";
More information about the llvm-commits
mailing list