diff options
Diffstat (limited to 'llvm/include/llvm/CodeGen/TargetInstrInfo.h')
-rw-r--r-- | llvm/include/llvm/CodeGen/TargetInstrInfo.h | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/llvm/include/llvm/CodeGen/TargetInstrInfo.h b/llvm/include/llvm/CodeGen/TargetInstrInfo.h index 36afdefd27b2..05d0591f1e5d 100644 --- a/llvm/include/llvm/CodeGen/TargetInstrInfo.h +++ b/llvm/include/llvm/CodeGen/TargetInstrInfo.h @@ -10,8 +10,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_TARGET_TARGETINSTRINFO_H -#define LLVM_TARGET_TARGETINSTRINFO_H +#ifndef LLVM_CODEGEN_TARGETINSTRINFO_H +#define LLVM_CODEGEN_TARGETINSTRINFO_H #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" @@ -129,6 +129,12 @@ public: isReallyTriviallyReMaterializableGeneric(MI, AA))); } + /// Given \p MO is a PhysReg use return if it can be ignored for the purpose + /// of instruction rematerialization. + virtual bool isIgnorableUse(const MachineOperand &MO) const { + return false; + } + protected: /// For instructions with opcodes for which the M_REMATERIALIZABLE flag is /// set, this hook lets the target specify whether the instruction is actually @@ -459,6 +465,13 @@ public: unsigned &SrcOpIdx1, unsigned &SrcOpIdx2) const; + /// Returns true if the target has a preference on the operands order of + /// the given machine instruction. And specify if \p Commute is required to + /// get the desired operands order. + virtual bool hasCommutePreference(MachineInstr &MI, bool &Commute) const { + return false; + } + /// A pair composed of a register and a sub-register index. /// Used to give some type checking when modeling Reg:SubReg. struct RegSubRegPair { @@ -951,6 +964,19 @@ public: llvm_unreachable("Target didn't implement TargetInstrInfo::copyPhysReg!"); } + /// Allow targets to tell MachineVerifier whether a specific register + /// MachineOperand can be used as part of PC-relative addressing. + /// PC-relative addressing modes in many CISC architectures contain + /// (non-PC) registers as offsets or scaling values, which inherently + /// tags the corresponding MachineOperand with OPERAND_PCREL. + /// + /// @param MO The MachineOperand in question. MO.isReg() should always + /// be true. + /// @return Whether this operand is allowed to be used PC-relatively. + virtual bool isPCRelRegisterOperandLegal(const MachineOperand &MO) const { + return false; + } + protected: /// Target-dependent implementation for IsCopyInstr. /// If the specific machine instruction is a instruction that moves/copies @@ -1051,6 +1077,16 @@ public: /// has the potential of causing nasty silent breakage in out-of-tree targets. virtual bool isSubregFoldable() const { return false; } + /// For a patchpoint, stackmap, or statepoint intrinsic, return the range of + /// operands which can't be folded into stack references. Operands outside + /// of the range are most likely foldable but it is not guaranteed. + /// These instructions are unique in that stack references for some operands + /// have the same execution cost (e.g. none) as the unfolded register forms. + /// The ranged return is guaranteed to include all operands which can't be + /// folded at zero cost. + virtual std::pair<unsigned, unsigned> + getPatchpointUnfoldableRange(const MachineInstr &MI) const; + /// Attempt to fold a load or store of the specified stack /// slot into the specified machine instruction for the specified operand(s). /// If this is possible, a new instruction is returned with the specified @@ -1382,7 +1418,7 @@ public: unsigned Quantity) const; /// Return the noop instruction to use for a noop. - virtual void getNoop(MCInst &NopInst) const; + virtual MCInst getNop() const; /// Return true for post-incremented instructions. virtual bool isPostIncrement(const MachineInstr &MI) const { return false; } @@ -1929,6 +1965,14 @@ public: virtual Optional<ParamLoadedValue> describeLoadedValue(const MachineInstr &MI, Register Reg) const; + /// Given the generic extension instruction \p ExtMI, returns true if this + /// extension is a likely candidate for being folded into an another + /// instruction. + virtual bool isExtendLikelyToBeFolded(MachineInstr &ExtMI, + MachineRegisterInfo &MRI) const { + return false; + } + /// Return MIR formatter to format/parse MIR operands. Target can override /// this virtual function and return target specific MIR formatter. virtual const MIRFormatter *getMIRFormatter() const { @@ -1937,6 +1981,18 @@ public: return Formatter.get(); } + /// Returns the target-specific default value for tail duplication. + /// This value will be used if the tail-dup-placement-threshold argument is + /// not provided. + virtual unsigned getTailDuplicateSize(CodeGenOpt::Level OptLevel) const { + return OptLevel >= CodeGenOpt::Aggressive ? 4 : 2; + } + + /// Returns the callee operand from the given \p MI. + virtual const MachineOperand &getCalleeOperand(const MachineInstr &MI) const { + return MI.getOperand(0); + } + private: mutable std::unique_ptr<MIRFormatter> Formatter; unsigned CallFrameSetupOpcode, CallFrameDestroyOpcode; @@ -1974,4 +2030,4 @@ template <> struct DenseMapInfo<TargetInstrInfo::RegSubRegPair> { } // end namespace llvm -#endif // LLVM_TARGET_TARGETINSTRINFO_H +#endif // LLVM_CODEGEN_TARGETINSTRINFO_H |