[llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp

Reid Spencer reid at x10sys.com
Fri Dec 22 22:07:00 PST 2006



Changes in directory llvm/projects/Stacker/lib/compiler:

StackerCompiler.cpp updated: 1.27 -> 1.28
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and 
been replaced with ICmpInst and FCmpInst.


---
Diffs of the changes:  (+25 -25)

 StackerCompiler.cpp |   50 +++++++++++++++++++++++++-------------------------
 1 files changed, 25 insertions(+), 25 deletions(-)


Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp
diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.27 llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.28
--- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.27	Tue Dec 19 17:03:41 2006
+++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp	Sat Dec 23 00:05:41 2006
@@ -721,7 +721,7 @@
     LoadInst* cond = cast<LoadInst>( pop_integer(bb) );
 
     // Compare the condition against 0
-    SetCondInst* cond_inst = new SetCondInst( Instruction::SetNE, cond,
+    ICmpInst* cond_inst = new ICmpInst( ICmpInst::ICMP_NE, cond,
         ConstantInt::get( Type::LongTy, 0) );
     bb->getInstList().push_back( cond_inst );
 
@@ -735,7 +735,7 @@
     BasicBlock* false_bb = 0;
     if ( ifFalse ) false_bb = new BasicBlock((echo?"else":""));
 
-    // Create a branch on the SetCond
+    // Create a branch on the ICmp
     BranchInst* br_inst = new BranchInst( true_bb,
         ( ifFalse ? false_bb : exit_bb ), cond_inst );
     bb->getInstList().push_back( br_inst );
@@ -805,8 +805,8 @@
     LoadInst* cond = cast<LoadInst>( stack_top(test) );
 
     // Compare the condition against 0
-    SetCondInst* cond_inst = new SetCondInst(
-        Instruction::SetNE, cond, ConstantInt::get( Type::LongTy, 0));
+    ICmpInst* cond_inst = new ICmpInst(
+        ICmpInst::ICMP_NE, cond, ConstantInt::get( Type::LongTy, 0));
     test->getInstList().push_back( cond_inst );
 
     // Add the branch instruction
@@ -920,8 +920,8 @@
         if (echo) bb->setName("LESS");
         LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
         LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
-        SetCondInst* cond_inst =
-            new SetCondInst( Instruction::SetLT, op1, op2 );
+        ICmpInst* cond_inst =
+            new ICmpInst( ICmpInst::ICMP_SLT, op1, op2 );
         bb->getInstList().push_back( cond_inst );
         push_value( bb, cond_inst );
         break;
@@ -931,8 +931,8 @@
         if (echo) bb->setName("MORE");
         LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
         LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
-        SetCondInst* cond_inst =
-            new SetCondInst( Instruction::SetGT, op1, op2 );
+        ICmpInst* cond_inst =
+            new ICmpInst( ICmpInst::ICMP_SGT, op1, op2 );
         bb->getInstList().push_back( cond_inst );
         push_value( bb, cond_inst );
         break;
@@ -942,8 +942,8 @@
         if (echo) bb->setName("LE");
         LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
         LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
-        SetCondInst* cond_inst =
-            new SetCondInst( Instruction::SetLE, op1, op2 );
+        ICmpInst* cond_inst =
+            new ICmpInst( ICmpInst::ICMP_SLE, op1, op2 );
         bb->getInstList().push_back( cond_inst );
         push_value( bb, cond_inst );
         break;
@@ -953,8 +953,8 @@
         if (echo) bb->setName("GE");
         LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
         LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
-        SetCondInst* cond_inst =
-            new SetCondInst( Instruction::SetGE, op1, op2 );
+        ICmpInst* cond_inst =
+            new ICmpInst( ICmpInst::ICMP_SGE, op1, op2 );
         bb->getInstList().push_back( cond_inst );
         push_value( bb, cond_inst );
         break;
@@ -964,8 +964,8 @@
         if (echo) bb->setName("NE");
         LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
         LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
-        SetCondInst* cond_inst =
-            new SetCondInst( Instruction::SetNE, op1, op2 );
+        ICmpInst* cond_inst =
+            new ICmpInst( ICmpInst::ICMP_NE, op1, op2 );
         bb->getInstList().push_back( cond_inst );
         push_value( bb, cond_inst );
         break;
@@ -975,8 +975,8 @@
         if (echo) bb->setName("EQ");
         LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
         LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
-        SetCondInst* cond_inst =
-            new SetCondInst( Instruction::SetEQ, op1, op2 );
+        ICmpInst* cond_inst =
+            new ICmpInst( ICmpInst::ICMP_EQ, op1, op2 );
         bb->getInstList().push_back( cond_inst );
         push_value( bb, cond_inst );
         break;
@@ -1102,8 +1102,8 @@
         LoadInst* op1 = cast<LoadInst>(stack_top(bb));
 
         // Determine if its negative
-        SetCondInst* cond_inst =
-            new SetCondInst( Instruction::SetLT, op1, Zero );
+        ICmpInst* cond_inst =
+            new ICmpInst( ICmpInst::ICMP_SLT, op1, Zero );
         bb->getInstList().push_back( cond_inst );
 
         // Create a block for storing the result
@@ -1112,7 +1112,7 @@
         // Create a block for making it a positive value
         BasicBlock* pos_bb = new BasicBlock((echo?"neg":""));
 
-        // Create the branch on the SetCond
+        // Create the branch on the ICmp
         BranchInst* br_inst = new BranchInst( pos_bb, exit_bb, cond_inst );
         bb->getInstList().push_back( br_inst );
 
@@ -1143,11 +1143,11 @@
         LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
 
         // Compare them
-        SetCondInst* cond_inst =
-            new SetCondInst( Instruction::SetLT, op1, op2);
+        ICmpInst* cond_inst =
+            new ICmpInst( ICmpInst::ICMP_SLT, op1, op2);
         bb->getInstList().push_back( cond_inst );
 
-        // Create a branch on the SetCond
+        // Create a branch on the ICmp
         BranchInst* br_inst =
             new BranchInst( op1_block, op2_block, cond_inst );
         bb->getInstList().push_back( br_inst );
@@ -1175,8 +1175,8 @@
         LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
 
         // Compare them
-        SetCondInst* cond_inst =
-            new SetCondInst( Instruction::SetGT, op1, op2);
+        ICmpInst* cond_inst =
+            new ICmpInst( ICmpInst::ICMP_SGT, op1, op2);
         bb->getInstList().push_back( cond_inst );
 
         // Create an exit block
@@ -1192,7 +1192,7 @@
         push_value(op2_block, op2);
         op2_block->getInstList().push_back( new BranchInst( exit_bb ) );
 
-        // Create a banch on the SetCond
+        // Create a banch on the ICmp
         BranchInst* br_inst =
             new BranchInst( op1_block, op2_block, cond_inst );
         bb->getInstList().push_back( br_inst );






More information about the llvm-commits mailing list