[LLVMdev] Memory Altering/Accessing Instructions

John Criswell criswell at cs.uiuc.edu
Wed Sep 24 13:57:38 PDT 2008


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.
> - Prakash
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>   




More information about the llvm-dev mailing list