49 inline SDValue getI32Imm(
unsigned Imm,
const SDLoc &dl) {
50 return CurDAG->getTargetConstant(Imm, dl,
MVT::i32);
53 inline bool immMskBitp(
SDNode *inN)
const {
60 return (msksize >= 1 && msksize <= 8) ||
61 msksize == 16 || msksize == 24 || msksize == 32;
67 bool SelectInlineAsmMemoryOperand(
const SDValue &
Op,
unsigned ConstraintID,
68 std::vector<SDValue> &OutOps)
override;
71 return "XCore DAG->DAG Pattern Instruction Selection";
75 #include "XCoreGenDAGISel.inc" 84 return new XCoreDAGToDAGISel(TM, OptLevel);
90 if ((FIN = dyn_cast<FrameIndexSDNode>(Addr))) {
97 if ((FIN = dyn_cast<FrameIndexSDNode>(Addr.
getOperand(0)))
110 bool XCoreDAGToDAGISel::
111 SelectInlineAsmMemoryOperand(
const SDValue &
Op,
unsigned ConstraintID,
112 std::vector<SDValue> &OutOps) {
114 switch (ConstraintID) {
115 default:
return true;
118 default:
return true;
123 Reg = CurDAG->getRegister(XCore::DP,
MVT::i32);
127 OutOps.push_back(Reg);
137 uint64_t Val = cast<ConstantSDNode>(
N)->getZExtValue();
142 ReplaceNode(N, CurDAG->getMachineNode(XCore::MKMSK_rus, dl,
147 SDValue CPIdx = CurDAG->getTargetConstantPool(
149 getTargetLowering()->getPointerTy(CurDAG->getDataLayout()));
150 SDNode *node = CurDAG->getMachineNode(XCore::LDWCP_lru6, dl,
MVT::i32,
152 CurDAG->getEntryNode());
156 CurDAG->setNodeMemRefs(cast<MachineSDNode>(node), {MemOp});
157 ReplaceNode(N, node);
165 ReplaceNode(N, CurDAG->getMachineNode(XCore::LADD_l5r, dl,
MVT::i32,
172 ReplaceNode(N, CurDAG->getMachineNode(XCore::LSUB_l5r, dl,
MVT::i32,
179 ReplaceNode(N, CurDAG->getMachineNode(XCore::MACCU_l4r, dl,
MVT::i32,
186 ReplaceNode(N, CurDAG->getMachineNode(XCore::MACCS_l4r, dl,
MVT::i32,
193 ReplaceNode(N, CurDAG->getMachineNode(XCore::LMUL_l6r, dl,
MVT::i32,
199 ReplaceNode(N, CurDAG->getMachineNode(XCore::CRC8_l4r, dl,
MVT::i32,
238 bool XCoreDAGToDAGISel::tryBRIND(
SDNode *N) {
245 unsigned IntNo = cast<ConstantSDNode>(Addr->
getOperand(1))->getZExtValue();
250 if (!CheckEventChainOut.use_empty()) {
266 SDValue constOne = getI32Imm(1, dl);
269 constOne, Chain), 0);
275 CurDAG->SelectNodeTo(N, XCore::BRFU_lu6,
MVT::Other,
279 CurDAG->SelectNodeTo(N, XCore::BAU_1r,
MVT::Other, nextAddr, Glue);
static SDValue replaceInChain(SelectionDAG *CurDAG, SDValue Chain, SDValue Old, SDValue New)
Given a chain return a new chain where any appearance of Old is replaced by New.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
This class represents lattice values for constants.
void push_back(const T &Elt)
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
std::size_t countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
constexpr bool isMask_32(uint32_t Value)
Return true if the argument is a non-empty sequence of ones starting at the least significant bit wit...
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
A description of a memory reference used in the backend.
int64_t getSExtValue() const
Simple integer binary arithmetic operators.
FunctionPass * createXCoreISelDag(XCoreTargetMachine &TM, CodeGenOpt::Level OptLevel)
createXCoreISelDag - This pass converts a legalized DAG into a XCore-specific DAG, ready for instruction scheduling.
const SDValue & getOperand(unsigned Num) const
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.
unsigned getNumOperands() const
Return the number of values used by this operation.
TokenFactor - This node takes multiple tokens as input and produces a single token result...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Represents one node in the SelectionDAG.
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
The memory access reads data.
static IntegerType * getInt32Ty(LLVMContext &C)
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
constexpr bool isUInt< 16 >(uint64_t x)
static MachinePointerInfo getConstantPool(MachineFunction &MF)
Return a MachinePointerInfo record that refers to the constant pool.
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.