On Mon, 15 Jan 2007, Nicolas Geoffray wrote:>> statements, but I'm sure there are cases we miss. If so, please let us >> know, so we can add them to lib/Target/README.txt >> >> > Two jumps are executed when using a switch statement for indirect branch: > the first jump goes to the right switch case, the second jumps to the > corresponding > label. However, indirect branches need only one jump: jumping to the > value contained > in a register for example (which contains the address of a label).Can you give a compilable C function as an example? -Chris -- http://nondot.org/sabre/ http://llvm.org/
Chris Lattner wrote:>> Two jumps are executed when using a switch statement for indirect branch: >> the first jump goes to the right switch case, the second jumps to the >> corresponding >> label. However, indirect branches need only one jump: jumping to the >> value contained >> in a register for example (which contains the address of a label). >> > > Can you give a compilable C function as an example? > >Well I'm not sure on how to do this in C, but in x86 assembly a simple jmp %eax does it.> -Chris > >
On Tue, 16 Jan 2007, Nicolas Geoffray wrote:>> Can you give a compilable C function as an example? >> >> > Well I'm not sure on how to do this in C, but in x86 assembly a simple > jmp %eax does it.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. Thanks, -Chris -- http://nondot.org/sabre/ http://llvm.org/