LLVMContext changes up to r77366

This commit is contained in:
Benjamin Kramer
2009-07-30 15:25:10 +02:00
parent 3f0a0686a8
commit 66101517d7
19 changed files with 113 additions and 114 deletions

View File

@@ -74,7 +74,7 @@ namespace {
this->TD = &TD;
this->AA = &AA;
if (CI->getCalledFunction())
Context = CI->getCalledFunction()->getContext();
Context = &CI->getCalledFunction()->getContext();
return CallOptimizer(CI->getCalledFunction(), CI, B);
}
};
@@ -95,7 +95,7 @@ Value *LibCallOptimization::EmitMemCpy(Value *Dst, Value *Src, Value *Len,
Tys[0] = Len->getType();
Value *MemCpy = Intrinsic::getDeclaration(M, IID, Tys, 1);
return B.CreateCall4(MemCpy, CastToCStr(Dst, B), CastToCStr(Src, B), Len,
Context->getConstantInt(Type::Int32Ty, Align));
ConstantInt::get(Type::Int32Ty, Align));
}
//===----------------------------------------------------------------------===//
@@ -181,7 +181,7 @@ struct VISIBILITY_HIDDEN ArrayCastLenOpt : public LibCallOptimization {
APInt Quot, Rem;
APInt::udivrem(OldInt->getValue(), NewInt->getValue(), Quot, Rem);
if (Rem == 0)
return B.CreateMul(OldLen, Context->getConstantInt(Quot));
return B.CreateMul(OldLen, ConstantInt::get(*Context, Quot));
}
return 0;
}
@@ -202,7 +202,7 @@ struct VISIBILITY_HIDDEN AllocationOpt : public LibCallOptimization {
Constant* C = 0;
if ((C = dyn_cast<Constant>(Cmp->getOperand(0)))
|| (C = dyn_cast<Constant>(Cmp->getOperand(1)))) {
Value* Result = Context->getConstantInt(Type::Int1Ty, !Cmp->isTrueWhenEqual());
Value* Result = ConstantInt::get(Type::Int1Ty, !Cmp->isTrueWhenEqual());
Cmp->replaceAllUsesWith(Result);
// Don't delete the comparison because there may be an
// iterator to it. Instead, set the operands to constants
@@ -359,8 +359,8 @@ bool SimplifyDRuntimeCalls::runOnFunction(Function &F) {
}
bool SimplifyDRuntimeCalls::runOnce(Function &F, const TargetData& TD, AliasAnalysis& AA) {
IRBuilder<> Builder(*Context);
IRBuilder<> Builder(F.getContext());
bool Changed = false;
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) {