55 Reg = CurDAG->getRegister(ARC::STATUS32,
MVT::i32);
60 return "ARC DAG->DAG Pattern Instruction Selection";
64 #include "ARCGenDAGISel.inc" 73 return new ARCDAGToDAGISel(TM, OptLevel);
86 bool ARCDAGToDAGISel::SelectAddrModeS9(
SDValue Addr,
SDValue &Base,
93 !CurDAG->isBaseWithConstantOffset(Addr)) {
96 int FI = cast<FrameIndexSDNode>(Addr)->getIndex();
97 Base = CurDAG->getTargetFrameIndex(
98 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
102 Offset = CurDAG->getTargetConstant(0,
SDLoc(Addr),
MVT::i32);
107 int32_t RHSC = RHS->getSExtValue();
116 int FI = cast<FrameIndexSDNode>(Base)->getIndex();
117 Base = CurDAG->getTargetFrameIndex(
118 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
120 Offset = CurDAG->getTargetConstant(RHSC,
SDLoc(Addr),
MVT::i32);
124 Offset = CurDAG->getTargetConstant(0,
SDLoc(Addr),
MVT::i32);
128 bool ARCDAGToDAGISel::SelectAddrModeFar(
SDValue Addr,
SDValue &Base,
130 if (SelectAddrModeS9(Addr, Base, Offset))
136 int32_t RHSC = RHS->getSExtValue();
140 Offset = CurDAG->getTargetConstant(RHSC,
SDLoc(Addr),
MVT::i32);
147 bool ARCDAGToDAGISel::SelectFrameADDR_ri(
SDValue Addr,
SDValue &Base,
150 if ((FIN = dyn_cast<FrameIndexSDNode>(Addr))) {
152 Offset = CurDAG->getTargetConstant(0,
SDLoc(Addr),
MVT::i32);
157 if ((FIN = dyn_cast<FrameIndexSDNode>(Addr.
getOperand(0))) &&
173 uint64_t CVal = cast<ConstantSDNode>(
N)->getZExtValue();
174 ReplaceNode(N, CurDAG->getMachineNode(
175 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.