What are all the LLVM IRs that will write into memory?

LLVMers,

I need to intercept all LLVM IR instructions that will write into memory and start to do analysis on these instructions.

In addition to StoreInst, what are all other IRs that will write into memory?

E.g.
char * ptr = malloc(…);
///…
//with use(s) of ptr later

The LLVM IR for the above code would be:

  %0 = tail call noalias i8* @malloc(i32 137) nounwind

///…
// use(s) of %0

LLVM’s Language Reference has the instruction format for CallInst:

 <result> = [tail] call [[cconv](http://llvm.org/docs/LangRef.html#callingconv)] [[ret attrs](http://llvm.org/docs/LangRef.html#paramattrs)] <ty> [<fnty>*] <fnptrval>(<function args>) [[fn attrs](http://llvm.org/docs/LangRef.html#fnattrs)]

Does that mean any LLVM IR that has a valid result field will be able to store the result into memory?

How about those temps allocated into registers via register allocation?
Is there a way to tell such temps at compile time before RA?

Thank you very much

Chuck

LLVMers,

I need to intercept all LLVM IR instructions that will write into memory and
start to do analysis on these instructions.

...

Does that mean any LLVM IR that has a valid result field will be able to
store the result into memory?

Yes, if the value ends up getting spilled to the stack.

How about those temps allocated into registers via register allocation?
Is there a way to tell such temps at compile time before RA?

No, I think you need to perform register allocation in order to know
about writes to the stack.

Are you doing a static analysis on the instructions or are you trying
to instrument all memory stores? If so, Pin and DynamoRIO seem like
better choices, unless you want to do a static instrumentation, in
which case I don't know what the right tool would be.

Reid

LLVMers,

I need to intercept all LLVM IR instructions that will write into memory and
start to do analysis on these instructions.

...

Does that mean any LLVM IR that has a valid result field will be able to
store the result into memory?

Yes, if the value ends up getting spilled to the stack.

How about those temps allocated into registers via register allocation?
Is there a way to tell such temps at compile time before RA?

No, I think you need to perform register allocation in order to know
about writes to the stack.

I am actually doing static analysis/optimizations before register allocation.
I feel I understand it properly, I will have to intercept each and every of such instructions.
Though some may end up being registered allocated, but there is no way to know which ones are in the optimization process before RA.
It is safe to assume them all will end of in memory.

Thank you very much, Reid,

Chuck