OSDN Git Service

NFC; refactor getFrameIndexReferenceFromSP
authorSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 16 Jun 2016 18:54:06 +0000 (18:54 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 16 Jun 2016 18:54:06 +0000 (18:54 +0000)
commit394afc7ae2614fa2b73515002f8d1014caf1a0fd
tree2a6bce84340f32d2f7acc79d0a505f37dcf73678
parenta49d9c37771b62e2970273cfdf5dfc3c483b74dc
NFC; refactor getFrameIndexReferenceFromSP

Summary:
... into getFrameIndexReferencePreferSP.  This change folds the
fail-then-retry logic into getFrameIndexReferencePreferSP.

There is a non-functional but behaviorial change in WinException --
earlier if `getFrameIndexReferenceFromSP` failed we'd trip an assert,
but now we'll silently use the (wrong) offset from the base pointer.  I
could not write the assert I'd like to write ("FrameReg ==
StackRegister", like I've done in X86FrameLowering) since there is no
easy way to get to the stack register from WinException (happy to be
proven wrong here).  One solution to this is to add a `bool
OnlyStackPointer` parameter to `getFrameIndexReferenceFromSP` that
asserts if it could not satisfy its promise of returning an offset from
a stack pointer, but that seems overkill.

Reviewers: rnk

Subscribers: sanjoy, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272938 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetFrameLowering.h
lib/CodeGen/AsmPrinter/WinException.cpp
lib/CodeGen/PrologEpilogInserter.cpp
lib/Target/X86/X86FrameLowering.cpp
lib/Target/X86/X86FrameLowering.h