diff options
author | Cristian Cadar <c.cadar@imperial.ac.uk> | 2017-02-27 14:47:33 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-27 14:47:33 +0000 |
commit | bff9fb9277f890f2fd9b4acd3b9d5eed0e78f967 (patch) | |
tree | 29e23676c07a95e83c58b5bcb5f8fd4189efaf45 /lib/Module/Checks.cpp | |
parent | 1b67624c3a2fc1ca6f60d0a2b0f675d046dbba76 (diff) | |
parent | 4c8fabc7de30e17ef116b8f413f3a973c29cb56c (diff) | |
download | klee-bff9fb9277f890f2fd9b4acd3b9d5eed0e78f967.tar.gz |
Merge pull request #600 from jirislaby/no_global_context
llvm: stop using global context
Diffstat (limited to 'lib/Module/Checks.cpp')
-rw-r--r-- | lib/Module/Checks.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp index 7d9b7284..44b35e6e 100644 --- a/lib/Module/Checks.cpp +++ b/lib/Module/Checks.cpp @@ -53,6 +53,7 @@ char DivCheckPass::ID; bool DivCheckPass::runOnModule(Module &M) { Function *divZeroCheckFunction = 0; + LLVMContext &ctx = M.getContext(); bool moduleChanged = false; @@ -67,7 +68,7 @@ bool DivCheckPass::runOnModule(Module &M) { CastInst *denominator = CastInst::CreateIntegerCast(i->getOperand(1), - Type::getInt64Ty(getGlobalContext()), + Type::getInt64Ty(ctx), false, /* sign doesn't matter */ "int_cast_to_i64", i); @@ -75,8 +76,8 @@ bool DivCheckPass::runOnModule(Module &M) { // Lazily bind the function to avoid always importing it. if (!divZeroCheckFunction) { Constant *fc = M.getOrInsertFunction("klee_div_zero_check", - Type::getVoidTy(getGlobalContext()), - Type::getInt64Ty(getGlobalContext()), + Type::getVoidTy(ctx), + Type::getInt64Ty(ctx), NULL); divZeroCheckFunction = cast<Function>(fc); } @@ -100,6 +101,7 @@ char OvershiftCheckPass::ID; bool OvershiftCheckPass::runOnModule(Module &M) { Function *overshiftCheckFunction = 0; + LLVMContext &ctx = M.getContext(); bool moduleChanged = false; @@ -118,12 +120,13 @@ bool OvershiftCheckPass::runOnModule(Module &M) { // Determine bit width of first operand uint64_t bitWidth=i->getOperand(0)->getType()->getScalarSizeInBits(); - ConstantInt *bitWidthC = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),bitWidth,false); + ConstantInt *bitWidthC = ConstantInt::get(Type::getInt64Ty(ctx), + bitWidth, false); args.push_back(bitWidthC); CastInst *shift = CastInst::CreateIntegerCast(i->getOperand(1), - Type::getInt64Ty(getGlobalContext()), + Type::getInt64Ty(ctx), false, /* sign doesn't matter */ "int_cast_to_i64", i); @@ -133,9 +136,9 @@ bool OvershiftCheckPass::runOnModule(Module &M) { // Lazily bind the function to avoid always importing it. if (!overshiftCheckFunction) { Constant *fc = M.getOrInsertFunction("klee_overshift_check", - Type::getVoidTy(getGlobalContext()), - Type::getInt64Ty(getGlobalContext()), - Type::getInt64Ty(getGlobalContext()), + Type::getVoidTy(ctx), + Type::getInt64Ty(ctx), + Type::getInt64Ty(ctx), NULL); overshiftCheckFunction = cast<Function>(fc); } |