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.> - Prakash > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
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 On Wed, Sep 24, 2008 at 4:57 PM, John Criswell <criswell at cs.uiuc.edu> wrote:> 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 >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >