diff options
author | David Greene <greened@obbligato.org> | 2011-07-29 19:07:05 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2011-07-29 19:07:05 +0000 |
commit | 1aa0e3e1185d80c9767c71253d83e5f23c3a4973 (patch) | |
tree | ad334e7b81f3d18436329784f8937d82caf8c888 /llvm/utils/TableGen/ARMDecoderEmitter.cpp | |
parent | cdd64328c7a794c3229aba52e4b5a55cb8400adc (diff) | |
download | bcm5719-llvm-1aa0e3e1185d80c9767c71253d83e5f23c3a4973.tar.gz bcm5719-llvm-1aa0e3e1185d80c9767c71253d83e5f23c3a4973.zip |
[AVX] Constify Inits
Make references to Inits const everywhere. This is the final step
before making them unique.
llvm-svn: 136485
Diffstat (limited to 'llvm/utils/TableGen/ARMDecoderEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/ARMDecoderEmitter.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/utils/TableGen/ARMDecoderEmitter.cpp b/llvm/utils/TableGen/ARMDecoderEmitter.cpp index c4bac10cfb2..cc0c5da5cc4 100644 --- a/llvm/utils/TableGen/ARMDecoderEmitter.cpp +++ b/llvm/utils/TableGen/ARMDecoderEmitter.cpp @@ -115,7 +115,7 @@ enum { /// byteFromBitsInit - Return the byte value from a BitsInit. /// Called from getByteField(). -static uint8_t byteFromBitsInit(BitsInit &init) { +static uint8_t byteFromBitsInit(const BitsInit &init) { int width = init.getNumBits(); assert(width <= 8 && "Field is too large for uint8_t!"); @@ -126,7 +126,7 @@ static uint8_t byteFromBitsInit(BitsInit &init) { uint8_t ret = 0; for (index = 0; index < width; index++) { - if (static_cast<BitInit*>(init.getBit(index))->getValue()) + if (static_cast<const BitInit*>(init.getBit(index))->getValue()) ret |= mask; mask <<= 1; @@ -136,12 +136,12 @@ static uint8_t byteFromBitsInit(BitsInit &init) { } static uint8_t getByteField(const Record &def, const char *str) { - BitsInit *bits = def.getValueAsBitsInit(str); + const BitsInit *bits = def.getValueAsBitsInit(str); return byteFromBitsInit(*bits); } -static BitsInit &getBitsField(const Record &def, const char *str) { - BitsInit *bits = def.getValueAsBitsInit(str); +static const BitsInit &getBitsField(const Record &def, const char *str) { + const BitsInit *bits = def.getValueAsBitsInit(str); return *bits; } @@ -184,15 +184,15 @@ static bool ValueNotSet(bit_value_t V) { static int Value(bit_value_t V) { return ValueNotSet(V) ? -1 : (V == BIT_FALSE ? 0 : 1); } -static bit_value_t bitFromBits(BitsInit &bits, unsigned index) { - if (BitInit *bit = dynamic_cast<BitInit*>(bits.getBit(index))) +static bit_value_t bitFromBits(const BitsInit &bits, unsigned index) { + if (const BitInit *bit = dynamic_cast<const BitInit*>(bits.getBit(index))) return bit->getValue() ? BIT_TRUE : BIT_FALSE; // The bit is uninitialized. return BIT_UNSET; } // Prints the bit value for each position. -static void dumpBits(raw_ostream &o, BitsInit &bits) { +static void dumpBits(raw_ostream &o, const BitsInit &bits) { unsigned index; for (index = bits.getNumBits(); index > 0; index--) { @@ -425,7 +425,7 @@ protected: if (AllInstructions[Opcode]->isPseudo) return; - BitsInit &Bits = getBitsField(*AllInstructions[Opcode]->TheDef, "Inst"); + const BitsInit &Bits = getBitsField(*AllInstructions[Opcode]->TheDef, "Inst"); for (unsigned i = 0; i < BIT_WIDTH; ++i) Insn[i] = bitFromBits(Bits, i); @@ -1559,7 +1559,7 @@ ARMDEBackend::populateInstruction(const CodeGenInstruction &CGI, const StringRef Name = Def.getName(); uint8_t Form = getByteField(Def, "Form"); - BitsInit &Bits = getBitsField(Def, "Inst"); + const BitsInit &Bits = getBitsField(Def, "Inst"); // If all the bit positions are not specified; do not decode this instruction. // We are bound to fail! For proper disassembly, the well-known encoding bits |