Go to the documentation of this file.
35 #define DEBUG_TYPE "mips-isel"
44 std::pair<SDNode *, SDNode *>
46 bool HasLo,
bool HasHi) {
53 unsigned Opcode = Mips::Mflo16;
58 unsigned Opcode = Mips::Mfhi16;
61 return std::make_pair(Lo, Hi);
94 void Mips16DAGToDAGISel::processFunctionAfterISel(
MachineFunction &MF) {
95 initGlobalBaseReg(
MF);
101 EVT ValTy =
Addr.getValueType();
124 auto *CN = cast<ConstantSDNode>(
Addr.getOperand(1));
129 dyn_cast<FrameIndexSDNode>(
Addr.getOperand(0))) {
154 if (isa<ConstantPoolSDNode>(Opnd0) || isa<GlobalAddressSDNode>(Opnd0) ||
155 isa<JumpTableSDNode>(Opnd0)) {
169 return selectAddr(
false,
Addr,
Base, Offset);
174 return selectAddr(
true,
Addr,
Base, Offset);
179 bool Mips16DAGToDAGISel::trySelect(
SDNode *Node) {
180 unsigned Opcode = Node->getOpcode();
187 EVT NodeTy = Node->getValueType(0);
197 MultOpc = (Opcode ==
ISD::UMUL_LOHI ? Mips::MultuRxRy16 : Mips::MultRxRy16);
198 std::pair<SDNode *, SDNode *> LoHi =
199 selectMULT(Node, MultOpc,
DL, NodeTy,
true,
true);
200 if (!
SDValue(Node, 0).use_empty())
203 if (!
SDValue(Node, 1).use_empty())
212 MultOpc = (Opcode ==
ISD::MULHU ? Mips::MultuRxRy16 : Mips::MultRxRy16);
213 auto LoHi = selectMULT(Node, MultOpc,
DL, NodeTy,
false,
true);
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
This is an optimization pass for GlobalISel generic memory operations.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Represents one node in the SelectionDAG.
bool isBaseWithConstantOffset(SDValue Op) const
Return true if the specified operand is an ISD::ADD with a ConstantSDNode on the right-hand side,...
const MipsInstrInfo * getInstrInfo() const override
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
const MipsSubtarget * Subtarget
Keep a pointer to the MipsSubtarget around so that we can make the right decision when generating cod...
const MachineBasicBlock & front() const
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
TargetInstrInfo - Interface to description of machine instruction set.
SDValue getTargetFrameIndex(int FI, EVT VT)
@ GlobalBaseReg
The result of the mflr at function entry, used for PIC code.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
bool inMips16Mode() const
MachineRegisterInfo * RegInfo
void ReplaceNode(SDNode *F, SDNode *T)
Replace all uses of F with T, then remove F from the DAG.
@ TargetGlobalAddress
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
const MachineInstrBuilder & addExternalSymbol(const char *FnName, unsigned TargetFlags=0) const
bool isPositionIndependent() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void RemoveDeadNode(SDNode *N)
Remove the specified node from the system.
const TargetInstrInfo * TII
MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s),...
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Register getGlobalBaseReg(MachineFunction &MF)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
@ SMUL_LOHI
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
Wrapper class representing virtual and physical registers.
constexpr bool isInt< 16 >(int64_t x)
void ReplaceUses(SDValue F, SDValue T)
ReplaceUses - replace all uses of the old node F with the use of the new node T.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
@ ADD
Simple integer binary arithmetic operators.
@ MO_ABS_HI
MO_ABS_HI/LO - Represents the hi or low part of an absolute symbol address.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
@ MULHU
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
const char LLVMTargetMachineRef TM
FunctionPass class - This class is used to implement most global optimizations.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
bool globalBaseRegSet() const
FunctionPass * createMips16ISelDag(MipsTargetMachine &TM, CodeGenOpt::Level OptLevel)