diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-03 06:28:54 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-03 06:28:54 +0000 |
commit | c8dab49aad45169275c2c40240d56cf01f37d21e (patch) | |
tree | 299276bb56427b2f2de6992adf0f70d1aacba1a7 /lib/Bytecode/Writer/Writer.cpp | |
parent | 74f1642bc1c2981e4573c9f0690d91b6a9bbc68c (diff) |
Implement reading and writing of the ICmp and FCmp instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer/Writer.cpp')
-rw-r--r-- | lib/Bytecode/Writer/Writer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index d8bcce8208..9cf61c6ee2 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -718,6 +718,15 @@ void BytecodeWriter::outputInstruction(const Instruction &I) { if (Slots[1] > MaxOpSlot) MaxOpSlot = Slots[1]; NumOperands = 2; } + } else if (isa<ICmpInst>(I) || isa<FCmpInst>(I)) { + // We need to encode the compare instruction's predicate as the third + // operand. Its not really a slot, but we don't want to break the + // instruction format for these instructions. + NumOperands++; + assert(NumOperands == 3 && "CmpInst with wrong number of operands?"); + Slots[2] = unsigned(cast<CmpInst>(&I)->getPredicate()); + if (Slots[2] > MaxOpSlot) + MaxOpSlot = Slots[2]; } else if (const GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(&I)) { // We need to encode the type of sequential type indices into their slot # unsigned Idx = 1; |