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!");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
ArrayRef - 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
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.
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
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
Wrapper class representing virtual and physical registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
#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)
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