19#define DEBUG_TYPE "ve-isel"
20#define PASS_NAME "VE DAG->DAG Pattern Instruction Selection"
33 VEDAGToDAGISel() =
delete;
54 bool SelectInlineAsmMemoryOperand(
const SDValue &
Op,
56 std::vector<SDValue> &OutOps)
override;
59#include "VEGenDAGISel.inc"
62 SDNode *getGlobalBaseReg();
76char VEDAGToDAGISelLegacy::ID = 0;
91 if (matchADDRrr(
LHS,
Base, Index)) {
98 if (matchADDRrr(Addr,
LHS,
RHS)) {
117 Offset = CurDAG->getTargetConstant(0,
SDLoc(Addr), MVT::i32);
126 Index = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
131 Index = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
132 Offset = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
153 Base = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
154 Index = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
156 CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(Addr), MVT::i32);
169 Offset = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
184 Base = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
186 CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(Addr), MVT::i32);
224 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), AddrTy);
225 Offset = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
233 if (CurDAG->isBaseWithConstantOffset(Addr)) {
236 if (FrameIndexSDNode *FIN =
239 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), AddrTy);
244 CurDAG->getTargetConstant(CN->
getZExtValue(), SDLoc(Addr), MVT::i32);
251void VEDAGToDAGISel::Select(SDNode *
N) {
252 if (
N->isMachineOpcode()) {
257 switch (
N->getOpcode()) {
261 ReplaceNode(
N,
N->getOperand(0).getNode());
266 MVT SplatResTy =
N->getSimpleValueType(0);
274 bool BCTrueMask = (BConst->getSExtValue() != 0);
281 New = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), SDLoc(
N), VE::VM0,
284 New = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), SDLoc(
N), VE::VMP0,
290 ReplaceNode(
N,
New.getNode());
295 ReplaceNode(
N, getGlobalBaseReg());
304bool VEDAGToDAGISel::SelectInlineAsmMemoryOperand(
306 std::vector<SDValue> &OutOps) {
308 switch (ConstraintID) {
311 case InlineAsm::ConstraintCode::o:
312 case InlineAsm::ConstraintCode::m:
315 if (selectADDRri(
Op, Op0, Op1)) {
316 OutOps.push_back(Op0);
317 OutOps.push_back(Op1);
321 OutOps.push_back(
Op);
322 OutOps.push_back(CurDAG->getTargetConstant(0, SDLoc(
Op), MVT::i32));
328SDNode *VEDAGToDAGISel::getGlobalBaseReg() {
331 ->getRegister(GlobalBaseReg, TLI->getPointerTy(CurDAG->getDataLayout()))
339 return new VEDAGToDAGISelLegacy(TM);
AMDGPU Register Bank Select
Promote Memory to Register
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
uint64_t getZExtValue() const
int64_t getSExtValue() const
FunctionPass class - This class is used to implement most global optimizations.
unsigned getVectorNumElements() const
MVT getVectorElementType() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
const SDValue & getOperand(unsigned i) const
unsigned getOpcode() const
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
virtual bool runOnMachineFunction(MachineFunction &mf)
Register getGlobalBaseReg(MachineFunction *MF) const
} Optimization
const VEInstrInfo * getInstrInfo() const override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ ADD
Simple integer binary arithmetic operators.
@ TargetGlobalAddress
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
@ GlobalBaseReg
The result of the mflr at function entry, used for PIC code.
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.
FunctionPass * createVEISelDag(VETargetMachine &TM)
createVEISelDag - This pass converts a legalized DAG into a VE-specific DAG, ready for instruction sc...
static const unsigned StandardVectorWidth
static const unsigned PackedVectorWidth
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...
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.