diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2017-02-22 16:10:21 +0100 |
---|---|---|
committer | Jiri Slaby <jirislaby@gmail.com> | 2017-02-25 11:11:04 +0100 |
commit | 4c8fabc7de30e17ef116b8f413f3a973c29cb56c (patch) | |
tree | 29e23676c07a95e83c58b5bcb5f8fd4189efaf45 /lib/Module/IntrinsicCleaner.cpp | |
parent | 1b67624c3a2fc1ca6f60d0a2b0f675d046dbba76 (diff) | |
download | klee-4c8fabc7de30e17ef116b8f413f3a973c29cb56c.tar.gz |
llvm: stop using global context
It was marked as deprecated long time ago and finally removed in LLVM 3.9. Remove all uses of getGlobalContext and create our own context. Propagate it all over the code then. [v2] use ctx, not C as name Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'lib/Module/IntrinsicCleaner.cpp')
-rw-r--r-- | lib/Module/IntrinsicCleaner.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index 54582e69..3f7644af 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -70,6 +70,7 @@ bool IntrinsicCleanerPass::runOnModule(Module &M) { bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { bool dirty = false; bool block_split=false; + LLVMContext &ctx = M.getContext(); #if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1) unsigned WordSize = TargetData.getPointerSizeInBits() / 8; @@ -97,18 +98,18 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { Value *src = ii->getArgOperand(1); if (WordSize == 4) { - Type *i8pp = PointerType::getUnqual(PointerType::getUnqual(Type::getInt8Ty(getGlobalContext()))); + Type *i8pp = PointerType::getUnqual(PointerType::getUnqual(Type::getInt8Ty(ctx))); Value *castedDst = CastInst::CreatePointerCast(dst, i8pp, "vacopy.cast.dst", ii); Value *castedSrc = CastInst::CreatePointerCast(src, i8pp, "vacopy.cast.src", ii); Value *load = new LoadInst(castedSrc, "vacopy.read", ii); new StoreInst(load, castedDst, false, ii); } else { assert(WordSize == 8 && "Invalid word size!"); - Type *i64p = PointerType::getUnqual(Type::getInt64Ty(getGlobalContext())); + Type *i64p = PointerType::getUnqual(Type::getInt64Ty(ctx)); Value *pDst = CastInst::CreatePointerCast(dst, i64p, "vacopy.cast.dst", ii); Value *pSrc = CastInst::CreatePointerCast(src, i64p, "vacopy.cast.src", ii); Value *val = new LoadInst(pSrc, std::string(), ii); new StoreInst(val, pDst, ii); - Value *off = ConstantInt::get(Type::getInt64Ty(getGlobalContext()), 1); + Value *off = ConstantInt::get(Type::getInt64Ty(ctx), 1); pDst = GetElementPtrInst::Create(pDst, off, std::string(), ii); pSrc = GetElementPtrInst::Create(pSrc, off, std::string(), ii); val = new LoadInst(pSrc, std::string(), ii); new StoreInst(val, pDst, ii); @@ -223,12 +224,12 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { // a call of the abort() function. Function *F = cast<Function>( M.getOrInsertFunction( - "abort", Type::getVoidTy(getGlobalContext()), NULL)); + "abort", Type::getVoidTy(ctx), NULL)); F->setDoesNotReturn(); F->setDoesNotThrow(); CallInst::Create(F, Twine(), ii); - new UnreachableInst(getGlobalContext(), ii); + new UnreachableInst(ctx, ii); ii->eraseFromParent(); |