mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
[globalisel][tablegen] Add tests for FeatureBitsets and ComplexPattern predicates.
llvm-svn: 311542
This commit is contained in:
parent
efa99bb7e3
commit
af50be44fd
@ -83,13 +83,32 @@ def HasC : Predicate<"Subtarget->hasC()"> { let RecomputePerFunction = 1; }
|
||||
// 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();
|
||||
|
@ -2567,7 +2567,8 @@ void GlobalISelEmitter::run(raw_ostream &OS) {
|
||||
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 &OS) {
|
||||
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) {
|
||||
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";
|
||||
|
Loading…
Reference in New Issue
Block a user