25 #define GET_INSTRINFO_CTOR_DTOR 26 #include "NVPTXGenInstrInfo.inc" 29 void NVPTXInstrInfo::anchor() {}
35 const DebugLoc &DL,
unsigned DestReg,
36 unsigned SrcReg,
bool KillSrc)
const {
41 if (RegInfo.getRegSizeInBits(*DestRC) != RegInfo.getRegSizeInBits(*SrcRC))
45 if (DestRC == &NVPTX::Int1RegsRegClass) {
47 }
else if (DestRC == &NVPTX::Int16RegsRegClass) {
49 }
else if (DestRC == &NVPTX::Int32RegsRegClass) {
50 Op = (SrcRC == &NVPTX::Int32RegsRegClass ? NVPTX::IMOV32rr
51 : NVPTX::BITCONVERT_32_F2I);
52 }
else if (DestRC == &NVPTX::Int64RegsRegClass) {
53 Op = (SrcRC == &NVPTX::Int64RegsRegClass ? NVPTX::IMOV64rr
54 : NVPTX::BITCONVERT_64_F2I);
55 }
else if (DestRC == &NVPTX::Float16RegsRegClass) {
56 Op = (SrcRC == &NVPTX::Float16RegsRegClass ? NVPTX::FMOV16rr
57 : NVPTX::BITCONVERT_16_I2F);
58 }
else if (DestRC == &NVPTX::Float16x2RegsRegClass) {
60 }
else if (DestRC == &NVPTX::Float32RegsRegClass) {
61 Op = (SrcRC == &NVPTX::Float32RegsRegClass ? NVPTX::FMOV32rr
62 : NVPTX::BITCONVERT_32_I2F);
63 }
else if (DestRC == &NVPTX::Float64RegsRegClass) {
64 Op = (SrcRC == &NVPTX::Float64RegsRegClass ? NVPTX::FMOV64rr
65 : NVPTX::BITCONVERT_64_I2F);
69 BuildMI(MBB, I, DL,
get(Op), DestReg)
100 bool AllowModify)
const {
103 if (I == MBB.
begin() || !isUnpredicatedTerminator(*--I))
110 if (I == MBB.
begin() || !isUnpredicatedTerminator(*--I)) {
111 if (LastInst.
getOpcode() == NVPTX::GOTO) {
114 }
else if (LastInst.
getOpcode() == NVPTX::CBranch) {
128 if (I != MBB.
begin() && isUnpredicatedTerminator(*--I))
132 if (SecondLastInst.
getOpcode() == NVPTX::CBranch &&
142 if (SecondLastInst.
getOpcode() == NVPTX::GOTO &&
147 I->eraseFromParent();
156 int *BytesRemoved)
const {
157 assert(!BytesRemoved &&
"code size not handled");
159 if (I == MBB.
begin())
162 if (I->getOpcode() != NVPTX::GOTO && I->getOpcode() != NVPTX::CBranch)
166 I->eraseFromParent();
170 if (I == MBB.
begin())
173 if (I->getOpcode() != NVPTX::CBranch)
177 I->eraseFromParent();
186 int *BytesAdded)
const {
187 assert(!BytesAdded &&
"code size not handled");
190 assert(TBB &&
"insertBranch must not be told to insert a fallthrough");
192 "NVPTX branch conditions have two components!");
197 BuildMI(&MBB, DL,
get(NVPTX::GOTO)).addMBB(TBB);
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override
MachineBasicBlock * getMBB() const
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
void push_back(const T &Elt)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
unsigned getKillRegState(bool B)
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
unsigned const MachineRegisterInfo * MRI
size_t size() const
size - Get the array size.
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...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
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.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
const MachineOperand & getOperand(unsigned i) const
bool empty() const
empty - Check if the array is empty.