[llvm-commits] [llvm] r91448 - in /llvm/trunk/utils/TableGen: CodeEmitterGen.cpp CodeEmitterGen.h
Dan Gohman
gohman at apple.com
Tue Dec 15 12:21:45 PST 2009
Author: djg
Date: Tue Dec 15 14:21:44 2009
New Revision: 91448
URL: http://llvm.org/viewvc/llvm-project?rev=91448&view=rev
Log:
Revert 90628, which was incorrect.
Modified:
llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
llvm/trunk/utils/TableGen/CodeEmitterGen.h
Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=91448&r1=91447&r2=91448&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Tue Dec 15 14:21:44 2009
@@ -61,11 +61,14 @@
// If the VarBitInit at position 'bit' matches the specified variable then
// return the variable bit position. Otherwise return -1.
-int CodeEmitterGen::getVariableBit(const Init *VarVal,
+int CodeEmitterGen::getVariableBit(const std::string &VarName,
BitsInit *BI, int bit) {
if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(BI->getBit(bit))) {
TypedInit *TI = VBI->getVariable();
- if (TI == VarVal) return VBI->getBitNum();
+
+ if (VarInit *VI = dynamic_cast<VarInit*>(TI)) {
+ if (VI->getName() == VarName) return VBI->getBitNum();
+ }
}
return -1;
@@ -159,11 +162,11 @@
if (!Vals[i].getPrefix() && !Vals[i].getValue()->isComplete()) {
// Is the operand continuous? If so, we can just mask and OR it in
// instead of doing it bit-by-bit, saving a lot in runtime cost.
- const Init *VarVal = Vals[i].getValue();
+ const std::string &VarName = Vals[i].getName();
bool gotOp = false;
for (int bit = BI->getNumBits()-1; bit >= 0; ) {
- int varBit = getVariableBit(VarVal, BI, bit);
+ int varBit = getVariableBit(VarName, BI, bit);
if (varBit == -1) {
--bit;
@@ -173,7 +176,7 @@
int N = 1;
for (--bit; bit >= 0;) {
- varBit = getVariableBit(VarVal, BI, bit);
+ varBit = getVariableBit(VarName, BI, bit);
if (varBit == -1 || varBit != (beginVarBit - N)) break;
++N;
--bit;
@@ -185,7 +188,7 @@
while (CGI.isFlatOperandNotEmitted(op))
++op;
- Case += " // op: " + Vals[i].getName() + "\n"
+ Case += " // op: " + VarName + "\n"
+ " op = getMachineOpValue(MI, MI.getOperand("
+ utostr(op++) + "));\n";
gotOp = true;
Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.h?rev=91448&r1=91447&r2=91448&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeEmitterGen.h (original)
+++ llvm/trunk/utils/TableGen/CodeEmitterGen.h Tue Dec 15 14:21:44 2009
@@ -23,7 +23,6 @@
class RecordVal;
class BitsInit;
-struct Init;
class CodeEmitterGen : public TableGenBackend {
RecordKeeper &Records;
@@ -36,7 +35,7 @@
void emitMachineOpEmitter(raw_ostream &o, const std::string &Namespace);
void emitGetValueBit(raw_ostream &o, const std::string &Namespace);
void reverseBits(std::vector<Record*> &Insts);
- int getVariableBit(const Init *VarVal, BitsInit *BI, int bit);
+ int getVariableBit(const std::string &VarName, BitsInit *BI, int bit);
};
} // End llvm namespace
More information about the llvm-commits
mailing list