Fernando Magno Quintao Pereira
2008-May-16 00:45 UTC
[LLVMdev] 64-bit to 32-bit conversion of pointers
Guys, I need advice in how to handle a problem. The problem: In X86_64, pointers are 64-bit variables, and are stored into 64-bit registers. However, some pointers are small enough that they can be represented as 32-bit values. Is there some way, in LLVM, to recognize which pointers can be stored into 32-bit registers, and so modify their class accordingly? Any ideas or hints would be appreciated. Best, Fernando
On Thu, May 15, 2008 at 5:45 PM, Fernando Magno Quintao Pereira <fernando at cs.ucla.edu> wrote:> > Guys, I need advice in how to handle a problem. > > The problem: > In X86_64, pointers are 64-bit variables, and are stored into 64-bit > registers. However, some pointers are small enough that they can be > represented as 32-bit values. > Is there some way, in LLVM, to recognize which pointers can be stored > into 32-bit registers, and so modify their class accordingly? Any ideas or > hints would be appreciated. >I don't think so. It really depends upon where the OS loads the program into memory, the virtual address space, etc. It's not something that the compiler itself is aware of. The only thing I can think of is forcing the OS to use the lower 32-bit address space for loading the program and creating ths stacks and heap space... -bw
I believe the Intel compiler (icc) has an option to use 32-bit pointers on a 64-bit machine like Itanium. So the programer effectively specifies that a 4GB address space is sufficient. We also have a research paper on this topic but the effectiveness depends heavily on the effectiveness of Automatic Pool Allocation and the underlying pointer analysis: http://llvm.org/pubs/2005-06-12-MSP-PointerComp.html Andrew Lenharth has a prototype of this but it has lots of limitations. --Vikram http://www.cs.uiuc.edu/~vadve http://llvm.org/ On May 15, 2008, at 8:06 PM, Bill Wendling wrote:> On Thu, May 15, 2008 at 5:45 PM, Fernando Magno Quintao Pereira > <fernando at cs.ucla.edu> wrote: >> >> Guys, I need advice in how to handle a problem. >> >> The problem: >> In X86_64, pointers are 64-bit variables, and are stored into 64- >> bit >> registers. However, some pointers are small enough that they can be >> represented as 32-bit values. >> Is there some way, in LLVM, to recognize which pointers can be >> stored >> into 32-bit registers, and so modify their class accordingly? Any >> ideas or >> hints would be appreciated. >> > I don't think so. It really depends upon where the OS loads the > program into memory, the virtual address space, etc. It's not > something that the compiler itself is aware of. The only thing I can > think of is forcing the OS to use the lower 32-bit address space for > loading the program and creating ths stacks and heap space... > > -bw > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev