indirectbr/blockaddress question

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?

Thanks for any advice.

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.


IIRC indirectbr isn't supported in the JIT:

Our first cut for implementing Python generators was to simply put a
switch in the entry block and number the re-entry points of the
generator. On exit, we update the next entrance to use.


Thanks very to all of you much for your advice. I think I can use a switch to do what I want, at least for now. I do like the idea of creating virtual entry points to a function with a switch. That solves a problem for us.