[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp

Reid Spencer reid at x10sys.com
Sat Dec 2 22:29:09 PST 2006



Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.130 -> 1.131
---
Log message:

Implement reading and writing of the ICmp and FCmp instructions.


---
Diffs of the changes:  (+9 -0)

 Writer.cpp |    9 +++++++++
 1 files changed, 9 insertions(+)


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.130 llvm/lib/Bytecode/Writer/Writer.cpp:1.131
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.130	Tue Nov 28 18:19:40 2006
+++ llvm/lib/Bytecode/Writer/Writer.cpp	Sun Dec  3 00:28:54 2006
@@ -718,6 +718,15 @@
         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;






More information about the llvm-commits mailing list