14 #define DEBUG_TYPE "mips-isel"
44 std::pair<SDNode*, SDNode*>
45 Mips16DAGToDAGISel::selectMULT(
SDNode *
N,
unsigned Opc,
SDLoc DL,
EVT Ty,
46 bool HasLo,
bool HasHi) {
53 unsigned Opcode = Mips::Mflo16;
58 unsigned Opcode = Mips::Mfhi16;
61 return std::make_pair(Lo,
Hi);
83 BuildMI(MBB, I, DL, TII.
get(Mips::GotPrologue16), V0).
108 BuildMI(MBB, I, DL, TII.
get(Mips::MoveR3216), Mips16SPAliasReg)
112 void Mips16DAGToDAGISel::processFunctionAfterISel(
MachineFunction &MF) {
113 initGlobalBaseReg(MF);
114 initMips16SPAliasReg(MF);
119 SDValue Mips16DAGToDAGISel::getMips16SPAliasReg() {
120 unsigned Mips16SPAliasReg =
126 void Mips16DAGToDAGISel::getMips16SPRefReg(
SDNode *Parent,
SDValue &AliasReg) {
137 AliasFPReg: getMips16SPAliasReg();
148 AliasFPReg: getMips16SPAliasReg();
160 bool Mips16DAGToDAGISel::selectAddr16(
171 getMips16SPRefReg(Parent, Alias);
194 getMips16SPRefReg(Parent, Alias);
216 if (isa<ConstantPoolSDNode>(Opnd0) || isa<GlobalAddressSDNode>(Opnd0) ||
217 isa<JumpTableSDNode>(Opnd0)) {
239 std::pair<bool, SDNode*> Mips16DAGToDAGISel::selectNode(
SDNode *Node) {
256 unsigned Opc = InFlag.
getOpcode(); (void)Opc;
259 "(ADD|SUB)E flag operand must come from (ADD|SUB)C/E insn");
264 MOp = Mips::AdduRxRyRz16;
267 MOp = Mips::SubuRxRyRz16;
277 unsigned Sltu_op = Mips::SltuRxRyRz16;
279 unsigned Addu_op = Mips::AdduRxRyRz16;
285 return std::make_pair(
true, Result);
291 MultOpc = (Opcode ==
ISD::UMUL_LOHI ? Mips::MultuRxRy16 : Mips::MultRxRy16);
292 std::pair<SDNode*, SDNode*> LoHi = selectMULT(Node, MultOpc, DL, NodeTy,
294 if (!
SDValue(Node, 0).use_empty())
297 if (!
SDValue(Node, 1).use_empty())
300 return std::make_pair(
true, (
SDNode*)NULL);
305 MultOpc = (Opcode ==
ISD::MULHU ? Mips::MultuRxRy16 : Mips::MultRxRy16);
306 SDNode *Result = selectMULT(Node, MultOpc, DL, NodeTy,
false,
true).second;
307 return std::make_pair(
true, Result);
311 return std::make_pair(
false, (
SDNode*)NULL);
SDValue getValue(unsigned R) const
Reloc::Model getRelocationModel() const
void ReplaceUses(SDValue F, SDValue T)
unsigned createVirtualRegister(const TargetRegisterClass *RegClass)
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getOpcode() const
const SDValue & getOperand(unsigned Num) const
const HexagonInstrInfo * TII
bool mips16SPAliasRegSet() const
virtual bool hasFP(const MachineFunction &MF) const =0
EVT getValueType(unsigned ResNo) const
const TargetLowering * getTargetLowering() const
const MachineInstrBuilder & addImm(int64_t Val) const
const MachineBasicBlock & front() const
SDValue getTargetFrameIndex(int FI, EVT VT)
Simple integer binary arithmetic operators.
EVT getMemoryVT() const
getMemoryVT - Return the type of the in-memory value.
MachineRegisterInfo * RegInfo
bundle_iterator< MachineInstr, instr_iterator > iterator
const SDValue & getOperand(unsigned i) const
unsigned getOpcode() const
bool inMips16Mode() const
MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL, const MCInstrDesc &MCID)
virtual const TargetFrameLowering * getFrameLowering() const
const MCInstrDesc & get(unsigned Opcode) const
virtual bool runOnMachineFunction(MachineFunction &MF)
virtual const TargetInstrInfo * getInstrInfo() const
bool isBaseWithConstantOffset(SDValue Op) const
unsigned getGlobalBaseReg()
SDNode * SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT)
int64_t getSExtValue() const
MachineRegisterInfo & getRegInfo()
unsigned getMips16SPAliasReg()
unsigned getSizeInBits() const
getSizeInBits - Return the size of the specified value type in bits.
const TargetMachine & getTarget() const
MachineSDNode * getMachineNode(unsigned Opcode, SDLoc dl, EVT VT)
bool isInt< 16 >(int64_t x)
bool globalBaseRegSet() const
const MipsSubtarget & Subtarget
SDValue getRegister(unsigned Reg, EVT VT)
SDValue getTargetConstant(uint64_t Val, EVT VT)
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
FunctionPass * createMips16ISelDag(MipsTargetMachine &TM)
uint64_t getZExtValue() const