[LLVMdev] Question about jumptable and indirect function call.

Tim Northover t.p.northover at gmail.com
Mon Oct 6 08:36:42 PDT 2014


Hi,

On 5 October 2014 13:47, XiaoGuang Wang <xjtuwxg at gmail.com> wrote:
> So what's going on with my test. Is there something I did wrong with
> jumptable options? Or is the jumptable tried to address other problem, not
> indirect call?

I think LLVM's jump table pass requires explicit function annotations
in the IR for functions that should go via the table, which Clang
doesn't create. Something like this in its simplest form:

define void @foo() unnamed_addr jumptable {
  ret void
}

define void @main() {
  %var = alloca void()*
  store void()* @foo, void()** %var
  %func = load void()** %var
  call void %func()
  ret void
}

Cheers.

Tim.



More information about the llvm-dev mailing list