20#define DEBUG_TYPE "ve-isel"
21#define PASS_NAME "VE DAG->DAG Pattern Instruction Selection"
34 VEDAGToDAGISel() =
delete;
55 bool SelectInlineAsmMemoryOperand(
const SDValue &
Op,
57 std::vector<SDValue> &OutOps)
override;
60#include "VEGenDAGISel.inc"
63 SDNode *getGlobalBaseReg();
77char VEDAGToDAGISelLegacy::ID = 0;
92 if (matchADDRrr(
LHS,
Base, Index)) {
99 if (matchADDRrr(Addr,
LHS,
RHS)) {
118 Offset = CurDAG->getTargetConstant(0,
SDLoc(Addr), MVT::i32);
127 Index = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
132 Index = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
133 Offset = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
154 Base = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
155 Index = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
157 CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(Addr), MVT::i32);
170 Offset = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
185 Base = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
187 CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(Addr), MVT::i32);
225 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), AddrTy);
226 Offset = CurDAG->getTargetConstant(0, SDLoc(Addr), MVT::i32);
234 if (CurDAG->isBaseWithConstantOffset(Addr)) {
237 if (FrameIndexSDNode *FIN =
240 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), AddrTy);
245 CurDAG->getTargetConstant(CN->
getZExtValue(), SDLoc(Addr), MVT::i32);
252void VEDAGToDAGISel::Select(SDNode *
N) {
253 if (
N->isMachineOpcode()) {
258 switch (
N->getOpcode()) {
262 ReplaceNode(
N,
N->getOperand(0).getNode());
266 case VEISD::VEC_BROADCAST: {
267 MVT SplatResTy =
N->getSimpleValueType(0);
275 bool BCTrueMask = (BConst->getSExtValue() != 0);
282 New = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), SDLoc(
N), VE::VM0,
285 New = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), SDLoc(
N), VE::VMP0,
291 ReplaceNode(
N,
New.getNode());
296 ReplaceNode(
N, getGlobalBaseReg());
305bool VEDAGToDAGISel::SelectInlineAsmMemoryOperand(
307 std::vector<SDValue> &OutOps) {
309 switch (ConstraintID) {
312 case InlineAsm::ConstraintCode::o:
313 case InlineAsm::ConstraintCode::m:
316 if (selectADDRri(
Op, Op0, Op1)) {
317 OutOps.push_back(Op0);
318 OutOps.push_back(Op1);
322 OutOps.push_back(
Op);
323 OutOps.push_back(CurDAG->getTargetConstant(0, SDLoc(
Op), MVT::i32));
329SDNode *VEDAGToDAGISel::getGlobalBaseReg() {
332 ->getRegister(GlobalBaseReg, TLI->getPointerTy(CurDAG->getDataLayout()))
340 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.