Since pointers are 32-bit on x32 we can use ebp and esp as frame and stack
pointer. Some operations like PUSH/POP and CFI_INSTRUCTION still
require 64-bit register, so using 64-bit MachineFramePtr where required.
Details
Diff Detail
Event Timeline
This area is actually one place where NaCl's 64-bit ABI differs from X32; i.e. NaCl considers the frame and stack pointers as 64 bits, but has special sequences to update them. For the purposes of this patch, instead of just e.g. using isLP64 everywhere in emitPrologue, could we just make the const at the top of be something like Uses64BitFramePtr and have that be the condition?
Splitting into FramePtr vs MachineFramePtr is fine.
Changed local vars names according last comments.
Updated test by adding nacl target case.
Also marked hasReservedSpillSlot as unreachable on X86.
Hi Pavel,
Sorry about the delay, we had a bit of a disruption.
I'll get you something more detailed soon but the short version is that I found that X86Subtarget::isTarget64BitLP64() returns true for NaCl when it should return false. So I was thinking about fixing that in a separate change, which would mean this change would be slightly different. does that seem reasonable?
lib/Target/X86/X86FrameLowering.cpp | ||
---|---|---|
453 | It looks like X86Subtarget::IsTarget64BitLP64 returns true for NaCl when it should return false. Would you mind fixing that, and then Uses64BitFramePtr would be STI.isTarget64BitLP64() || STI.isTargetNaCl64() |
OK, after taking a closer look, I had thought some other changes might be required but because of what we have upstream and downstream, we'll have to fix stuff on our end anyway. For the purposes of this change, can you change X86Subtarget::isTarget64BitLP64() to return false for NaCl (and then Uses64BitFramePtr would be STI.isTarget64BitLP64() || STI.isTargetNaCl64()), and then LGTM
It looks like X86Subtarget::IsTarget64BitLP64 returns true for NaCl when it should return false. Would you mind fixing that, and then Uses64BitFramePtr would be STI.isTarget64BitLP64() || STI.isTargetNaCl64()