X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FFixedLenDecoderEmitter.cpp;h=87d18cdb9d46bb31ed600740f315278898c6aab0;hb=be5c1fd43fd1cef8a18f41978d147190b50f5510;hp=b2dc878880908087bf0611b61af190f93381254f;hpb=4ffd89fa4d2788611187d1a534d2ed46adf1702c;p=oota-llvm.git diff --git a/utils/TableGen/FixedLenDecoderEmitter.cpp b/utils/TableGen/FixedLenDecoderEmitter.cpp index b2dc8788809..87d18cdb9d4 100644 --- a/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -879,15 +879,20 @@ emitPredicateFunction(formatted_raw_ostream &OS, PredicateSet &Predicates, OS.indent(Indentation) << "static bool checkDecoderPredicate(unsigned Idx, " << "uint64_t Bits) {\n"; Indentation += 2; - OS.indent(Indentation) << "switch (Idx) {\n"; - OS.indent(Indentation) << "default: llvm_unreachable(\"Invalid index!\");\n"; - unsigned Index = 0; - for (PredicateSet::const_iterator I = Predicates.begin(), E = Predicates.end(); - I != E; ++I, ++Index) { - OS.indent(Indentation) << "case " << Index << ":\n"; - OS.indent(Indentation+2) << "return (" << *I << ");\n"; + if (!Predicates.empty()) { + OS.indent(Indentation) << "switch (Idx) {\n"; + OS.indent(Indentation) << "default: llvm_unreachable(\"Invalid index!\");\n"; + unsigned Index = 0; + for (PredicateSet::const_iterator I = Predicates.begin(), E = Predicates.end(); + I != E; ++I, ++Index) { + OS.indent(Indentation) << "case " << Index << ":\n"; + OS.indent(Indentation+2) << "return (" << *I << ");\n"; + } + OS.indent(Indentation) << "}\n"; + } else { + // No case statement to emit + OS.indent(Indentation) << "llvm_unreachable(\"Invalid index!\");\n"; } - OS.indent(Indentation) << "}\n"; Indentation -= 2; OS.indent(Indentation) << "}\n\n"; } @@ -1866,7 +1871,7 @@ static void emitFieldFromInstruction(formatted_raw_ostream &OS) { << " if (numBits == sizeof(InsnType)*8)\n" << " fieldMask = (InsnType)(-1LL);\n" << " else\n" - << " fieldMask = ((1 << numBits) - 1) << startBit;\n" + << " fieldMask = (((InsnType)1 << numBits) - 1) << startBit;\n" << " return (insn & fieldMask) >> startBit;\n" << "}\n\n"; } @@ -2033,7 +2038,6 @@ void FixedLenDecoderEmitter::run(raw_ostream &o) { } DecoderTableInfo TableInfo; - std::set Sizes; for (std::map, std::vector >::const_iterator I = OpcMap.begin(), E = OpcMap.end(); I != E; ++I) {