[LLVMdev] Address of label

Anton Korobeynikov asl at math.spbu.ru
Wed Jun 13 08:17:52 PDT 2007


Hello, Mikael.

> 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.
Right.

> 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? 
As it seems to me, no (I can be mistaken, though).

> 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 ?
Your switch is too small to emit jump table. LLVM uses some heuristics
in order to emit switches in more-or-less optimal way. The lower number
of cases for jumptable emission is 5. If you'll add one more switch case
to your example, you'll see the jump table emitted.

-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.





More information about the llvm-dev mailing list