summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Writer/InstructionWriter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-21 00:14:44 +0000
committerChris Lattner <sabre@nondot.org>2001-10-21 00:14:44 +0000
commit18e81933c7c2a00a4d7fc95c50e0dc4f339f1212 (patch)
tree16df5980a6f73a6df227fb9011e461db93ce650d /llvm/lib/Bytecode/Writer/InstructionWriter.cpp
parent9bc488984f43694600e2d3b3596117675fd0b42c (diff)
downloadbcm5719-llvm-18e81933c7c2a00a4d7fc95c50e0dc4f339f1212.tar.gz
bcm5719-llvm-18e81933c7c2a00a4d7fc95c50e0dc4f339f1212.zip
Fix problem with a cast instruction that must be expanded to type 0
llvm-svn: 929
Diffstat (limited to 'llvm/lib/Bytecode/Writer/InstructionWriter.cpp')
-rw-r--r--llvm/lib/Bytecode/Writer/InstructionWriter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Bytecode/Writer/InstructionWriter.cpp b/llvm/lib/Bytecode/Writer/InstructionWriter.cpp
index c972a7cf791..c6a32ed51f0 100644
--- a/llvm/lib/Bytecode/Writer/InstructionWriter.cpp
+++ b/llvm/lib/Bytecode/Writer/InstructionWriter.cpp
@@ -34,13 +34,20 @@ static void outputInstructionFormat0(const Instruction *I,
output_vbr(Type, Out); // Result type
unsigned NumArgs = I->getNumOperands();
- output_vbr(NumArgs, Out);
+ output_vbr(NumArgs + isa<CastInst>(I), Out);
for (unsigned i = 0; i < NumArgs; ++i) {
int Slot = Table.getValSlot(I->getOperand(i));
assert(Slot >= 0 && "No slot number for value!?!?");
output_vbr((unsigned)Slot, Out);
}
+
+ if (isa<CastInst>(I)) {
+ int Slot = Table.getValSlot(I->getType());
+ assert(Slot != -1 && "Cast return type unknown?");
+ output_vbr((unsigned)Slot, Out);
+ }
+
align32(Out); // We must maintain correct alignment!
}
@@ -210,7 +217,7 @@ void BytecodeWriter::processInstruction(const Instruction *I) {
if (Slot > MaxOpSlot) MaxOpSlot = Slot;
// Handle the special case for cast...
- if (I->getOpcode() == Instruction::Cast) {
+ if (isa<CastInst>(I)) {
// Cast has to encode the destination type as the second argument in the
// packet, or else we won't know what type to cast to!
Slots[1] = Table.getValSlot(I->getType());
OpenPOWER on IntegriCloud