54 Reg = CurDAG->getRegister(ARC::STATUS32,
MVT::i32);
59 return "ARC DAG->DAG Pattern Instruction Selection";
63 #include "ARCGenDAGISel.inc" 72 return new ARCDAGToDAGISel(TM, OptLevel);
85 bool ARCDAGToDAGISel::SelectAddrModeS9(
SDValue Addr,
SDValue &Base,
92 !CurDAG->isBaseWithConstantOffset(Addr)) {
95 int FI = cast<FrameIndexSDNode>(Addr)->getIndex();
96 Base = CurDAG->getTargetFrameIndex(
97 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
101 Offset = CurDAG->getTargetConstant(0,
SDLoc(Addr),
MVT::i32);
106 int32_t RHSC = RHS->getSExtValue();
115 int FI = cast<FrameIndexSDNode>(Base)->getIndex();
116 Base = CurDAG->getTargetFrameIndex(
117 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
119 Offset = CurDAG->getTargetConstant(RHSC,
SDLoc(Addr),
MVT::i32);
123 Offset = CurDAG->getTargetConstant(0,
SDLoc(Addr),
MVT::i32);
127 bool ARCDAGToDAGISel::SelectAddrModeFar(
SDValue Addr,
SDValue &Base,
129 if (SelectAddrModeS9(Addr, Base, Offset))
135 int32_t RHSC = RHS->getSExtValue();
139 Offset = CurDAG->getTargetConstant(RHSC,
SDLoc(Addr),
MVT::i32);
146 bool ARCDAGToDAGISel::SelectFrameADDR_ri(
SDValue Addr,
SDValue &Base,
149 if ((FIN = dyn_cast<FrameIndexSDNode>(Addr))) {
151 Offset = CurDAG->getTargetConstant(0,
SDLoc(Addr),
MVT::i32);
156 if ((FIN = dyn_cast<FrameIndexSDNode>(Addr.
getOperand(0))) &&
172 uint64_t CVal = cast<ConstantSDNode>(
N)->getZExtValue();
173 ReplaceNode(N, CurDAG->getMachineNode(
174 isInt<12>(CVal) ? ARC::MOV_rs12 : ARC::MOV_rlimm,
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
This class represents lattice values for constants.
FunctionPass * createARCISelDag(ARCTargetMachine &TM, CodeGenOpt::Level OptLevel)
This pass converts a legalized DAG into a ARC-specific DAG, ready for instruction scheduling...
int64_t getSExtValue() const
Simple integer binary arithmetic operators.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
FunctionPass class - This class is used to implement most global optimizations.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getOpcode() const
StringRef - Represent a constant reference to a string, i.e.
const SDValue & getOperand(unsigned i) const
uint64_t getZExtValue() const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
This file describes how to lower LLVM code to machine code.