diff options
Diffstat (limited to 'include/llvm/CodeGen/SelectionDAG.h')
| -rw-r--r-- | include/llvm/CodeGen/SelectionDAG.h | 88 | 
1 files changed, 69 insertions, 19 deletions
| diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index d6851f7143a5..6a5c2db34bb1 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -211,6 +211,7 @@ class SelectionDAG {    const SelectionDAGTargetInfo *TSI = nullptr;    const TargetLowering *TLI = nullptr;    MachineFunction *MF; +  Pass *SDAGISelPass = nullptr;    LLVMContext *Context;    CodeGenOpt::Level OptLevel; @@ -335,6 +336,14 @@ private:          .getRawSubclassData();    } +  template <typename SDNodeTy> +  static uint16_t getSyntheticNodeSubclassData(unsigned Opc, unsigned Order, +                                                SDVTList VTs, EVT MemoryVT, +                                                MachineMemOperand *MMO) { +    return SDNodeTy(Opc, Order, DebugLoc(), VTs, MemoryVT, MMO) +         .getRawSubclassData(); +  } +    void createOperands(SDNode *Node, ArrayRef<SDValue> Vals) {      assert(!Node->OperandList && "Node already has operands");      SDUse *Ops = OperandRecycler.allocate( @@ -366,13 +375,16 @@ public:    ~SelectionDAG();    /// Prepare this SelectionDAG to process code in the given MachineFunction. -  void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE); +  void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE, +            Pass *PassPtr);    /// Clear state and free memory necessary to make this    /// SelectionDAG ready to process a new block.    void clear();    MachineFunction &getMachineFunction() const { return *MF; } +  const Pass *getPass() const { return SDAGISelPass; } +    const DataLayout &getDataLayout() const { return MF->getDataLayout(); }    const TargetMachine &getTarget() const { return TM; }    const TargetSubtargetInfo &getSubtarget() const { return MF->getSubtarget(); } @@ -631,6 +643,8 @@ public:    SDValue getRegister(unsigned Reg, EVT VT);    SDValue getRegisterMask(const uint32_t *RegMask);    SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label); +  SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root, +                       MCSymbol *Label);    SDValue getBlockAddress(const BlockAddress *BA, EVT VT,                            int64_t Offset = 0, bool isTarget = false,                            unsigned char TargetFlags = 0); @@ -782,6 +796,24 @@ public:    /// \brief Create a logical NOT operation as (XOR Val, BooleanOne).    SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT); +  /// \brief Create an add instruction with appropriate flags when used for +  /// addressing some offset of an object. i.e. if a load is split into multiple +  /// components, create an add nuw from the base pointer to the offset. +  SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Op, int64_t Offset) { +    EVT VT = Op.getValueType(); +    return getObjectPtrOffset(SL, Op, getConstant(Offset, SL, VT)); +  } + +  SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Op, SDValue Offset) { +    EVT VT = Op.getValueType(); + +    // The object itself can't wrap around the address space, so it shouldn't be +    // possible for the adds of the offsets to the split parts to overflow. +    SDNodeFlags Flags; +    Flags.setNoUnsignedWrap(true); +    return getNode(ISD::ADD, SL, VT, Op, Offset, Flags); +  } +    /// Return a new CALLSEQ_START node, that starts new call frame, in which    /// InSize bytes are set up inside CALLSEQ_START..CALLSEQ_END sequence and    /// OutSize specifies part of the frame set up prior to the sequence. @@ -956,11 +988,14 @@ public:    /// result and takes a list of operands. Opcode may be INTRINSIC_VOID,    /// INTRINSIC_W_CHAIN, or a target-specific opcode with a value not    /// less than FIRST_TARGET_MEMORY_OPCODE. -  SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, -                              ArrayRef<SDValue> Ops, EVT MemVT, -                              MachinePointerInfo PtrInfo, unsigned Align = 0, -                              bool Vol = false, bool ReadMem = true, -                              bool WriteMem = true, unsigned Size = 0); +  SDValue getMemIntrinsicNode( +    unsigned Opcode, const SDLoc &dl, SDVTList VTList, +    ArrayRef<SDValue> Ops, EVT MemVT, +    MachinePointerInfo PtrInfo, +    unsigned Align = 0, +    MachineMemOperand::Flags Flags +    = MachineMemOperand::MOLoad | MachineMemOperand::MOStore, +    unsigned Size = 0);    SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList,                                ArrayRef<SDValue> Ops, EVT MemVT, @@ -1166,19 +1201,26 @@ public:                            const SDNodeFlags Flags = SDNodeFlags());    /// Creates a SDDbgValue node. -  SDDbgValue *getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R, -                          bool IsIndirect, uint64_t Off, const DebugLoc &DL, +  SDDbgValue *getDbgValue(DIVariable *Var, DIExpression *Expr, SDNode *N, +                          unsigned R, bool IsIndirect, const DebugLoc &DL,                            unsigned O); -  /// Constant -  SDDbgValue *getConstantDbgValue(MDNode *Var, MDNode *Expr, const Value *C, -                                  uint64_t Off, const DebugLoc &DL, unsigned O); +  /// Creates a constant SDDbgValue node. +  SDDbgValue *getConstantDbgValue(DIVariable *Var, DIExpression *Expr, +                                  const Value *C, const DebugLoc &DL, +                                  unsigned O); -  /// FrameIndex -  SDDbgValue *getFrameIndexDbgValue(MDNode *Var, MDNode *Expr, unsigned FI, -                                    uint64_t Off, const DebugLoc &DL, +  /// Creates a FrameIndex SDDbgValue node. +  SDDbgValue *getFrameIndexDbgValue(DIVariable *Var, DIExpression *Expr, +                                    unsigned FI, const DebugLoc &DL,                                      unsigned O); +  /// Transfer debug values from one node to another, while optionally +  /// generating fragment expressions for split-up values. If \p InvalidateDbg +  /// is set, debug values are invalidated after they are transferred. +  void transferDbgValues(SDValue From, SDValue To, unsigned OffsetInBits = 0, +                         unsigned SizeInBits = 0, bool InvalidateDbg = true); +    /// Remove the specified node from the system. If any of its    /// operands then becomes dead, remove them as well. Inform UpdateListener    /// for each node deleted. @@ -1208,7 +1250,7 @@ public:    void ReplaceAllUsesWith(SDNode *From, const SDValue *To);    /// Replace any uses of From with To, leaving -  /// uses of other values produced by From.Val alone. +  /// uses of other values produced by From.getNode() alone.    void ReplaceAllUsesOfValueWith(SDValue From, SDValue To);    /// Like ReplaceAllUsesOfValueWith, but for multiple values at once. @@ -1259,10 +1301,6 @@ public:      return DbgInfo->getSDDbgValues(SD);    } -private: -  /// Transfer SDDbgValues. Called via ReplaceAllUses{OfValue}?With -  void TransferDbgValues(SDValue From, SDValue To); -  public:    /// Return true if there are any SDDbgValue nodes associated    /// with this SelectionDAG. @@ -1279,6 +1317,10 @@ public:      return DbgInfo->ByvalParmDbgEnd();    } +  /// To be invoked on an SDNode that is slated to be erased. This +  /// function mirrors \c llvm::salvageDebugInfo. +  void salvageDebugInfo(SDNode &N); +    void dump() const;    /// Create a stack temporary, suitable for holding the specified value type. @@ -1308,6 +1350,14 @@ public:    SDValue FoldSetCC(EVT VT, SDValue N1, SDValue N2, ISD::CondCode Cond,                      const SDLoc &dl); +  /// See if the specified operand can be simplified with the knowledge that only +  /// the bits specified by Mask are used.  If so, return the simpler operand, +  /// otherwise return a null SDValue. +  /// +  /// (This exists alongside SimplifyDemandedBits because GetDemandedBits can +  /// simplify nodes with multiple uses more aggressively.) +  SDValue GetDemandedBits(SDValue V, const APInt &Mask); +    /// Return true if the sign bit of Op is known to be zero.    /// We use this predicate to simplify operations downstream.    bool SignBitIsZero(SDValue Op, unsigned Depth = 0) const; | 
