23#define DEBUG_TYPE "ve-isel"
24#define PASS_NAME "VE DAG->DAG Pattern Instruction Selection"
37 VEDAGToDAGISel() =
delete;
60 std::vector<SDValue> &OutOps)
override;
63#include "VEGenDAGISel.inc"
66 SDNode *getGlobalBaseReg();
80char VEDAGToDAGISelLegacy::ID = 0;
94 if (matchADDRri(
Addr, LHS, RHS)) {
102 if (matchADDRrr(
Addr, LHS, RHS)) {
108 if (isa<FrameIndexSDNode>(RHS))
148 if (isa<FrameIndexSDNode>(
Addr))
155 if (
auto *CN = dyn_cast<ConstantSDNode>(
Addr)) {
156 if (isInt<32>(CN->getSExtValue())) {
160 CurDAG->getTargetConstant(CN->getZExtValue(),
SDLoc(
Addr), MVT::i32);
179 if (isa<FrameIndexSDNode>(
Addr))
186 if (
auto *CN = dyn_cast<ConstantSDNode>(
Addr)) {
187 if (isInt<32>(CN->getSExtValue())) {
190 CurDAG->getTargetConstant(CN->getZExtValue(),
SDLoc(
Addr), MVT::i32);
198 if (isa<FrameIndexSDNode>(
Addr))
210 if (!CurDAG->haveNoCommonBitsSet(
Addr.getOperand(0),
Addr.getOperand(1)))
226 auto AddrTy =
Addr->getValueType(0);
228 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), AddrTy);
237 if (CurDAG->isBaseWithConstantOffset(
Addr)) {
241 dyn_cast<FrameIndexSDNode>(
Addr.getOperand(0))) {
243 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), AddrTy);
255void VEDAGToDAGISel::Select(
SDNode *
N) {
257 if (
N->isMachineOpcode()) {
262 switch (
N->getOpcode()) {
266 ReplaceNode(
N,
N->getOperand(0).getNode());
271 MVT SplatResTy =
N->getSimpleValueType(0);
276 auto BConst = dyn_cast<ConstantSDNode>(
N->getOperand(0));
279 bool BCTrueMask = (BConst->getSExtValue() != 0);
286 New = CurDAG->getCopyFromReg(CurDAG->getEntryNode(),
SDLoc(
N), VE::VM0,
289 New = CurDAG->getCopyFromReg(CurDAG->getEntryNode(),
SDLoc(
N), VE::VMP0,
295 ReplaceNode(
N,
New.getNode());
300 ReplaceNode(
N, getGlobalBaseReg());
309bool VEDAGToDAGISel::SelectInlineAsmMemoryOperand(
311 std::vector<SDValue> &OutOps) {
313 switch (ConstraintID) {
316 case InlineAsm::ConstraintCode::o:
317 case InlineAsm::ConstraintCode::m:
320 if (selectADDRri(
Op, Op0, Op1)) {
321 OutOps.push_back(Op0);
322 OutOps.push_back(Op1);
326 OutOps.push_back(
Op);
327 OutOps.push_back(CurDAG->getTargetConstant(0,
SDLoc(
Op), MVT::i32));
333SDNode *VEDAGToDAGISel::getGlobalBaseReg() {
336 ->getRegister(GlobalBaseReg, TLI->getPointerTy(CurDAG->getDataLayout()))
344 return new VEDAGToDAGISelLegacy(TM);
amdgpu AMDGPU Register Bank Select
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
uint64_t getZExtValue() const
int64_t getSExtValue() const
This class represents an Operation in the Expression.
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 representing virtual and physical registers.
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.
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
virtual bool SelectInlineAsmMemoryOperand(const SDValue &Op, InlineAsm::ConstraintCode ConstraintID, std::vector< SDValue > &OutOps)
SelectInlineAsmMemoryOperand - Select the specified address as a target addressing mode,...
virtual bool runOnMachineFunction(MachineFunction &mf)
#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.
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
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.