19#define DEBUG_TYPE "ve-isel"
20#define PASS_NAME "VE DAG->DAG Pattern Instruction Selection"
33 VEDAGToDAGISel() =
delete;
56 std::vector<SDValue> &OutOps)
override;
59#include "VEGenDAGISel.inc"
62 SDNode *getGlobalBaseReg();
76char VEDAGToDAGISelLegacy::ID = 0;
90 if (matchADDRri(
Addr, LHS, RHS)) {
91 if (matchADDRrr(LHS,
Base, Index)) {
98 if (matchADDRrr(
Addr, LHS, RHS)) {
104 if (isa<FrameIndexSDNode>(RHS))
107 if (matchADDRri(RHS, Index,
Offset)) {
144 if (isa<FrameIndexSDNode>(
Addr))
151 if (
auto *CN = dyn_cast<ConstantSDNode>(
Addr)) {
152 if (isInt<32>(CN->getSExtValue())) {
156 CurDAG->getTargetConstant(CN->getZExtValue(),
SDLoc(
Addr), MVT::i32);
175 if (isa<FrameIndexSDNode>(
Addr))
182 if (
auto *CN = dyn_cast<ConstantSDNode>(
Addr)) {
183 if (isInt<32>(CN->getSExtValue())) {
186 CurDAG->getTargetConstant(CN->getZExtValue(),
SDLoc(
Addr), MVT::i32);
194 if (isa<FrameIndexSDNode>(
Addr))
206 if (!CurDAG->haveNoCommonBitsSet(
Addr.getOperand(0),
Addr.getOperand(1)))
222 auto AddrTy =
Addr->getValueType(0);
224 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), AddrTy);
233 if (CurDAG->isBaseWithConstantOffset(
Addr)) {
237 dyn_cast<FrameIndexSDNode>(
Addr.getOperand(0))) {
239 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), AddrTy);
251void VEDAGToDAGISel::Select(
SDNode *
N) {
253 if (
N->isMachineOpcode()) {
258 switch (
N->getOpcode()) {
262 ReplaceNode(
N,
N->getOperand(0).getNode());
267 MVT SplatResTy =
N->getSimpleValueType(0);
272 auto BConst = dyn_cast<ConstantSDNode>(
N->getOperand(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
#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.