Guys, I need advice in how to handle a 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...
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:
Transparent Pointer Compression for Linked Data Structures
Andrew Lenharth has a prototype of this but it has lots of limitations.