[LLVMdev] Being able to know the jitted code-size before emitting

Evan Cheng evan.cheng at apple.com
Fri Apr 4 13:15:23 PDT 2008


Intra-function branches are resolved by branch shortening pass. If a  
call destination it too far away, then JIT will emit function stub to  
facilitate it. This means codegen has already determined the  
instructions that will be emitted so it's possible to determine the  
length of each instruction.

Evan

On Apr 4, 2008, at 1:07 PM, Chris Lattner wrote:

> On Fri, 4 Apr 2008, Jonathan S. Shapiro wrote:
>> Evan: please explain how span-dependent branches are resolved in your
>> method. You don't need to compute the bits that will be emitted,  
>> but you
>> do need to compute the length of those bits. In most real
>> implementations, the two steps are therefore inseparable.
>
> I think the important point here is that llvm explicitly represent  
> short
> and long branches as two different instructions.  We don't leave it  
> up to
> the assembler to determine whether a short or long branch is to be  
> used.
> The PPC and ARM backend have branch shortening passes to know what  
> sort of
> branch to us, for example.
>
> -Chris
>
> -- 
> http://nondot.org/sabre/
> http://llvm.org/
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list