diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2017-04-13 14:10:52 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2017-04-13 14:10:52 +0000 |
commit | 49acf9c8ebba8deada0d22524c0482848d5de486 (patch) | |
tree | 38056d09a32f30bd2cdf9f6f5ddbdf6c65631bb5 /llvm/lib/Target/X86/X86InstrInfo.cpp | |
parent | e32a66b2de3ce7dec25f32b46974880b9ce20875 (diff) | |
download | bcm5719-llvm-49acf9c8ebba8deada0d22524c0482848d5de486.tar.gz bcm5719-llvm-49acf9c8ebba8deada0d22524c0482848d5de486.zip |
Use methods to access data stored with frame instructions
Instructions CALLSEQ_START..CALLSEQ_END and their target dependent
counterparts keep data like frame size, stack adjustment etc. These
data are accessed by getOperand using hard coded indices. It is
error prone way. This change implements the access by special methods,
which improve readability and allow changing data representation without
massive changes of index values.
Differential Revision: https://reviews.llvm.org/D31953
llvm-svn: 300196
Diffstat (limited to 'llvm/lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86InstrInfo.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index 722fb12fadd..7b456fd6834 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -3616,18 +3616,13 @@ int X86InstrInfo::getSPAdjust(const MachineInstr &MI) const { const MachineFunction *MF = MI.getParent()->getParent(); const TargetFrameLowering *TFI = MF->getSubtarget().getFrameLowering(); - if (MI.getOpcode() == getCallFrameSetupOpcode() || - MI.getOpcode() == getCallFrameDestroyOpcode()) { + if (isFrameInstr(MI)) { unsigned StackAlign = TFI->getStackAlignment(); - int SPAdj = - (MI.getOperand(0).getImm() + StackAlign - 1) / StackAlign * StackAlign; - - SPAdj -= MI.getOperand(1).getImm(); - - if (MI.getOpcode() == getCallFrameSetupOpcode()) - return SPAdj; - else - return -SPAdj; + int SPAdj = alignTo(getFrameSize(MI), StackAlign); + SPAdj -= getFrameAdjustment(MI); + if (!isFrameSetup(MI)) + SPAdj = -SPAdj; + return SPAdj; } // To know whether a call adjusts the stack, we need information |