From d568b3f55294917d1cc701da14a8a7daeb6563e6 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Mon, 11 Jul 2011 23:06:52 +0000 Subject: Revert r134921, 134917, 134908 and 134907. They're causing failures in multiple buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134936 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/FixedLenDecoderEmitter.cpp | 33 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'utils/TableGen/FixedLenDecoderEmitter.cpp') diff --git a/utils/TableGen/FixedLenDecoderEmitter.cpp b/utils/TableGen/FixedLenDecoderEmitter.cpp index e4b6f12..c9dcb01 100644 --- a/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -48,15 +48,15 @@ static bool ValueNotSet(bit_value_t V) { static int Value(bit_value_t V) { return ValueNotSet(V) ? -1 : (V == BIT_FALSE ? 0 : 1); } -static bit_value_t bitFromBits(const BitsInit &bits, unsigned index) { - if (const BitInit *bit = dynamic_cast(bits.getBit(index))) +static bit_value_t bitFromBits(BitsInit &bits, unsigned index) { + if (BitInit *bit = dynamic_cast(bits.getBit(index))) return bit->getValue() ? BIT_TRUE : BIT_FALSE; // The bit is uninitialized. return BIT_UNSET; } // Prints the bit value for each position. -static void dumpBits(raw_ostream &o, const BitsInit &bits) { +static void dumpBits(raw_ostream &o, BitsInit &bits) { unsigned index; for (index = bits.getNumBits(); index > 0; index--) { @@ -76,8 +76,8 @@ static void dumpBits(raw_ostream &o, const BitsInit &bits) { } } -static const BitsInit &getBitsField(const Record &def, const char *str) { - const BitsInit *bits = def.getValueAsBitsInit(str); +static BitsInit &getBitsField(const Record &def, const char *str) { + BitsInit *bits = def.getValueAsBitsInit(str); return *bits; } @@ -279,8 +279,7 @@ public: protected: // Populates the insn given the uid. void insnWithID(insn_t &Insn, unsigned Opcode) const { - const BitsInit &Bits = - getBitsField(*AllInstructions[Opcode]->TheDef, "Inst"); + BitsInit &Bits = getBitsField(*AllInstructions[Opcode]->TheDef, "Inst"); for (unsigned i = 0; i < BIT_WIDTH; ++i) Insn[i] = bitFromBits(Bits, i); @@ -1231,7 +1230,7 @@ bool FixedLenDecoderEmitter::populateInstruction(const CodeGenInstruction &CGI, Def.getValueAsBit("isCodeGenOnly")) return false; - const BitsInit &Bits = getBitsField(Def, "Inst"); + BitsInit &Bits = getBitsField(Def, "Inst"); if (Bits.allInComplete()) return false; std::vector InsnOperands; @@ -1252,16 +1251,16 @@ bool FixedLenDecoderEmitter::populateInstruction(const CodeGenInstruction &CGI, // Gather the outputs/inputs of the instruction, so we can find their // positions in the encoding. This assumes for now that they appear in the // MCInst in the order that they're listed. - std::vector > InOutOperands; - const DagInit *Out = Def.getValueAsDag("OutOperandList"); - const DagInit *In = Def.getValueAsDag("InOperandList"); + std::vector > InOutOperands; + DagInit *Out = Def.getValueAsDag("OutOperandList"); + DagInit *In = Def.getValueAsDag("InOperandList"); for (unsigned i = 0; i < Out->getNumArgs(); ++i) InOutOperands.push_back(std::make_pair(Out->getArg(i), Out->getArgName(i))); for (unsigned i = 0; i < In->getNumArgs(); ++i) InOutOperands.push_back(std::make_pair(In->getArg(i), In->getArgName(i))); // For each operand, see if we can figure out where it is encoded. - for (std::vector >::iterator + for (std::vector >::iterator NI = InOutOperands.begin(), NE = InOutOperands.end(); NI != NE; ++NI) { unsigned PrevBit = ~0; unsigned Base = ~0; @@ -1269,10 +1268,10 @@ bool FixedLenDecoderEmitter::populateInstruction(const CodeGenInstruction &CGI, std::string Decoder = ""; for (unsigned bi = 0; bi < Bits.getNumBits(); ++bi) { - const VarBitInit *BI = dynamic_cast(Bits.getBit(bi)); + VarBitInit *BI = dynamic_cast(Bits.getBit(bi)); if (!BI) continue; - const VarInit *Var = dynamic_cast(BI->getVariable()); + VarInit *Var = dynamic_cast(BI->getVariable()); assert(Var); unsigned CurrBit = BI->getBitNum(); if (Var->getName() != NI->second) continue; @@ -1302,7 +1301,7 @@ bool FixedLenDecoderEmitter::populateInstruction(const CodeGenInstruction &CGI, // for decoding register classes. // FIXME: This need to be extended to handle instructions with custom // decoder methods, and operands with (simple) MIOperandInfo's. - const TypedInit *TI = dynamic_cast(NI->first); + TypedInit *TI = dynamic_cast(NI->first); RecordRecTy *Type = dynamic_cast(TI->getType()); Record *TypeRecord = Type->getRecord(); bool isReg = false; @@ -1314,8 +1313,8 @@ bool FixedLenDecoderEmitter::populateInstruction(const CodeGenInstruction &CGI, } RecordVal *DecoderString = TypeRecord->getValue("DecoderMethod"); - const StringInit *String = DecoderString ? - dynamic_cast(DecoderString->getValue()) : + StringInit *String = DecoderString ? + dynamic_cast(DecoderString->getValue()) : 0; if (!isReg && String && String->getValue() != "") Decoder = String->getValue(); -- cgit v1.1