diff options
author | Misha Brukman <brukman+llvm@gmail.com> | 2003-07-15 21:26:09 +0000 |
---|---|---|
committer | Misha Brukman <brukman+llvm@gmail.com> | 2003-07-15 21:26:09 +0000 |
commit | f6e5217b54441866dec596c1be20747036440cd4 (patch) | |
tree | 8ef6ced7db6f8deb3c5335c5c9294c0fc8330596 /support/tools/TableGen | |
parent | 7eac4766b156ad2965125a7ee3f1f4834dfbb00b (diff) | |
download | external_llvm-f6e5217b54441866dec596c1be20747036440cd4.zip external_llvm-f6e5217b54441866dec596c1be20747036440cd4.tar.gz external_llvm-f6e5217b54441866dec596c1be20747036440cd4.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'support/tools/TableGen')
-rw-r--r-- | support/tools/TableGen/CodeEmitterGen.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/support/tools/TableGen/CodeEmitterGen.cpp b/support/tools/TableGen/CodeEmitterGen.cpp index 8cb7979..14cb6be 100644 --- a/support/tools/TableGen/CodeEmitterGen.cpp +++ b/support/tools/TableGen/CodeEmitterGen.cpp @@ -1,3 +1,4 @@ +#include "Support/Statistic.h" #include "Record.h" #include "CodeEmitterGen.h" @@ -39,19 +40,19 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { 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 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { } } + 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 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { // 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 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { 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 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { // 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() |