diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-13 04:09:18 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-13 04:09:18 +0000 |
commit | 15b3932454f2777376ac500eae3999139a2c1f2e (patch) | |
tree | 89dc39f73d938c223b4e192bc6fd918490a60218 /lib/Analysis | |
parent | 08ee8812e70ea01e8e91ef4e9522ca877106f81c (diff) | |
download | external_llvm-15b3932454f2777376ac500eae3999139a2c1f2e.zip external_llvm-15b3932454f2777376ac500eae3999139a2c1f2e.tar.gz external_llvm-15b3932454f2777376ac500eae3999139a2c1f2e.tar.bz2 |
Begin the painful process of tearing apart the rat'ss nest that is Constants.cpp and ConstantFold.cpp.
This involves temporarily hard wiring some parts to use the global context. This isn't ideal, but it's
the only way I could figure out to make this process vaguely incremental.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 2 | ||||
-rw-r--r-- | lib/Analysis/IPA/Andersens.cpp | 2 | ||||
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 11 |
3 files changed, 8 insertions, 7 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 491cc3f..437ff03 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -463,7 +463,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 Constant::getNullValue(EmptyStructPtr); + if (D.isNull()) return VMContext.getNullValue(EmptyStructPtr); return VMContext.getConstantExprBitCast(D.getGV(), EmptyStructPtr); } diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index 3f1dcb7..91aaf06 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(Constant::getNullValue(P->getType())); + RetVals.push_back(Context->getNullValue(P->getType())); } } AliasAnalysis::getMustAliases(P, RetVals); diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index a167792..fc7d286 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -2084,7 +2084,8 @@ const SCEV *ScalarEvolution::getIntegerSCEV(int Val, const Type *Ty) { /// const SCEV *ScalarEvolution::getNegativeSCEV(const SCEV *V) { if (const SCEVConstant *VC = dyn_cast<SCEVConstant>(V)) - return getConstant(cast<ConstantInt>(ConstantExpr::getNeg(VC->getValue()))); + return getConstant( + cast<ConstantInt>(Context->getConstantExprNeg(VC->getValue()))); const Type *Ty = V->getType(); Ty = getEffectiveSCEVType(Ty); @@ -3284,7 +3285,7 @@ EvaluateConstantChrecAtConstant(const SCEVAddRecExpr *AddRec, ConstantInt *C, /// the addressed element of the initializer or null if the index expression is /// invalid. static Constant * -GetAddressedElementFromGlobal(GlobalVariable *GV, +GetAddressedElementFromGlobal(LLVMContext *Context, GlobalVariable *GV, const std::vector<ConstantInt*> &Indices) { Constant *Init = GV->getInitializer(); for (unsigned i = 0, e = Indices.size(); i != e; ++i) { @@ -3298,10 +3299,10 @@ GetAddressedElementFromGlobal(GlobalVariable *GV, } else if (isa<ConstantAggregateZero>(Init)) { if (const StructType *STy = dyn_cast<StructType>(Init->getType())) { assert(Idx < STy->getNumElements() && "Bad struct index!"); - Init = Constant::getNullValue(STy->getElementType(Idx)); + Init = Context->getNullValue(STy->getElementType(Idx)); } else if (const ArrayType *ATy = dyn_cast<ArrayType>(Init->getType())) { if (Idx >= ATy->getNumElements()) return 0; // Bogus program - Init = Constant::getNullValue(ATy->getElementType()); + Init = Context->getNullValue(ATy->getElementType()); } else { LLVM_UNREACHABLE("Unknown constant aggregate type!"); } @@ -3372,7 +3373,7 @@ ScalarEvolution::ComputeLoadConstantCompareBackedgeTakenCount( // Form the GEP offset. Indexes[VarIdxNum] = Val; - Constant *Result = GetAddressedElementFromGlobal(GV, Indexes); + Constant *Result = GetAddressedElementFromGlobal(Context, GV, Indexes); if (Result == 0) break; // Cannot compute! // Evaluate the condition for this iteration. |