Zhang Qiuyu
2004-Sep-20 22:02 UTC
[LLVMdev] Re: How could I get memory address for each assemble code?
Thanks John and Chris. I could get the address information by the way you guys mentioned. But it is not what I want, because it will lose information about the entry of basic block. Actually what I want to get is the address of each entry of basic block. Now I am trying to declare the label of basic block as global type, hopefully I can get it from symbol table. Can I get it by this way? Thanks>For example,>llc -o file.s file.bc >gcc -o file.o file.s >objdump -d file.o>This would produce the list of native code instructions generated by >llc, including the addresses of the native code instructions.>Is this the sort of answer you're looking for?>Hi all,>I am trying to disassemble *.bc to assemble code by using llvm-dis command, but what I got is like the following. So how >could I get the assemble code like objdump? I mean the memory address for each instruction.>Thanks>Qiuyu-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040920/83de85e4/attachment.html>
Chris Lattner
2004-Sep-21 04:12 UTC
[LLVMdev] Re: How could I get memory address for each assemble code?
On Mon, 20 Sep 2004, Zhang Qiuyu wrote:> I could get the address information by the way you guys mentioned. But > it is not what I want, because it will lose information about the entry > of basic block. Actually what I want to get is the address of each entry > of basic block. Now I am trying to declare the label of basic block as > global type, hopefully I can get it from symbol table. Can I get it by > this way?I'm sure you could hack something, by emitting a global symbol like we do for functions, but really, what are you trying to do? There is probably a much better and more robust way to do it. If you tell us what you're trying to actually accomplish (what you need the addresses of BB's for), maybe we can make a useful suggestion. -Chris -- http://llvm.org/ http://nondot.org/sabre/
Andrew Lenharth
2004-Sep-21 15:18 UTC
[LLVMdev] Re: How could I get memory address for each assemble code?
This can be done with a quick hack. Just modify the assembly printer to emit a symbol that encodes the basic block uniquely. I have had to do something similar, and I take the function name (with full type information) and the label of the BB and hash them with crc32. This gives a unique int which you can use in a label (which you output) to uniquely identify the entry point of a basic block. There are problems if the hash is not unique or if there is not a 1-1 mapping of BB to machine BB or if a function is defined in multiple modules with the exact same type. Anyway, it's a start. Andrew On Mon, 2004-09-20 at 17:02, Zhang Qiuyu wrote:> > Thanks John and Chris. > > I could get the address information by the way you guys mentioned. But > it is not what I want, because it will lose information about the > entry of basic block. Actually what I want to get is the address of > each entry of basic block. Now I am trying to declare the label of > basic block as global type, hopefully I can get it from symbol table. > Can I get it by this way? > > Thanks > > >For example, > > >llc -o file.s file.bc > >gcc -o file.o file.s > >objdump -d file.o > > >This would produce the list of native code instructions generated by > >llc, including the addresses of the native code instructions. > > >Is this the sort of answer you're looking for? > > >Hi all, > > >I am trying to disassemble *.bc to assemble code by using llvm-dis > command, but what I got is like the following. So how >could I get the > assemble code like objdump? I mean the memory address for each > instruction. > > >Thanks > > >Qiuyu > > > > > ______________________________________________________________________ > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
Apparently Analagous Threads
- [LLVMdev] How could I get memory address for each assemble instruction?
- [LLVMdev] Re: Re: How could I get memory address for each assemble
- [LLVMdev] How could I get memory address for each basic block?
- [LLVMdev] How could I get memory address for each basic block?
- [LLVMdev] How could I get memory address for each basic block?