Address of label


I search information in order to access address (i.e. value) of label directly in llvm assembler file.

This can be useful to realize jump table from address, etc.

I generate the file branch.ll from a C file.

In this file, we saw that branches are realized by affecting virtually an id to each label and use a switch in order to find the right target.

I want to know if there is another way to do this, for instance, by accessing the address of label and to branch directly to it?

In order to optimize the program (to decrease the cost of branch dispatch), I use the following command line:

llvmc –O5 –o branch_opt branch.bc

llc –march=arm –mcpu=arm1136j-s –mattr=+v6 –f –o branch_opt.s branch_opt.bc

In the optimized program (branch_opt.arm), I saw that all branches are not suppressed.

I want to know, if it is possible to suppress the remaining useless branches? if yes, how ?

Thanks in advance.


branch.ll (2.67 KB)

branch_opt.arm (809 Bytes)

This question needs an FAQ. This is the fourth time I've seen this question asked on llvm-dev. Could someone in-the-know write a succinct FAQ on this topic and add it to the documentation (similarly to the one I did for GEP)? I think that would help answer these kinds of questions in the future.

Mikael: sorry, I don't have the answer, but I'm sure someone will (again!) answer this question :slight_smile:


Peltier, Mikael wrote: