[llvm-commits] CVS: llvm/utils/TableGen/CodeEmitterGen.cpp
Misha Brukman
brukman at cs.uiuc.edu
Mon Aug 9 10:47:56 PDT 2004
Changes in directory llvm/utils/TableGen:
CodeEmitterGen.cpp updated: 1.31 -> 1.32
---
Log message:
* Use Classname and ClassPrefix instead of hard-coded V9 values
* Simplify code and shorten lines by not recomputing values
---
Diffs of the changes: (+7 -8)
Index: llvm/utils/TableGen/CodeEmitterGen.cpp
diff -u llvm/utils/TableGen/CodeEmitterGen.cpp:1.31 llvm/utils/TableGen/CodeEmitterGen.cpp:1.32
--- llvm/utils/TableGen/CodeEmitterGen.cpp:1.31 Wed Aug 4 17:07:54 2004
+++ llvm/utils/TableGen/CodeEmitterGen.cpp Mon Aug 9 12:47:45 2004
@@ -23,8 +23,9 @@
EmitSourceFileHeader("Machine Code Emitter", o);
- std::string Namespace = "V9::";
- std::string ClassName = "SparcV9CodeEmitter::";
+ std::string Namespace = Insts[0]->getValueAsString("Namespace") + "::";
+ std::string ClassName = Insts[0]->getValueAsString("ClassPrefix") +
+ "CodeEmitter::";
//const std::string &Namespace = Inst->getValue("Namespace")->getName();
o << "unsigned " << ClassName
@@ -177,14 +178,12 @@
// Scan through the field looking for bit initializers of the current
// variable...
for (int i = FieldInitializer->getNumBits()-1; i >= 0; --i) {
- if (BitInit *BI = dynamic_cast<BitInit*>(FieldInitializer->getBit(i)))
- {
+ Init *I = FieldInitializer->getBit(i);
+ if (BitInit *BI = dynamic_cast<BitInit*>(I)) {
DEBUG(o << " // bit init: f: " << f << ", i: " << i << "\n");
- } else if (UnsetInit *UI =
- dynamic_cast<UnsetInit*>(FieldInitializer->getBit(i))) {
+ } else if (UnsetInit *UI = dynamic_cast<UnsetInit*>(I)) {
DEBUG(o << " // unset init: f: " << f << ", i: " << i << "\n");
- } else if (VarBitInit *VBI =
- dynamic_cast<VarBitInit*>(FieldInitializer->getBit(i))) {
+ } else if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(I)) {
TypedInit *TI = VBI->getVariable();
if (VarInit *VI = dynamic_cast<VarInit*>(TI)) {
// If the bits of the field are laid out consecutively in the
More information about the llvm-commits
mailing list