27 bool isConstantLoad(
const MemSDNode *
N,
int cbID)
const;
33 R600DAGToDAGISel() =
delete;
51#include "R600GenDAGISel.inc"
59 ID,
std::make_unique<R600DAGToDAGISel>(
TM, OptLevel)) {}
62char R600DAGToDAGISelLegacy::ID = 0;
71bool R600DAGToDAGISel::isConstantLoad(
const MemSDNode *
N,
int CbId)
const {
81bool R600DAGToDAGISel::SelectGlobalValueConstantOffset(
SDValue Addr,
85 CurDAG->getIntPtrConstant(Cst->getZExtValue() / 4,
SDLoc(
Addr),
true);
91bool R600DAGToDAGISel::SelectGlobalValueVariableOffset(
SDValue Addr,
94 if (!isa<ConstantSDNode>(
Addr)) {
102void R600DAGToDAGISel::Select(
SDNode *
N) {
103 unsigned int Opc =
N->getOpcode();
104 if (
N->isMachineOpcode()) {
115 EVT VT =
N->getValueType(0);
122 switch (NumVectorElts) {
124 RegClassID = R600::R600_Reg64RegClassID;
128 RegClassID = R600::R600_Reg128VerticalRegClassID;
130 RegClassID = R600::R600_Reg128RegClassID;
135 SelectBuildVector(
N, RegClassID);
148 if ((
C = dyn_cast<ConstantSDNode>(
Addr))) {
149 Base = CurDAG->getRegister(R600::INDIRECT_BASE_ADDR, MVT::i32);
150 Offset = CurDAG->getTargetConstant(
C->getZExtValue(),
DL, MVT::i32);
152 (
C = dyn_cast<ConstantSDNode>(
Addr.getOperand(0)))) {
153 Base = CurDAG->getRegister(R600::INDIRECT_BASE_ADDR, MVT::i32);
154 Offset = CurDAG->getTargetConstant(
C->getZExtValue(),
DL, MVT::i32);
156 (
C = dyn_cast<ConstantSDNode>(
Addr.getOperand(1)))) {
158 Offset = CurDAG->getTargetConstant(
C->getZExtValue(),
DL, MVT::i32);
161 Offset = CurDAG->getTargetConstant(0,
DL, MVT::i32);
172 (IMMOffset = dyn_cast<ConstantSDNode>(
Addr.getOperand(1))) &&
181 if ((IMMOffset = dyn_cast<ConstantSDNode>(
Addr)) &&
183 Base = CurDAG->getCopyFromReg(CurDAG->getEntryNode(),
184 SDLoc(CurDAG->getEntryNode()), R600::ZERO,
201 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.
bool runOnMachineFunction(MachineFunction &MF) override
void PreprocessISelDAG() override
PreprocessISelDAG - This hook allows targets to hack on the graph before instruction selection starts...
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.
This is an abstract virtual class for memory operations.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
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.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ 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,...
This is an optimization pass for GlobalISel generic memory operations.
CodeGenOptLevel
Code generation optimization level.
FunctionPass * createR600ISelDag(TargetMachine &TM, CodeGenOptLevel OptLevel)
This pass converts a legalized DAG into a R600-specific.
Implement std::hash so that hash_code can be used in STL containers.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.