Memory Altering/Accessing Instructions

Hi all,

Would it be correct to say that the only instructions in LLVM IR that
modify/access memory potentially are the following:

(1) LoadInst : Ref
(2) StoreInst : Mod
(3) VAArgInst : Ref (?)
(4) AllocaInst : Mod
(5) MallocInst : Mod
(6) FreeInst : Mod
(7) CallInst : Mod/Ref ?

Also, my earlier impression was that the GEP instruction only computes
the effective address and does not modify/access any memory location.
Is that true ?
If I have missed other instructions that could alter/modify memory,
please let me know.

Thanks for your time.

- Prakash

Prakash Prabhu wrote:

Hi all,

Would it be correct to say that the only instructions in LLVM IR that
modify/access memory potentially are the following:
  

I believe that every instruction has a mayWriteToMemory()/mayReadToMemory() method that you can use to determine this information. See http://llvm.org/doxygen/classllvm_1_1Instruction.html (the LLVM doxygen info on llvm::Instruction) for more details. I believe these methods describe whether memory is read/written in a way visible from the LLVM IR; I don't believe they'll take into account things like read/writes due to register spills created by the code generator.

(1) LoadInst : Ref
(2) StoreInst : Mod
(3) VAArgInst : Ref (?)
(4) AllocaInst : Mod
(5) MallocInst : Mod
(6) FreeInst : Mod
(7) CallInst : Mod/Ref ?

Also, my earlier impression was that the GEP instruction only computes
the effective address and does not modify/access any memory location.
Is that true ?
  

This is correct.

If I have missed other instructions that could alter/modify memory,
please let me know.

Thanks for your time.
  

-- John T.

Hi John,

Thanks for the reply. I am planning to use this information as a part
of Analysis, so I guess it should be ok since it is before code
generation.

- Prakash