Move SPAdj logic from PEI into the targets (NFC)
authorMichael Kuperstein <michael.m.kuperstein@intel.com>
Thu, 8 Jan 2015 11:04:38 +0000 (11:04 +0000)
committerMichael Kuperstein <michael.m.kuperstein@intel.com>
Thu, 8 Jan 2015 11:04:38 +0000 (11:04 +0000)
commit1cea74978028ded2d980786d232288651db3ce97
tree38d8bdb8e70a1cbd283a14edf9753d2706d49949
parentcb964a5c58446a601a128e5823e39de07f30232a
Move SPAdj logic from PEI into the targets (NFC)

PEI tries to keep track of how much starting or ending a call sequence adjusts the stack pointer by, 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 view is in fact incorrect for some targets (e.g. due to stack re-alignment, or because it may want to adjust the stack pointer in multiple steps). However, that doesn't cause breakage, because most targets (the only in-tree exception appears to be 32-bit ARM) rely on being able to simplify the call frame pseudo-instructions earlier, so this code is never hit.

Moving the computation into TargetInstrInfo allows targets to override the way the adjustment is computed if they need to have a non-zero SPAdj.

Differential Revision: http://reviews.llvm.org/D6863

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225437 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetInstrInfo.h
lib/CodeGen/PrologEpilogInserter.cpp
lib/CodeGen/TargetInstrInfo.cpp