From 9833493bae15d9b84cb1c5dc26a2d7bcc8aefebd Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 2 Dec 2002 17:43:43 +0000 Subject: [PATCH] Adjustments due to new FieldInit stuff git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4852 91177308-0d34-0410-b5e6-96231b3b80d8 --- support/tools/TableGen/TableGen.cpp | 18 ++++++++++++------ utils/TableGen/TableGen.cpp | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/support/tools/TableGen/TableGen.cpp b/support/tools/TableGen/TableGen.cpp index a66ffe6765c..6f330ea8187 100644 --- a/support/tools/TableGen/TableGen.cpp +++ b/support/tools/TableGen/TableGen.cpp @@ -236,7 +236,7 @@ static void PrintValue(Record *I, unsigned char *Ptr, const RecordVal &Val) { unsigned Offset = 0; for (unsigned f = 0, e = Vals.size(); f != e; ++f) if (Vals[f].getPrefix()) { - BitsInit *FieldInit = (BitsInit*)Vals[f].getValue(); + BitsInit *FieldInitializer = (BitsInit*)Vals[f].getValue(); if (&Vals[f] == &Val) { // Read the bits directly now... for (unsigned i = 0, e = BI->getNumBits(); i != e; ++i) @@ -246,13 +246,19 @@ static void PrintValue(Record *I, unsigned char *Ptr, const RecordVal &Val) { // Scan through the field looking for bit initializers of the current // variable... - for (unsigned i = 0, e = FieldInit->getNumBits(); i != e; ++i) + for (unsigned i = 0, e = FieldInitializer->getNumBits(); i != e; ++i) if (VarBitInit *VBI = - dynamic_cast(FieldInit->getBit(i))) { - if (VBI->getVariable()->getName() == Val.getName()) - Value |= getMemoryBit(Ptr, Offset+i) << VBI->getBitNum(); + dynamic_cast(FieldInitializer->getBit(i))) { + TypedInit *TI = VBI->getVariable(); + if (VarInit *VI = dynamic_cast(TI)) { + if (VI->getName() == Val.getName()) + Value |= getMemoryBit(Ptr, Offset+i) << VBI->getBitNum(); + } else if (FieldInit *FI = dynamic_cast(TI)) { + // FIXME: implement this! + std::cerr << "FIELD INIT not implemented yet!\n"; + } } - Offset += FieldInit->getNumBits(); + Offset += FieldInitializer->getNumBits(); } std::cout << "0x" << std::hex << Value << std::dec; diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp index a66ffe6765c..6f330ea8187 100644 --- a/utils/TableGen/TableGen.cpp +++ b/utils/TableGen/TableGen.cpp @@ -236,7 +236,7 @@ static void PrintValue(Record *I, unsigned char *Ptr, const RecordVal &Val) { unsigned Offset = 0; for (unsigned f = 0, e = Vals.size(); f != e; ++f) if (Vals[f].getPrefix()) { - BitsInit *FieldInit = (BitsInit*)Vals[f].getValue(); + BitsInit *FieldInitializer = (BitsInit*)Vals[f].getValue(); if (&Vals[f] == &Val) { // Read the bits directly now... for (unsigned i = 0, e = BI->getNumBits(); i != e; ++i) @@ -246,13 +246,19 @@ static void PrintValue(Record *I, unsigned char *Ptr, const RecordVal &Val) { // Scan through the field looking for bit initializers of the current // variable... - for (unsigned i = 0, e = FieldInit->getNumBits(); i != e; ++i) + for (unsigned i = 0, e = FieldInitializer->getNumBits(); i != e; ++i) if (VarBitInit *VBI = - dynamic_cast(FieldInit->getBit(i))) { - if (VBI->getVariable()->getName() == Val.getName()) - Value |= getMemoryBit(Ptr, Offset+i) << VBI->getBitNum(); + dynamic_cast(FieldInitializer->getBit(i))) { + TypedInit *TI = VBI->getVariable(); + if (VarInit *VI = dynamic_cast(TI)) { + if (VI->getName() == Val.getName()) + Value |= getMemoryBit(Ptr, Offset+i) << VBI->getBitNum(); + } else if (FieldInit *FI = dynamic_cast(TI)) { + // FIXME: implement this! + std::cerr << "FIELD INIT not implemented yet!\n"; + } } - Offset += FieldInit->getNumBits(); + Offset += FieldInitializer->getNumBits(); } std::cout << "0x" << std::hex << Value << std::dec; -- 2.34.1