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?


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.


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.