diff options
| author | czhengsz <czhengsz@cn.ibm.com> | 2019-10-25 04:13:30 -0400 |
|---|---|---|
| committer | czhengsz <czhengsz@cn.ibm.com> | 2019-10-25 04:13:30 -0400 |
| commit | 822059147bf2870d88321824d41c92abb1f671d1 (patch) | |
| tree | 83461863c01b11ed1bac1c23a3d35abecfff3f63 /llvm/lib/Target/PowerPC/PPCInstrInfo.h | |
| parent | a6712889f5f1702dfa535718abe400d1a83174c5 (diff) | |
| download | bcm5719-llvm-822059147bf2870d88321824d41c92abb1f671d1.tar.gz bcm5719-llvm-822059147bf2870d88321824d41c92abb1f671d1.zip | |
[PowerPC] [Peephole] fold frame offset by using index form to save add.
renamable $x6 = ADDI8 $x1, -80 ;;; 0 is replaced with -80
renamable $x6 = ADD8 killed renamable $x6, renamable $x5
STW killed renamable $r3, 4, killed renamable $x6 :: (store 4 into %ir.14, !tbaa !2)
After PEI there is a peephole opt opportunity to combine above -80 in ADDI8 with 4 in the STW to eliminate unnecessary ADD8.
Expected result:
renamable $x6 = ADDI8 $x1, -76
STWX killed renamable $r3, renamable $x5, killed renamable $x6 :: (store 4 into %ir.6, !tbaa !2)
Reviewed by: stefanp
Differential Revision: https://reviews.llvm.org/D66329
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCInstrInfo.h')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrInfo.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.h b/llvm/lib/Target/PowerPC/PPCInstrInfo.h index 19ab30cb090..d76809027f8 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.h +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.h @@ -422,6 +422,16 @@ public: bool convertToImmediateForm(MachineInstr &MI, MachineInstr **KilledDef = nullptr) const; + bool foldFrameOffset(MachineInstr &MI) const; + bool isADDIInstrEligibleForFolding(MachineInstr &ADDIMI, int64_t &Imm) const; + bool isADDInstrEligibleForFolding(MachineInstr &ADDMI) const; + bool isImmInstrEligibleForFolding(MachineInstr &MI, unsigned &BaseReg, + unsigned &XFormOpcode, + int64_t &OffsetOfImmInstr, + ImmInstrInfo &III) const; + bool isValidToBeChangedReg(MachineInstr *ADDMI, unsigned Index, + MachineInstr *&ADDIMI, int64_t &OffsetAddi, + int64_t OffsetImm) const; /// Fixup killed/dead flag for register \p RegNo between instructions [\p /// StartMI, \p EndMI]. Some PostRA transformations may violate register |

