[LLVMdev] Re:About the address of Basic Block

Zhang Qiuyu qiuyu at ee.ucla.edu
Fri Aug 20 15:01:57 PDT 2004


I really appreciated for you guys' help and thanks all you guys, Misha Brukman, Vikram S. Adve, Michael McCracken, Chris Lattner and Brian R. Gaeke .

I hope I can make it clear :-). I am trying ...

There is application i.e decoder.c . I compile it using llvm and get excutable file/object file ( named decoder.out/decoder.o  ) and decoder.s. And I wrote another code loader.c which is trying to find the entry of decoder.out, actually I guess it is the first basic block we need run. If I got the address of entry basic block, I want to copy the basic block in the decoder.out to a segment of memory, and the loader jump the start of the memory segment  and run the code. Then after running the entry basic block, the loader can load the next basic block and running it. keeping doing it. Of course, we know some of basic blocks can never be used. 

Actually, I want to simulate the procedure of excuting program by using my loader to excute it. And I can do some statistic and operation such as cache miss, basic block clustering, compress etc ( these are just my guess :). I know some tools like simplescalar can do lots stuff but it is not what I want.

So I am not sure how I could get the address of each basic block in decoder.out/decoder.o? and I am not sure it is available to implement what I want either? 

Originally  I browser the decoder.s file and see there is a label at the front of  basic block, so I thought maybe after compiling the decoder.s, I can use nm to exact the address from label information. But I failed :-(  (someone told me it is possible to get the address of memory if there is a label in your code). 

I am not sure it is clear or not. Any reply is welcome.

Thanks  




More information about the llvm-dev mailing list