[LLVMdev] Memory Altering/Accessing Instructions

37 views
Skip to first unread message

Prakash Prabhu

unread,
Sep 24, 2008, 4:22:37 PM9/24/08
to LLVM Developers Mailing List
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
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

John Criswell

unread,
Sep 24, 2008, 4:57:38 PM9/24/08
to LLVM Developers Mailing List
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 Prabhu

unread,
Sep 25, 2008, 10:47:13 AM9/25/08
to LLVM Developers Mailing List
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

Reply all
Reply to author
Forward
0 new messages