Chuck Zhao
2011-Jan-06 02:03 UTC
[LLVMdev] What are all the LLVM IRs that will write into memory?
LLVMers, I need to intercept all LLVM IR instructions that will write into memory and start to do analysis on these instructions. In addition to StoreInst, what are all other IRs that will write into memory? E.g. char * ptr = malloc(...); ///... //with use(s) of ptr later The LLVM IR for the above code would be: %0 = tail call noalias i8* @malloc(i32 137) nounwind ///... // use(s) of %0 LLVM's Language Reference has the instruction format for CallInst: <result> = [tail] call [cconv <http://llvm.org/docs/LangRef.html#callingconv>] [ret attrs <http://llvm.org/docs/LangRef.html#paramattrs>]<ty> [<fnty>*]<fnptrval>(<function args>) [fn attrs <http://llvm.org/docs/LangRef.html#fnattrs>] Does that mean any LLVM IR that has a valid result field will be able to store the result into memory? How about those temps allocated into registers via register allocation? Is there a way to tell such temps at compile time before RA? Thank you very much Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110105/b08d1d27/attachment.html>
Reid Kleckner
2011-Jan-06 02:16 UTC
[LLVMdev] What are all the LLVM IRs that will write into memory?
On Wed, Jan 5, 2011 at 7:03 PM, Chuck Zhao <czhao at eecg.toronto.edu> wrote:> LLVMers, > > I need to intercept all LLVM IR instructions that will write into memory and > start to do analysis on these instructions....> Does that mean any LLVM IR that has a valid result field will be able to > store the result into memory?Yes, if the value ends up getting spilled to the stack.> How about those temps allocated into registers via register allocation? > Is there a way to tell such temps at compile time before RA?No, I think you need to perform register allocation in order to know about writes to the stack. Are you doing a static analysis on the instructions or are you trying to instrument all memory stores? If so, Pin and DynamoRIO seem like better choices, unless you want to do a static instrumentation, in which case I don't know what the right tool would be. Reid
Chuck Zhao
2011-Jan-06 15:55 UTC
[LLVMdev] What are all the LLVM IRs that will write into memory?
On 1/5/2011 9:16 PM, Reid Kleckner wrote:> On Wed, Jan 5, 2011 at 7:03 PM, Chuck Zhao<czhao at eecg.toronto.edu> wrote: >> LLVMers, >> >> I need to intercept all LLVM IR instructions that will write into memory and >> start to do analysis on these instructions. > ... >> Does that mean any LLVM IR that has a valid result field will be able to >> store the result into memory? > Yes, if the value ends up getting spilled to the stack. > >> How about those temps allocated into registers via register allocation? >> Is there a way to tell such temps at compile time before RA? > No, I think you need to perform register allocation in order to know > about writes to the stack. >I am actually doing static analysis/optimizations before register allocation. I feel I understand it properly, I will have to intercept each and every of such instructions. Though some may end up being registered allocated, but there is no way to know which ones are in the optimization process before RA. It is safe to assume them all will end of in memory. Thank you very much, Reid, Chuck> Are you doing a static analysis on the instructions or are you trying > to instrument all memory stores? If so, Pin and DynamoRIO seem like > better choices, unless you want to do a static instrumentation, in > which case I don't know what the right tool would be. > > Reid > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Possibly Parallel Threads
- [LLVMdev] What are all the LLVM IRs that will write into memory?
- [LLVMdev] still failed to build the llbrowse on Debian5-32b-llvm2.8
- [LLVMdev] still failed to build the llbrowse on Debian5-32b-llvm2.8
- [LLVMdev] inline callsites whose function definitions are in different file?
- [LLVMdev] Clang + SAFECode Release Announcement