52 bool SelectInlineAsmMemoryOperand(
const SDValue &Op,
53 unsigned ConstraintID,
54 std::vector<SDValue> &OutOps)
override;
56 const char *getPassName()
const override {
57 return "SPARC DAG->DAG Pattern Instruction Selection";
61 #include "SparcGenDAGISel.inc"
64 SDNode* getGlobalBaseReg();
68 SDNode* SparcDAGToDAGISel::getGlobalBaseReg() {
69 unsigned GlobalBaseReg = Subtarget->getInstrInfo()->getGlobalBaseReg(MF);
70 return CurDAG->getRegister(GlobalBaseReg,
71 TLI->getPointerTy(CurDAG->getDataLayout()))
75 bool SparcDAGToDAGISel::SelectADDRri(
SDValue Addr,
78 Base = CurDAG->getTargetFrameIndex(
79 FIN->getIndex(), TLI->getPointerTy(CurDAG->getDataLayout()));
90 if (isInt<13>(CN->getSExtValue())) {
92 dyn_cast<FrameIndexSDNode>(Addr.
getOperand(0))) {
94 Base = CurDAG->getTargetFrameIndex(
95 FIN->getIndex(), TLI->getPointerTy(CurDAG->getDataLayout()));
99 Offset = CurDAG->getTargetConstant(CN->getZExtValue(),
SDLoc(Addr),
116 Offset = CurDAG->getTargetConstant(0,
SDLoc(Addr),
MVT::i32);
129 if (isInt<13>(CN->getSExtValue()))
140 R2 = CurDAG->getRegister(SP::G0, TLI->getPointerTy(CurDAG->getDataLayout()));
154 return getGlobalBaseReg();
168 TopPart =
SDValue(CurDAG->getMachineNode(SP::SRAri, dl,
MVT::i32, DivLHS,
169 CurDAG->getTargetConstant(31, dl,
MVT::i32)),
172 TopPart = CurDAG->getRegister(SP::G0,
MVT::i32);
174 TopPart = CurDAG->getCopyToReg(CurDAG->getEntryNode(), dl,
SP::Y, TopPart,
180 return CurDAG->SelectNodeTo(N, Opcode,
MVT::i32, DivLHS, DivRHS,
192 ReplaceUses(
SDValue(N, 0), ResultHigh);
197 return SelectCode(N);
204 SparcDAGToDAGISel::SelectInlineAsmMemoryOperand(
const SDValue &Op,
205 unsigned ConstraintID,
206 std::vector<SDValue> &OutOps) {
208 switch (ConstraintID) {
209 default:
return true;
212 if (!SelectADDRrr(Op, Op0, Op1))
213 SelectADDRri(Op, Op0, Op1);
217 OutOps.push_back(Op0);
218 OutOps.push_back(Op1);
226 return new SparcDAGToDAGISel(TM);
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
const SDValue & getOperand(unsigned Num) const
void setNodeId(int Id)
Set unique node id.
GlobalBaseReg - On Darwin, this node represents the result of the mflr at function entry...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
Simple integer binary arithmetic operators.
const SDValue & getOperand(unsigned i) const
unsigned getOpcode() const
FunctionPass class - This class is used to implement most global optimizations.
FunctionPass * createSparcISelDag(SparcTargetMachine &TM)
createSparcISelDag - This pass converts a legalized DAG into a SPARC-specific DAG, ready for instruction scheduling.
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...
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...