1 //===- PTXInstrInfo.h - PTX Instruction Information -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the PTX implementation of the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef PTX_INSTR_INFO_H
15 #define PTX_INSTR_INFO_H
17 #include "PTXRegisterInfo.h"
18 #include "llvm/CodeGen/SelectionDAG.h"
19 #include "llvm/CodeGen/SelectionDAGNodes.h"
20 #include "llvm/Target/TargetInstrInfo.h"
23 class PTXTargetMachine;
25 class PTXInstrInfo : public TargetInstrInfoImpl {
27 const PTXRegisterInfo RI;
31 explicit PTXInstrInfo(PTXTargetMachine &_TM);
33 virtual const PTXRegisterInfo &getRegisterInfo() const { return RI; }
35 virtual void copyPhysReg(MachineBasicBlock &MBB,
36 MachineBasicBlock::iterator I, DebugLoc DL,
37 unsigned DstReg, unsigned SrcReg,
40 virtual bool copyRegToReg(MachineBasicBlock &MBB,
41 MachineBasicBlock::iterator I,
42 unsigned DstReg, unsigned SrcReg,
43 const TargetRegisterClass *DstRC,
44 const TargetRegisterClass *SrcRC,
47 virtual bool isMoveInstr(const MachineInstr& MI,
48 unsigned &SrcReg, unsigned &DstReg,
49 unsigned &SrcSubIdx, unsigned &DstSubIdx) const;
51 // static helper routines
53 static MachineSDNode *GetPTXMachineNode(SelectionDAG *DAG, unsigned Opcode,
56 SDValue pred_reg = DAG->getRegister(0, MVT::i1);
57 SDValue pred_imm = DAG->getTargetConstant(0, MVT::i32);
58 SDValue ops[] = { Op1, pred_reg, pred_imm };
59 return DAG->getMachineNode(Opcode, dl, VT, ops, array_lengthof(ops));
62 static MachineSDNode *GetPTXMachineNode(SelectionDAG *DAG, unsigned Opcode,
66 SDValue pred_reg = DAG->getRegister(0, MVT::i1);
67 SDValue pred_imm = DAG->getTargetConstant(0, MVT::i32);
68 SDValue ops[] = { Op1, Op2, pred_reg, pred_imm };
69 return DAG->getMachineNode(Opcode, dl, VT, ops, array_lengthof(ops));
72 }; // class PTXInstrInfo
75 #endif // PTX_INSTR_INFO_H