diff options
author | Chris Lattner <sabre@nondot.org> | 2001-07-28 17:51:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-07-28 17:51:21 +0000 |
commit | f324dc82a1eada1561bc43793e477b933f9fc7e0 (patch) | |
tree | 26b00cb4076706400129b47bc1a7dadc267f961c /llvm/lib/Bytecode | |
parent | 5bdab0f9ad39d2872dea3e9640d13ca00f6cc3b8 (diff) | |
download | bcm5719-llvm-f324dc82a1eada1561bc43793e477b933f9fc7e0.tar.gz bcm5719-llvm-f324dc82a1eada1561bc43793e477b933f9fc7e0.zip |
* Make sure that the size of the type field can also control the output
instruction pattern.
llvm-svn: 324
Diffstat (limited to 'llvm/lib/Bytecode')
-rw-r--r-- | llvm/lib/Bytecode/Writer/InstructionWriter.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Bytecode/Writer/InstructionWriter.cpp b/llvm/lib/Bytecode/Writer/InstructionWriter.cpp index 18140772a39..3ab882fa7b9 100644 --- a/llvm/lib/Bytecode/Writer/InstructionWriter.cpp +++ b/llvm/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 |