[PATCH] Add a jumptable attribute and support for creating jump-instruction tables

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed May 21 12:58:09 PDT 2014


> Oh wait. Another way of interpreting your suggestion is to make a list
> of GlobalAliases to replace and only do the replacement at the end,
> when there's actually a symbol to use. Yes, I think that could be made
> to work. I'll look into it.

No, the idea was to replace code that stores a function pointer into
code that stores a dummy global variable:

@jump_table_entry1 = global i8 0, section "llvm.metadata"
@func_pointer = global i8* null
define void @store_func_ptr() {
  store i8* @jump_table_entry1, i8** @func_pointer
  ret void
}

later in the pipeline you can turn @jump_table_entry1 into an actual
table entry. That is what I mean by "like llvm.used". It is not that
it is a list, just that is a fake variable that then gets converted to
something else. It would be nice to have a more explicit say to
represent those, but there is precedent for just using a global
variable in the llvm.metadata section.

Cheers,
Rafael



More information about the llvm-commits mailing list