Anurag Chakraborty via llvm-dev
2019-Feb-26 16:32 UTC
[llvm-dev] LLVM pass to track memory usage by a program
Hi, I am trying to write an llvm pass, that detects whether any instruction is allocating,reading or writing to memory. If it is doing so, I extract the address of that memory location, and identify the next time, this memory location is again accessed. For this, I am iterating over the .ll IR file generated from the program, and using mayReadOrWriteMemory() to check whether any memory access is being made (for alloca instructions, I am just checking separately). If there is an access then, I iterate over the operand list using op_begin() and op_end() to get the memory address. But so far, I have been getting some ambiguous results. Is my approach wrong ? Could someone please help me out here. Thanks Anurag -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190226/adbd29df/attachment.html>
Alberto Barbaro via llvm-dev
2019-Feb-26 17:24 UTC
[llvm-dev] LLVM pass to track memory usage by a program
Hi Anurag, I assume you would like to have the moment traced at real-time during a real execution. Wouldn't better to rely on the Interpreter class and relying on the various visit methods? Thanks On Tue, Feb 26, 2019, 16:32 Anurag Chakraborty via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > I am trying to write an llvm pass, that detects whether any instruction is > allocating,reading or writing to memory. If it is doing so, I extract the > address of that memory location, and identify the next time, this memory > location is again accessed. > For this, I am iterating over the .ll IR file generated from the program, > and using mayReadOrWriteMemory() to check whether any memory access is > being made (for alloca instructions, I am just checking separately). If > there is an access then, I iterate over the operand list using op_begin() > and op_end() to get the memory address. But so far, I have been getting > some ambiguous results. Is my > approach wrong ? Could someone please help me out here. > Thanks > Anurag > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190226/ec46c94a/attachment.html>