[LLVMdev] minimum function ir

Reed Kotler rkotler at mips.com
Mon Apr 22 17:46:14 PDT 2013


On 04/22/2013 08:24 AM, Joe Groff wrote:
> On Mon, Apr 22, 2013 at 8:09 AM, Pete Couperus <pjcoup at gmail.com
> <mailto:pjcoup at gmail.com>> wrote:
>
>     Hello Reed,
>
>     Basic blocks need to end with a terminator instruction.
>     There is an "unreachable" terminator instruction, whose
>     documentation says:
>     "the presence of this instruction indicates some higher level
>     knowledge that the end of the block cannot be reached."
>     (see include/llvm/IR/Instructions.h).
>     I've been able to suppress the return using this.  I'm not
>     completely clear if this would be the right use for your scenario.
>
>
> This is the right thing to do. If your inline assembly always transfers
> code out of the block, then the end of the block is indeed unreachable.
> You do need to ensure that the asm expression has the "sideeffect"
> attribute so that it doesn't get optimized away.
>
> -Joe
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
Cool. That worked for me.

So I think that clang should replace "return instruction" with 
"unreachable instruction" if the "naked" attribute is present.

The only issue here is that targets need to declare whether they support 
"naked".




More information about the llvm-dev mailing list