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 | 0a5372ed3e8cda10d724feda3c1a1c998db05ca0 (patch) | |
tree | 89dc39f73d938c223b4e192bc6fd918490a60218 /tools | |
parent | f1db120d0494ec55d9265cea7dab22e80dcae10c (diff) | |
download | external_llvm-0a5372ed3e8cda10d724feda3c1a1c998db05ca0.zip external_llvm-0a5372ed3e8cda10d724feda3c1a1c998db05ca0.tar.gz external_llvm-0a5372ed3e8cda10d724feda3c1a1c998db05ca0.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 'tools')
-rw-r--r-- | tools/bugpoint/CrashDebugger.cpp | 3 | ||||
-rw-r--r-- | tools/bugpoint/ExtractFunction.cpp | 2 | ||||
-rw-r--r-- | tools/bugpoint/Miscompilation.cpp | 3 | ||||
-rw-r--r-- | tools/bugpoint/TestPasses.cpp | 2 | ||||
-rw-r--r-- | tools/lto/LTOModule.cpp | 2 |
5 files changed, 7 insertions, 5 deletions
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index 9697b34..3084857 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -299,7 +299,8 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) { if (isa<StructType>(BBTerm->getType())) BBTerm->replaceAllUsesWith(UndefValue::get(BBTerm->getType())); else if (BB->getTerminator()->getType() != Type::VoidTy) - BBTerm->replaceAllUsesWith(Constant::getNullValue(BBTerm->getType())); + BBTerm->replaceAllUsesWith( + BD.getContext().getNullValue(BBTerm->getType())); // Replace the old terminator instruction. BB->getInstList().pop_back(); diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index 6cd2d19..4498f98 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -74,7 +74,7 @@ Module *BugDriver::deleteInstructionFromProgram(const Instruction *I, if (isa<StructType>(TheInst->getType())) TheInst->replaceAllUsesWith(UndefValue::get(TheInst->getType())); else if (TheInst->getType() != Type::VoidTy) - TheInst->replaceAllUsesWith(Constant::getNullValue(TheInst->getType())); + TheInst->replaceAllUsesWith(Context.getNullValue(TheInst->getType())); // Remove the instruction from the program. TheInst->getParent()->getInstList().erase(TheInst); diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index 785abb9..5fffcc1 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -711,7 +711,8 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // sbyte* so it matches the signature of the resolver function. // GetElementPtr *funcName, ulong 0, ulong 0 - std::vector<Constant*> GEPargs(2,Constant::getNullValue(Type::Int32Ty)); + std::vector<Constant*> GEPargs(2, + BD.getContext().getNullValue(Type::Int32Ty)); Value *GEP = ConstantExpr::getGetElementPtr(funcName, &GEPargs[0], 2); std::vector<Value*> ResolverArgs; ResolverArgs.push_back(GEP); diff --git a/tools/bugpoint/TestPasses.cpp b/tools/bugpoint/TestPasses.cpp index 900bf63..2c5b3b2 100644 --- a/tools/bugpoint/TestPasses.cpp +++ b/tools/bugpoint/TestPasses.cpp @@ -60,7 +60,7 @@ namespace { for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I) if (CallInst *CI = dyn_cast<CallInst>(I)) { if (!CI->use_empty()) - CI->replaceAllUsesWith(Constant::getNullValue(CI->getType())); + CI->replaceAllUsesWith(Context->getNullValue(CI->getType())); CI->getParent()->getInstList().erase(CI); break; } diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index c4980d6..591547f 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -189,7 +189,7 @@ bool LTOModule::objcClassNameFromExpression(Constant* c, std::string& name) if (GlobalVariable* gvn = dyn_cast<GlobalVariable>(op)) { Constant* cn = gvn->getInitializer(); if (ConstantArray* ca = dyn_cast<ConstantArray>(cn)) { - if ( ca->isCString() ) { + if ( ca->isCString(getGlobalContext()) ) { name = ".objc_class_name_" + ca->getAsString(); return true; } |