diff options
| author | Daniel Sanders <daniel_l_sanders@apple.com> | 2017-08-24 18:54:16 +0000 |
|---|---|---|
| committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2017-08-24 18:54:16 +0000 |
| commit | 069bb8d45fbc66f648fa26f3471dcccc50c1b089 (patch) | |
| tree | 0d620ca2daa4e5da3e86ebb3160d28171d49c488 /llvm/utils | |
| parent | 5a2b322e0d27e6c0184fe8e835e4c1d33003f5c9 (diff) | |
| download | bcm5719-llvm-069bb8d45fbc66f648fa26f3471dcccc50c1b089.tar.gz bcm5719-llvm-069bb8d45fbc66f648fa26f3471dcccc50c1b089.zip | |
[globalisel][tablegen] Predicates should start from GIPFP_Invalid+1 not GIPFP_Invalid
This fixes a warning when there are zero defined predicates and also fixes an
unnoticed bug where the first predicate in the table was unusable.
llvm-svn: 311684
Diffstat (limited to 'llvm/utils')
| -rw-r--r-- | llvm/utils/TableGen/GlobalISelEmitter.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index 17898beb7de..3402c496c8d 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -2731,7 +2731,7 @@ void GlobalISelEmitter::run(raw_ostream &OS) { { OS << "// PatFrag predicates.\n" << "enum {\n"; - StringRef EnumeratorSeparator = " = GIPFP_Invalid,\n"; + StringRef EnumeratorSeparator = " = GIPFP_Invalid + 1,\n"; for (const auto *Record : RK.getAllDerivedDefinitions("PatFrag")) { if (!Record->getValueAsString("ImmediateCode").empty()) { OS << " GIPFP_Predicate_" << Record->getName() << EnumeratorSeparator; @@ -2744,7 +2744,9 @@ void GlobalISelEmitter::run(raw_ostream &OS) { if (!Record->getValueAsString("ImmediateCode").empty()) OS << " static bool Predicate_" << Record->getName() << "(int64_t Imm) {" << Record->getValueAsString("ImmediateCode") << " }\n"; - OS << "static InstructionSelector::ImmediatePredicateFn ImmPredicateFns[] = {\n"; + OS << "static InstructionSelector::ImmediatePredicateFn ImmPredicateFns[] = " + "{\n" + << " nullptr,\n"; for (const auto *Record : RK.getAllDerivedDefinitions("PatFrag")) if (!Record->getValueAsString("ImmediateCode").empty()) OS << " Predicate_" << Record->getName() << ",\n"; |

