aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Writer/InstructionWriter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-08 04:57:15 +0000
committerChris Lattner <sabre@nondot.org>2001-07-08 04:57:15 +0000
commit0908309e3c4b4f423e88d8d8fe8060cb10eaa1c9 (patch)
treedcdecdda0cd3e1168527d832f3824e0c94b3ef60 /lib/Bytecode/Writer/InstructionWriter.cpp
parentf22696f209701bff12edbe41c646d1ef179c685d (diff)
Neg instruction removed. Cast instruction implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer/InstructionWriter.cpp')
-rw-r--r--lib/Bytecode/Writer/InstructionWriter.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Bytecode/Writer/InstructionWriter.cpp b/lib/Bytecode/Writer/InstructionWriter.cpp
index 3bd9a0902b..34d95682bf 100644
--- a/lib/Bytecode/Writer/InstructionWriter.cpp
+++ b/lib/Bytecode/Writer/InstructionWriter.cpp
@@ -145,6 +145,15 @@ bool BytecodeWriter::processInstruction(const Instruction *I) {
assert(Slot != -1 && "Type not available!!?!");
Type = (unsigned)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
+ // packet, or else we won't know what type to cast to!
+ Slots[1] = Table.getValSlot(I->getType());
+ assert(Slots[1] != -1 && "Cast return type unknown?");
+ if (Slots[1] > MaxOpSlot) MaxOpSlot = Slots[1];
+ NumOperands++;
+ }
// Decide which instruction encoding to use. This is determined primarily by
// the number of operands, and secondarily by whether or not the max operand