summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2012-03-06 21:48:32 +0000
committerOwen Anderson <resistor@mac.com>2012-03-06 21:48:32 +0000
commit40530ad3a8384e597b7a80d04c2ab80ac0232e0c (patch)
treed37d6fc24945502d0d277bff188297ec96f6dafa /utils
parent2945a32ffd0bf079de1b23db12bc8a0de596a167 (diff)
downloadllvm-40530ad3a8384e597b7a80d04c2ab80ac0232e0c.tar.gz
llvm-40530ad3a8384e597b7a80d04c2ab80ac0232e0c.tar.bz2
llvm-40530ad3a8384e597b7a80d04c2ab80ac0232e0c.tar.xz
Fix support for encodings up to 64-bits in length. TableGen was silently truncating them to 32-bits prior to this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152148 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/CodeEmitterGen.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp
index f6701afa31..91d8446bc8 100644
--- a/utils/TableGen/CodeEmitterGen.cpp
+++ b/utils/TableGen/CodeEmitterGen.cpp
@@ -163,7 +163,7 @@ AddCodeToMergeInOperand(Record *R, BitsInit *BI, const std::string &VarName,
--bit;
}
- unsigned opMask = ~0U >> (32-N);
+ uint64_t opMask = ~0U >> (64-N);
int opShift = beginVarBit - N + 1;
opMask <<= opShift;
opShift = beginInstBit - beginVarBit;
@@ -228,7 +228,7 @@ void CodeEmitterGen::run(raw_ostream &o) {
o << "CodeEmitter::getBinaryCodeForInstr(const MachineInstr &MI) const {\n";
// Emit instruction base values
- o << " static const unsigned InstBits[] = {\n";
+ o << " static const uint64_t InstBits[] = {\n";
for (std::vector<const CodeGenInstruction*>::const_iterator
IN = NumberedInstructions.begin(),
EN = NumberedInstructions.end();
@@ -245,10 +245,10 @@ void CodeEmitterGen::run(raw_ostream &o) {
BitsInit *BI = R->getValueAsBitsInit("Inst");
// Start by filling in fixed values.
- unsigned Value = 0;
+ uint64_t Value = 0;
for (unsigned i = 0, e = BI->getNumBits(); i != e; ++i) {
if (BitInit *B = dynamic_cast<BitInit*>(BI->getBit(e-i-1)))
- Value |= B->getValue() << (e-i-1);
+ Value |= (uint64_t)B->getValue() << (e-i-1);
}
o << " UINT64_C(" << Value << ")," << '\t' << "// " << R->getName() << "\n";
}
@@ -273,8 +273,8 @@ void CodeEmitterGen::run(raw_ostream &o) {
// Emit initial function code
o << " const unsigned opcode = MI.getOpcode();\n"
- << " unsigned Value = InstBits[opcode];\n"
- << " unsigned op = 0;\n"
+ << " uint64_t Value = InstBits[opcode];\n"
+ << " uint64_t op = 0;\n"
<< " (void)op; // suppress warning\n"
<< " switch (opcode) {\n";