Hello, I have a problem trying to create an inline asm that checks one condition and based on the result of the condition it should jump to one BasicBlock or to another. My question is: is this possible in LLVM, from the inline asm to jump out, to the LLVM code, and if it is, how can I pass the label to which the code should jump. I tried passing the address of the BasicBlocks, using blockaddress, but without success. Thank you in advance for your help. Alexandra -- View this message in context: http://old.nabble.com/How-to-..-jump-from-inline-asm-to-a-BasicBlock--tp27796645p27796645.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Jakob Stoklund Olesen
2010-Mar-05 18:24 UTC
[LLVMdev] How to .. jump from inline asm to a BasicBlock?
On Mar 5, 2010, at 9:10 AM, Xinfinity wrote:> > I have a problem trying to create an inline asm that checks one condition > and based on the result of the condition it should jump to one BasicBlock or > to another. My question is: is this possible in LLVM, from the inline asm to > jump out, to the LLVM code, and if it is, how can I pass the label to which > the code should jump.That is not possible in LLVM. Inline asm is expected to 'fall through' to the following code. /jakob
Chris Lattner
2010-Mar-05 18:24 UTC
[LLVMdev] How to .. jump from inline asm to a BasicBlock?
On Mar 5, 2010, at 9:10 AM, Xinfinity wrote:> > Hello, > > I have a problem trying to create an inline asm that checks one condition > and based on the result of the condition it should jump to one BasicBlock or > to another. My question is: is this possible in LLVM, from the inline asm to > jump out, to the LLVM code, and if it is, how can I pass the label to which > the code should jump. > > I tried passing the address of the BasicBlocks, using blockaddress, but > without success.Like GNU inline assembly, LLVM doesn't allow control flow into or out of inline asms. -Chris
Samuel Crow
2010-Mar-05 21:41 UTC
[LLVMdev] How to .. jump from inline asm to a BasicBlock?
Hello, The best workaround I can think of is an inline function that returns a boolean value for your comparison then uses an LLVM conditional branch. (Note: You may need to truncate the boolean to an i1 if you can't figure out how to return a single bit.) --Sam ----- Original Message ----> From: Xinfinity <xinfinity_a at yahoo.com> > To: llvmdev at cs.uiuc.edu > Sent: Fri, March 5, 2010 11:10:19 AM > Subject: [LLVMdev] How to .. jump from inline asm to a BasicBlock? > > > Hello, > > I have a problem trying to create an inline asm that checks one condition > and based on the result of the condition it should jump to one BasicBlock or > to another. My question is: is this possible in LLVM, from the inline asm to > jump out, to the LLVM code, and if it is, how can I pass the label to which > the code should jump. > > I tried passing the address of the BasicBlocks, using blockaddress, but > without success. > > Thank you in advance for your help. > Alexandra > > -- > View this message in context: > http://old.nabble.com/How-to-..-jump-from-inline-asm-to-a-BasicBlock--tp27796645p27796645.html > Sent from the LLVM - Dev mailing list archive at Nabble.com. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Possibly Parallel Threads
- [LLVMdev] goto in inline asm
- [LLVMdev] Specify dominator for BasicBlock to avoid "Instruction does not dominate all uses!"
- [LLVMdev] Values have no names when generating *.ll files in clang and llvm 2.8 ?
- [LLVMdev] Metadata for Argument, BasicBlock
- [LLVMdev] Separate loop condition and loop body