aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-28 17:51:21 +0000
committerChris Lattner <sabre@nondot.org>2001-07-28 17:51:21 +0000
commit7c5014767f8f4696365f663bf0f4ddb4abfbe068 (patch)
treef184b8ba434f5a8b0549b348368d2f110a77c4c6 /lib
parent3d3f289eac5e85f65e55ca2798d0f0f1b7218163 (diff)
downloadexternal_llvm-7c5014767f8f4696365f663bf0f4ddb4abfbe068.zip
external_llvm-7c5014767f8f4696365f663bf0f4ddb4abfbe068.tar.gz
external_llvm-7c5014767f8f4696365f663bf0f4ddb4abfbe068.tar.bz2
* Make sure that the size of the type field can also control the output
instruction pattern. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Bytecode/Writer/InstructionWriter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Bytecode/Writer/InstructionWriter.cpp b/lib/Bytecode/Writer/InstructionWriter.cpp
index 1814077..3ab882f 100644
--- a/lib/Bytecode/Writer/InstructionWriter.cpp
+++ b/lib/Bytecode/Writer/InstructionWriter.cpp
@@ -187,6 +187,7 @@ bool BytecodeWriter::processInstruction(const Instruction *I) {
break;
case Instruction::Store:
Ty = I->getOperand(1)->getType(); // Encode the pointer type...
+ assert(Ty->isPointerType() && "Store to nonpointer type!?!?");
break;
default: // Otherwise use the default behavior...
Ty = NumOperands ? I->getOperand(0)->getType() : I->getType();
@@ -198,6 +199,11 @@ bool BytecodeWriter::processInstruction(const Instruction *I) {
assert(Slot != -1 && "Type not available!!?!");
Type = (unsigned)Slot;
+ // Make sure that we take the type number into consideration. We don't want
+ // to overflow the field size for the instruction format we select.
+ //
+ if (Slot > MaxOpSlot) MaxOpSlot = Slot;
+
// Handle the special case for cast...
if (I->getOpcode() == Instruction::Cast) {
// Cast has to encode the destination type as the second argument in the