API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interf...
[oota-llvm.git] / lib / Transforms / Scalar / Reassociate.cpp
index 0a118cd338b9269b88b88a1882ae09d7e565bc79..de1a3babdd56226d1465609b6bcf34d5459e73b4 100644 (file)
@@ -64,7 +64,7 @@ static void PrintOps(Instruction *I, const std::vector<ValueEntry> &Ops) {
       << "," << Ops[i].Rank;
 }
   
-namespace {  
+namespace {
   class VISIBILITY_HIDDEN Reassociate : public FunctionPass {
     std::map<BasicBlock*, unsigned> RankMap;
     std::map<Value*, unsigned> ValueRankMap;
@@ -92,11 +92,11 @@ namespace {
     
     void RemoveDeadBinaryOp(Value *V);
   };
-
-  char Reassociate::ID = 0;
-  RegisterPass<Reassociate> X("reassociate", "Reassociate expressions");
 }
 
+char Reassociate::ID = 0;
+static RegisterPass<Reassociate> X("reassociate", "Reassociate expressions");
+
 // Public interface to the Reassociate pass
 FunctionPass *llvm::createReassociatePass() { return new Reassociate(); }
 
@@ -194,7 +194,7 @@ static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) {
 static Instruction *LowerNegateToMultiply(Instruction *Neg) {
   Constant *Cst = ConstantInt::getAllOnesValue(Neg->getType());
 
-  Instruction *Res = BinaryOperator::createMul(Neg->getOperand(1), Cst, "",Neg);
+  Instruction *Res = BinaryOperator::CreateMul(Neg->getOperand(1), Cst, "",Neg);
   Res->takeName(Neg);
   Neg->replaceAllUsesWith(Res);
   Neg->eraseFromParent();
@@ -389,7 +389,7 @@ static Value *NegateValue(Value *V, Instruction *BI) {
   // Insert a 'neg' instruction that subtracts the value from zero to get the
   // negation.
   //
-  return BinaryOperator::createNeg(V, V->getName() + ".neg", BI);
+  return BinaryOperator::CreateNeg(V, V->getName() + ".neg", BI);
 }
 
 /// ShouldBreakUpSubtract - Return true if we should break up this subtract of
@@ -427,7 +427,7 @@ static Instruction *BreakUpSubtract(Instruction *Sub) {
   //
   Value *NegVal = NegateValue(Sub->getOperand(1), Sub);
   Instruction *New =
-    BinaryOperator::createAdd(Sub->getOperand(0), NegVal, "", Sub);
+    BinaryOperator::CreateAdd(Sub->getOperand(0), NegVal, "", Sub);
   New->takeName(Sub);
 
   // Everyone now refers to the add instruction.
@@ -451,7 +451,7 @@ static Instruction *ConvertShiftToMul(Instruction *Shl) {
     Constant *MulCst = ConstantInt::get(Shl->getType(), 1);
     MulCst = ConstantExpr::getShl(MulCst, cast<Constant>(Shl->getOperand(1)));
     
-    Instruction *Mul = BinaryOperator::createMul(Shl->getOperand(0), MulCst,
+    Instruction *Mul = BinaryOperator::CreateMul(Shl->getOperand(0), MulCst,
                                                  "", Shl);
     Mul->takeName(Shl);
     Shl->replaceAllUsesWith(Mul);
@@ -485,7 +485,7 @@ static Value *EmitAddTreeOfValues(Instruction *I, std::vector<Value*> &Ops) {
   Value *V1 = Ops.back();
   Ops.pop_back();
   Value *V2 = EmitAddTreeOfValues(I, Ops);
-  return BinaryOperator::createAdd(V2, V1, "tmp", I);
+  return BinaryOperator::CreateAdd(V2, V1, "tmp", I);
 }
 
 /// RemoveFactorFromExpression - If V is an expression tree that is a 
@@ -714,7 +714,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I,
       // this, we could otherwise run into situations where removing a factor
       // from an expression will drop a use of maxocc, and this can cause 
       // RemoveFactorFromExpression on successive values to behave differently.
-      Instruction *DummyInst = BinaryOperator::createAdd(MaxOccVal, MaxOccVal);
+      Instruction *DummyInst = BinaryOperator::CreateAdd(MaxOccVal, MaxOccVal);
       std::vector<Value*> NewMulOps;
       for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
         if (Value *V = RemoveFactorFromExpression(Ops[i].Op, MaxOccVal)) {
@@ -729,7 +729,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I,
 
       unsigned NumAddedValues = NewMulOps.size();
       Value *V = EmitAddTreeOfValues(I, NewMulOps);
-      Value *V2 = BinaryOperator::createMul(V, MaxOccVal, "tmp", I);
+      Value *V2 = BinaryOperator::CreateMul(V, MaxOccVal, "tmp", I);
 
       // Now that we have inserted V and its sole use, optimize it. This allows
       // us to handle cases that require multiple factoring steps, such as this: