[LLVMdev] Indirect branch instruction

Chris Lattner sabre at nondot.org
Sat Jan 13 11:49:24 PST 2007


On Thu, 11 Jan 2007, Nicolas Geoffray wrote:
>> I think the question is how to branch to a location of which you do
>> not have a label.
>>
> Yes, that was the original question. But actually, for my purpose, 
> Chris' solution is functional enough. However, I looked into llvm-gcc 
> code and the switch instruction switches for all possible labels defined 
> in the method. Does LLVM is smart enough to realize that it switches on 
> the address of a label, therefore only has to generate a jmp in x86 or a 
> {mtctr, bctr} couple in powerpc?

I'm not sure what you mean.  We do reasonable optimization of switch 
statements, but I'm sure there are cases we miss.  If so, please let us 
know, so we can add them to lib/Target/README.txt

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list