[llvm-commits] [PATCH] JIT support for ARM

Chris Lattner clattner at apple.com
Fri Aug 17 12:05:04 PDT 2007


On Aug 17, 2007, at 12:02 PM, Evan Cheng wrote:

>  void *ARMJITInfo::emitFunctionStub(void *Fn, MachineCodeEmitter  
> &MCE) {
> -  unsigned addr = (intptr_t)Fn-MCE.getCurrentPCValue()-4;
> +  unsigned addr = (intptr_t)Fn;
>    // If this is just a call to an external function, emit a branch  
> instead of a
>    // call.  The code is the same except for one bit of the last  
> instruction.
>    if (Fn != (void*)(intptr_t)ARMCompilationCallback) {
> +    // branch to the corresponding function addr
> +    MCE.startFunctionStub(8, 4);
> +    MCE.emitWordLE(0xE51FF004); // LDR PC, [PC,#-4]
>
> This is ok.... But I would rather see you refactor  
> getBinaryCodeForInstr() so you can "manufacture" the value by  
> passing it ARM::LDR, ARM::PC, etc.? Do you think that's possible?

This probably isn't possible, because it would require creating a  
machineinstr to pass in.  Other JITs do similar things :(

-Chris




More information about the llvm-commits mailing list