diff options
author | Misha Brukman <brukman+llvm@gmail.com> | 2003-07-07 22:30:44 +0000 |
---|---|---|
committer | Misha Brukman <brukman+llvm@gmail.com> | 2003-07-07 22:30:44 +0000 |
commit | 48aa8242799b639526b8b696260045be0c0c0139 (patch) | |
tree | 28f128fb8475c9b40bd48a4d5e28a043efc32ba2 | |
parent | 29abc971009cf4b18c02e7e972de92d98aef3784 (diff) | |
download | external_llvm-48aa8242799b639526b8b696260045be0c0c0139.zip external_llvm-48aa8242799b639526b8b696260045be0c0c0139.tar.gz external_llvm-48aa8242799b639526b8b696260045be0c0c0139.tar.bz2 |
Stop using the `Offset' variable, as we are cycling through the bits of a field
initializer and the loop index variable already carries the offset information
that we need.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7123 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | support/tools/TableGen/CodeEmitterGen.cpp | 15 | ||||
-rw-r--r-- | utils/TableGen/CodeEmitterGen.cpp | 15 |
2 files changed, 14 insertions, 16 deletions
diff --git a/support/tools/TableGen/CodeEmitterGen.cpp b/support/tools/TableGen/CodeEmitterGen.cpp index c32fd4b..9d0d939 100644 --- a/support/tools/TableGen/CodeEmitterGen.cpp +++ b/support/tools/TableGen/CodeEmitterGen.cpp @@ -74,8 +74,7 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { } } - unsigned Offset = 31; - for (int f = Vals.size()-1; f >= 0; --f) { + for (unsigned f = 0, e = Vals.size(); f != e; ++f) { if (Vals[f].getPrefix()) { BitsInit *FieldInitializer = (BitsInit*)Vals[f].getValue(); @@ -83,18 +82,17 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { // variable... for (int i = FieldInitializer->getNumBits()-1; i >= 0; --i) { if (BitInit *BI=dynamic_cast<BitInit*>(FieldInitializer->getBit(i))){ - --Offset; + o << " // bit init: f: " << f << ", i: " << i << "\n"; } else if (UnsetInit *UI = dynamic_cast<UnsetInit*>(FieldInitializer->getBit(i))) { - --Offset; + o << " // unset init: f: " << f << ", i: " << i << "\n"; } else if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(FieldInitializer->getBit(i))) { TypedInit *TI = VBI->getVariable(); if (VarInit *VI = dynamic_cast<VarInit*>(TI)) { o << " Value |= getValueBit(op" << OpOrder[VI->getName()] << ", " << VBI->getBitNum() - << ")" << " << " << Offset << ";\n"; - --Offset; + << ")" << " << " << i << ";\n"; } else if (FieldInit *FI = dynamic_cast<FieldInit*>(TI)) { // FIXME: implement this! o << "FIELD INIT not implemented yet!\n"; @@ -105,8 +103,9 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { } } else { // ignore annul and predict bits since no one sets them yet - if (Vals[f].getName() == "annul" || Vals[f].getName() == "predict") - --Offset; + if (Vals[f].getName() == "annul" || Vals[f].getName() == "predict") { + o << " // found " << Vals[f].getName() << "\n"; + } } } diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp index c32fd4b..9d0d939 100644 --- a/utils/TableGen/CodeEmitterGen.cpp +++ b/utils/TableGen/CodeEmitterGen.cpp @@ -74,8 +74,7 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { } } - unsigned Offset = 31; - for (int f = Vals.size()-1; f >= 0; --f) { + for (unsigned f = 0, e = Vals.size(); f != e; ++f) { if (Vals[f].getPrefix()) { BitsInit *FieldInitializer = (BitsInit*)Vals[f].getValue(); @@ -83,18 +82,17 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { // variable... for (int i = FieldInitializer->getNumBits()-1; i >= 0; --i) { if (BitInit *BI=dynamic_cast<BitInit*>(FieldInitializer->getBit(i))){ - --Offset; + o << " // bit init: f: " << f << ", i: " << i << "\n"; } else if (UnsetInit *UI = dynamic_cast<UnsetInit*>(FieldInitializer->getBit(i))) { - --Offset; + o << " // unset init: f: " << f << ", i: " << i << "\n"; } else if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(FieldInitializer->getBit(i))) { TypedInit *TI = VBI->getVariable(); if (VarInit *VI = dynamic_cast<VarInit*>(TI)) { o << " Value |= getValueBit(op" << OpOrder[VI->getName()] << ", " << VBI->getBitNum() - << ")" << " << " << Offset << ";\n"; - --Offset; + << ")" << " << " << i << ";\n"; } else if (FieldInit *FI = dynamic_cast<FieldInit*>(TI)) { // FIXME: implement this! o << "FIELD INIT not implemented yet!\n"; @@ -105,8 +103,9 @@ void CodeEmitterGen::createEmitter(std::ostream &o) { } } else { // ignore annul and predict bits since no one sets them yet - if (Vals[f].getName() == "annul" || Vals[f].getName() == "predict") - --Offset; + if (Vals[f].getName() == "annul" || Vals[f].getName() == "predict") { + o << " // found " << Vals[f].getName() << "\n"; + } } } |