[LLVMdev] Forcing order of execution

Sarah Thompson thompson at email.arc.nasa.gov
Thu Aug 2 13:55:25 PDT 2007


Hi all,

I'm currently writing a pass that inserts memory tracing calls before
and after store instructions. I need to make sure that these calls, and
the instruction itself, are executed strictly in order, such that no
later stage optimisations reorder the operations. Do I need to do
anything special to make this happen, or will simply having the write
address referenced by both calls and the store be sufficient to prevent
weirdness? Do I need to split the basic block? Is there an easier way to
do it (e.g. an explicit-ordering intrinsic or some such?) I am
bitcasting the pointer from its original type (whatever that may be) to
a sbyte* for the calls (but, for obvious reasons, not the store). My
assumption is that using the pointer in all three cases should result in
strict ordering because program semantics might be affected otherwise.
The tracing functions are external and never inlined, by the way  (they
actually exist outside the JIT environment).

Thanks,
Sarah

PS: Forgive me for asking something that can be verified through
just-trying-it-and-seeing, but this ordering is extremely critical, so I
thought it best to ask rather than guess.




More information about the llvm-dev mailing list