LLVM  5.0.0
AArch64InstrInfo.h
Go to the documentation of this file.
1 //===- AArch64InstrInfo.h - AArch64 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 AArch64 implementation of the TargetInstrInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64INSTRINFO_H
15 #define LLVM_LIB_TARGET_AARCH64_AARCH64INSTRINFO_H
16 
17 #include "AArch64.h"
18 #include "AArch64RegisterInfo.h"
21 
22 #define GET_INSTRINFO_HEADER
23 #include "AArch64GenInstrInfo.inc"
24 
25 namespace llvm {
26 
27 class AArch64Subtarget;
28 class AArch64TargetMachine;
29 
34 
35 #define FALKOR_STRIDED_ACCESS_MD "falkor.strided.access"
36 
37 class AArch64InstrInfo final : public AArch64GenInstrInfo {
38  const AArch64RegisterInfo RI;
39  const AArch64Subtarget &Subtarget;
40 
41 public:
42  explicit AArch64InstrInfo(const AArch64Subtarget &STI);
43 
44  /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
45  /// such, whenever a client has an instance of instruction info, it should
46  /// always be able to get register info as well (through this method).
47  const AArch64RegisterInfo &getRegisterInfo() const { return RI; }
48 
49  unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
50 
51  bool isAsCheapAsAMove(const MachineInstr &MI) const override;
52 
53  bool isCoalescableExtInstr(const MachineInstr &MI, unsigned &SrcReg,
54  unsigned &DstReg, unsigned &SubIdx) const override;
55 
56  bool
58  AliasAnalysis *AA = nullptr) const override;
59 
60  unsigned isLoadFromStackSlot(const MachineInstr &MI,
61  int &FrameIndex) const override;
62  unsigned isStoreToStackSlot(const MachineInstr &MI,
63  int &FrameIndex) const override;
64 
65  /// Returns true if there is a shiftable register and that the shift value
66  /// is non-zero.
67  bool hasShiftedReg(const MachineInstr &MI) const;
68 
69  /// Returns true if there is an extendable register and that the extending
70  /// value is non-zero.
71  bool hasExtendedReg(const MachineInstr &MI) const;
72 
73  /// \brief Does this instruction set its full destination register to zero?
74  bool isGPRZero(const MachineInstr &MI) const;
75 
76  /// \brief Does this instruction rename a GPR without modifying bits?
77  bool isGPRCopy(const MachineInstr &MI) const;
78 
79  /// \brief Does this instruction rename an FPR without modifying bits?
80  bool isFPRCopy(const MachineInstr &MI) const;
81 
82  /// Return true if this is load/store scales or extends its register offset.
83  /// This refers to scaling a dynamic index as opposed to scaled immediates.
84  /// MI should be a memory op that allows scaled addressing.
85  bool isScaledAddr(const MachineInstr &MI) const;
86 
87  /// Return true if pairing the given load or store is hinted to be
88  /// unprofitable.
89  bool isLdStPairSuppressed(const MachineInstr &MI) const;
90 
91  /// Return true if the given load or store is a strided memory access.
92  bool isStridedAccess(const MachineInstr &MI) const;
93 
94  /// Return true if this is an unscaled load/store.
95  bool isUnscaledLdSt(unsigned Opc) const;
96 
97  /// Return true if this is an unscaled load/store.
98  bool isUnscaledLdSt(MachineInstr &MI) const;
99 
100  static bool isPairableLdStInst(const MachineInstr &MI) {
101  switch (MI.getOpcode()) {
102  default:
103  return false;
104  // Scaled instructions.
105  case AArch64::STRSui:
106  case AArch64::STRDui:
107  case AArch64::STRQui:
108  case AArch64::STRXui:
109  case AArch64::STRWui:
110  case AArch64::LDRSui:
111  case AArch64::LDRDui:
112  case AArch64::LDRQui:
113  case AArch64::LDRXui:
114  case AArch64::LDRWui:
115  case AArch64::LDRSWui:
116  // Unscaled instructions.
117  case AArch64::STURSi:
118  case AArch64::STURDi:
119  case AArch64::STURQi:
120  case AArch64::STURWi:
121  case AArch64::STURXi:
122  case AArch64::LDURSi:
123  case AArch64::LDURDi:
124  case AArch64::LDURQi:
125  case AArch64::LDURWi:
126  case AArch64::LDURXi:
127  case AArch64::LDURSWi:
128  return true;
129  }
130  }
131 
132  /// \brief Return the opcode that set flags when possible. The caller is
133  /// responsible for ensuring the opc has a flag setting equivalent.
134  static unsigned convertToFlagSettingOpc(unsigned Opc, bool &Is64Bit) {
135  switch (Opc) {
136  default:
137  llvm_unreachable("Opcode has no flag setting equivalent!");
138  // 32-bit cases:
139  case AArch64::ADDWri: Is64Bit = false; return AArch64::ADDSWri;
140  case AArch64::ADDWrr: Is64Bit = false; return AArch64::ADDSWrr;
141  case AArch64::ADDWrs: Is64Bit = false; return AArch64::ADDSWrs;
142  case AArch64::ADDWrx: Is64Bit = false; return AArch64::ADDSWrx;
143  case AArch64::ANDWri: Is64Bit = false; return AArch64::ANDSWri;
144  case AArch64::ANDWrr: Is64Bit = false; return AArch64::ANDSWrr;
145  case AArch64::ANDWrs: Is64Bit = false; return AArch64::ANDSWrs;
146  case AArch64::BICWrr: Is64Bit = false; return AArch64::BICSWrr;
147  case AArch64::BICWrs: Is64Bit = false; return AArch64::BICSWrs;
148  case AArch64::SUBWri: Is64Bit = false; return AArch64::SUBSWri;
149  case AArch64::SUBWrr: Is64Bit = false; return AArch64::SUBSWrr;
150  case AArch64::SUBWrs: Is64Bit = false; return AArch64::SUBSWrs;
151  case AArch64::SUBWrx: Is64Bit = false; return AArch64::SUBSWrx;
152  // 64-bit cases:
153  case AArch64::ADDXri: Is64Bit = true; return AArch64::ADDSXri;
154  case AArch64::ADDXrr: Is64Bit = true; return AArch64::ADDSXrr;
155  case AArch64::ADDXrs: Is64Bit = true; return AArch64::ADDSXrs;
156  case AArch64::ADDXrx: Is64Bit = true; return AArch64::ADDSXrx;
157  case AArch64::ANDXri: Is64Bit = true; return AArch64::ANDSXri;
158  case AArch64::ANDXrr: Is64Bit = true; return AArch64::ANDSXrr;
159  case AArch64::ANDXrs: Is64Bit = true; return AArch64::ANDSXrs;
160  case AArch64::BICXrr: Is64Bit = true; return AArch64::BICSXrr;
161  case AArch64::BICXrs: Is64Bit = true; return AArch64::BICSXrs;
162  case AArch64::SUBXri: Is64Bit = true; return AArch64::SUBSXri;
163  case AArch64::SUBXrr: Is64Bit = true; return AArch64::SUBSXrr;
164  case AArch64::SUBXrs: Is64Bit = true; return AArch64::SUBSXrs;
165  case AArch64::SUBXrx: Is64Bit = true; return AArch64::SUBSXrx;
166  }
167  }
168 
169 
170  /// Return true if this is a load/store that can be potentially paired/merged.
172 
173  /// Hint that pairing the given load or store is unprofitable.
174  void suppressLdStPair(MachineInstr &MI) const;
175 
176  bool getMemOpBaseRegImmOfs(MachineInstr &LdSt, unsigned &BaseReg,
177  int64_t &Offset,
178  const TargetRegisterInfo *TRI) const override;
179 
180  bool getMemOpBaseRegImmOfsWidth(MachineInstr &LdSt, unsigned &BaseReg,
181  int64_t &Offset, unsigned &Width,
182  const TargetRegisterInfo *TRI) const;
183 
184  /// Return the immediate offset of the base register in a load/store \p LdSt.
186 
187  /// \brief Returns true if opcode \p Opc is a memory operation. If it is, set
188  /// \p Scale, \p Width, \p MinOffset, and \p MaxOffset accordingly.
189  ///
190  /// For unscaled instructions, \p Scale is set to 1.
191  bool getMemOpInfo(unsigned Opcode, unsigned &Scale, unsigned &Width,
192  int64_t &MinOffset, int64_t &MaxOffset) const;
193 
194  bool shouldClusterMemOps(MachineInstr &FirstLdSt, MachineInstr &SecondLdSt,
195  unsigned NumLoads) const override;
196 
198  uint64_t Offset, const MDNode *Var,
199  const MDNode *Expr,
200  const DebugLoc &DL) const;
202  const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
203  bool KillSrc, unsigned Opcode,
204  llvm::ArrayRef<unsigned> Indices) const;
206  const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
207  bool KillSrc) const override;
208 
210  MachineBasicBlock::iterator MBBI, unsigned SrcReg,
211  bool isKill, int FrameIndex,
212  const TargetRegisterClass *RC,
213  const TargetRegisterInfo *TRI) const override;
214 
216  MachineBasicBlock::iterator MBBI, unsigned DestReg,
217  int FrameIndex, const TargetRegisterClass *RC,
218  const TargetRegisterInfo *TRI) const override;
219 
220  // This tells target independent code that it is okay to pass instructions
221  // with subreg operands to foldMemoryOperandImpl.
222  bool isSubregFoldable() const override { return true; }
223 
225  MachineInstr *
227  ArrayRef<unsigned> Ops,
229  LiveIntervals *LIS = nullptr) const override;
230 
231  /// \returns true if a branch from an instruction with opcode \p BranchOpc
232  /// bytes is capable of jumping to a position \p BrOffset bytes away.
233  bool isBranchOffsetInRange(unsigned BranchOpc,
234  int64_t BrOffset) const override;
235 
236  MachineBasicBlock *getBranchDestBlock(const MachineInstr &MI) const override;
237 
239  MachineBasicBlock *&FBB,
241  bool AllowModify = false) const override;
242  unsigned removeBranch(MachineBasicBlock &MBB,
243  int *BytesRemoved = nullptr) const override;
246  const DebugLoc &DL,
247  int *BytesAdded = nullptr) const override;
248  bool
251  unsigned, unsigned, int &, int &, int &) const override;
253  const DebugLoc &DL, unsigned DstReg,
254  ArrayRef<MachineOperand> Cond, unsigned TrueReg,
255  unsigned FalseReg) const override;
256  void getNoop(MCInst &NopInst) const override;
257 
258  /// analyzeCompare - For a comparison instruction, return the source registers
259  /// in SrcReg and SrcReg2, and the value it compares against in CmpValue.
260  /// Return true if the comparison instruction can be analyzed.
261  bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg,
262  unsigned &SrcReg2, int &CmpMask,
263  int &CmpValue) const override;
264  /// optimizeCompareInstr - Convert the instruction supplying the argument to
265  /// the comparison into one that sets the zero bit in the flags register.
266  bool optimizeCompareInstr(MachineInstr &CmpInstr, unsigned SrcReg,
267  unsigned SrcReg2, int CmpMask, int CmpValue,
268  const MachineRegisterInfo *MRI) const override;
269  bool optimizeCondBranch(MachineInstr &MI) const override;
270 
271  /// Return true when a code sequence can improve throughput. It
272  /// should be called only for instructions in loops.
273  /// \param Pattern - combiner pattern
274  bool isThroughputPattern(MachineCombinerPattern Pattern) const override;
275  /// Return true when there is potentially a faster code sequence
276  /// for an instruction chain ending in ``Root``. All potential patterns are
277  /// listed in the ``Patterns`` array.
280  const override;
281  /// Return true when Inst is associative and commutative so that it can be
282  /// reassociated.
283  bool isAssociativeAndCommutative(const MachineInstr &Inst) const override;
284  /// When getMachineCombinerPatterns() finds patterns, this function generates
285  /// the instructions that could replace the original code sequence
287  MachineInstr &Root, MachineCombinerPattern Pattern,
290  DenseMap<unsigned, unsigned> &InstrIdxForVirtReg) const override;
291  /// AArch64 supports MachineCombiner.
292  bool useMachineCombiner() const override;
293 
294  bool expandPostRAPseudo(MachineInstr &MI) const override;
295 
296  std::pair<unsigned, unsigned>
297  decomposeMachineOperandsTargetFlags(unsigned TF) const override;
304 
305  bool isFunctionSafeToOutlineFrom(MachineFunction &MF) const override;
306  unsigned getOutliningBenefit(size_t SequenceSize, size_t Occurrences,
307  bool CanBeTailCall) const override;
308  AArch64GenInstrInfo::MachineOutlinerInstrType
309  getOutliningType(MachineInstr &MI) const override;
311  MachineFunction &MF,
312  bool IsTailCall) const override;
314  MachineFunction &MF,
315  bool isTailCall) const override;
319  MachineFunction &MF,
320  bool IsTailCall) const override;
321  /// Returns true if the instruction has a shift by immediate that can be
322  /// executed in one cycle less.
323  bool isFalkorShiftExtFast(const MachineInstr &MI) const;
324 private:
325 
326  /// \brief Sets the offsets on outlined instructions in \p MBB which use SP
327  /// so that they will be valid post-outlining.
328  ///
329  /// \param MBB A \p MachineBasicBlock in an outlined function.
330  void fixupPostOutline(MachineBasicBlock &MBB) const;
331 
332  void instantiateCondBranch(MachineBasicBlock &MBB, const DebugLoc &DL,
333  MachineBasicBlock *TBB,
334  ArrayRef<MachineOperand> Cond) const;
335  bool substituteCmpToZero(MachineInstr &CmpInstr, unsigned SrcReg,
336  const MachineRegisterInfo *MRI) const;
337 };
338 
339 /// emitFrameOffset - Emit instructions as needed to set DestReg to SrcReg
340 /// plus Offset. This is intended to be used from within the prolog/epilog
341 /// insertion (PEI) pass, where a virtual scratch register may be allocated
342 /// if necessary, to be replaced by the scavenger at the end of PEI.
343 void emitFrameOffset(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
344  const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
345  int Offset, const TargetInstrInfo *TII,
347  bool SetNZCV = false);
348 
349 /// rewriteAArch64FrameIndex - Rewrite MI to access 'Offset' bytes from the
350 /// FP. Return false if the offset could not be handled directly in MI, and
351 /// return the left-over portion by reference.
352 bool rewriteAArch64FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
353  unsigned FrameReg, int &Offset,
354  const AArch64InstrInfo *TII);
355 
356 /// \brief Use to report the frame offset status in isAArch64FrameOffsetLegal.
358  AArch64FrameOffsetCannotUpdate = 0x0, ///< Offset cannot apply.
359  AArch64FrameOffsetIsLegal = 0x1, ///< Offset is legal.
360  AArch64FrameOffsetCanUpdate = 0x2 ///< Offset can apply, at least partly.
361 };
362 
363 /// \brief Check if the @p Offset is a valid frame offset for @p MI.
364 /// The returned value reports the validity of the frame offset for @p MI.
365 /// It uses the values defined by AArch64FrameOffsetStatus for that.
366 /// If result == AArch64FrameOffsetCannotUpdate, @p MI cannot be updated to
367 /// use an offset.eq
368 /// If result & AArch64FrameOffsetIsLegal, @p Offset can completely be
369 /// rewritten in @p MI.
370 /// If result & AArch64FrameOffsetCanUpdate, @p Offset contains the
371 /// amount that is off the limit of the legal offset.
372 /// If set, @p OutUseUnscaledOp will contain the whether @p MI should be
373 /// turned into an unscaled operator, which opcode is in @p OutUnscaledOp.
374 /// If set, @p EmittableOffset contains the amount that can be set in @p MI
375 /// (possibly with @p OutUnscaledOp if OutUseUnscaledOp is true) and that
376 /// is a legal offset.
377 int isAArch64FrameOffsetLegal(const MachineInstr &MI, int &Offset,
378  bool *OutUseUnscaledOp = nullptr,
379  unsigned *OutUnscaledOp = nullptr,
380  int *EmittableOffset = nullptr);
381 
382 static inline bool isUncondBranchOpcode(int Opc) { return Opc == AArch64::B; }
383 
384 static inline bool isCondBranchOpcode(int Opc) {
385  switch (Opc) {
386  case AArch64::Bcc:
387  case AArch64::CBZW:
388  case AArch64::CBZX:
389  case AArch64::CBNZW:
390  case AArch64::CBNZX:
391  case AArch64::TBZW:
392  case AArch64::TBZX:
393  case AArch64::TBNZW:
394  case AArch64::TBNZX:
395  return true;
396  default:
397  return false;
398  }
399 }
400 
401 static inline bool isIndirectBranchOpcode(int Opc) { return Opc == AArch64::BR; }
402 
403 } // end namespace llvm
404 
405 #endif
ArrayRef< std::pair< unsigned, const char * > > getSerializableBitmaskMachineOperandTargetFlags() const override
const AArch64RegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
bool isGPRZero(const MachineInstr &MI) const
Does this instruction set its full destination register to zero?
AArch64GenInstrInfo::MachineOutlinerInstrType getOutliningType(MachineInstr &MI) const override
bool getMemOpBaseRegImmOfs(MachineInstr &LdSt, unsigned &BaseReg, int64_t &Offset, const TargetRegisterInfo *TRI) const override
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:63
bool hasShiftedReg(const MachineInstr &MI) const
Returns true if there is a shiftable register and that the shift value is non-zero.
DataLayout DL
void suppressLdStPair(MachineInstr &MI) const
Hint that pairing the given load or store is unprofitable.
MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, MachineBasicBlock::iterator InsertPt, int FrameIndex, LiveIntervals *LIS=nullptr) const override
Offset can apply, at least partly.
MachineOperand & getMemOpBaseRegImmOfsOffsetOperand(MachineInstr &LdSt) const
Return the immediate offset of the base register in a load/store LdSt.
bool shouldClusterMemOps(MachineInstr &FirstLdSt, MachineInstr &SecondLdSt, unsigned NumLoads) const override
Detect opportunities for ldp/stp formation.
A debug info location.
Definition: DebugLoc.h:34
Metadata node.
Definition: Metadata.h:862
bool hasExtendedReg(const MachineInstr &MI) const
Returns true if there is an extendable register and that the extending value is non-zero.
bool isUnscaledLdSt(unsigned Opc) const
Return true if this is an unscaled load/store.
bool isAssociativeAndCommutative(const MachineInstr &Inst) const override
Return true when Inst is associative and commutative so that it can be reassociated.
const HexagonInstrInfo * TII
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
bool useMachineCombiner() const override
AArch64 supports MachineCombiner.
int isAArch64FrameOffsetLegal(const MachineInstr &MI, int &Offset, bool *OutUseUnscaledOp=nullptr, unsigned *OutUnscaledOp=nullptr, int *EmittableOffset=nullptr)
Check if the Offset is a valid frame offset for MI.
AArch64InstrInfo(const AArch64Subtarget &STI)
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Return the number of bytes of code the specified instruction may be.
virtual MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, MachineBasicBlock::iterator InsertPt, int FrameIndex, LiveIntervals *LIS=nullptr) const
Target-dependent implementation for foldMemoryOperand.
bool canInsertSelect(const MachineBasicBlock &, ArrayRef< MachineOperand > Cond, unsigned, unsigned, int &, int &, int &) const override
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
static const MachineMemOperand::Flags MOSuppressPair
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:159
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Definition: MachineInstr.h:279
void emitFrameOffset(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, int Offset, const TargetInstrInfo *TII, MachineInstr::MIFlag=MachineInstr::NoFlags, bool SetNZCV=false)
emitFrameOffset - Emit instructions as needed to set DestReg to SrcReg plus Offset.
static bool isCondBranchOpcode(int Opc)
MachineInstrBundleIterator< MachineInstr > iterator
bool getMemOpInfo(unsigned Opcode, unsigned &Scale, unsigned &Width, int64_t &MinOffset, int64_t &MaxOffset) const
Returns true if opcode Opc is a memory operation.
Control flow instructions. These all have token chains.
Definition: ISDOpcodes.h:595
unsigned getOutliningBenefit(size_t SequenceSize, size_t Occurrences, bool CanBeTailCall) const override
unsigned const MachineRegisterInfo * MRI
bool isFalkorShiftExtFast(const MachineInstr &MI) const
Returns true if the instruction has a shift by immediate that can be executed in one cycle less...
bool isFPRCopy(const MachineInstr &MI) const
Does this instruction rename an FPR without modifying bits?
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
MachineInstr * emitFrameIndexDebugValue(MachineFunction &MF, int FrameIx, uint64_t Offset, const MDNode *Var, const MDNode *Expr, const DebugLoc &DL) const
bool rewriteAArch64FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, unsigned FrameReg, int &Offset, const AArch64InstrInfo *TII)
rewriteAArch64FrameIndex - Rewrite MI to access 'Offset' bytes from the FP.
static bool isPairableLdStInst(const MachineInstr &MI)
void insertOutlinerPrologue(MachineBasicBlock &MBB, MachineFunction &MF, bool isTailCall) const override
bool areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb, AliasAnalysis *AA=nullptr) const override
bool isBranchOffsetInRange(unsigned BranchOpc, int64_t BrOffset) const override
bool isAsCheapAsAMove(const MachineInstr &MI) const override
bool expandPostRAPseudo(MachineInstr &MI) const override
bool isThroughputPattern(MachineCombinerPattern Pattern) const override
Return true when a code sequence can improve throughput.
MachineCombinerPattern
These are instruction patterns matched by the machine combiner pass.
bool getMachineCombinerPatterns(MachineInstr &Root, SmallVectorImpl< MachineCombinerPattern > &Patterns) const override
Return true when there is potentially a faster code sequence for an instruction chain ending in Root...
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override
void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned DstReg, ArrayRef< MachineOperand > Cond, unsigned TrueReg, unsigned FalseReg) const override
bool isCoalescableExtInstr(const MachineInstr &MI, unsigned &SrcReg, unsigned &DstReg, unsigned &SubIdx) const override
AArch64FrameOffsetStatus
Use to report the frame offset status in isAArch64FrameOffsetLegal.
unsigned isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
ArrayRef< std::pair< MachineMemOperand::Flags, const char * > > getSerializableMachineMemOperandTargetFlags() const override
static bool isIndirectBranchOpcode(int Opc)
static bool isUncondBranchOpcode(int Opc)
void getNoop(MCInst &NopInst) const override
#define B
Definition: LargeTest.cpp:24
MachineBasicBlock::iterator insertOutlinedCall(Module &M, MachineBasicBlock &MBB, MachineBasicBlock::iterator &It, MachineFunction &MF, bool IsTailCall) const override
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
MachineOperand class - Representation of each machine instruction operand.
bool optimizeCondBranch(MachineInstr &MI) const override
Replace csincr-branch sequence by simple conditional branch.
unsigned isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
bool isSubregFoldable() const override
Flags
Flags values. These may be or'd together.
llvm_unreachable("Unknown RegBank!")
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
Definition: MachineInstr.h:59
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const override
bool optimizeCompareInstr(MachineInstr &CmpInstr, unsigned SrcReg, unsigned SrcReg2, int CmpMask, int CmpValue, const MachineRegisterInfo *MRI) const override
optimizeCompareInstr - Convert the instruction supplying the argument to the comparison into one that...
static unsigned convertToFlagSettingOpc(unsigned Opc, bool &Is64Bit)
Return the opcode that set flags when possible.
bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg, unsigned &SrcReg2, int &CmpMask, int &CmpValue) const override
analyzeCompare - For a comparison instruction, return the source registers in SrcReg and SrcReg2...
bool isScaledAddr(const MachineInstr &MI) const
Return true if this is load/store scales or extends its register offset.
void insertOutlinerEpilogue(MachineBasicBlock &MBB, MachineFunction &MF, bool IsTailCall) const override
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
#define I(x, y, z)
Definition: MD5.cpp:58
bool isLdStPairSuppressed(const MachineInstr &MI) const
Return true if pairing the given load or store is hinted to be unprofitable.
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
bool getMemOpBaseRegImmOfsWidth(MachineInstr &LdSt, unsigned &BaseReg, int64_t &Offset, unsigned &Width, const TargetRegisterInfo *TRI) const
bool isGPRCopy(const MachineInstr &MI) const
Does this instruction rename a GPR without modifying bits?
MachineBasicBlock * getBranchDestBlock(const MachineInstr &MI) const override
void copyPhysRegTuple(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc, unsigned Opcode, llvm::ArrayRef< unsigned > Indices) const
void genAlternativeCodeSequence(MachineInstr &Root, MachineCombinerPattern Pattern, SmallVectorImpl< MachineInstr * > &InsInstrs, SmallVectorImpl< MachineInstr * > &DelInstrs, DenseMap< unsigned, unsigned > &InstrIdxForVirtReg) const override
When getMachineCombinerPatterns() finds patterns, this function generates the instructions that could...
bool isFunctionSafeToOutlineFrom(MachineFunction &MF) const override
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
bool isStridedAccess(const MachineInstr &MI) const
Return true if the given load or store is a strided memory access.
IRTranslator LLVM IR MI
bool isCandidateToMergeOrPair(MachineInstr &MI) const
Return true if this is a load/store that can be potentially paired/merged.
static const MachineMemOperand::Flags MOStridedAccess