search for: createcondbr

Displaying 7 results from an estimated 7 matches for "createcondbr".

2018 Sep 05
3
How to get return address at llvm ir level?
Hi I want to write a FunctionPass to insert some code before return. Funcion: .. .. .. mov eax,[esp] cmp eax,0x12345678 je 0x12345678 ret (maybe stack will not balance) I wonder that can I get the return address at llvm ir level? I use IRBuilder to CreateICmpEQ and CreateCondBr. but I don't how to get the value of return addrss. I have found there is a Intrinsic::returnaddress. Is Intrinsic::returnaddress can help me? I don't konw how to use Intrinsic::returnaddress because few files use this intrinsic. Thanks -------------- next part -------------- An HTML...
2011 Aug 31
2
[LLVMdev] How to place call(s) to functions found in other llvm modules ???
...uot;, gcd); BasicBlock* cond_true = BasicBlock::Create(Context, "cond_true", gcd); BasicBlock* cond_false_2 = BasicBlock::Create(Context, "cond_false", gcd); IRBuilder<> builder(entry); Value* xEqualsY = builder.CreateICmpEQ(x, y, "tmp"); builder.CreateCondBr(xEqualsY, ret, cond_false); builder.SetInsertPoint(ret); builder.CreateRet(x); builder.SetInsertPoint(cond_false); Value* xLessThanY = builder.CreateICmpULT(x, y, "tmp"); builder.CreateCondBr(xLessThanY, cond_true, cond_false_2); builder.SetInsertPoint(cond_true);...
2013 Nov 26
0
[LLVMdev] Help needed with a pass
...rue"), foo); const char* pPath; pPath = getenv("<SOME_ENV_VAR>"); Twine temp=new Twine("tmp"); IRBuilder<> builder(Entry); Value* envVarDoesntExist = builder.CreateICmpEQ(new StringRef(pPath),Constant::getNullValue(StringRef),temp); builder.CreateCondBr(envVarDoesntExist, False, True); builder.SetInsertPoint(True); builder.CreateCall3(strncpy_func,buf,new StringRef(pPath),29,temp); builder.SetInsertPoint(False); builder.CreateCall(printf_func,"Set <SOME_ENV_VAR>\n",temp); return mod;...
2012 Apr 05
0
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
...contains the blocks of code that should be executed in reverse-iterator order as the function is unwinding (either due to an exception being thrown or simply normally). The value of unwind_blks_[0] is the exit block that's created by: > builder.SetInsertPoint( exit_blk_ ); > builder.CreateCondBr( > // If we caught an exception ... > builder.CreateICmpNE( > builder.CreateLoad( exception_caught_flag_ ), > exception_not_thrown_state_ > ), > // ... then branch to the unwind-resume block > unwind_resume_blk, > // ... else branch to the...
2020 Feb 27
3
How to set DebugLoc when using IRBuilder's CreateCall ?
Hi I want to insert some functions into the llvm bitcode ir files. So I use IRBuilder and CreateCall(). But it how error : inlinable function call in a function with debug info must have a !dbg location. I don't know what DebugLoc should I give the new CallInst to setDebugLoc. I Create this CallInst , so this CallInst doesn't hava so-called "DebugLoc" mapping to the source
2012 Mar 23
2
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
On Mar 23, 2012, at 4:29 PM, Paul J. Lucas wrote: > On Mar 23, 2012, at 3:25 PM, Bill Wendling wrote: > >> Let's take your example. You will have code that looks like this: >> >> extern "C" void thunk_item_M_delete( void *v_that ) { >> item *that = 0; >> try { >> that = static_cast<item*>( v_that ); >>
2014 Mar 07
3
[LLVMdev] [RFC] Add second "failure" AtomicOrdering to cmpxchg instruction
...lue *old = Builder.CreateAtomicCmpXchg( + LV.getAddress(), atomicPHI, CGF.EmitToMemory(value, type), + llvm::SequentiallyConsistent, llvm::SequentiallyConsistent); atomicPHI->addIncoming(old, opBB); llvm::Value *success = Builder.CreateICmpEQ(old, atomicPHI); Builder.CreateCondBr(success, contBB, opBB); @@ -2077,8 +2078,9 @@ LValue ScalarExprEmitter::EmitCompoundAssignLValue( if (atomicPHI) { llvm::BasicBlock *opBB = Builder.GetInsertBlock(); llvm::BasicBlock *contBB = CGF.createBasicBlock("atomic_cont", CGF.CurFn); - llvm::Value *old = Builder.Cre...