[LLVMdev] Instructions that access memory @ the IR level

Eli Friedman eli.friedman at gmail.com
Tue Jul 5 12:49:12 PDT 2011


On Tue, Jul 5, 2011 at 11:47 AM, Griffin Wright <gwright215 at gmail.com> wrote:
> Hello,
>
> I'm working with a pass that operates at the LLVM IR level.  I need to run
> some statistics on instructions that access memory, and I'm wondering, at
> the IR level, which instructions aside from Load and Store access memory
>
> directly as a result of their operation?  I know on an ISA level, this
> varies from arch to arch, but I'm wondering how LLVM has this set up at the
> IR level.

If you're writing a pass, you probably want to use
Instruction::mayReadFromMemory() and Instruction::mayWriteToMemory().
If you need something more specific, you can also take a look at their
implementations (in lib/VMCore/Instruction.cpp).

-Eli



More information about the llvm-dev mailing list