[LLVMdev] Indirect branch instruction

Nicolas Geoffray nicolas.geoffray at lip6.fr
Mon Jan 15 11:32:41 PST 2007


Chris Lattner wrote:
> On Thu, 11 Jan 2007, Eric van Riet Paap wrote:
>
>   
>>> The switch instruction serves the same functional role.  In llvm- gcc, 
>>> the GCC "Address of label" and "indirect goto" extensions are compiled 
>>> into a switch instruction.
>>>       
>> I think the question is how to branch to a location of which you do not 
>> have a label.
>>     
>
> I'm not sure what you mean.  The compiler needs to have an accurate CFG to 
> be successful with dataflow analysis (i.e. not miscompile your code).
>
>   
It would be to the programer responsability that there are no "phis"
with an indirect branch. So there is no dataflow analysis needed in
such case.
>> Presumably to avoid a stack overflow when you know that 
>> you only want to return the result of an indirect call.
>>     
>
> It sounds like you just want tail call elimination?  Jumping to the 
> address of an indirect call is a great way to get a crash, except in the 
> most trivial cases.
>
>   
Again, it would be the programer responsabilty to not jump to an
invalid address. But maybe this is undesirable for llvm (and I would
understand, it's better to have a compiler that can certify most things
won't go wrong).
> -Chris
>
>   
Nicolas




More information about the llvm-dev mailing list