LLVM API Documentation

MipsISelLowering.h
Go to the documentation of this file.
00001 //===-- MipsISelLowering.h - Mips DAG Lowering Interface --------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file defines the interfaces that Mips uses to lower LLVM code into a
00011 // selection DAG.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H
00016 #define LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H
00017 
00018 #include "MCTargetDesc/MipsBaseInfo.h"
00019 #include "Mips.h"
00020 #include "llvm/CodeGen/CallingConvLower.h"
00021 #include "llvm/CodeGen/SelectionDAG.h"
00022 #include "llvm/IR/Function.h"
00023 #include "llvm/Target/TargetLowering.h"
00024 #include <deque>
00025 #include <string>
00026 
00027 namespace llvm {
00028   namespace MipsISD {
00029     enum NodeType {
00030       // Start the numbering from where ISD NodeType finishes.
00031       FIRST_NUMBER = ISD::BUILTIN_OP_END,
00032 
00033       // Jump and link (call)
00034       JmpLink,
00035 
00036       // Tail call
00037       TailCall,
00038 
00039       // Get the Higher 16 bits from a 32-bit immediate
00040       // No relation with Mips Hi register
00041       Hi,
00042 
00043       // Get the Lower 16 bits from a 32-bit immediate
00044       // No relation with Mips Lo register
00045       Lo,
00046 
00047       // Handle gp_rel (small data/bss sections) relocation.
00048       GPRel,
00049 
00050       // Thread Pointer
00051       ThreadPointer,
00052 
00053       // Floating Point Branch Conditional
00054       FPBrcond,
00055 
00056       // Floating Point Compare
00057       FPCmp,
00058 
00059       // Floating Point Conditional Moves
00060       CMovFP_T,
00061       CMovFP_F,
00062 
00063       // FP-to-int truncation node.
00064       TruncIntFP,
00065 
00066       // Return
00067       Ret,
00068 
00069       EH_RETURN,
00070 
00071       // Node used to extract integer from accumulator.
00072       MFHI,
00073       MFLO,
00074 
00075       // Node used to insert integers to accumulator.
00076       MTLOHI,
00077 
00078       // Mult nodes.
00079       Mult,
00080       Multu,
00081 
00082       // MAdd/Sub nodes
00083       MAdd,
00084       MAddu,
00085       MSub,
00086       MSubu,
00087 
00088       // DivRem(u)
00089       DivRem,
00090       DivRemU,
00091       DivRem16,
00092       DivRemU16,
00093 
00094       BuildPairF64,
00095       ExtractElementF64,
00096 
00097       Wrapper,
00098 
00099       DynAlloc,
00100 
00101       Sync,
00102 
00103       Ext,
00104       Ins,
00105 
00106       // EXTR.W instrinsic nodes.
00107       EXTP,
00108       EXTPDP,
00109       EXTR_S_H,
00110       EXTR_W,
00111       EXTR_R_W,
00112       EXTR_RS_W,
00113       SHILO,
00114       MTHLIP,
00115 
00116       // DPA.W intrinsic nodes.
00117       MULSAQ_S_W_PH,
00118       MAQ_S_W_PHL,
00119       MAQ_S_W_PHR,
00120       MAQ_SA_W_PHL,
00121       MAQ_SA_W_PHR,
00122       DPAU_H_QBL,
00123       DPAU_H_QBR,
00124       DPSU_H_QBL,
00125       DPSU_H_QBR,
00126       DPAQ_S_W_PH,
00127       DPSQ_S_W_PH,
00128       DPAQ_SA_L_W,
00129       DPSQ_SA_L_W,
00130       DPA_W_PH,
00131       DPS_W_PH,
00132       DPAQX_S_W_PH,
00133       DPAQX_SA_W_PH,
00134       DPAX_W_PH,
00135       DPSX_W_PH,
00136       DPSQX_S_W_PH,
00137       DPSQX_SA_W_PH,
00138       MULSA_W_PH,
00139 
00140       MULT,
00141       MULTU,
00142       MADD_DSP,
00143       MADDU_DSP,
00144       MSUB_DSP,
00145       MSUBU_DSP,
00146 
00147       // DSP shift nodes.
00148       SHLL_DSP,
00149       SHRA_DSP,
00150       SHRL_DSP,
00151 
00152       // DSP setcc and select_cc nodes.
00153       SETCC_DSP,
00154       SELECT_CC_DSP,
00155 
00156       // Vector comparisons.
00157       // These take a vector and return a boolean.
00158       VALL_ZERO,
00159       VANY_ZERO,
00160       VALL_NONZERO,
00161       VANY_NONZERO,
00162 
00163       // These take a vector and return a vector bitmask.
00164       VCEQ,
00165       VCLE_S,
00166       VCLE_U,
00167       VCLT_S,
00168       VCLT_U,
00169 
00170       // Element-wise vector max/min.
00171       VSMAX,
00172       VSMIN,
00173       VUMAX,
00174       VUMIN,
00175 
00176       // Vector Shuffle with mask as an operand
00177       VSHF,  // Generic shuffle
00178       SHF,   // 4-element set shuffle.
00179       ILVEV, // Interleave even elements
00180       ILVOD, // Interleave odd elements
00181       ILVL,  // Interleave left elements
00182       ILVR,  // Interleave right elements
00183       PCKEV, // Pack even elements
00184       PCKOD, // Pack odd elements
00185 
00186       // Vector Lane Copy
00187       INSVE, // Copy element from one vector to another
00188 
00189       // Combined (XOR (OR $a, $b), -1)
00190       VNOR,
00191 
00192       // Extended vector element extraction
00193       VEXTRACT_SEXT_ELT,
00194       VEXTRACT_ZEXT_ELT,
00195 
00196       // Load/Store Left/Right nodes.
00197       LWL = ISD::FIRST_TARGET_MEMORY_OPCODE,
00198       LWR,
00199       SWL,
00200       SWR,
00201       LDL,
00202       LDR,
00203       SDL,
00204       SDR
00205     };
00206   }
00207 
00208   //===--------------------------------------------------------------------===//
00209   // TargetLowering Implementation
00210   //===--------------------------------------------------------------------===//
00211   class MipsFunctionInfo;
00212   class MipsSubtarget;
00213 
00214   class MipsTargetLowering : public TargetLowering  {
00215     bool isMicroMips;
00216   public:
00217     explicit MipsTargetLowering(MipsTargetMachine &TM,
00218                                 const MipsSubtarget &STI);
00219 
00220     static const MipsTargetLowering *create(MipsTargetMachine &TM,
00221                                             const MipsSubtarget &STI);
00222 
00223     /// createFastISel - This method returns a target specific FastISel object,
00224     /// or null if the target does not support "fast" ISel.
00225     FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
00226                              const TargetLibraryInfo *libInfo) const override;
00227 
00228     MVT getScalarShiftAmountTy(EVT LHSTy) const override { return MVT::i32; }
00229 
00230     void LowerOperationWrapper(SDNode *N,
00231                                SmallVectorImpl<SDValue> &Results,
00232                                SelectionDAG &DAG) const override;
00233 
00234     /// LowerOperation - Provide custom lowering hooks for some operations.
00235     SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
00236 
00237     /// ReplaceNodeResults - Replace the results of node with an illegal result
00238     /// type with new values built out of custom code.
00239     ///
00240     void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
00241                             SelectionDAG &DAG) const override;
00242 
00243     /// getTargetNodeName - This method returns the name of a target specific
00244     //  DAG node.
00245     const char *getTargetNodeName(unsigned Opcode) const override;
00246 
00247     /// getSetCCResultType - get the ISD::SETCC result ValueType
00248     EVT getSetCCResultType(LLVMContext &Context, EVT VT) const override;
00249 
00250     SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
00251 
00252     MachineBasicBlock *
00253     EmitInstrWithCustomInserter(MachineInstr *MI,
00254                                 MachineBasicBlock *MBB) const override;
00255 
00256     struct LTStr {
00257       bool operator()(const char *S1, const char *S2) const {
00258         return strcmp(S1, S2) < 0;
00259       }
00260     };
00261 
00262   protected:
00263     SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const;
00264 
00265     // This method creates the following nodes, which are necessary for
00266     // computing a local symbol's address:
00267     //
00268     // (add (load (wrapper $gp, %got(sym)), %lo(sym))
00269     template <class NodeTy>
00270     SDValue getAddrLocal(NodeTy *N, EVT Ty, SelectionDAG &DAG,
00271                          bool IsN32OrN64) const {
00272       SDLoc DL(N);
00273       unsigned GOTFlag = IsN32OrN64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
00274       SDValue GOT = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
00275                                 getTargetNode(N, Ty, DAG, GOTFlag));
00276       SDValue Load = DAG.getLoad(Ty, DL, DAG.getEntryNode(), GOT,
00277                                  MachinePointerInfo::getGOT(), false, false,
00278                                  false, 0);
00279       unsigned LoFlag = IsN32OrN64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
00280       SDValue Lo = DAG.getNode(MipsISD::Lo, DL, Ty,
00281                                getTargetNode(N, Ty, DAG, LoFlag));
00282       return DAG.getNode(ISD::ADD, DL, Ty, Load, Lo);
00283     }
00284 
00285     // This method creates the following nodes, which are necessary for
00286     // computing a global symbol's address:
00287     //
00288     // (load (wrapper $gp, %got(sym)))
00289     template<class NodeTy>
00290     SDValue getAddrGlobal(NodeTy *N, EVT Ty, SelectionDAG &DAG,
00291                           unsigned Flag, SDValue Chain,
00292                           const MachinePointerInfo &PtrInfo) const {
00293       SDLoc DL(N);
00294       SDValue Tgt = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
00295                                 getTargetNode(N, Ty, DAG, Flag));
00296       return DAG.getLoad(Ty, DL, Chain, Tgt, PtrInfo, false, false, false, 0);
00297     }
00298 
00299     // This method creates the following nodes, which are necessary for
00300     // computing a global symbol's address in large-GOT mode:
00301     //
00302     // (load (wrapper (add %hi(sym), $gp), %lo(sym)))
00303     template<class NodeTy>
00304     SDValue getAddrGlobalLargeGOT(NodeTy *N, EVT Ty, SelectionDAG &DAG,
00305                                   unsigned HiFlag, unsigned LoFlag,
00306                                   SDValue Chain,
00307                                   const MachinePointerInfo &PtrInfo) const {
00308       SDLoc DL(N);
00309       SDValue Hi = DAG.getNode(MipsISD::Hi, DL, Ty,
00310                                getTargetNode(N, Ty, DAG, HiFlag));
00311       Hi = DAG.getNode(ISD::ADD, DL, Ty, Hi, getGlobalReg(DAG, Ty));
00312       SDValue Wrapper = DAG.getNode(MipsISD::Wrapper, DL, Ty, Hi,
00313                                     getTargetNode(N, Ty, DAG, LoFlag));
00314       return DAG.getLoad(Ty, DL, Chain, Wrapper, PtrInfo, false, false, false,
00315                          0);
00316     }
00317 
00318     // This method creates the following nodes, which are necessary for
00319     // computing a symbol's address in non-PIC mode:
00320     //
00321     // (add %hi(sym), %lo(sym))
00322     template<class NodeTy>
00323     SDValue getAddrNonPIC(NodeTy *N, EVT Ty, SelectionDAG &DAG) const {
00324       SDLoc DL(N);
00325       SDValue Hi = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI);
00326       SDValue Lo = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO);
00327       return DAG.getNode(ISD::ADD, DL, Ty,
00328                          DAG.getNode(MipsISD::Hi, DL, Ty, Hi),
00329                          DAG.getNode(MipsISD::Lo, DL, Ty, Lo));
00330     }
00331 
00332     /// This function fills Ops, which is the list of operands that will later
00333     /// be used when a function call node is created. It also generates
00334     /// copyToReg nodes to set up argument registers.
00335     virtual void
00336     getOpndList(SmallVectorImpl<SDValue> &Ops,
00337                 std::deque< std::pair<unsigned, SDValue> > &RegsToPass,
00338                 bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage,
00339                 CallLoweringInfo &CLI, SDValue Callee, SDValue Chain) const;
00340 
00341     /// ByValArgInfo - Byval argument information.
00342     struct ByValArgInfo {
00343       unsigned FirstIdx; // Index of the first register used.
00344       unsigned NumRegs;  // Number of registers used for this argument.
00345       unsigned Address;  // Offset of the stack area used to pass this argument.
00346 
00347       ByValArgInfo() : FirstIdx(0), NumRegs(0), Address(0) {}
00348     };
00349 
00350     /// MipsCC - This class provides methods used to analyze formal and call
00351     /// arguments and inquire about calling convention information.
00352     class MipsCC {
00353     public:
00354       enum SpecialCallingConvType {
00355         Mips16RetHelperConv, NoSpecialCallingConv
00356       };
00357 
00358       MipsCC(CallingConv::ID CallConv, const MipsSubtarget &Subtarget,
00359              CCState &Info,
00360              SpecialCallingConvType SpecialCallingConv = NoSpecialCallingConv);
00361 
00362       void analyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
00363                                bool IsVarArg, bool IsSoftFloat,
00364                                const SDNode *CallNode,
00365                                std::vector<ArgListEntry> &FuncArgs);
00366       void analyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
00367                                   bool IsSoftFloat,
00368                                   Function::const_arg_iterator FuncArg);
00369 
00370       void analyzeCallResult(const SmallVectorImpl<ISD::InputArg> &Ins,
00371                              bool IsSoftFloat, const SDNode *CallNode,
00372                              const Type *RetTy) const;
00373 
00374       void analyzeReturn(const SmallVectorImpl<ISD::OutputArg> &Outs,
00375                          bool IsSoftFloat, const Type *RetTy) const;
00376 
00377       const CCState &getCCInfo() const { return CCInfo; }
00378 
00379       /// hasByValArg - Returns true if function has byval arguments.
00380       bool hasByValArg() const { return !ByValArgs.empty(); }
00381 
00382       /// reservedArgArea - The size of the area the caller reserves for
00383       /// register arguments. This is 16-byte if ABI is O32.
00384       unsigned reservedArgArea() const;
00385 
00386       /// Return pointer to array of integer argument registers.
00387       const ArrayRef<MCPhysReg> intArgRegs() const;
00388 
00389       typedef SmallVectorImpl<ByValArgInfo>::const_iterator byval_iterator;
00390       byval_iterator byval_begin() const { return ByValArgs.begin(); }
00391       byval_iterator byval_end() const { return ByValArgs.end(); }
00392 
00393     private:
00394       void handleByValArg(unsigned ValNo, MVT ValVT, MVT LocVT,
00395                           CCValAssign::LocInfo LocInfo,
00396                           ISD::ArgFlagsTy ArgFlags);
00397 
00398       /// useRegsForByval - Returns true if the calling convention allows the
00399       /// use of registers to pass byval arguments.
00400       bool useRegsForByval() const { return CallConv != CallingConv::Fast; }
00401 
00402       /// Return the function that analyzes fixed argument list functions.
00403       llvm::CCAssignFn *fixedArgFn() const;
00404 
00405       /// Return the function that analyzes variable argument list functions.
00406       llvm::CCAssignFn *varArgFn() const;
00407 
00408       const MCPhysReg *shadowRegs() const;
00409 
00410       void allocateRegs(ByValArgInfo &ByVal, unsigned ByValSize,
00411                         unsigned Align);
00412 
00413       /// Return the type of the register which is used to pass an argument or
00414       /// return a value. This function returns f64 if the argument is an i64
00415       /// value which has been generated as a result of softening an f128 value.
00416       /// Otherwise, it just returns VT.
00417       MVT getRegVT(MVT VT, const Type *OrigTy, const SDNode *CallNode,
00418                    bool IsSoftFloat) const;
00419 
00420       template<typename Ty>
00421       void analyzeReturn(const SmallVectorImpl<Ty> &RetVals, bool IsSoftFloat,
00422                          const SDNode *CallNode, const Type *RetTy) const;
00423 
00424       CCState &CCInfo;
00425       CallingConv::ID CallConv;
00426       const MipsSubtarget &Subtarget;
00427       SpecialCallingConvType SpecialCallingConv;
00428       SmallVector<ByValArgInfo, 2> ByValArgs;
00429     };
00430   protected:
00431     SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const;
00432     SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const;
00433 
00434     // Subtarget Info
00435     const MipsSubtarget &Subtarget;
00436 
00437   private:
00438     // Create a TargetGlobalAddress node.
00439     SDValue getTargetNode(GlobalAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
00440                           unsigned Flag) const;
00441 
00442     // Create a TargetExternalSymbol node.
00443     SDValue getTargetNode(ExternalSymbolSDNode *N, EVT Ty, SelectionDAG &DAG,
00444                           unsigned Flag) const;
00445 
00446     // Create a TargetBlockAddress node.
00447     SDValue getTargetNode(BlockAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
00448                           unsigned Flag) const;
00449 
00450     // Create a TargetJumpTable node.
00451     SDValue getTargetNode(JumpTableSDNode *N, EVT Ty, SelectionDAG &DAG,
00452                           unsigned Flag) const;
00453 
00454     // Create a TargetConstantPool node.
00455     SDValue getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG,
00456                           unsigned Flag) const;
00457 
00458     MipsCC::SpecialCallingConvType getSpecialCallingConv(SDValue Callee) const;
00459     // Lower Operand helpers
00460     SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
00461                             CallingConv::ID CallConv, bool isVarArg,
00462                             const SmallVectorImpl<ISD::InputArg> &Ins,
00463                             SDLoc dl, SelectionDAG &DAG,
00464                             SmallVectorImpl<SDValue> &InVals,
00465                             const SDNode *CallNode, const Type *RetTy) const;
00466 
00467     // Lower Operand specifics
00468     SDValue lowerBR_JT(SDValue Op, SelectionDAG &DAG) const;
00469     SDValue lowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
00470     SDValue lowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
00471     SDValue lowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
00472     SDValue lowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
00473     SDValue lowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
00474     SDValue lowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
00475     SDValue lowerSELECT(SDValue Op, SelectionDAG &DAG) const;
00476     SDValue lowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
00477     SDValue lowerSETCC(SDValue Op, SelectionDAG &DAG) const;
00478     SDValue lowerVASTART(SDValue Op, SelectionDAG &DAG) const;
00479     SDValue lowerVAARG(SDValue Op, SelectionDAG &DAG) const;
00480     SDValue lowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
00481     SDValue lowerFABS(SDValue Op, SelectionDAG &DAG) const;
00482     SDValue lowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
00483     SDValue lowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
00484     SDValue lowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const;
00485     SDValue lowerATOMIC_FENCE(SDValue Op, SelectionDAG& DAG) const;
00486     SDValue lowerShiftLeftParts(SDValue Op, SelectionDAG& DAG) const;
00487     SDValue lowerShiftRightParts(SDValue Op, SelectionDAG& DAG,
00488                                  bool IsSRA) const;
00489     SDValue lowerADD(SDValue Op, SelectionDAG &DAG) const;
00490     SDValue lowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) const;
00491 
00492     /// isEligibleForTailCallOptimization - Check whether the call is eligible
00493     /// for tail call optimization.
00494     virtual bool
00495     isEligibleForTailCallOptimization(const MipsCC &MipsCCInfo,
00496                                       unsigned NextStackOffset,
00497                                       const MipsFunctionInfo& FI) const = 0;
00498 
00499     /// copyByValArg - Copy argument registers which were used to pass a byval
00500     /// argument to the stack. Create a stack frame object for the byval
00501     /// argument.
00502     void copyByValRegs(SDValue Chain, SDLoc DL,
00503                        std::vector<SDValue> &OutChains, SelectionDAG &DAG,
00504                        const ISD::ArgFlagsTy &Flags,
00505                        SmallVectorImpl<SDValue> &InVals,
00506                        const Argument *FuncArg,
00507                        const MipsCC &CC, const ByValArgInfo &ByVal) const;
00508 
00509     /// passByValArg - Pass a byval argument in registers or on stack.
00510     void passByValArg(SDValue Chain, SDLoc DL,
00511                       std::deque< std::pair<unsigned, SDValue> > &RegsToPass,
00512                       SmallVectorImpl<SDValue> &MemOpChains, SDValue StackPtr,
00513                       MachineFrameInfo *MFI, SelectionDAG &DAG, SDValue Arg,
00514                       const MipsCC &CC, const ByValArgInfo &ByVal,
00515                       const ISD::ArgFlagsTy &Flags, bool isLittle) const;
00516 
00517     /// writeVarArgRegs - Write variable function arguments passed in registers
00518     /// to the stack. Also create a stack frame object for the first variable
00519     /// argument.
00520     void writeVarArgRegs(std::vector<SDValue> &OutChains, const MipsCC &CC,
00521                          SDValue Chain, SDLoc DL, SelectionDAG &DAG) const;
00522 
00523     SDValue
00524       LowerFormalArguments(SDValue Chain,
00525                            CallingConv::ID CallConv, bool isVarArg,
00526                            const SmallVectorImpl<ISD::InputArg> &Ins,
00527                            SDLoc dl, SelectionDAG &DAG,
00528                            SmallVectorImpl<SDValue> &InVals) const override;
00529 
00530     SDValue passArgOnStack(SDValue StackPtr, unsigned Offset, SDValue Chain,
00531                            SDValue Arg, SDLoc DL, bool IsTailCall,
00532                            SelectionDAG &DAG) const;
00533 
00534     SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI,
00535                       SmallVectorImpl<SDValue> &InVals) const override;
00536 
00537     bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
00538                         bool isVarArg,
00539                         const SmallVectorImpl<ISD::OutputArg> &Outs,
00540                         LLVMContext &Context) const override;
00541 
00542     SDValue LowerReturn(SDValue Chain,
00543                         CallingConv::ID CallConv, bool isVarArg,
00544                         const SmallVectorImpl<ISD::OutputArg> &Outs,
00545                         const SmallVectorImpl<SDValue> &OutVals,
00546                         SDLoc dl, SelectionDAG &DAG) const override;
00547 
00548     // Inline asm support
00549     ConstraintType
00550       getConstraintType(const std::string &Constraint) const override;
00551 
00552     /// Examine constraint string and operand type and determine a weight value.
00553     /// The operand object must already have been set up with the operand type.
00554     ConstraintWeight getSingleConstraintMatchWeight(
00555       AsmOperandInfo &info, const char *constraint) const override;
00556 
00557     /// This function parses registers that appear in inline-asm constraints.
00558     /// It returns pair (0, 0) on failure.
00559     std::pair<unsigned, const TargetRegisterClass *>
00560     parseRegForInlineAsmConstraint(StringRef C, MVT VT) const;
00561 
00562     std::pair<unsigned, const TargetRegisterClass*>
00563               getRegForInlineAsmConstraint(const std::string &Constraint,
00564                                            MVT VT) const override;
00565 
00566     /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
00567     /// vector.  If it is invalid, don't add anything to Ops. If hasMemory is
00568     /// true it means one of the asm constraint of the inline asm instruction
00569     /// being processed is 'm'.
00570     void LowerAsmOperandForConstraint(SDValue Op,
00571                                       std::string &Constraint,
00572                                       std::vector<SDValue> &Ops,
00573                                       SelectionDAG &DAG) const override;
00574 
00575     bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const override;
00576 
00577     bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
00578 
00579     EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign,
00580                             unsigned SrcAlign,
00581                             bool IsMemset, bool ZeroMemset,
00582                             bool MemcpyStrSrc,
00583                             MachineFunction &MF) const override;
00584 
00585     /// isFPImmLegal - Returns true if the target can instruction select the
00586     /// specified FP immediate natively. If false, the legalizer will
00587     /// materialize the FP immediate as a load from a constant pool.
00588     bool isFPImmLegal(const APFloat &Imm, EVT VT) const override;
00589 
00590     unsigned getJumpTableEncoding() const override;
00591 
00592     /// Emit a sign-extension using sll/sra, seb, or seh appropriately.
00593     MachineBasicBlock *emitSignExtendToI32InReg(MachineInstr *MI,
00594                                                 MachineBasicBlock *BB,
00595                                                 unsigned Size, unsigned DstReg,
00596                                                 unsigned SrcRec) const;
00597 
00598     MachineBasicBlock *emitAtomicBinary(MachineInstr *MI, MachineBasicBlock *BB,
00599                     unsigned Size, unsigned BinOpcode, bool Nand = false) const;
00600     MachineBasicBlock *emitAtomicBinaryPartword(MachineInstr *MI,
00601                     MachineBasicBlock *BB, unsigned Size, unsigned BinOpcode,
00602                     bool Nand = false) const;
00603     MachineBasicBlock *emitAtomicCmpSwap(MachineInstr *MI,
00604                                   MachineBasicBlock *BB, unsigned Size) const;
00605     MachineBasicBlock *emitAtomicCmpSwapPartword(MachineInstr *MI,
00606                                   MachineBasicBlock *BB, unsigned Size) const;
00607     MachineBasicBlock *emitSEL_D(MachineInstr *MI, MachineBasicBlock *BB) const;
00608   };
00609 
00610   /// Create MipsTargetLowering objects.
00611   const MipsTargetLowering *
00612   createMips16TargetLowering(MipsTargetMachine &TM, const MipsSubtarget &STI);
00613   const MipsTargetLowering *
00614   createMipsSETargetLowering(MipsTargetMachine &TM, const MipsSubtarget &STI);
00615 
00616   namespace Mips {
00617     FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
00618                              const TargetLibraryInfo *libInfo);
00619   }
00620 }
00621 
00622 #endif