[LLVMdev] pragmas

Torvald Riegel torvald at se.inf.tu-dresden.de
Wed Apr 1 07:25:23 PDT 2009

On Wednesday 25 March 2009, Luke Dalessandro wrote:
> You could encode this information as simple library function calls and
> then find them again in the generated LLVM IR. The client then just
> needs a header declaring the functions and information on what they
> mean. Since there are never any definitions of them they won't end up
> going anywhere.

I've been using this approach now for almost two years in a project and it 
_seems_ to work fine. However, I'd like to get some feedback from the experts 
on which kinds of code could be moved by the standard passes over the points 
in code marked by such calls.
For me, loads, stores, and calls to other functions are most interesting. Do 
the current optimization passes do that? (For example, by checking whether a 
global's address would escape to external entities like the dummy function 
that is the marker and allowing accesses to the global to be moved if it 
doesn't escape.)


More information about the llvm-dev mailing list