35#define DEBUG_TYPE "mips-isel"
44std::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);
78 V0 =
RegInfo.createVirtualRegister(RC);
79 V1 =
RegInfo.createVirtualRegister(RC);
95 initGlobalBaseReg(
MF);
101 EVT ValTy =
Addr.getValueType();
124 auto *CN = cast<ConstantSDNode>(
Addr.getOperand(1));
125 if (isInt<16>(CN->getSExtValue())) {
129 dyn_cast<FrameIndexSDNode>(
Addr.getOperand(0))) {
154 if (isa<ConstantPoolSDNode>(Opnd0) || isa<GlobalAddressSDNode>(Opnd0) ||
155 isa<JumpTableSDNode>(Opnd0)) {
179bool 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);
212 MultOpc = (Opcode ==
ISD::MULHU ? Mips::MultuRxRy16 : Mips::MultRxRy16);
213 auto LoHi = selectMULT(
Node, MultOpc,
DL, NodeTy,
false,
true);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
FunctionPass class - This class is used to implement most global optimizations.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const MachineBasicBlock & front() const
const MachineInstrBuilder & addExternalSymbol(const char *FnName, unsigned TargetFlags=0) const
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Mips16DAGToDAGISelLegacy(MipsTargetMachine &TM, CodeGenOptLevel OL)
bool runOnMachineFunction(MachineFunction &MF) override
const MipsSubtarget * Subtarget
Keep a pointer to the MipsSubtarget around so that we can make the right decision when generating cod...
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
Register getGlobalBaseReg(MachineFunction &MF)
bool globalBaseRegSet() const
const MipsInstrInfo * getInstrInfo() const override
bool inMips16Mode() const
Wrapper class representing virtual and physical registers.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
const TargetInstrInfo * TII
void ReplaceUses(SDValue F, SDValue T)
ReplaceUses - replace all uses of the old node F with the use of the new node T.
void ReplaceNode(SDNode *F, SDNode *T)
Replace all uses of F with T, then remove F from the DAG.
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),...
SDValue getTargetFrameIndex(int FI, EVT VT)
void RemoveDeadNode(SDNode *N)
Remove the specified node from the system.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
bool isBaseWithConstantOffset(SDValue Op) const
Return true if the specified operand is an ISD::ADD with a ConstantSDNode on the right-hand side,...
TargetInstrInfo - Interface to description of machine instruction set.
bool isPositionIndependent() const
@ SMUL_LOHI
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
@ ADD
Simple integer binary arithmetic operators.
@ TargetGlobalAddress
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
@ MULHU
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
@ MO_ABS_HI
MO_ABS_HI/LO - Represents the hi or low part of an absolute symbol address.
@ GlobalBaseReg
The result of the mflr at function entry, used for PIC code.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
CodeGenOptLevel
Code generation optimization level.
@ Mul
Product of integers.
FunctionPass * createMips16ISelDag(MipsTargetMachine &TM, CodeGenOptLevel OptLevel)
Implement std::hash so that hash_code can be used in STL containers.