[LLVMdev] 'Address of Label and Indirect Branches in LLVM IR' blog post
Dustin Laurence
dllaurence at dslextreme.com
Sun Jan 3 12:22:00 PST 2010
On 01/03/2010 12:33 AM, Chris Lattner wrote:
> If you're interested in this new extension, here is some more
> information with some less-than-obvious aspects of the design:
> http://blog.llvm.org/2010/01/address-of-label-and-indirect-branches.html
>
> This feature was added to LLVM by Bob Wilson, Dan Gohman and I to
> mainline back in November. If you have questions or comments about
> the post, this is a good thread to discuss them on :)
My only comment is that I tripped over inadvertent version skew with the
docs while tryin to code exactly the case discussed. I am building a
small lexer which I naturally wanted to implement with a jump table to
labels corresponding to automaton states, and when I couldn't get it to
work I finally fell back on the switch solution too. But it offends my
moral sensibilities. :-)
Since I'm a newcomer to LLVM I can't comment on the implementation of
the extension at all, but will make a wild guess that all the "creative"
uses of label addresses are going to be like the Linux case you
describe--it sounds like some sort of debugging hackery. If they
interfere with optimizations, perhaps you can support them only with
optimizations shut off (at least for that bit of code), or better just
tell the relevant optimizer stages to leave that code alone when weird
usages are detected. I for one wouldn't expect you to kill yourself so
my debugging code could be aggressively optimized.
Now that I've said that I'll no doubt think of some other use I *would*
like optimized. It would have to be pretty strange, though.
Dustin
More information about the llvm-dev
mailing list