aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-31 20:28:14 +0000
committerOwen Anderson <resistor@mac.com>2009-07-31 20:28:14 +0000
commita7235ea7245028a0723e8ab7fd011386b3900777 (patch)
tree4d702ea3baaaeaeaeb5cf194e266a0911882c613 /lib/Analysis
parent2a29899d74476e2a14069af7231ab76d8322a157 (diff)
downloadexternal_llvm-a7235ea7245028a0723e8ab7fd011386b3900777.zip
external_llvm-a7235ea7245028a0723e8ab7fd011386b3900777.tar.gz
external_llvm-a7235ea7245028a0723e8ab7fd011386b3900777.tar.bz2
Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp16
-rw-r--r--lib/Analysis/ConstantFolding.cpp18
-rw-r--r--lib/Analysis/DebugInfo.cpp8
-rw-r--r--lib/Analysis/IPA/Andersens.cpp2
-rw-r--r--lib/Analysis/ScalarEvolution.cpp8
-rw-r--r--lib/Analysis/ScalarEvolutionExpander.cpp6
-rw-r--r--lib/Analysis/ValueTracking.cpp2
7 files changed, 29 insertions, 31 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index 2badd26..a895055 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -308,8 +308,6 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS1, CallSite CS2) {
AliasAnalysis::AliasResult
BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
const Value *V2, unsigned V2Size) {
- LLVMContext &Context = V1->getType()->getContext();
-
// Strip off any constant expression casts if they exist
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V1))
if (CE->isCast() && isa<PointerType>(CE->getOperand(0)->getType()))
@@ -394,13 +392,13 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
// the base pointers.
while (isGEP(GEP1->getOperand(0)) &&
GEP1->getOperand(1) ==
- Context.getNullValue(GEP1->getOperand(1)->getType()))
+ Constant::getNullValue(GEP1->getOperand(1)->getType()))
GEP1 = cast<User>(GEP1->getOperand(0));
const Value *BasePtr1 = GEP1->getOperand(0);
while (isGEP(GEP2->getOperand(0)) &&
GEP2->getOperand(1) ==
- Context.getNullValue(GEP2->getOperand(1)->getType()))
+ Constant::getNullValue(GEP2->getOperand(1)->getType()))
GEP2 = cast<User>(GEP2->getOperand(0));
const Value *BasePtr2 = GEP2->getOperand(0);
@@ -480,7 +478,7 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
for (unsigned i = 0; i != GEPOperands.size(); ++i)
if (!isa<ConstantInt>(GEPOperands[i]))
GEPOperands[i] =
- Context.getNullValue(GEPOperands[i]->getType());
+ Constant::getNullValue(GEPOperands[i]->getType());
int64_t Offset =
TD->getIndexedOffset(BasePtr->getType(),
&GEPOperands[0],
@@ -696,7 +694,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
// TargetData::getIndexedOffset.
for (i = 0; i != MaxOperands; ++i)
if (!isa<ConstantInt>(GEP1Ops[i]))
- GEP1Ops[i] = Context.getNullValue(GEP1Ops[i]->getType());
+ GEP1Ops[i] = Constant::getNullValue(GEP1Ops[i]->getType());
// Okay, now get the offset. This is the relative offset for the full
// instruction.
int64_t Offset1 = TD->getIndexedOffset(GEPPointerTy, GEP1Ops,
@@ -740,7 +738,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
const Type *ZeroIdxTy = GEPPointerTy;
for (unsigned i = 0; i != FirstConstantOper; ++i) {
if (!isa<StructType>(ZeroIdxTy))
- GEP1Ops[i] = GEP2Ops[i] = Context.getNullValue(Type::Int32Ty);
+ GEP1Ops[i] = GEP2Ops[i] = Constant::getNullValue(Type::Int32Ty);
if (const CompositeType *CT = dyn_cast<CompositeType>(ZeroIdxTy))
ZeroIdxTy = CT->getTypeAtIndex(GEP1Ops[i]);
@@ -755,7 +753,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
// If they are equal, use a zero index...
if (Op1 == Op2 && BasePtr1Ty == BasePtr2Ty) {
if (!isa<ConstantInt>(Op1))
- GEP1Ops[i] = GEP2Ops[i] = Context.getNullValue(Op1->getType());
+ GEP1Ops[i] = GEP2Ops[i] = Constant::getNullValue(Op1->getType());
// Otherwise, just keep the constants we have.
} else {
if (Op1) {
@@ -800,7 +798,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
return MayAlias; // Be conservative with out-of-range accesses
}
} else { // Conservatively assume the minimum value for this index
- GEP2Ops[i] = Context.getNullValue(Op2->getType());
+ GEP2Ops[i] = Constant::getNullValue(Op2->getType());
}
}
}
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 12ef017..57e7816 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -215,7 +215,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy,
SmallVector<Constant*, 32> Result;
if (NumDstElt < NumSrcElt) {
// Handle: bitcast (<4 x i32> <i32 0, i32 1, i32 2, i32 3> to <2 x i64>)
- Constant *Zero = Context.getNullValue(DstEltTy);
+ Constant *Zero = Constant::getNullValue(DstEltTy);
unsigned Ratio = NumSrcElt/NumDstElt;
unsigned SrcBitSize = SrcEltTy->getPrimitiveSizeInBits();
unsigned SrcElt = 0;
@@ -419,7 +419,7 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
if (ElemIdx.ult(APInt(ElemIdx.getBitWidth(),
AT->getNumElements()))) {
Constant *Index[] = {
- Context.getNullValue(CE->getType()),
+ Constant::getNullValue(CE->getType()),
ConstantInt::get(Context, ElemIdx)
};
return
@@ -486,7 +486,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate,
// proper extension or truncation.
Constant *C = ConstantExpr::getIntegerCast(CE0->getOperand(0),
IntPtrTy, false);
- Constant *NewOps[] = { C, Context.getNullValue(C->getType()) };
+ Constant *NewOps[] = { C, Constant::getNullValue(C->getType()) };
return ConstantFoldCompareInstOperands(Predicate, NewOps, 2,
Context, TD);
}
@@ -496,7 +496,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate,
if (CE0->getOpcode() == Instruction::PtrToInt &&
CE0->getType() == IntPtrTy) {
Constant *C = CE0->getOperand(0);
- Constant *NewOps[] = { C, Context.getNullValue(C->getType()) };
+ Constant *NewOps[] = { C, Constant::getNullValue(C->getType()) };
// FIXME!
return ConstantFoldCompareInstOperands(Predicate, NewOps, 2,
Context, TD);
@@ -543,7 +543,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate,
Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
ConstantExpr *CE,
LLVMContext &Context) {
- if (CE->getOperand(1) != Context.getNullValue(CE->getOperand(1)->getType()))
+ if (CE->getOperand(1) != Constant::getNullValue(CE->getOperand(1)->getType()))
return 0; // Do not allow stepping over the value!
// Loop over all of the operands, tracking down which value we are
@@ -558,7 +558,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C)) {
C = CS->getOperand(El);
} else if (isa<ConstantAggregateZero>(C)) {
- C = Context.getNullValue(STy->getElementType(El));
+ C = Constant::getNullValue(STy->getElementType(El));
} else if (isa<UndefValue>(C)) {
C = UndefValue::get(STy->getElementType(El));
} else {
@@ -571,7 +571,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
if (ConstantArray *CA = dyn_cast<ConstantArray>(C))
C = CA->getOperand(CI->getZExtValue());
else if (isa<ConstantAggregateZero>(C))
- C = Context.getNullValue(ATy->getElementType());
+ C = Constant::getNullValue(ATy->getElementType());
else if (isa<UndefValue>(C))
C = UndefValue::get(ATy->getElementType());
else
@@ -582,7 +582,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
if (ConstantVector *CP = dyn_cast<ConstantVector>(C))
C = CP->getOperand(CI->getZExtValue());
else if (isa<ConstantAggregateZero>(C))
- C = Context.getNullValue(PTy->getElementType());
+ C = Constant::getNullValue(PTy->getElementType());
else if (isa<UndefValue>(C))
C = UndefValue::get(PTy->getElementType());
else
@@ -741,7 +741,7 @@ llvm::ConstantFoldCall(Function *F,
if (V >= -0.0)
return ConstantFoldFP(sqrt, V, Ty, Context);
else // Undefined
- return Context.getNullValue(Ty);
+ return Constant::getNullValue(Ty);
}
break;
case 's':
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 5ecfdcd..1e29134 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -476,7 +476,7 @@ DIFactory::DIFactory(Module &m)
/// getCastToEmpty - Return this descriptor as a Constant* with type '{}*'.
/// This is only valid when the descriptor is non-null.
Constant *DIFactory::getCastToEmpty(DIDescriptor D) {
- if (D.isNull()) return VMContext.getNullValue(EmptyStructPtr);
+ if (D.isNull()) return llvm::Constant::getNullValue(EmptyStructPtr);
return ConstantExpr::getBitCast(D.getGV(), EmptyStructPtr);
}
@@ -576,7 +576,7 @@ DICompileUnit DIFactory::CreateCompileUnit(unsigned LangID,
unsigned RunTimeVer) {
Constant *Elts[] = {
GetTagConstant(dwarf::DW_TAG_compile_unit),
- VMContext.getNullValue(EmptyStructPtr),
+ llvm::Constant::getNullValue(EmptyStructPtr),
ConstantInt::get(Type::Int32Ty, LangID),
GetStringConstant(Filename),
GetStringConstant(Directory),
@@ -737,7 +737,7 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
Constant *Elts[] = {
GetTagConstant(dwarf::DW_TAG_subprogram),
- VMContext.getNullValue(EmptyStructPtr),
+ llvm::Constant::getNullValue(EmptyStructPtr),
getCastToEmpty(Context),
GetStringConstant(Name),
GetStringConstant(DisplayName),
@@ -769,7 +769,7 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
bool isDefinition, llvm::GlobalVariable *Val) {
Constant *Elts[] = {
GetTagConstant(dwarf::DW_TAG_variable),
- VMContext.getNullValue(EmptyStructPtr),
+ llvm::Constant::getNullValue(EmptyStructPtr),
getCastToEmpty(Context),
GetStringConstant(Name),
GetStringConstant(DisplayName),
diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp
index 84cde63..3c07d24 100644
--- a/lib/Analysis/IPA/Andersens.cpp
+++ b/lib/Analysis/IPA/Andersens.cpp
@@ -693,7 +693,7 @@ void Andersens::getMustAliases(Value *P, std::vector<Value*> &RetVals) {
// If the object in the points-to set is the null object, then the null
// pointer is a must alias.
if (Pointee == &GraphNodes[NullObject])
- RetVals.push_back(P->getContext().getNullValue(P->getType()));
+ RetVals.push_back(Constant::getNullValue(P->getType()));
}
}
AliasAnalysis::getMustAliases(P, RetVals);
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 8c4d191..03f3cd6 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2100,7 +2100,7 @@ const SCEV *ScalarEvolution::getNegativeSCEV(const SCEV *V) {
const Type *Ty = V->getType();
Ty = getEffectiveSCEVType(Ty);
return getMulExpr(V,
- getConstant(cast<ConstantInt>(getContext().getAllOnesValue(Ty))));
+ getConstant(cast<ConstantInt>(Constant::getAllOnesValue(Ty))));
}
/// getNotSCEV - Return a SCEV corresponding to ~V = -1-V
@@ -2112,7 +2112,7 @@ const SCEV *ScalarEvolution::getNotSCEV(const SCEV *V) {
const Type *Ty = V->getType();
Ty = getEffectiveSCEVType(Ty);
const SCEV *AllOnes =
- getConstant(cast<ConstantInt>(getContext().getAllOnesValue(Ty)));
+ getConstant(cast<ConstantInt>(Constant::getAllOnesValue(Ty)));
return getMinusSCEV(AllOnes, V);
}
@@ -3479,10 +3479,10 @@ GetAddressedElementFromGlobal(LLVMContext &Context, GlobalVariable *GV,
} else if (isa<ConstantAggregateZero>(Init)) {
if (const StructType *STy = dyn_cast<StructType>(Init->getType())) {
assert(Idx < STy->getNumElements() && "Bad struct index!");
- Init = Context.getNullValue(STy->getElementType(Idx));
+ Init = Constant::getNullValue(STy->getElementType(Idx));
} else if (const ArrayType *ATy = dyn_cast<ArrayType>(Init->getType())) {
if (Idx >= ATy->getNumElements()) return 0; // Bogus program
- Init = Context.getNullValue(ATy->getElementType());
+ Init = Constant::getNullValue(ATy->getElementType());
} else {
llvm_unreachable("Unknown constant aggregate type!");
}
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index b6c30fb..40bf0a1 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -285,7 +285,7 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin,
Ops = NewOps;
AnyNonZeroIndices |= !ScaledOps.empty();
Value *Scaled = ScaledOps.empty() ?
- getContext().getNullValue(Ty) :
+ Constant::getNullValue(Ty) :
expandCodeFor(SE.getAddExpr(ScaledOps), Ty);
GepIndices.push_back(Scaled);
@@ -401,7 +401,7 @@ Value *SCEVExpander::visitMulExpr(const SCEVMulExpr *S) {
// -1 * ... ---> 0 - ...
if (FirstOp == 1)
- V = InsertBinop(Instruction::Sub, getContext().getNullValue(Ty), V);
+ V = InsertBinop(Instruction::Sub, Constant::getNullValue(Ty), V);
return V;
}
@@ -523,7 +523,7 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
BasicBlock *Preheader = L->getLoopPreheader();
PHINode *PN = PHINode::Create(Ty, "indvar", Header->begin());
InsertedValues.insert(PN);
- PN->addIncoming(getContext().getNullValue(Ty), Preheader);
+ PN->addIncoming(Constant::getNullValue(Ty), Preheader);
pred_iterator HPI = pred_begin(Header);
assert(HPI != pred_end(Header) && "Loop with zero preds???");
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 70f11f4..0ed0bbd 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -917,7 +917,7 @@ Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin,
idx_begin,
idx_end));
else if (isa<ConstantAggregateZero>(V))
- return Context.getNullValue(ExtractValueInst::getIndexedType(PTy,
+ return Constant::getNullValue(ExtractValueInst::getIndexedType(PTy,
idx_begin,
idx_end));
else if (Constant *C = dyn_cast<Constant>(V)) {