[LLVMdev] Clobbering llvm.eh.selector return

Duncan Sands baldrick at free.fr
Fri Feb 5 16:35:53 PST 2010


Hi Garrison,

> Funny I remember that code (DwarfEHPrepare), wondering at the time why it was doing this. Thanks for your response,
> as I can now stop trying figure out how I am introducing this error, and more importantly now will be able to go back to
> DwarfEHPrepare, and understand it better knowing one of its purposes. However the result of my tests indicates that
> the underlying register used by the exception/unwind (get/setGR(built in reg. index 1)), mechanism is shared for other uses.
> If this is true, what criteria is used to identify whether this register is going to be used. I can image future efforts directed toward
> changing or adding to the exception mechanism needing to know what to avoid before the passes that actually lower the graphs 
> into machine/assembly code have been executed.

it doesn't matter what else it is used for, since at the start of every landing
pad you can store the register to a stack variable (or, for bonus points, place
it in a virtual register), and replace each call to eh.exception with a load of
the stack variable.  It then doesn't matter if the register gets used for other
things too.  This is an essence what DwarfEHPrepare does for eh.exception.

Ciao,

Duncan.



More information about the llvm-dev mailing list