Chris Lattner wrote:> I don't understand. You're making a claim that the C compiler
isn't
> producing optimal code for some case. Can you give an example of a C
> function that llvm compiles to something suboptimal? LLVM certainly does
> generate stuff like "jmp %eax", but presumably not in the way you
want.
> Without an example to see what you mean, we won't be able to fix the
> deficiency that you've encountered.
>
>
Sorry, I've been misunderstood. I'm claiming nothing. I'm just
assuming that when using a SwitchInst, the just in time compiler
generates two jumps, one to jump to the right case, and then one
to jump to the correct label.
Typically, I understood that, to make indirect branches, the
(pseudo-) code generated is:
label1:
instructions
label2:
instructions
label3:
instructions
my_value = @ of a label
switch(my_value)
{
case label1: jump label1
case label2: jump label2
case label3: jump label3
default: abort("invalid label")
}
What I was asking is : what is the assembly code generated by llvm for this
kind of code? My guess was 2 jumps. But it might be 1 jump, based on
the fact that llvm knows it switches on labels.
I hope it's clearer now.
Thanks Chris,
Nicolas> Thanks,
>
> -Chris
>
>