[llvm-commits] CVS: llvm/utils/TableGen/CodeEmitterGen.cpp
Misha Brukman
brukman at cs.uiuc.edu
Tue Jul 15 16:27:19 PDT 2003
Changes in directory llvm/utils/TableGen:
CodeEmitterGen.cpp updated: 1.11 -> 1.12
---
Log message:
Fixed a bug: outputting name of variable instead of its value.
Also, placed DEBUG() guards around debug information so that the generated file
is much smaller and hence should be faster to preprocess/compile.
---
Diffs of the changes:
Index: llvm/utils/TableGen/CodeEmitterGen.cpp
diff -u llvm/utils/TableGen/CodeEmitterGen.cpp:1.11 llvm/utils/TableGen/CodeEmitterGen.cpp:1.12
--- llvm/utils/TableGen/CodeEmitterGen.cpp:1.11 Tue Jul 15 16:00:32 2003
+++ llvm/utils/TableGen/CodeEmitterGen.cpp Tue Jul 15 16:26:09 2003
@@ -1,3 +1,4 @@
+#include "Support/Statistic.h"
#include "Record.h"
#include "CodeEmitterGen.h"
@@ -39,19 +40,19 @@
unsigned Value = 0;
const std::vector<RecordVal> &Vals = R->getValues();
- o << " // prefilling: ";
+ DEBUG(o << " // prefilling: ");
// Start by filling in fixed values...
for (unsigned i = 0, e = BI->getNumBits(); i != e; ++i) {
if (BitInit *B = dynamic_cast<BitInit*>(BI->getBit(e-i-1))) {
Value |= B->getValue() << (e-i-1);
- o << B->getValue();
+ DEBUG(o << B->getValue());
} else {
- o << "0";
+ DEBUG(o << "0");
}
}
- o << "\n";
+ DEBUG(o << "\n");
- o << " // " << *InstVal << "\n";
+ DEBUG(o << " // " << *InstVal << "\n");
o << " Value = " << Value << "U;\n\n";
// Loop over all of the fields in the instruction adding in any
@@ -129,6 +130,11 @@
}
}
+ DEBUG(o << " // Var: begin = " << beginBitInVar
+ << ", end = " << endBitInVar
+ << "; Inst: begin = " << beginBitInInst
+ << ", end = " << endBitInInst << "\n");
+
if (continuous) {
o << " // continuous: op" << OpOrder[Vals[i].getName()] << "\n";
@@ -136,7 +142,7 @@
// Low mask (ie. shift, if necessary)
if (endBitInVar != 0) {
o << " op" << OpOrder[Vals[i].getName()]
- << " >>= endBitInVar;\n";
+ << " >>= " << endBitInVar << ";\n";
beginBitInVar -= endBitInVar;
endBitInVar = 0;
}
@@ -168,10 +174,10 @@
for (int i = FieldInitializer->getNumBits()-1; i >= 0; --i) {
if (BitInit *BI=dynamic_cast<BitInit*>(FieldInitializer->getBit(i)))
{
- o << " // bit init: f: " << f << ", i: " << i << "\n";
+ DEBUG(o << " // bit init: f: " << f << ", i: " << i << "\n");
} else if (UnsetInit *UI =
dynamic_cast<UnsetInit*>(FieldInitializer->getBit(i))) {
- o << " // unset init: f: " << f << ", i: " << i << "\n";
+ DEBUG(o << " // unset init: f: " << f << ", i: " << i << "\n");
} else if (VarBitInit *VBI =
dynamic_cast<VarBitInit*>(FieldInitializer->getBit(i))) {
TypedInit *TI = VBI->getVariable();
@@ -184,9 +190,9 @@
// need to individually OR in the bits
// for debugging, output the regular version anyway, commented
- o << " // Value |= getValueBit(op"
- << OpOrder[VI->getName()] << ", " << VBI->getBitNum()
- << ")" << " << " << i << ";\n";
+ DEBUG(o << " // Value |= getValueBit(op"
+ << OpOrder[VI->getName()] << ", " << VBI->getBitNum()
+ << ")" << " << " << i << ";\n");
} else {
o << " Value |= getValueBit(op" << OpOrder[VI->getName()]
<< ", " << VBI->getBitNum()
More information about the llvm-commits
mailing list