generalize 'CaseBlock'. It really allows any comparison to be inserted.
authorChris Lattner <sabre@nondot.org>
Tue, 24 Oct 2006 17:03:35 +0000 (17:03 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 24 Oct 2006 17:03:35 +0000 (17:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31161 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGISel.h
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index f733d965fd31a11c27c5c14076591f43e4149b80..855febe2e4e409019bb1cfd1a851ad82a9b95abb 100644 (file)
@@ -82,20 +82,19 @@ public:
   /// SDISel for the code generation of additional basic blocks needed by multi-
   /// case switch statements.
   struct CaseBlock {
-    CaseBlock(ISD::CondCode cc, Value *s, Constant *c, MachineBasicBlock *lhs,
-              MachineBasicBlock *rhs, MachineBasicBlock *me) : 
-    CC(cc), SwitchV(s), CaseC(c), LHSBB(lhs), RHSBB(rhs), ThisBB(me) {}
+    CaseBlock(ISD::CondCode cc, Value *cmplhs, Value *cmprhs, 
+              MachineBasicBlock *lhs, MachineBasicBlock *rhs,
+              MachineBasicBlock *me) : 
+    CC(cc), CmpLHS(cmplhs), CmpRHS(cmprhs), LHSBB(lhs), RHSBB(rhs), ThisBB(me){}
     // CC - the condition code to use for the case block's setcc node
     ISD::CondCode CC;
-    // SwitchV - the value to be switched on, 'foo' in switch(foo)
-    Value *SwitchV;
-    // CaseC - the constant the setcc node will compare against SwitchV
-    Constant *CaseC;
+    // CmpLHS/CmpRHS - The LHS/RHS of the comparison to emit.
+    Value *CmpLHS, *CmpRHS;
     // LHSBB - the block to branch to if the setcc is true
     MachineBasicBlock *LHSBB;
     // RHSBB - the block to branch to if the setcc is false
     MachineBasicBlock *RHSBB;
-    // ThisBB - the blcok into which to emit the code for the setcc and branches
+    // ThisBB - the block into which to emit the code for the setcc and branches
     MachineBasicBlock *ThisBB;
   };
   struct JumpTable {
index fa4407def528933ba62af929ea4cce860de2bff2..17ee59762efa2e55fdbb7f07f1d39640efe9153c 100644 (file)
@@ -819,9 +819,8 @@ void SelectionDAGLowering::visitBr(BranchInst &I) {
 /// visitSwitchCase - Emits the necessary code to represent a single node in
 /// the binary search tree resulting from lowering a switch instruction.
 void SelectionDAGLowering::visitSwitchCase(SelectionDAGISel::CaseBlock &CB) {
-  SDOperand SwitchOp = getValue(CB.SwitchV);
-  SDOperand CaseOp = getValue(CB.CaseC);
-  SDOperand Cond = DAG.getSetCC(MVT::i1, SwitchOp, CaseOp, CB.CC);
+  SDOperand Cond = DAG.getSetCC(MVT::i1, getValue(CB.CmpLHS),
+                                getValue(CB.CmpRHS), CB.CC);
   
   // Set NextBlock to be the MBB immediately after the current one, if any.
   // This is used to avoid emitting unnecessary branches to the next block.