22#define GET_INSTRINFO_CTOR_DTOR
23#include "NVPTXGenInstrInfo.inc"
26void NVPTXInstrInfo::anchor() {}
35 bool RenamableDest,
bool RenamableSrc)
const {
44 if (DestRC == &NVPTX::B1RegClass)
46 else if (DestRC == &NVPTX::B16RegClass)
47 Op = NVPTX::MOV_B16_r;
48 else if (DestRC == &NVPTX::B32RegClass)
49 Op = NVPTX::MOV_B32_r;
50 else if (DestRC == &NVPTX::B64RegClass)
51 Op = NVPTX::MOV_B64_r;
52 else if (DestRC == &NVPTX::B128RegClass)
53 Op = NVPTX::MOV_B128_r;
88 bool AllowModify)
const {
91 if (
I ==
MBB.begin() || !isUnpredicatedTerminator(*--
I))
98 if (
I ==
MBB.begin() || !isUnpredicatedTerminator(*--
I)) {
99 if (LastInst.
getOpcode() == NVPTX::GOTO) {
102 }
else if (LastInst.
getOpcode() == NVPTX::CBranch) {
117 if (
I !=
MBB.begin() && isUnpredicatedTerminator(*--
I))
121 if (SecondLastInst.
getOpcode() == NVPTX::CBranch &&
132 if (SecondLastInst.
getOpcode() == NVPTX::GOTO &&
137 I->eraseFromParent();
146 int *BytesRemoved)
const {
147 assert(!BytesRemoved &&
"code size not handled");
149 if (
I ==
MBB.begin())
152 if (
I->getOpcode() != NVPTX::GOTO &&
I->getOpcode() != NVPTX::CBranch)
156 I->eraseFromParent();
160 if (
I ==
MBB.begin())
163 if (
I->getOpcode() != NVPTX::CBranch)
167 I->eraseFromParent();
176 int *BytesAdded)
const {
177 assert(!BytesAdded &&
"code size not handled");
180 assert(
TBB &&
"insertBranch must not be told to insert a fallthrough");
182 "NVPTX branch conditions have two components!");
204 assert(
Cond.size() == 2 &&
"Invalid NVPTX branch condition!");
225 switch (
MI.getOpcode()) {
226 case NVPTX::SETP_i16rr:
227 case NVPTX::SETP_i16ri:
228 case NVPTX::SETP_i16ir:
229 case NVPTX::SETP_i32rr:
230 case NVPTX::SETP_i32ri:
231 case NVPTX::SETP_i32ir:
232 case NVPTX::SETP_i64rr:
233 case NVPTX::SETP_i64ri:
234 case NVPTX::SETP_i64ir:
242 switch (
MI.getOpcode()) {
243 case NVPTX::SETP_bf16rr:
244 case NVPTX::SETP_f16rr:
245 case NVPTX::SETP_f32rr:
246 case NVPTX::SETP_f32ri:
247 case NVPTX::SETP_f32ir:
248 case NVPTX::SETP_f64rr:
249 case NVPTX::SETP_f64ri:
250 case NVPTX::SETP_f64ir:
332 unsigned &SrcOpIdx2)
const {
334 return fixCommutedOpIndices(SrcOpIdx1, SrcOpIdx2, 1, 2);
341 unsigned OpIdx2)
const {
342 assert(!NewMI &&
"this should never be used");
353 if (!
UseMI.isConditionalBranch())
360 return !invertPredicateBranchInstr(*
MBB);
368 invertPredicateBranchInstr(*
MBB);
MachineInstrBuilder & UseMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static bool isIntegerSetp(const MachineInstr &MI)
static int64_t invertScalarFloatCmpMode(int64_t Mode)
static void invertScalarCompareInstr(MachineInstr &MI)
static bool isScalarFloatSetp(const MachineInstr &MI)
static int64_t invertIntegerCmpMode(int64_t Mode)
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
Represent a constant reference to an array (0 or more elements consecutively in memory),...
MachineInstrBundleIterator< MachineInstr > iterator
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineOperand & getOperand(unsigned i) const
MachineOperand class - Representation of each machine instruction operand.
void setImm(int64_t immVal)
MachineBasicBlock * getMBB() const
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
iterator_range< use_instr_nodbg_iterator > use_nodbg_instructions(Register Reg) const
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
NVPTXInstrInfo(const NVPTXSubtarget &STI)
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx1, unsigned &SrcOpIdx2) const override
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
analyzeBranch - Analyze the branching code at the end of MBB, returning true if it cannot be understo...
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
MachineInstr * commuteInstructionImpl(MachineInstr &MI, bool NewMI, unsigned OpIdx1, unsigned OpIdx2) const override
Wrapper class representing virtual and physical registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
virtual bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx1, unsigned &SrcOpIdx2) const
Returns true iff the routine could find two commutable operands in the given machine instruction.
virtual MachineInstr * commuteInstructionImpl(MachineInstr &MI, bool NewMI, unsigned OpIdx1, unsigned OpIdx2) const
This method commutes the operands of the given machine instruction MI.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
constexpr RegState getKillRegState(bool B)
testing::Matcher< const detail::ErrorHolder & > Failed()
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
DWARFExpression::Operation Op
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.