[LLVMdev] direct calls to inttoptr constants

Mike Stump mrs at apple.com
Tue Feb 10 14:03:16 PST 2009


On Feb 10, 2009, at 4:51 AM, Tobias wrote:
> I'm compiling code which contains indirect function calls
> via their absolute addresses, which are known/fixed at compile-time:

> call *%eax
>
> does anyone know a way to cause llc to call the address directly?
> hints where to start patching the codegen are also welcome.

lib/Target/X86/X86InstrInfo.td, search for call and CALL.  The problem  
is that the instruction only allows for 32-relative addresses.  The  
form:

   call *0x20

isn't always valid as a 32-bit relative address.  If you place that  
instruction at 1<<60, the destination is more than 1<<32 away.

If you want to say something about your model, say, all code is in the  
first 2bg, then, the instruction would be allowed.  Problem is, I  
suspect there isn't enough model support for this, or your not using it.



More information about the llvm-dev mailing list