summaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeEmitterGen.cpp
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-07-29 19:07:05 +0000
committerDavid Greene <greened@obbligato.org>2011-07-29 19:07:05 +0000
commitf37dd02f7743ebd2424480361f5a7db510495c4f (patch)
tree9c8f6bfe436ec32ede5b9c46eeb65c5024c4c783 /utils/TableGen/CodeEmitterGen.cpp
parent60c04af7879c3eda957162737783de726dd177b6 (diff)
downloadllvm-f37dd02f7743ebd2424480361f5a7db510495c4f.tar.gz
llvm-f37dd02f7743ebd2424480361f5a7db510495c4f.tar.bz2
llvm-f37dd02f7743ebd2424480361f5a7db510495c4f.tar.xz
[AVX] Constify Inits
Make references to Inits const everywhere. This is the final step before making them unique. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136485 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeEmitterGen.cpp')
-rw-r--r--utils/TableGen/CodeEmitterGen.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp
index 8b5cddae25..c11e4d0beb 100644
--- a/utils/TableGen/CodeEmitterGen.cpp
+++ b/utils/TableGen/CodeEmitterGen.cpp
@@ -38,16 +38,16 @@ void CodeEmitterGen::reverseBits(std::vector<Record*> &Insts) {
R->getValueAsBit("isPseudo"))
continue;
- BitsInit *BI = R->getValueAsBitsInit("Inst");
+ const BitsInit *BI = R->getValueAsBitsInit("Inst");
unsigned numBits = BI->getNumBits();
- SmallVector<Init *, 16> NewBits(numBits);
+ SmallVector<const Init *, 16> NewBits(numBits);
for (unsigned bit = 0, end = numBits / 2; bit != end; ++bit) {
unsigned bitSwapIdx = numBits - bit - 1;
- Init *OrigBit = BI->getBit(bit);
- Init *BitSwap = BI->getBit(bitSwapIdx);
+ const Init *OrigBit = BI->getBit(bit);
+ const Init *BitSwap = BI->getBit(bitSwapIdx);
NewBits[bit] = BitSwap;
NewBits[bitSwapIdx] = OrigBit;
}
@@ -56,7 +56,7 @@ void CodeEmitterGen::reverseBits(std::vector<Record*> &Insts) {
NewBits[middle] = BI->getBit(middle);
}
- BitsInit *NewBI = new BitsInit(ArrayRef<Init *>(NewBits));
+ BitsInit *NewBI = new BitsInit(ArrayRef<const Init *>(NewBits));
// Update the bits in reversed order so that emitInstrOpBits will get the
// correct endianness.
@@ -67,12 +67,12 @@ void CodeEmitterGen::reverseBits(std::vector<Record*> &Insts) {
// If the VarBitInit at position 'bit' matches the specified variable then
// return the variable bit position. Otherwise return -1.
int CodeEmitterGen::getVariableBit(const std::string &VarName,
- BitsInit *BI, int bit) {
- if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(BI->getBit(bit))) {
- if (VarInit *VI = dynamic_cast<VarInit*>(VBI->getVariable()))
+ const BitsInit *BI, int bit) {
+ if (const VarBitInit *VBI = dynamic_cast<const VarBitInit*>(BI->getBit(bit))) {
+ if (const VarInit *VI = dynamic_cast<const VarInit*>(VBI->getVariable()))
if (VI->getName() == VarName)
return VBI->getBitNum();
- } else if (VarInit *VI = dynamic_cast<VarInit*>(BI->getBit(bit))) {
+ } else if (const VarInit *VI = dynamic_cast<const VarInit*>(BI->getBit(bit))) {
if (VI->getName() == VarName)
return 0;
}
@@ -81,7 +81,7 @@ int CodeEmitterGen::getVariableBit(const std::string &VarName,
}
void CodeEmitterGen::
-AddCodeToMergeInOperand(Record *R, BitsInit *BI, const std::string &VarName,
+AddCodeToMergeInOperand(Record *R, const BitsInit *BI, const std::string &VarName,
unsigned &NumberedOp,
std::string &Case, CodeGenTarget &Target) {
CodeGenInstruction &CGI = Target.getInstruction(R);
@@ -185,7 +185,7 @@ std::string CodeEmitterGen::getInstructionCase(Record *R,
CodeGenTarget &Target) {
std::string Case;
- BitsInit *BI = R->getValueAsBitsInit("Inst");
+ const BitsInit *BI = R->getValueAsBitsInit("Inst");
const std::vector<RecordVal> &Vals = R->getValues();
unsigned NumberedOp = 0;
@@ -242,12 +242,12 @@ void CodeEmitterGen::run(raw_ostream &o) {
continue;
}
- BitsInit *BI = R->getValueAsBitsInit("Inst");
+ const BitsInit *BI = R->getValueAsBitsInit("Inst");
// Start by filling in fixed values.
unsigned Value = 0;
for (unsigned i = 0, e = BI->getNumBits(); i != e; ++i) {
- if (BitInit *B = dynamic_cast<BitInit*>(BI->getBit(e-i-1)))
+ if (const BitInit *B = dynamic_cast<const BitInit*>(BI->getBit(e-i-1)))
Value |= B->getValue() << (e-i-1);
}
o << " " << Value << "U," << '\t' << "// " << R->getName() << "\n";