| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 1 | //===-- SystemZInstrInfo.h - SystemZ instruction information ----*- C++ -*-===// | 
|  | 2 | // | 
|  | 3 | //                     The LLVM Compiler Infrastructure | 
|  | 4 | // | 
|  | 5 | // This file is distributed under the University of Illinois Open Source | 
|  | 6 | // License. See LICENSE.TXT for details. | 
|  | 7 | // | 
|  | 8 | //===----------------------------------------------------------------------===// | 
|  | 9 | // | 
|  | 10 | // This file contains the SystemZ implementation of the TargetInstrInfo class. | 
|  | 11 | // | 
|  | 12 | //===----------------------------------------------------------------------===// | 
|  | 13 |  | 
| Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZINSTRINFO_H | 
|  | 15 | #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZINSTRINFO_H | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 16 |  | 
|  | 17 | #include "SystemZ.h" | 
|  | 18 | #include "SystemZRegisterInfo.h" | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/ArrayRef.h" | 
|  | 20 | #include "llvm/CodeGen/MachineBasicBlock.h" | 
|  | 21 | #include "llvm/CodeGen/MachineFunction.h" | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 22 | #include "llvm/Target/TargetInstrInfo.h" | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 23 | #include <cstdint> | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 24 |  | 
|  | 25 | #define GET_INSTRINFO_HEADER | 
|  | 26 | #include "SystemZGenInstrInfo.inc" | 
|  | 27 |  | 
|  | 28 | namespace llvm { | 
|  | 29 |  | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 30 | class SystemZSubtarget; | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 31 |  | 
|  | 32 | namespace SystemZII { | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 33 |  | 
| Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 34 | enum { | 
|  | 35 | // See comments in SystemZInstrFormats.td. | 
|  | 36 | SimpleBDXLoad          = (1 << 0), | 
|  | 37 | SimpleBDXStore         = (1 << 1), | 
|  | 38 | Has20BitOffset         = (1 << 2), | 
|  | 39 | HasIndex               = (1 << 3), | 
|  | 40 | Is128Bit               = (1 << 4), | 
|  | 41 | AccessSizeMask         = (31 << 5), | 
|  | 42 | AccessSizeShift        = 5, | 
|  | 43 | CCValuesMask           = (15 << 10), | 
|  | 44 | CCValuesShift          = 10, | 
|  | 45 | CompareZeroCCMaskMask  = (15 << 14), | 
|  | 46 | CompareZeroCCMaskShift = 14, | 
|  | 47 | CCMaskFirst            = (1 << 18), | 
|  | 48 | CCMaskLast             = (1 << 19), | 
|  | 49 | IsLogical              = (1 << 20) | 
|  | 50 | }; | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 51 |  | 
| Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 52 | static inline unsigned getAccessSize(unsigned int Flags) { | 
|  | 53 | return (Flags & AccessSizeMask) >> AccessSizeShift; | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 54 | } | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 55 |  | 
| Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 56 | static inline unsigned getCCValues(unsigned int Flags) { | 
|  | 57 | return (Flags & CCValuesMask) >> CCValuesShift; | 
|  | 58 | } | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 59 |  | 
| Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 60 | static inline unsigned getCompareZeroCCMask(unsigned int Flags) { | 
|  | 61 | return (Flags & CompareZeroCCMaskMask) >> CompareZeroCCMaskShift; | 
|  | 62 | } | 
|  | 63 |  | 
|  | 64 | // SystemZ MachineOperand target flags. | 
|  | 65 | enum { | 
|  | 66 | // Masks out the bits for the access model. | 
| Ulrich Weigand | 7db6918 | 2015-02-18 09:13:27 +0000 | [diff] [blame] | 67 | MO_SYMBOL_MODIFIER = (3 << 0), | 
| Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 68 |  | 
|  | 69 | // @GOT (aka @GOTENT) | 
| Ulrich Weigand | 7db6918 | 2015-02-18 09:13:27 +0000 | [diff] [blame] | 70 | MO_GOT = (1 << 0), | 
|  | 71 |  | 
|  | 72 | // @INDNTPOFF | 
|  | 73 | MO_INDNTPOFF = (2 << 0) | 
| Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 74 | }; | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 75 |  | 
| Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 76 | // Classifies a branch. | 
|  | 77 | enum BranchType { | 
|  | 78 | // An instruction that branches on the current value of CC. | 
|  | 79 | BranchNormal, | 
|  | 80 |  | 
|  | 81 | // An instruction that peforms a 32-bit signed comparison and branches | 
|  | 82 | // on the result. | 
|  | 83 | BranchC, | 
|  | 84 |  | 
|  | 85 | // An instruction that peforms a 32-bit unsigned comparison and branches | 
|  | 86 | // on the result. | 
|  | 87 | BranchCL, | 
|  | 88 |  | 
|  | 89 | // An instruction that peforms a 64-bit signed comparison and branches | 
|  | 90 | // on the result. | 
|  | 91 | BranchCG, | 
|  | 92 |  | 
|  | 93 | // An instruction that peforms a 64-bit unsigned comparison and branches | 
|  | 94 | // on the result. | 
|  | 95 | BranchCLG, | 
|  | 96 |  | 
|  | 97 | // An instruction that decrements a 32-bit register and branches if | 
|  | 98 | // the result is nonzero. | 
|  | 99 | BranchCT, | 
|  | 100 |  | 
|  | 101 | // An instruction that decrements a 64-bit register and branches if | 
|  | 102 | // the result is nonzero. | 
|  | 103 | BranchCTG | 
|  | 104 | }; | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 105 |  | 
| Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 106 | // Information about a branch instruction. | 
|  | 107 | struct Branch { | 
|  | 108 | // The type of the branch. | 
|  | 109 | BranchType Type; | 
|  | 110 |  | 
|  | 111 | // CCMASK_<N> is set if CC might be equal to N. | 
|  | 112 | unsigned CCValid; | 
|  | 113 |  | 
|  | 114 | // CCMASK_<N> is set if the branch should be taken when CC == N. | 
|  | 115 | unsigned CCMask; | 
|  | 116 |  | 
|  | 117 | // The target of the branch. | 
|  | 118 | const MachineOperand *Target; | 
|  | 119 |  | 
|  | 120 | Branch(BranchType type, unsigned ccValid, unsigned ccMask, | 
|  | 121 | const MachineOperand *target) | 
|  | 122 | : Type(type), CCValid(ccValid), CCMask(ccMask), Target(target) {} | 
|  | 123 | }; | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 124 |  | 
| Zhan Jun Liau | ab42cbc | 2016-06-10 19:58:10 +0000 | [diff] [blame] | 125 | // Kinds of fused compares in compare-and-* instructions.  Together with type | 
|  | 126 | // of the converted compare, this identifies the compare-and-* | 
| Ulrich Weigand | 2eb027d | 2016-04-07 16:11:44 +0000 | [diff] [blame] | 127 | // instruction. | 
| Zhan Jun Liau | ab42cbc | 2016-06-10 19:58:10 +0000 | [diff] [blame] | 128 | enum FusedCompareType { | 
| Ulrich Weigand | 2eb027d | 2016-04-07 16:11:44 +0000 | [diff] [blame] | 129 | // Relative branch - CRJ etc. | 
|  | 130 | CompareAndBranch, | 
|  | 131 |  | 
|  | 132 | // Indirect branch, used for return - CRBReturn etc. | 
| Ulrich Weigand | 848a513 | 2016-04-11 12:12:32 +0000 | [diff] [blame] | 133 | CompareAndReturn, | 
|  | 134 |  | 
|  | 135 | // Indirect branch, used for sibcall - CRBCall etc. | 
| Zhan Jun Liau | ab42cbc | 2016-06-10 19:58:10 +0000 | [diff] [blame] | 136 | CompareAndSibcall, | 
|  | 137 |  | 
|  | 138 | // Trap | 
|  | 139 | CompareAndTrap | 
| Ulrich Weigand | 2eb027d | 2016-04-07 16:11:44 +0000 | [diff] [blame] | 140 | }; | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 141 |  | 
| Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 142 | } // end namespace SystemZII | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 143 |  | 
|  | 144 | class SystemZInstrInfo : public SystemZGenInstrInfo { | 
|  | 145 | const SystemZRegisterInfo RI; | 
| Eric Christopher | 673b3af | 2014-06-27 07:01:17 +0000 | [diff] [blame] | 146 | SystemZSubtarget &STI; | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 147 |  | 
|  | 148 | void splitMove(MachineBasicBlock::iterator MI, unsigned NewOpcode) const; | 
|  | 149 | void splitAdjDynAlloc(MachineBasicBlock::iterator MI) const; | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 150 | void expandRIPseudo(MachineInstr &MI, unsigned LowOpcode, unsigned HighOpcode, | 
|  | 151 | bool ConvertHigh) const; | 
|  | 152 | void expandRIEPseudo(MachineInstr &MI, unsigned LowOpcode, | 
| Richard Sandiford | 42a694f | 2013-10-01 14:53:46 +0000 | [diff] [blame] | 153 | unsigned LowOpcodeK, unsigned HighOpcode) const; | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 154 | void expandRXYPseudo(MachineInstr &MI, unsigned LowOpcode, | 
| Richard Sandiford | 0755c93 | 2013-10-01 11:26:28 +0000 | [diff] [blame] | 155 | unsigned HighOpcode) const; | 
| Ulrich Weigand | 524f276 | 2016-11-28 13:34:08 +0000 | [diff] [blame] | 156 | void expandLOCPseudo(MachineInstr &MI, unsigned LowOpcode, | 
|  | 157 | unsigned HighOpcode) const; | 
|  | 158 | void expandLOCRPseudo(MachineInstr &MI, unsigned LowOpcode, | 
|  | 159 | unsigned HighOpcode) const; | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 160 | void expandZExtPseudo(MachineInstr &MI, unsigned LowOpcode, | 
| Richard Sandiford | 21235a2 | 2013-10-01 12:49:07 +0000 | [diff] [blame] | 161 | unsigned Size) const; | 
| Marcin Koscielnicki | aef3b5b | 2016-04-24 13:57:49 +0000 | [diff] [blame] | 162 | void expandLoadStackGuard(MachineInstr *MI) const; | 
| Richard Sandiford | 0755c93 | 2013-10-01 11:26:28 +0000 | [diff] [blame] | 163 | void emitGRX32Move(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, | 
| Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 164 | const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, | 
| Jonas Paulsson | a9bb00d | 2017-01-18 08:32:54 +0000 | [diff] [blame] | 165 | unsigned LowLowOpcode, unsigned Size, bool KillSrc, | 
|  | 166 | bool UndefSrc) const; | 
| Juergen Ributzka | d12ccbd | 2013-11-19 00:57:56 +0000 | [diff] [blame] | 167 | virtual void anchor(); | 
| Ulrich Weigand | 524f276 | 2016-11-28 13:34:08 +0000 | [diff] [blame] | 168 |  | 
|  | 169 | protected: | 
|  | 170 | /// Commutes the operands in the given instruction by changing the operands | 
|  | 171 | /// order and/or changing the instruction's opcode and/or the immediate value | 
|  | 172 | /// operand. | 
|  | 173 | /// | 
|  | 174 | /// The arguments 'CommuteOpIdx1' and 'CommuteOpIdx2' specify the operands | 
|  | 175 | /// to be commuted. | 
|  | 176 | /// | 
|  | 177 | /// Do not call this method for a non-commutable instruction or | 
|  | 178 | /// non-commutable operands. | 
|  | 179 | /// Even though the instruction is commutable, the method may still | 
|  | 180 | /// fail to commute the operands, null pointer is returned in such cases. | 
|  | 181 | MachineInstr *commuteInstructionImpl(MachineInstr &MI, bool NewMI, | 
|  | 182 | unsigned CommuteOpIdx1, | 
|  | 183 | unsigned CommuteOpIdx2) const override; | 
|  | 184 |  | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 185 | public: | 
| Eric Christopher | 673b3af | 2014-06-27 07:01:17 +0000 | [diff] [blame] | 186 | explicit SystemZInstrInfo(SystemZSubtarget &STI); | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 187 |  | 
|  | 188 | // Override TargetInstrInfo. | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 189 | unsigned isLoadFromStackSlot(const MachineInstr &MI, | 
| Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 190 | int &FrameIndex) const override; | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 191 | unsigned isStoreToStackSlot(const MachineInstr &MI, | 
| Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 192 | int &FrameIndex) const override; | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 193 | bool isStackSlotCopy(const MachineInstr &MI, int &DestFrameIndex, | 
| Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 194 | int &SrcFrameIndex) const override; | 
| Jacques Pienaar | 71c30a1 | 2016-07-15 14:41:04 +0000 | [diff] [blame] | 195 | bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, | 
| Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 196 | MachineBasicBlock *&FBB, | 
|  | 197 | SmallVectorImpl<MachineOperand> &Cond, | 
|  | 198 | bool AllowModify) const override; | 
| Matt Arsenault | 1b9fc8e | 2016-09-14 20:43:16 +0000 | [diff] [blame] | 199 | unsigned removeBranch(MachineBasicBlock &MBB, | 
| Matt Arsenault | a2b036e | 2016-09-14 17:23:48 +0000 | [diff] [blame] | 200 | int *BytesRemoved = nullptr) const override; | 
| Matt Arsenault | e8e0f5c | 2016-09-14 17:24:15 +0000 | [diff] [blame] | 201 | unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, | 
| Ahmed Bougacha | c88bf54 | 2015-06-11 19:30:37 +0000 | [diff] [blame] | 202 | MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond, | 
| Matt Arsenault | a2b036e | 2016-09-14 17:23:48 +0000 | [diff] [blame] | 203 | const DebugLoc &DL, | 
|  | 204 | int *BytesAdded = nullptr) const override; | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 205 | bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg, | 
| Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 206 | unsigned &SrcReg2, int &Mask, int &Value) const override; | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 207 | bool optimizeCompareInstr(MachineInstr &CmpInstr, unsigned SrcReg, | 
| Richard Sandiford | 564681c | 2013-08-12 10:28:10 +0000 | [diff] [blame] | 208 | unsigned SrcReg2, int Mask, int Value, | 
| Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 209 | const MachineRegisterInfo *MRI) const override; | 
| Ulrich Weigand | 524f276 | 2016-11-28 13:34:08 +0000 | [diff] [blame] | 210 | bool canInsertSelect(const MachineBasicBlock&, ArrayRef<MachineOperand> Cond, | 
|  | 211 | unsigned, unsigned, int&, int&, int&) const override; | 
|  | 212 | void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, | 
|  | 213 | const DebugLoc &DL, unsigned DstReg, | 
|  | 214 | ArrayRef<MachineOperand> Cond, unsigned TrueReg, | 
|  | 215 | unsigned FalseReg) const override; | 
|  | 216 | bool FoldImmediate(MachineInstr &UseMI, MachineInstr &DefMI, unsigned Reg, | 
|  | 217 | MachineRegisterInfo *MRI) const override; | 
| Krzysztof Parzyszek | cc31871 | 2017-03-03 18:30:54 +0000 | [diff] [blame^] | 218 | bool isPredicable(const MachineInstr &MI) const override; | 
| Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 219 | bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, | 
|  | 220 | unsigned ExtraPredCycles, | 
| Cong Hou | c536bd9 | 2015-09-10 23:10:42 +0000 | [diff] [blame] | 221 | BranchProbability Probability) const override; | 
| Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 222 | bool isProfitableToIfCvt(MachineBasicBlock &TMBB, | 
|  | 223 | unsigned NumCyclesT, unsigned ExtraPredCyclesT, | 
|  | 224 | MachineBasicBlock &FMBB, | 
|  | 225 | unsigned NumCyclesF, unsigned ExtraPredCyclesF, | 
| Cong Hou | c536bd9 | 2015-09-10 23:10:42 +0000 | [diff] [blame] | 226 | BranchProbability Probability) const override; | 
| Ulrich Weigand | 2eb027d | 2016-04-07 16:11:44 +0000 | [diff] [blame] | 227 | bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, | 
|  | 228 | BranchProbability Probability) const override; | 
| Duncan P. N. Exon Smith | 6307eb5 | 2016-02-23 02:46:52 +0000 | [diff] [blame] | 229 | bool PredicateInstruction(MachineInstr &MI, | 
| Ahmed Bougacha | c88bf54 | 2015-06-11 19:30:37 +0000 | [diff] [blame] | 230 | ArrayRef<MachineOperand> Pred) const override; | 
| Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 231 | void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, | 
| Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 232 | const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, | 
| Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 233 | bool KillSrc) const override; | 
|  | 234 | void storeRegToStackSlot(MachineBasicBlock &MBB, | 
|  | 235 | MachineBasicBlock::iterator MBBI, | 
|  | 236 | unsigned SrcReg, bool isKill, int FrameIndex, | 
|  | 237 | const TargetRegisterClass *RC, | 
|  | 238 | const TargetRegisterInfo *TRI) const override; | 
|  | 239 | void loadRegFromStackSlot(MachineBasicBlock &MBB, | 
|  | 240 | MachineBasicBlock::iterator MBBI, | 
|  | 241 | unsigned DestReg, int FrameIdx, | 
|  | 242 | const TargetRegisterClass *RC, | 
|  | 243 | const TargetRegisterInfo *TRI) const override; | 
|  | 244 | MachineInstr *convertToThreeAddress(MachineFunction::iterator &MFI, | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 245 | MachineInstr &MI, | 
| Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 246 | LiveVariables *LV) const override; | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 247 | MachineInstr * | 
|  | 248 | foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, | 
|  | 249 | ArrayRef<unsigned> Ops, | 
|  | 250 | MachineBasicBlock::iterator InsertPt, int FrameIndex, | 
|  | 251 | LiveIntervals *LIS = nullptr) const override; | 
|  | 252 | MachineInstr *foldMemoryOperandImpl( | 
|  | 253 | MachineFunction &MF, MachineInstr &MI, ArrayRef<unsigned> Ops, | 
|  | 254 | MachineBasicBlock::iterator InsertPt, MachineInstr &LoadMI, | 
|  | 255 | LiveIntervals *LIS = nullptr) const override; | 
|  | 256 | bool expandPostRAPseudo(MachineInstr &MBBI) const override; | 
| Matt Arsenault | 1b9fc8e | 2016-09-14 20:43:16 +0000 | [diff] [blame] | 257 | bool reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const | 
| Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 258 | override; | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 259 |  | 
|  | 260 | // Return the SystemZRegisterInfo, which this class owns. | 
|  | 261 | const SystemZRegisterInfo &getRegisterInfo() const { return RI; } | 
|  | 262 |  | 
| Richard Sandiford | 312425f | 2013-05-20 14:23:08 +0000 | [diff] [blame] | 263 | // Return the size in bytes of MI. | 
| Sjoerd Meijer | 0eb96ed | 2016-07-29 08:16:16 +0000 | [diff] [blame] | 264 | unsigned getInstSizeInBytes(const MachineInstr &MI) const override; | 
| Richard Sandiford | 312425f | 2013-05-20 14:23:08 +0000 | [diff] [blame] | 265 |  | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 266 | // Return true if MI is a conditional or unconditional branch. | 
|  | 267 | // When returning true, set Cond to the mask of condition-code | 
|  | 268 | // values on which the instruction will branch, and set Target | 
|  | 269 | // to the operand that contains the branch target.  This target | 
|  | 270 | // can be a register or a basic block. | 
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 271 | SystemZII::Branch getBranchInfo(const MachineInstr &MI) const; | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 272 |  | 
|  | 273 | // Get the load and store opcodes for a given register class. | 
|  | 274 | void getLoadStoreOpcodes(const TargetRegisterClass *RC, | 
|  | 275 | unsigned &LoadOpcode, unsigned &StoreOpcode) const; | 
|  | 276 |  | 
|  | 277 | // Opcode is the opcode of an instruction that has an address operand, | 
|  | 278 | // and the caller wants to perform that instruction's operation on an | 
|  | 279 | // address that has displacement Offset.  Return the opcode of a suitable | 
|  | 280 | // instruction (which might be Opcode itself) or 0 if no such instruction | 
|  | 281 | // exists. | 
|  | 282 | unsigned getOpcodeForOffset(unsigned Opcode, int64_t Offset) const; | 
|  | 283 |  | 
| Richard Sandiford | b49a3ab | 2013-08-05 11:03:20 +0000 | [diff] [blame] | 284 | // If Opcode is a load instruction that has a LOAD AND TEST form, | 
|  | 285 | // return the opcode for the testing form, otherwise return 0. | 
|  | 286 | unsigned getLoadAndTest(unsigned Opcode) const; | 
|  | 287 |  | 
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 288 | // Return true if ROTATE AND ... SELECTED BITS can be used to select bits | 
|  | 289 | // Mask of the R2 operand, given that only the low BitSize bits of Mask are | 
|  | 290 | // significant.  Set Start and End to the I3 and I4 operands if so. | 
|  | 291 | bool isRxSBGMask(uint64_t Mask, unsigned BitSize, | 
|  | 292 | unsigned &Start, unsigned &End) const; | 
|  | 293 |  | 
| Zhan Jun Liau | ab42cbc | 2016-06-10 19:58:10 +0000 | [diff] [blame] | 294 | // If Opcode is a COMPARE opcode for which an associated fused COMPARE AND * | 
|  | 295 | // operation exists, return the opcode for the latter, otherwise return 0. | 
| Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 296 | // MI, if nonnull, is the compare instruction. | 
| Zhan Jun Liau | ab42cbc | 2016-06-10 19:58:10 +0000 | [diff] [blame] | 297 | unsigned getFusedCompare(unsigned Opcode, | 
|  | 298 | SystemZII::FusedCompareType Type, | 
|  | 299 | const MachineInstr *MI = nullptr) const; | 
| Richard Sandiford | 0fb90ab | 2013-05-28 10:41:11 +0000 | [diff] [blame] | 300 |  | 
| Ulrich Weigand | 2d9e3d9 | 2016-11-28 13:59:22 +0000 | [diff] [blame] | 301 | // If Opcode is a LOAD opcode for with an associated LOAD AND TRAP | 
|  | 302 | // operation exists, returh the opcode for the latter, otherwise return 0. | 
|  | 303 | unsigned getLoadAndTrap(unsigned Opcode) const; | 
|  | 304 |  | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 305 | // Emit code before MBBI in MI to move immediate value Value into | 
|  | 306 | // physical register Reg. | 
|  | 307 | void loadImmediate(MachineBasicBlock &MBB, | 
|  | 308 | MachineBasicBlock::iterator MBBI, | 
|  | 309 | unsigned Reg, uint64_t Value) const; | 
| Jonas Paulsson | 8010b63 | 2016-10-20 08:27:16 +0000 | [diff] [blame] | 310 |  | 
|  | 311 | // Sometimes, it is possible for the target to tell, even without | 
|  | 312 | // aliasing information, that two MIs access different memory | 
|  | 313 | // addresses. This function returns true if two MIs access different | 
|  | 314 | // memory addresses and false otherwise. | 
|  | 315 | bool | 
|  | 316 | areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb, | 
|  | 317 | AliasAnalysis *AA = nullptr) const override; | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 318 | }; | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 319 |  | 
| Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 320 | } // end namespace llvm | 
|  | 321 |  | 
| Eugene Zelenko | 3943d2b | 2017-01-24 22:10:43 +0000 | [diff] [blame] | 322 | #endif // LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZINSTRINFO_H |