[LLVMdev] indirectbr/blockaddress question

Eli Friedman eli.friedman at gmail.com
Sat Dec 11 19:13:09 PST 2010


On Sat, Dec 11, 2010 at 1:19 PM, Maurice Marks <maurice.marks at gmail.com> wrote:
> In my llvm jit project I needed to lookup BB addresses at execution time and
> then jump to the corresponding BB. A C++ routine called at runtime from IR
> finds the right BB, gets its BlockAddress and returns it as an i8*. The IR
> does an indirectbr on this value...
> Well, not really. The routine returns the address of a BlockAddress node. Is
> there any way to get the real runtime code address for the indirect jump at
> runtime?

If you're having trouble with the correctness of your program, don't
use indirectbr; the semantics are tricky and it's usually unnecessary.
 The only advantage over a "switch" instruction is a slight
performance boost for certain kinds of loops.

-Eli



More information about the llvm-dev mailing list