[PATCH] Move SPAdj logic from PEI into the targets (No functionality change.)

Michael Kuperstein michael.m.kuperstein at intel.com
Wed Jan 7 06:55:12 PST 2015


Hi rafael, rnk, t.p.northover,

The back-story here is that PEI tries to keep track of how much starting or ending a call sequence adjusts the stack pointer, so that it can resolve frame-index references.
Currently, it takes a very simplistic view of how SP adjustments are done - both FrameStartOpcode and FrameDestroyOpcode adjust it exactly by the amount written in its first argument.
This is in fact false for many targets (e.g. due to stack re-alignment, or because it may want to adjust the stack pointer in multiple steps). 

So why don't things break? Because most targets (the only in-tree exception I could find is 32-bit ARM) rely on being able to simplify the call frame pseudo-instructions earlier, so this code is never hit. This assumption is enforced by an "assert(SPAdj == 0 && "Unexpected")" in eliminateFrameIndex().

I want to start using it on x86 (to make the mov -> push transform work, http://reviews.llvm.org/D6789 will depend on this), and that means delegating the decision to the target, so that x86 can return the actual adjustment value.

http://reviews.llvm.org/D6863

Files:
  include/llvm/Target/TargetInstrInfo.h
  lib/CodeGen/PrologEpilogInserter.cpp
  lib/CodeGen/TargetInstrInfo.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6863.17856.patch
Type: text/x-patch
Size: 4771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150107/aa68662d/attachment.bin>


More information about the llvm-commits mailing list