[LLVMdev] Indirect Branch Representation
Chris Lattner
clattner at apple.com
Wed Jul 23 23:47:49 PDT 2008
On Jul 23, 2008, at 8:47 PM, kapil anand wrote:
>
> Specifically, I need a way to represent indirect branch instruction
> (in binary) as an equivalent LLVM instruction. With switch
> instruction , I would have to list all the possible targets and then
> initialize the corresponding instruction. I was just thinking
> whether it might be possible to have some kind of indirect branch
> where label is a "variable" and not an explicit label present in
> module.
>
No, and there never will be a way. In the future, we will probably
extend the CFG to better model the GCC "address of label + indirect
goto" extension. However, even with that, all the possible
destinations of an indirect goto must be explicitly known.
Without knowing the CFG, the compiler cannot do any useful
optimization. Eli is right, you probably want lots of tail calls or
something.
-Chris
More information about the llvm-dev
mailing list