1*9880d681SAndroid Build Coastguard Worker //===-- MipsISelLowering.h - Mips DAG Lowering Interface --------*- C++ -*-===// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker // 10*9880d681SAndroid Build Coastguard Worker // This file defines the interfaces that Mips uses to lower LLVM code into a 11*9880d681SAndroid Build Coastguard Worker // selection DAG. 12*9880d681SAndroid Build Coastguard Worker // 13*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H 16*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker #include "MCTargetDesc/MipsABIInfo.h" 19*9880d681SAndroid Build Coastguard Worker #include "MCTargetDesc/MipsBaseInfo.h" 20*9880d681SAndroid Build Coastguard Worker #include "Mips.h" 21*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/CallingConvLower.h" 22*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/SelectionDAG.h" 23*9880d681SAndroid Build Coastguard Worker #include "llvm/IR/Function.h" 24*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetLowering.h" 25*9880d681SAndroid Build Coastguard Worker #include <deque> 26*9880d681SAndroid Build Coastguard Worker #include <string> 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Worker namespace llvm { 29*9880d681SAndroid Build Coastguard Worker namespace MipsISD { 30*9880d681SAndroid Build Coastguard Worker enum NodeType : unsigned { 31*9880d681SAndroid Build Coastguard Worker // Start the numbering from where ISD NodeType finishes. 32*9880d681SAndroid Build Coastguard Worker FIRST_NUMBER = ISD::BUILTIN_OP_END, 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Worker // Jump and link (call) 35*9880d681SAndroid Build Coastguard Worker JmpLink, 36*9880d681SAndroid Build Coastguard Worker 37*9880d681SAndroid Build Coastguard Worker // Tail call 38*9880d681SAndroid Build Coastguard Worker TailCall, 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker // Get the Higher 16 bits from a 32-bit immediate 41*9880d681SAndroid Build Coastguard Worker // No relation with Mips Hi register 42*9880d681SAndroid Build Coastguard Worker Hi, 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Worker // Get the Lower 16 bits from a 32-bit immediate 45*9880d681SAndroid Build Coastguard Worker // No relation with Mips Lo register 46*9880d681SAndroid Build Coastguard Worker Lo, 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Worker // Handle gp_rel (small data/bss sections) relocation. 49*9880d681SAndroid Build Coastguard Worker GPRel, 50*9880d681SAndroid Build Coastguard Worker 51*9880d681SAndroid Build Coastguard Worker // Thread Pointer 52*9880d681SAndroid Build Coastguard Worker ThreadPointer, 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard Worker // Floating Point Branch Conditional 55*9880d681SAndroid Build Coastguard Worker FPBrcond, 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Worker // Floating Point Compare 58*9880d681SAndroid Build Coastguard Worker FPCmp, 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Worker // Floating Point Conditional Moves 61*9880d681SAndroid Build Coastguard Worker CMovFP_T, 62*9880d681SAndroid Build Coastguard Worker CMovFP_F, 63*9880d681SAndroid Build Coastguard Worker 64*9880d681SAndroid Build Coastguard Worker // FP-to-int truncation node. 65*9880d681SAndroid Build Coastguard Worker TruncIntFP, 66*9880d681SAndroid Build Coastguard Worker 67*9880d681SAndroid Build Coastguard Worker // Return 68*9880d681SAndroid Build Coastguard Worker Ret, 69*9880d681SAndroid Build Coastguard Worker 70*9880d681SAndroid Build Coastguard Worker // Interrupt, exception, error trap Return 71*9880d681SAndroid Build Coastguard Worker ERet, 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Worker // Software Exception Return. 74*9880d681SAndroid Build Coastguard Worker EH_RETURN, 75*9880d681SAndroid Build Coastguard Worker 76*9880d681SAndroid Build Coastguard Worker // Node used to extract integer from accumulator. 77*9880d681SAndroid Build Coastguard Worker MFHI, 78*9880d681SAndroid Build Coastguard Worker MFLO, 79*9880d681SAndroid Build Coastguard Worker 80*9880d681SAndroid Build Coastguard Worker // Node used to insert integers to accumulator. 81*9880d681SAndroid Build Coastguard Worker MTLOHI, 82*9880d681SAndroid Build Coastguard Worker 83*9880d681SAndroid Build Coastguard Worker // Mult nodes. 84*9880d681SAndroid Build Coastguard Worker Mult, 85*9880d681SAndroid Build Coastguard Worker Multu, 86*9880d681SAndroid Build Coastguard Worker 87*9880d681SAndroid Build Coastguard Worker // MAdd/Sub nodes 88*9880d681SAndroid Build Coastguard Worker MAdd, 89*9880d681SAndroid Build Coastguard Worker MAddu, 90*9880d681SAndroid Build Coastguard Worker MSub, 91*9880d681SAndroid Build Coastguard Worker MSubu, 92*9880d681SAndroid Build Coastguard Worker 93*9880d681SAndroid Build Coastguard Worker // DivRem(u) 94*9880d681SAndroid Build Coastguard Worker DivRem, 95*9880d681SAndroid Build Coastguard Worker DivRemU, 96*9880d681SAndroid Build Coastguard Worker DivRem16, 97*9880d681SAndroid Build Coastguard Worker DivRemU16, 98*9880d681SAndroid Build Coastguard Worker 99*9880d681SAndroid Build Coastguard Worker BuildPairF64, 100*9880d681SAndroid Build Coastguard Worker ExtractElementF64, 101*9880d681SAndroid Build Coastguard Worker 102*9880d681SAndroid Build Coastguard Worker Wrapper, 103*9880d681SAndroid Build Coastguard Worker 104*9880d681SAndroid Build Coastguard Worker DynAlloc, 105*9880d681SAndroid Build Coastguard Worker 106*9880d681SAndroid Build Coastguard Worker Sync, 107*9880d681SAndroid Build Coastguard Worker 108*9880d681SAndroid Build Coastguard Worker Ext, 109*9880d681SAndroid Build Coastguard Worker Ins, 110*9880d681SAndroid Build Coastguard Worker 111*9880d681SAndroid Build Coastguard Worker // EXTR.W instrinsic nodes. 112*9880d681SAndroid Build Coastguard Worker EXTP, 113*9880d681SAndroid Build Coastguard Worker EXTPDP, 114*9880d681SAndroid Build Coastguard Worker EXTR_S_H, 115*9880d681SAndroid Build Coastguard Worker EXTR_W, 116*9880d681SAndroid Build Coastguard Worker EXTR_R_W, 117*9880d681SAndroid Build Coastguard Worker EXTR_RS_W, 118*9880d681SAndroid Build Coastguard Worker SHILO, 119*9880d681SAndroid Build Coastguard Worker MTHLIP, 120*9880d681SAndroid Build Coastguard Worker 121*9880d681SAndroid Build Coastguard Worker // DPA.W intrinsic nodes. 122*9880d681SAndroid Build Coastguard Worker MULSAQ_S_W_PH, 123*9880d681SAndroid Build Coastguard Worker MAQ_S_W_PHL, 124*9880d681SAndroid Build Coastguard Worker MAQ_S_W_PHR, 125*9880d681SAndroid Build Coastguard Worker MAQ_SA_W_PHL, 126*9880d681SAndroid Build Coastguard Worker MAQ_SA_W_PHR, 127*9880d681SAndroid Build Coastguard Worker DPAU_H_QBL, 128*9880d681SAndroid Build Coastguard Worker DPAU_H_QBR, 129*9880d681SAndroid Build Coastguard Worker DPSU_H_QBL, 130*9880d681SAndroid Build Coastguard Worker DPSU_H_QBR, 131*9880d681SAndroid Build Coastguard Worker DPAQ_S_W_PH, 132*9880d681SAndroid Build Coastguard Worker DPSQ_S_W_PH, 133*9880d681SAndroid Build Coastguard Worker DPAQ_SA_L_W, 134*9880d681SAndroid Build Coastguard Worker DPSQ_SA_L_W, 135*9880d681SAndroid Build Coastguard Worker DPA_W_PH, 136*9880d681SAndroid Build Coastguard Worker DPS_W_PH, 137*9880d681SAndroid Build Coastguard Worker DPAQX_S_W_PH, 138*9880d681SAndroid Build Coastguard Worker DPAQX_SA_W_PH, 139*9880d681SAndroid Build Coastguard Worker DPAX_W_PH, 140*9880d681SAndroid Build Coastguard Worker DPSX_W_PH, 141*9880d681SAndroid Build Coastguard Worker DPSQX_S_W_PH, 142*9880d681SAndroid Build Coastguard Worker DPSQX_SA_W_PH, 143*9880d681SAndroid Build Coastguard Worker MULSA_W_PH, 144*9880d681SAndroid Build Coastguard Worker 145*9880d681SAndroid Build Coastguard Worker MULT, 146*9880d681SAndroid Build Coastguard Worker MULTU, 147*9880d681SAndroid Build Coastguard Worker MADD_DSP, 148*9880d681SAndroid Build Coastguard Worker MADDU_DSP, 149*9880d681SAndroid Build Coastguard Worker MSUB_DSP, 150*9880d681SAndroid Build Coastguard Worker MSUBU_DSP, 151*9880d681SAndroid Build Coastguard Worker 152*9880d681SAndroid Build Coastguard Worker // DSP shift nodes. 153*9880d681SAndroid Build Coastguard Worker SHLL_DSP, 154*9880d681SAndroid Build Coastguard Worker SHRA_DSP, 155*9880d681SAndroid Build Coastguard Worker SHRL_DSP, 156*9880d681SAndroid Build Coastguard Worker 157*9880d681SAndroid Build Coastguard Worker // DSP setcc and select_cc nodes. 158*9880d681SAndroid Build Coastguard Worker SETCC_DSP, 159*9880d681SAndroid Build Coastguard Worker SELECT_CC_DSP, 160*9880d681SAndroid Build Coastguard Worker 161*9880d681SAndroid Build Coastguard Worker // Vector comparisons. 162*9880d681SAndroid Build Coastguard Worker // These take a vector and return a boolean. 163*9880d681SAndroid Build Coastguard Worker VALL_ZERO, 164*9880d681SAndroid Build Coastguard Worker VANY_ZERO, 165*9880d681SAndroid Build Coastguard Worker VALL_NONZERO, 166*9880d681SAndroid Build Coastguard Worker VANY_NONZERO, 167*9880d681SAndroid Build Coastguard Worker 168*9880d681SAndroid Build Coastguard Worker // These take a vector and return a vector bitmask. 169*9880d681SAndroid Build Coastguard Worker VCEQ, 170*9880d681SAndroid Build Coastguard Worker VCLE_S, 171*9880d681SAndroid Build Coastguard Worker VCLE_U, 172*9880d681SAndroid Build Coastguard Worker VCLT_S, 173*9880d681SAndroid Build Coastguard Worker VCLT_U, 174*9880d681SAndroid Build Coastguard Worker 175*9880d681SAndroid Build Coastguard Worker // Element-wise vector max/min. 176*9880d681SAndroid Build Coastguard Worker VSMAX, 177*9880d681SAndroid Build Coastguard Worker VSMIN, 178*9880d681SAndroid Build Coastguard Worker VUMAX, 179*9880d681SAndroid Build Coastguard Worker VUMIN, 180*9880d681SAndroid Build Coastguard Worker 181*9880d681SAndroid Build Coastguard Worker // Vector Shuffle with mask as an operand 182*9880d681SAndroid Build Coastguard Worker VSHF, // Generic shuffle 183*9880d681SAndroid Build Coastguard Worker SHF, // 4-element set shuffle. 184*9880d681SAndroid Build Coastguard Worker ILVEV, // Interleave even elements 185*9880d681SAndroid Build Coastguard Worker ILVOD, // Interleave odd elements 186*9880d681SAndroid Build Coastguard Worker ILVL, // Interleave left elements 187*9880d681SAndroid Build Coastguard Worker ILVR, // Interleave right elements 188*9880d681SAndroid Build Coastguard Worker PCKEV, // Pack even elements 189*9880d681SAndroid Build Coastguard Worker PCKOD, // Pack odd elements 190*9880d681SAndroid Build Coastguard Worker 191*9880d681SAndroid Build Coastguard Worker // Vector Lane Copy 192*9880d681SAndroid Build Coastguard Worker INSVE, // Copy element from one vector to another 193*9880d681SAndroid Build Coastguard Worker 194*9880d681SAndroid Build Coastguard Worker // Combined (XOR (OR $a, $b), -1) 195*9880d681SAndroid Build Coastguard Worker VNOR, 196*9880d681SAndroid Build Coastguard Worker 197*9880d681SAndroid Build Coastguard Worker // Extended vector element extraction 198*9880d681SAndroid Build Coastguard Worker VEXTRACT_SEXT_ELT, 199*9880d681SAndroid Build Coastguard Worker VEXTRACT_ZEXT_ELT, 200*9880d681SAndroid Build Coastguard Worker 201*9880d681SAndroid Build Coastguard Worker // Load/Store Left/Right nodes. 202*9880d681SAndroid Build Coastguard Worker LWL = ISD::FIRST_TARGET_MEMORY_OPCODE, 203*9880d681SAndroid Build Coastguard Worker LWR, 204*9880d681SAndroid Build Coastguard Worker SWL, 205*9880d681SAndroid Build Coastguard Worker SWR, 206*9880d681SAndroid Build Coastguard Worker LDL, 207*9880d681SAndroid Build Coastguard Worker LDR, 208*9880d681SAndroid Build Coastguard Worker SDL, 209*9880d681SAndroid Build Coastguard Worker SDR 210*9880d681SAndroid Build Coastguard Worker }; 211*9880d681SAndroid Build Coastguard Worker } 212*9880d681SAndroid Build Coastguard Worker 213*9880d681SAndroid Build Coastguard Worker //===--------------------------------------------------------------------===// 214*9880d681SAndroid Build Coastguard Worker // TargetLowering Implementation 215*9880d681SAndroid Build Coastguard Worker //===--------------------------------------------------------------------===// 216*9880d681SAndroid Build Coastguard Worker class MipsFunctionInfo; 217*9880d681SAndroid Build Coastguard Worker class MipsSubtarget; 218*9880d681SAndroid Build Coastguard Worker class MipsCCState; 219*9880d681SAndroid Build Coastguard Worker 220*9880d681SAndroid Build Coastguard Worker class MipsTargetLowering : public TargetLowering { 221*9880d681SAndroid Build Coastguard Worker bool isMicroMips; 222*9880d681SAndroid Build Coastguard Worker public: 223*9880d681SAndroid Build Coastguard Worker explicit MipsTargetLowering(const MipsTargetMachine &TM, 224*9880d681SAndroid Build Coastguard Worker const MipsSubtarget &STI); 225*9880d681SAndroid Build Coastguard Worker 226*9880d681SAndroid Build Coastguard Worker static const MipsTargetLowering *create(const MipsTargetMachine &TM, 227*9880d681SAndroid Build Coastguard Worker const MipsSubtarget &STI); 228*9880d681SAndroid Build Coastguard Worker 229*9880d681SAndroid Build Coastguard Worker /// createFastISel - This method returns a target specific FastISel object, 230*9880d681SAndroid Build Coastguard Worker /// or null if the target does not support "fast" ISel. 231*9880d681SAndroid Build Coastguard Worker FastISel *createFastISel(FunctionLoweringInfo &funcInfo, 232*9880d681SAndroid Build Coastguard Worker const TargetLibraryInfo *libInfo) const override; 233*9880d681SAndroid Build Coastguard Worker getScalarShiftAmountTy(const DataLayout &,EVT)234*9880d681SAndroid Build Coastguard Worker MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override { 235*9880d681SAndroid Build Coastguard Worker return MVT::i32; 236*9880d681SAndroid Build Coastguard Worker } 237*9880d681SAndroid Build Coastguard Worker 238*9880d681SAndroid Build Coastguard Worker bool isCheapToSpeculateCttz() const override; 239*9880d681SAndroid Build Coastguard Worker bool isCheapToSpeculateCtlz() const override; 240*9880d681SAndroid Build Coastguard Worker getExtendForAtomicOps()241*9880d681SAndroid Build Coastguard Worker ISD::NodeType getExtendForAtomicOps() const override { 242*9880d681SAndroid Build Coastguard Worker return ISD::SIGN_EXTEND; 243*9880d681SAndroid Build Coastguard Worker } 244*9880d681SAndroid Build Coastguard Worker 245*9880d681SAndroid Build Coastguard Worker void LowerOperationWrapper(SDNode *N, 246*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &Results, 247*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 248*9880d681SAndroid Build Coastguard Worker 249*9880d681SAndroid Build Coastguard Worker /// LowerOperation - Provide custom lowering hooks for some operations. 250*9880d681SAndroid Build Coastguard Worker SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; 251*9880d681SAndroid Build Coastguard Worker 252*9880d681SAndroid Build Coastguard Worker /// ReplaceNodeResults - Replace the results of node with an illegal result 253*9880d681SAndroid Build Coastguard Worker /// type with new values built out of custom code. 254*9880d681SAndroid Build Coastguard Worker /// 255*9880d681SAndroid Build Coastguard Worker void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results, 256*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 257*9880d681SAndroid Build Coastguard Worker 258*9880d681SAndroid Build Coastguard Worker /// getTargetNodeName - This method returns the name of a target specific 259*9880d681SAndroid Build Coastguard Worker // DAG node. 260*9880d681SAndroid Build Coastguard Worker const char *getTargetNodeName(unsigned Opcode) const override; 261*9880d681SAndroid Build Coastguard Worker 262*9880d681SAndroid Build Coastguard Worker /// getSetCCResultType - get the ISD::SETCC result ValueType 263*9880d681SAndroid Build Coastguard Worker EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, 264*9880d681SAndroid Build Coastguard Worker EVT VT) const override; 265*9880d681SAndroid Build Coastguard Worker 266*9880d681SAndroid Build Coastguard Worker SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; 267*9880d681SAndroid Build Coastguard Worker 268*9880d681SAndroid Build Coastguard Worker MachineBasicBlock * 269*9880d681SAndroid Build Coastguard Worker EmitInstrWithCustomInserter(MachineInstr &MI, 270*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB) const override; 271*9880d681SAndroid Build Coastguard Worker 272*9880d681SAndroid Build Coastguard Worker void HandleByVal(CCState *, unsigned &, unsigned) const override; 273*9880d681SAndroid Build Coastguard Worker 274*9880d681SAndroid Build Coastguard Worker unsigned getRegisterByName(const char* RegName, EVT VT, 275*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 276*9880d681SAndroid Build Coastguard Worker 277*9880d681SAndroid Build Coastguard Worker /// If a physical register, this returns the register that receives the 278*9880d681SAndroid Build Coastguard Worker /// exception address on entry to an EH pad. 279*9880d681SAndroid Build Coastguard Worker unsigned getExceptionPointerRegister(const Constant * PersonalityFn)280*9880d681SAndroid Build Coastguard Worker getExceptionPointerRegister(const Constant *PersonalityFn) const override { 281*9880d681SAndroid Build Coastguard Worker return ABI.IsN64() ? Mips::A0_64 : Mips::A0; 282*9880d681SAndroid Build Coastguard Worker } 283*9880d681SAndroid Build Coastguard Worker 284*9880d681SAndroid Build Coastguard Worker /// If a physical register, this returns the register that receives the 285*9880d681SAndroid Build Coastguard Worker /// exception typeid on entry to a landing pad. 286*9880d681SAndroid Build Coastguard Worker unsigned getExceptionSelectorRegister(const Constant * PersonalityFn)287*9880d681SAndroid Build Coastguard Worker getExceptionSelectorRegister(const Constant *PersonalityFn) const override { 288*9880d681SAndroid Build Coastguard Worker return ABI.IsN64() ? Mips::A1_64 : Mips::A1; 289*9880d681SAndroid Build Coastguard Worker } 290*9880d681SAndroid Build Coastguard Worker 291*9880d681SAndroid Build Coastguard Worker /// Returns true if a cast between SrcAS and DestAS is a noop. isNoopAddrSpaceCast(unsigned SrcAS,unsigned DestAS)292*9880d681SAndroid Build Coastguard Worker bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override { 293*9880d681SAndroid Build Coastguard Worker // Mips doesn't have any special address spaces so we just reserve 294*9880d681SAndroid Build Coastguard Worker // the first 256 for software use (e.g. OpenCL) and treat casts 295*9880d681SAndroid Build Coastguard Worker // between them as noops. 296*9880d681SAndroid Build Coastguard Worker return SrcAS < 256 && DestAS < 256; 297*9880d681SAndroid Build Coastguard Worker } 298*9880d681SAndroid Build Coastguard Worker 299*9880d681SAndroid Build Coastguard Worker protected: 300*9880d681SAndroid Build Coastguard Worker SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const; 301*9880d681SAndroid Build Coastguard Worker 302*9880d681SAndroid Build Coastguard Worker // This method creates the following nodes, which are necessary for 303*9880d681SAndroid Build Coastguard Worker // computing a local symbol's address: 304*9880d681SAndroid Build Coastguard Worker // 305*9880d681SAndroid Build Coastguard Worker // (add (load (wrapper $gp, %got(sym)), %lo(sym)) 306*9880d681SAndroid Build Coastguard Worker template <class NodeTy> getAddrLocal(NodeTy * N,const SDLoc & DL,EVT Ty,SelectionDAG & DAG,bool IsN32OrN64)307*9880d681SAndroid Build Coastguard Worker SDValue getAddrLocal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, 308*9880d681SAndroid Build Coastguard Worker bool IsN32OrN64) const { 309*9880d681SAndroid Build Coastguard Worker unsigned GOTFlag = IsN32OrN64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT; 310*9880d681SAndroid Build Coastguard Worker SDValue GOT = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty), 311*9880d681SAndroid Build Coastguard Worker getTargetNode(N, Ty, DAG, GOTFlag)); 312*9880d681SAndroid Build Coastguard Worker SDValue Load = 313*9880d681SAndroid Build Coastguard Worker DAG.getLoad(Ty, DL, DAG.getEntryNode(), GOT, 314*9880d681SAndroid Build Coastguard Worker MachinePointerInfo::getGOT(DAG.getMachineFunction()), 315*9880d681SAndroid Build Coastguard Worker false, false, false, 0); 316*9880d681SAndroid Build Coastguard Worker unsigned LoFlag = IsN32OrN64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO; 317*9880d681SAndroid Build Coastguard Worker SDValue Lo = DAG.getNode(MipsISD::Lo, DL, Ty, 318*9880d681SAndroid Build Coastguard Worker getTargetNode(N, Ty, DAG, LoFlag)); 319*9880d681SAndroid Build Coastguard Worker return DAG.getNode(ISD::ADD, DL, Ty, Load, Lo); 320*9880d681SAndroid Build Coastguard Worker } 321*9880d681SAndroid Build Coastguard Worker 322*9880d681SAndroid Build Coastguard Worker // This method creates the following nodes, which are necessary for 323*9880d681SAndroid Build Coastguard Worker // computing a global symbol's address: 324*9880d681SAndroid Build Coastguard Worker // 325*9880d681SAndroid Build Coastguard Worker // (load (wrapper $gp, %got(sym))) 326*9880d681SAndroid Build Coastguard Worker template <class NodeTy> getAddrGlobal(NodeTy * N,const SDLoc & DL,EVT Ty,SelectionDAG & DAG,unsigned Flag,SDValue Chain,const MachinePointerInfo & PtrInfo)327*9880d681SAndroid Build Coastguard Worker SDValue getAddrGlobal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, 328*9880d681SAndroid Build Coastguard Worker unsigned Flag, SDValue Chain, 329*9880d681SAndroid Build Coastguard Worker const MachinePointerInfo &PtrInfo) const { 330*9880d681SAndroid Build Coastguard Worker SDValue Tgt = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty), 331*9880d681SAndroid Build Coastguard Worker getTargetNode(N, Ty, DAG, Flag)); 332*9880d681SAndroid Build Coastguard Worker return DAG.getLoad(Ty, DL, Chain, Tgt, PtrInfo, false, false, false, 0); 333*9880d681SAndroid Build Coastguard Worker } 334*9880d681SAndroid Build Coastguard Worker 335*9880d681SAndroid Build Coastguard Worker // This method creates the following nodes, which are necessary for 336*9880d681SAndroid Build Coastguard Worker // computing a global symbol's address in large-GOT mode: 337*9880d681SAndroid Build Coastguard Worker // 338*9880d681SAndroid Build Coastguard Worker // (load (wrapper (add %hi(sym), $gp), %lo(sym))) 339*9880d681SAndroid Build Coastguard Worker template <class NodeTy> getAddrGlobalLargeGOT(NodeTy * N,const SDLoc & DL,EVT Ty,SelectionDAG & DAG,unsigned HiFlag,unsigned LoFlag,SDValue Chain,const MachinePointerInfo & PtrInfo)340*9880d681SAndroid Build Coastguard Worker SDValue getAddrGlobalLargeGOT(NodeTy *N, const SDLoc &DL, EVT Ty, 341*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG, unsigned HiFlag, 342*9880d681SAndroid Build Coastguard Worker unsigned LoFlag, SDValue Chain, 343*9880d681SAndroid Build Coastguard Worker const MachinePointerInfo &PtrInfo) const { 344*9880d681SAndroid Build Coastguard Worker SDValue Hi = 345*9880d681SAndroid Build Coastguard Worker DAG.getNode(MipsISD::Hi, DL, Ty, getTargetNode(N, Ty, DAG, HiFlag)); 346*9880d681SAndroid Build Coastguard Worker Hi = DAG.getNode(ISD::ADD, DL, Ty, Hi, getGlobalReg(DAG, Ty)); 347*9880d681SAndroid Build Coastguard Worker SDValue Wrapper = DAG.getNode(MipsISD::Wrapper, DL, Ty, Hi, 348*9880d681SAndroid Build Coastguard Worker getTargetNode(N, Ty, DAG, LoFlag)); 349*9880d681SAndroid Build Coastguard Worker return DAG.getLoad(Ty, DL, Chain, Wrapper, PtrInfo, false, false, false, 350*9880d681SAndroid Build Coastguard Worker 0); 351*9880d681SAndroid Build Coastguard Worker } 352*9880d681SAndroid Build Coastguard Worker 353*9880d681SAndroid Build Coastguard Worker // This method creates the following nodes, which are necessary for 354*9880d681SAndroid Build Coastguard Worker // computing a symbol's address in non-PIC mode: 355*9880d681SAndroid Build Coastguard Worker // 356*9880d681SAndroid Build Coastguard Worker // (add %hi(sym), %lo(sym)) 357*9880d681SAndroid Build Coastguard Worker template <class NodeTy> getAddrNonPIC(NodeTy * N,const SDLoc & DL,EVT Ty,SelectionDAG & DAG)358*9880d681SAndroid Build Coastguard Worker SDValue getAddrNonPIC(NodeTy *N, const SDLoc &DL, EVT Ty, 359*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const { 360*9880d681SAndroid Build Coastguard Worker SDValue Hi = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI); 361*9880d681SAndroid Build Coastguard Worker SDValue Lo = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO); 362*9880d681SAndroid Build Coastguard Worker return DAG.getNode(ISD::ADD, DL, Ty, 363*9880d681SAndroid Build Coastguard Worker DAG.getNode(MipsISD::Hi, DL, Ty, Hi), 364*9880d681SAndroid Build Coastguard Worker DAG.getNode(MipsISD::Lo, DL, Ty, Lo)); 365*9880d681SAndroid Build Coastguard Worker } 366*9880d681SAndroid Build Coastguard Worker 367*9880d681SAndroid Build Coastguard Worker // This method creates the following nodes, which are necessary for 368*9880d681SAndroid Build Coastguard Worker // computing a symbol's address using gp-relative addressing: 369*9880d681SAndroid Build Coastguard Worker // 370*9880d681SAndroid Build Coastguard Worker // (add $gp, %gp_rel(sym)) 371*9880d681SAndroid Build Coastguard Worker template <class NodeTy> getAddrGPRel(NodeTy * N,const SDLoc & DL,EVT Ty,SelectionDAG & DAG)372*9880d681SAndroid Build Coastguard Worker SDValue getAddrGPRel(NodeTy *N, const SDLoc &DL, EVT Ty, 373*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const { 374*9880d681SAndroid Build Coastguard Worker assert(Ty == MVT::i32); 375*9880d681SAndroid Build Coastguard Worker SDValue GPRel = getTargetNode(N, Ty, DAG, MipsII::MO_GPREL); 376*9880d681SAndroid Build Coastguard Worker return DAG.getNode(ISD::ADD, DL, Ty, 377*9880d681SAndroid Build Coastguard Worker DAG.getRegister(Mips::GP, Ty), 378*9880d681SAndroid Build Coastguard Worker DAG.getNode(MipsISD::GPRel, DL, DAG.getVTList(Ty), 379*9880d681SAndroid Build Coastguard Worker GPRel)); 380*9880d681SAndroid Build Coastguard Worker } 381*9880d681SAndroid Build Coastguard Worker 382*9880d681SAndroid Build Coastguard Worker /// This function fills Ops, which is the list of operands that will later 383*9880d681SAndroid Build Coastguard Worker /// be used when a function call node is created. It also generates 384*9880d681SAndroid Build Coastguard Worker /// copyToReg nodes to set up argument registers. 385*9880d681SAndroid Build Coastguard Worker virtual void 386*9880d681SAndroid Build Coastguard Worker getOpndList(SmallVectorImpl<SDValue> &Ops, 387*9880d681SAndroid Build Coastguard Worker std::deque< std::pair<unsigned, SDValue> > &RegsToPass, 388*9880d681SAndroid Build Coastguard Worker bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage, 389*9880d681SAndroid Build Coastguard Worker bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee, 390*9880d681SAndroid Build Coastguard Worker SDValue Chain) const; 391*9880d681SAndroid Build Coastguard Worker 392*9880d681SAndroid Build Coastguard Worker protected: 393*9880d681SAndroid Build Coastguard Worker SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const; 394*9880d681SAndroid Build Coastguard Worker SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const; 395*9880d681SAndroid Build Coastguard Worker 396*9880d681SAndroid Build Coastguard Worker // Subtarget Info 397*9880d681SAndroid Build Coastguard Worker const MipsSubtarget &Subtarget; 398*9880d681SAndroid Build Coastguard Worker // Cache the ABI from the TargetMachine, we use it everywhere. 399*9880d681SAndroid Build Coastguard Worker const MipsABIInfo &ABI; 400*9880d681SAndroid Build Coastguard Worker 401*9880d681SAndroid Build Coastguard Worker private: 402*9880d681SAndroid Build Coastguard Worker // Create a TargetGlobalAddress node. 403*9880d681SAndroid Build Coastguard Worker SDValue getTargetNode(GlobalAddressSDNode *N, EVT Ty, SelectionDAG &DAG, 404*9880d681SAndroid Build Coastguard Worker unsigned Flag) const; 405*9880d681SAndroid Build Coastguard Worker 406*9880d681SAndroid Build Coastguard Worker // Create a TargetExternalSymbol node. 407*9880d681SAndroid Build Coastguard Worker SDValue getTargetNode(ExternalSymbolSDNode *N, EVT Ty, SelectionDAG &DAG, 408*9880d681SAndroid Build Coastguard Worker unsigned Flag) const; 409*9880d681SAndroid Build Coastguard Worker 410*9880d681SAndroid Build Coastguard Worker // Create a TargetBlockAddress node. 411*9880d681SAndroid Build Coastguard Worker SDValue getTargetNode(BlockAddressSDNode *N, EVT Ty, SelectionDAG &DAG, 412*9880d681SAndroid Build Coastguard Worker unsigned Flag) const; 413*9880d681SAndroid Build Coastguard Worker 414*9880d681SAndroid Build Coastguard Worker // Create a TargetJumpTable node. 415*9880d681SAndroid Build Coastguard Worker SDValue getTargetNode(JumpTableSDNode *N, EVT Ty, SelectionDAG &DAG, 416*9880d681SAndroid Build Coastguard Worker unsigned Flag) const; 417*9880d681SAndroid Build Coastguard Worker 418*9880d681SAndroid Build Coastguard Worker // Create a TargetConstantPool node. 419*9880d681SAndroid Build Coastguard Worker SDValue getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG, 420*9880d681SAndroid Build Coastguard Worker unsigned Flag) const; 421*9880d681SAndroid Build Coastguard Worker 422*9880d681SAndroid Build Coastguard Worker // Lower Operand helpers 423*9880d681SAndroid Build Coastguard Worker SDValue LowerCallResult(SDValue Chain, SDValue InFlag, 424*9880d681SAndroid Build Coastguard Worker CallingConv::ID CallConv, bool isVarArg, 425*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 426*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG, 427*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals, 428*9880d681SAndroid Build Coastguard Worker TargetLowering::CallLoweringInfo &CLI) const; 429*9880d681SAndroid Build Coastguard Worker 430*9880d681SAndroid Build Coastguard Worker // Lower Operand specifics 431*9880d681SAndroid Build Coastguard Worker SDValue lowerBR_JT(SDValue Op, SelectionDAG &DAG) const; 432*9880d681SAndroid Build Coastguard Worker SDValue lowerBRCOND(SDValue Op, SelectionDAG &DAG) const; 433*9880d681SAndroid Build Coastguard Worker SDValue lowerConstantPool(SDValue Op, SelectionDAG &DAG) const; 434*9880d681SAndroid Build Coastguard Worker SDValue lowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const; 435*9880d681SAndroid Build Coastguard Worker SDValue lowerBlockAddress(SDValue Op, SelectionDAG &DAG) const; 436*9880d681SAndroid Build Coastguard Worker SDValue lowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const; 437*9880d681SAndroid Build Coastguard Worker SDValue lowerJumpTable(SDValue Op, SelectionDAG &DAG) const; 438*9880d681SAndroid Build Coastguard Worker SDValue lowerSELECT(SDValue Op, SelectionDAG &DAG) const; 439*9880d681SAndroid Build Coastguard Worker SDValue lowerSETCC(SDValue Op, SelectionDAG &DAG) const; 440*9880d681SAndroid Build Coastguard Worker SDValue lowerVASTART(SDValue Op, SelectionDAG &DAG) const; 441*9880d681SAndroid Build Coastguard Worker SDValue lowerVAARG(SDValue Op, SelectionDAG &DAG) const; 442*9880d681SAndroid Build Coastguard Worker SDValue lowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const; 443*9880d681SAndroid Build Coastguard Worker SDValue lowerFABS(SDValue Op, SelectionDAG &DAG) const; 444*9880d681SAndroid Build Coastguard Worker SDValue lowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const; 445*9880d681SAndroid Build Coastguard Worker SDValue lowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const; 446*9880d681SAndroid Build Coastguard Worker SDValue lowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const; 447*9880d681SAndroid Build Coastguard Worker SDValue lowerATOMIC_FENCE(SDValue Op, SelectionDAG& DAG) const; 448*9880d681SAndroid Build Coastguard Worker SDValue lowerShiftLeftParts(SDValue Op, SelectionDAG& DAG) const; 449*9880d681SAndroid Build Coastguard Worker SDValue lowerShiftRightParts(SDValue Op, SelectionDAG& DAG, 450*9880d681SAndroid Build Coastguard Worker bool IsSRA) const; 451*9880d681SAndroid Build Coastguard Worker SDValue lowerADD(SDValue Op, SelectionDAG &DAG) const; 452*9880d681SAndroid Build Coastguard Worker SDValue lowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) const; 453*9880d681SAndroid Build Coastguard Worker 454*9880d681SAndroid Build Coastguard Worker /// isEligibleForTailCallOptimization - Check whether the call is eligible 455*9880d681SAndroid Build Coastguard Worker /// for tail call optimization. 456*9880d681SAndroid Build Coastguard Worker virtual bool 457*9880d681SAndroid Build Coastguard Worker isEligibleForTailCallOptimization(const CCState &CCInfo, 458*9880d681SAndroid Build Coastguard Worker unsigned NextStackOffset, 459*9880d681SAndroid Build Coastguard Worker const MipsFunctionInfo &FI) const = 0; 460*9880d681SAndroid Build Coastguard Worker 461*9880d681SAndroid Build Coastguard Worker /// copyByValArg - Copy argument registers which were used to pass a byval 462*9880d681SAndroid Build Coastguard Worker /// argument to the stack. Create a stack frame object for the byval 463*9880d681SAndroid Build Coastguard Worker /// argument. 464*9880d681SAndroid Build Coastguard Worker void copyByValRegs(SDValue Chain, const SDLoc &DL, 465*9880d681SAndroid Build Coastguard Worker std::vector<SDValue> &OutChains, SelectionDAG &DAG, 466*9880d681SAndroid Build Coastguard Worker const ISD::ArgFlagsTy &Flags, 467*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals, 468*9880d681SAndroid Build Coastguard Worker const Argument *FuncArg, unsigned FirstReg, 469*9880d681SAndroid Build Coastguard Worker unsigned LastReg, const CCValAssign &VA, 470*9880d681SAndroid Build Coastguard Worker MipsCCState &State) const; 471*9880d681SAndroid Build Coastguard Worker 472*9880d681SAndroid Build Coastguard Worker /// passByValArg - Pass a byval argument in registers or on stack. 473*9880d681SAndroid Build Coastguard Worker void passByValArg(SDValue Chain, const SDLoc &DL, 474*9880d681SAndroid Build Coastguard Worker std::deque<std::pair<unsigned, SDValue>> &RegsToPass, 475*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &MemOpChains, SDValue StackPtr, 476*9880d681SAndroid Build Coastguard Worker MachineFrameInfo *MFI, SelectionDAG &DAG, SDValue Arg, 477*9880d681SAndroid Build Coastguard Worker unsigned FirstReg, unsigned LastReg, 478*9880d681SAndroid Build Coastguard Worker const ISD::ArgFlagsTy &Flags, bool isLittle, 479*9880d681SAndroid Build Coastguard Worker const CCValAssign &VA) const; 480*9880d681SAndroid Build Coastguard Worker 481*9880d681SAndroid Build Coastguard Worker /// writeVarArgRegs - Write variable function arguments passed in registers 482*9880d681SAndroid Build Coastguard Worker /// to the stack. Also create a stack frame object for the first variable 483*9880d681SAndroid Build Coastguard Worker /// argument. 484*9880d681SAndroid Build Coastguard Worker void writeVarArgRegs(std::vector<SDValue> &OutChains, SDValue Chain, 485*9880d681SAndroid Build Coastguard Worker const SDLoc &DL, SelectionDAG &DAG, 486*9880d681SAndroid Build Coastguard Worker CCState &State) const; 487*9880d681SAndroid Build Coastguard Worker 488*9880d681SAndroid Build Coastguard Worker SDValue 489*9880d681SAndroid Build Coastguard Worker LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, 490*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 491*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG, 492*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals) const override; 493*9880d681SAndroid Build Coastguard Worker 494*9880d681SAndroid Build Coastguard Worker SDValue passArgOnStack(SDValue StackPtr, unsigned Offset, SDValue Chain, 495*9880d681SAndroid Build Coastguard Worker SDValue Arg, const SDLoc &DL, bool IsTailCall, 496*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const; 497*9880d681SAndroid Build Coastguard Worker 498*9880d681SAndroid Build Coastguard Worker SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI, 499*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals) const override; 500*9880d681SAndroid Build Coastguard Worker 501*9880d681SAndroid Build Coastguard Worker bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, 502*9880d681SAndroid Build Coastguard Worker bool isVarArg, 503*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 504*9880d681SAndroid Build Coastguard Worker LLVMContext &Context) const override; 505*9880d681SAndroid Build Coastguard Worker 506*9880d681SAndroid Build Coastguard Worker SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, 507*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 508*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<SDValue> &OutVals, 509*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG) const override; 510*9880d681SAndroid Build Coastguard Worker 511*9880d681SAndroid Build Coastguard Worker SDValue LowerInterruptReturn(SmallVectorImpl<SDValue> &RetOps, 512*9880d681SAndroid Build Coastguard Worker const SDLoc &DL, SelectionDAG &DAG) const; 513*9880d681SAndroid Build Coastguard Worker 514*9880d681SAndroid Build Coastguard Worker bool shouldSignExtendTypeInLibCall(EVT Type, bool IsSigned) const override; 515*9880d681SAndroid Build Coastguard Worker 516*9880d681SAndroid Build Coastguard Worker // Inline asm support 517*9880d681SAndroid Build Coastguard Worker ConstraintType getConstraintType(StringRef Constraint) const override; 518*9880d681SAndroid Build Coastguard Worker 519*9880d681SAndroid Build Coastguard Worker /// Examine constraint string and operand type and determine a weight value. 520*9880d681SAndroid Build Coastguard Worker /// The operand object must already have been set up with the operand type. 521*9880d681SAndroid Build Coastguard Worker ConstraintWeight getSingleConstraintMatchWeight( 522*9880d681SAndroid Build Coastguard Worker AsmOperandInfo &info, const char *constraint) const override; 523*9880d681SAndroid Build Coastguard Worker 524*9880d681SAndroid Build Coastguard Worker /// This function parses registers that appear in inline-asm constraints. 525*9880d681SAndroid Build Coastguard Worker /// It returns pair (0, 0) on failure. 526*9880d681SAndroid Build Coastguard Worker std::pair<unsigned, const TargetRegisterClass *> 527*9880d681SAndroid Build Coastguard Worker parseRegForInlineAsmConstraint(StringRef C, MVT VT) const; 528*9880d681SAndroid Build Coastguard Worker 529*9880d681SAndroid Build Coastguard Worker std::pair<unsigned, const TargetRegisterClass *> 530*9880d681SAndroid Build Coastguard Worker getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, 531*9880d681SAndroid Build Coastguard Worker StringRef Constraint, MVT VT) const override; 532*9880d681SAndroid Build Coastguard Worker 533*9880d681SAndroid Build Coastguard Worker /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops 534*9880d681SAndroid Build Coastguard Worker /// vector. If it is invalid, don't add anything to Ops. If hasMemory is 535*9880d681SAndroid Build Coastguard Worker /// true it means one of the asm constraint of the inline asm instruction 536*9880d681SAndroid Build Coastguard Worker /// being processed is 'm'. 537*9880d681SAndroid Build Coastguard Worker void LowerAsmOperandForConstraint(SDValue Op, 538*9880d681SAndroid Build Coastguard Worker std::string &Constraint, 539*9880d681SAndroid Build Coastguard Worker std::vector<SDValue> &Ops, 540*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 541*9880d681SAndroid Build Coastguard Worker 542*9880d681SAndroid Build Coastguard Worker unsigned getInlineAsmMemConstraint(StringRef ConstraintCode)543*9880d681SAndroid Build Coastguard Worker getInlineAsmMemConstraint(StringRef ConstraintCode) const override { 544*9880d681SAndroid Build Coastguard Worker if (ConstraintCode == "R") 545*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_R; 546*9880d681SAndroid Build Coastguard Worker else if (ConstraintCode == "ZC") 547*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_ZC; 548*9880d681SAndroid Build Coastguard Worker return TargetLowering::getInlineAsmMemConstraint(ConstraintCode); 549*9880d681SAndroid Build Coastguard Worker } 550*9880d681SAndroid Build Coastguard Worker 551*9880d681SAndroid Build Coastguard Worker bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, 552*9880d681SAndroid Build Coastguard Worker Type *Ty, unsigned AS) const override; 553*9880d681SAndroid Build Coastguard Worker 554*9880d681SAndroid Build Coastguard Worker bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override; 555*9880d681SAndroid Build Coastguard Worker 556*9880d681SAndroid Build Coastguard Worker EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, 557*9880d681SAndroid Build Coastguard Worker unsigned SrcAlign, 558*9880d681SAndroid Build Coastguard Worker bool IsMemset, bool ZeroMemset, 559*9880d681SAndroid Build Coastguard Worker bool MemcpyStrSrc, 560*9880d681SAndroid Build Coastguard Worker MachineFunction &MF) const override; 561*9880d681SAndroid Build Coastguard Worker 562*9880d681SAndroid Build Coastguard Worker /// isFPImmLegal - Returns true if the target can instruction select the 563*9880d681SAndroid Build Coastguard Worker /// specified FP immediate natively. If false, the legalizer will 564*9880d681SAndroid Build Coastguard Worker /// materialize the FP immediate as a load from a constant pool. 565*9880d681SAndroid Build Coastguard Worker bool isFPImmLegal(const APFloat &Imm, EVT VT) const override; 566*9880d681SAndroid Build Coastguard Worker 567*9880d681SAndroid Build Coastguard Worker unsigned getJumpTableEncoding() const override; 568*9880d681SAndroid Build Coastguard Worker bool useSoftFloat() const override; 569*9880d681SAndroid Build Coastguard Worker shouldInsertFencesForAtomic(const Instruction * I)570*9880d681SAndroid Build Coastguard Worker bool shouldInsertFencesForAtomic(const Instruction *I) const override { 571*9880d681SAndroid Build Coastguard Worker return true; 572*9880d681SAndroid Build Coastguard Worker } 573*9880d681SAndroid Build Coastguard Worker 574*9880d681SAndroid Build Coastguard Worker /// Emit a sign-extension using sll/sra, seb, or seh appropriately. 575*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *emitSignExtendToI32InReg(MachineInstr &MI, 576*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *BB, 577*9880d681SAndroid Build Coastguard Worker unsigned Size, unsigned DstReg, 578*9880d681SAndroid Build Coastguard Worker unsigned SrcRec) const; 579*9880d681SAndroid Build Coastguard Worker 580*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *emitAtomicBinary(MachineInstr &MI, MachineBasicBlock *BB, 581*9880d681SAndroid Build Coastguard Worker unsigned Size, unsigned BinOpcode, 582*9880d681SAndroid Build Coastguard Worker bool Nand = false) const; 583*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *emitAtomicBinaryPartword(MachineInstr &MI, 584*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *BB, 585*9880d681SAndroid Build Coastguard Worker unsigned Size, 586*9880d681SAndroid Build Coastguard Worker unsigned BinOpcode, 587*9880d681SAndroid Build Coastguard Worker bool Nand = false) const; 588*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *emitAtomicCmpSwap(MachineInstr &MI, 589*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *BB, 590*9880d681SAndroid Build Coastguard Worker unsigned Size) const; 591*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *emitAtomicCmpSwapPartword(MachineInstr &MI, 592*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *BB, 593*9880d681SAndroid Build Coastguard Worker unsigned Size) const; 594*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *emitSEL_D(MachineInstr &MI, MachineBasicBlock *BB) const; 595*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *emitPseudoSELECT(MachineInstr &MI, MachineBasicBlock *BB, 596*9880d681SAndroid Build Coastguard Worker bool isFPCmp, unsigned Opc) const; 597*9880d681SAndroid Build Coastguard Worker }; 598*9880d681SAndroid Build Coastguard Worker 599*9880d681SAndroid Build Coastguard Worker /// Create MipsTargetLowering objects. 600*9880d681SAndroid Build Coastguard Worker const MipsTargetLowering * 601*9880d681SAndroid Build Coastguard Worker createMips16TargetLowering(const MipsTargetMachine &TM, 602*9880d681SAndroid Build Coastguard Worker const MipsSubtarget &STI); 603*9880d681SAndroid Build Coastguard Worker const MipsTargetLowering * 604*9880d681SAndroid Build Coastguard Worker createMipsSETargetLowering(const MipsTargetMachine &TM, 605*9880d681SAndroid Build Coastguard Worker const MipsSubtarget &STI); 606*9880d681SAndroid Build Coastguard Worker 607*9880d681SAndroid Build Coastguard Worker namespace Mips { 608*9880d681SAndroid Build Coastguard Worker FastISel *createFastISel(FunctionLoweringInfo &funcInfo, 609*9880d681SAndroid Build Coastguard Worker const TargetLibraryInfo *libInfo); 610*9880d681SAndroid Build Coastguard Worker } 611*9880d681SAndroid Build Coastguard Worker } 612*9880d681SAndroid Build Coastguard Worker 613*9880d681SAndroid Build Coastguard Worker #endif 614