24 const R600Subtarget *Subtarget =
nullptr;
26 bool isConstantLoad(
const MemSDNode *
N,
int cbID)
const;
27 bool SelectGlobalValueConstantOffset(
SDValue Addr,
SDValue &IntPtr);
28 bool SelectGlobalValueVariableOffset(
SDValue Addr,
SDValue &BaseReg,
32 R600DAGToDAGISel() =
delete;
35 : AMDGPUDAGToDAGISel(
TM, OptLevel) {}
37 void Select(SDNode *
N)
override;
44 bool runOnMachineFunction(MachineFunction &MF)
override;
46 void PreprocessISelDAG()
override {}
50#include "R600GenDAGISel.inc"
56 explicit R600DAGToDAGISelLegacy(TargetMachine &TM,
CodeGenOptLevel OptLevel)
57 : SelectionDAGISelLegacy(
58 ID, std::make_unique<R600DAGToDAGISel>(
TM, OptLevel)) {}
61char R600DAGToDAGISelLegacy::ID = 0;
70bool R600DAGToDAGISel::isConstantLoad(
const MemSDNode *
N,
int CbId)
const {
80bool R600DAGToDAGISel::SelectGlobalValueConstantOffset(
SDValue Addr,
84 CurDAG->getIntPtrConstant(Cst->getZExtValue() / 4, SDLoc(Addr),
true);
90bool R600DAGToDAGISel::SelectGlobalValueVariableOffset(
SDValue Addr,
95 Offset = CurDAG->getIntPtrConstant(0, SDLoc(Addr),
true);
101void R600DAGToDAGISel::Select(SDNode *
N) {
102 unsigned int Opc =
N->getOpcode();
103 if (
N->isMachineOpcode()) {
114 EVT VT =
N->getValueType(0);
121 switch (NumVectorElts) {
123 RegClassID = R600::R600_Reg64RegClassID;
127 RegClassID = R600::R600_Reg128VerticalRegClassID;
129 RegClassID = R600::R600_Reg128RegClassID;
134 SelectBuildVector(
N, RegClassID);
148 Base = CurDAG->getRegister(R600::INDIRECT_BASE_ADDR, MVT::i32);
149 Offset = CurDAG->getTargetConstant(
C->getZExtValue(),
DL, MVT::i32);
152 Base = CurDAG->getRegister(R600::INDIRECT_BASE_ADDR, MVT::i32);
153 Offset = CurDAG->getTargetConstant(
C->getZExtValue(),
DL, MVT::i32);
157 Offset = CurDAG->getTargetConstant(
C->getZExtValue(),
DL, MVT::i32);
160 Offset = CurDAG->getTargetConstant(0,
DL, MVT::i32);
168 ConstantSDNode *IMMOffset;
182 Base = CurDAG->getCopyFromReg(CurDAG->getEntryNode(),
183 SDLoc(CurDAG->getEntryNode()), R600::ZERO,
192 Offset = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
200 return new R600DAGToDAGISelLegacy(TM, OptLevel);
Defines an instruction selector for the AMDGPU target.
AMDGPU Register Bank Select
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Provides R600 specific target descriptions.
AMDGPU R600 specific subclass of TargetSubtarget.
AMDGPU specific code to select AMDGPU machine instructions for SelectionDAG operations.
uint64_t getZExtValue() const
FunctionPass class - This class is used to implement most global optimizations.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const SDValue & getOperand(unsigned i) const
unsigned getOpcode() const
virtual bool runOnMachineFunction(MachineFunction &mf)
Primary interface to the complete machine description for the target machine.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ CONSTANT_ADDRESS_32BIT
Address space for 32-bit constant memory.
@ CONSTANT_ADDRESS
Address space for constant memory (VTX2).
@ BUILD_VERTICAL_VECTOR
This node is for VLIW targets and it is used to represent a vector that is stored in consecutive regi...
@ C
The default llvm calling convention, compatible with C.
@ ADD
Simple integer binary arithmetic operators.
@ SCALAR_TO_VECTOR
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
BaseReg
Stack frame base register. Bit 0 of FREInfo.Info.
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
CodeGenOptLevel
Code generation optimization level.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
FunctionPass * createR600ISelDag(TargetMachine &TM, CodeGenOptLevel OptLevel)
This pass converts a legalized DAG into a R600-specific.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.