LLVM API Documentation

llvm::SelectionDAG Class Reference

#include <SelectionDAG.h>

Collaboration diagram for llvm::SelectionDAG:

Collaboration graph
[legend]

List of all members.

Public Types

typedef ilist< SDNode >
::const_iterator 
allnodes_const_iterator
typedef ilist< SDNode >::iterator allnodes_iterator

Public Member Functions

 SelectionDAG (TargetLowering &tli, FunctionLoweringInfo &fli)
 ~SelectionDAG ()
void init (MachineFunction &mf, MachineModuleInfo *mmi)
void clear ()
MachineFunctiongetMachineFunction () const
const TargetMachinegetTarget () const
TargetLoweringgetTargetLoweringInfo () const
FunctionLoweringInfogetFunctionLoweringInfo () const
MachineModuleInfogetMachineModuleInfo () const
void viewGraph (const std::string &Title)
void viewGraph ()
void clearGraphAttrs ()
void setGraphAttrs (const SDNode *N, const char *Attrs)
const std::string getGraphAttrs (const SDNode *N) const
void setGraphColor (const SDNode *N, const char *Color)
void setSubgraphColor (SDNode *N, const char *Color)
allnodes_const_iterator allnodes_begin () const
allnodes_const_iterator allnodes_end () const
allnodes_iterator allnodes_begin ()
allnodes_iterator allnodes_end ()
ilist< SDNode >::size_type allnodes_size () const
const SDValuegetRoot () const
SDValue getEntryNode () const
const SDValuesetRoot (SDValue N)
void Combine (CombineLevel Level, AliasAnalysis &AA, bool Fast)
bool LegalizeTypes ()
void Legalize (bool TypesNeedLegalizing)
void RemoveDeadNodes ()
void DeleteNode (SDNode *N)
SDVTList getVTList (MVT VT)
SDVTList getVTList (MVT VT1, MVT VT2)
SDVTList getVTList (MVT VT1, MVT VT2, MVT VT3)
SDVTList getVTList (MVT VT1, MVT VT2, MVT VT3, MVT VT4)
SDVTList getVTList (const MVT *VTs, unsigned NumVTs)
const MVTgetNodeValueTypes (MVT VT)
 getNodeValueTypes - These are obsolete, use getVTList instead.
const MVTgetNodeValueTypes (MVT VT1, MVT VT2)
const MVTgetNodeValueTypes (MVT VT1, MVT VT2, MVT VT3)
const MVTgetNodeValueTypes (MVT VT1, MVT VT2, MVT VT3, MVT VT4)
const MVTgetNodeValueTypes (const std::vector< MVT > &vtList)
SDValue getConstant (uint64_t Val, MVT VT, bool isTarget=false)
SDValue getConstant (const APInt &Val, MVT VT, bool isTarget=false)
SDValue getConstant (const ConstantInt &Val, MVT VT, bool isTarget=false)
SDValue getIntPtrConstant (uint64_t Val, bool isTarget=false)
SDValue getTargetConstant (uint64_t Val, MVT VT)
SDValue getTargetConstant (const APInt &Val, MVT VT)
SDValue getTargetConstant (const ConstantInt &Val, MVT VT)
SDValue getConstantFP (double Val, MVT VT, bool isTarget=false)
SDValue getConstantFP (const APFloat &Val, MVT VT, bool isTarget=false)
SDValue getConstantFP (const ConstantFP &CF, MVT VT, bool isTarget=false)
SDValue getTargetConstantFP (double Val, MVT VT)
SDValue getTargetConstantFP (const APFloat &Val, MVT VT)
SDValue getTargetConstantFP (const ConstantFP &Val, MVT VT)
SDValue getGlobalAddress (const GlobalValue *GV, MVT VT, int64_t offset=0, bool isTargetGA=false)
SDValue getTargetGlobalAddress (const GlobalValue *GV, MVT VT, int64_t offset=0)
SDValue getFrameIndex (int FI, MVT VT, bool isTarget=false)
SDValue getTargetFrameIndex (int FI, MVT VT)
SDValue getJumpTable (int JTI, MVT VT, bool isTarget=false)
SDValue getTargetJumpTable (int JTI, MVT VT)
SDValue getConstantPool (Constant *C, MVT VT, unsigned Align=0, int Offs=0, bool isT=false)
SDValue getTargetConstantPool (Constant *C, MVT VT, unsigned Align=0, int Offset=0)
SDValue getConstantPool (MachineConstantPoolValue *C, MVT VT, unsigned Align=0, int Offs=0, bool isT=false)
SDValue getTargetConstantPool (MachineConstantPoolValue *C, MVT VT, unsigned Align=0, int Offset=0)
SDValue getBasicBlock (MachineBasicBlock *MBB)
SDValue getExternalSymbol (const char *Sym, MVT VT)
SDValue getTargetExternalSymbol (const char *Sym, MVT VT)
SDValue getArgFlags (ISD::ArgFlagsTy Flags)
SDValue getValueType (MVT)
SDValue getRegister (unsigned Reg, MVT VT)
SDValue getDbgStopPoint (SDValue Root, unsigned Line, unsigned Col, const CompileUnitDesc *CU)
SDValue getLabel (unsigned Opcode, SDValue Root, unsigned LabelID)
SDValue getCopyToReg (SDValue Chain, unsigned Reg, SDValue N)
SDValue getCopyToReg (SDValue Chain, unsigned Reg, SDValue N, SDValue Flag)
SDValue getCopyToReg (SDValue Chain, SDValue Reg, SDValue N, SDValue Flag)
SDValue getCopyFromReg (SDValue Chain, unsigned Reg, MVT VT)
SDValue getCopyFromReg (SDValue Chain, unsigned Reg, MVT VT, SDValue Flag)
SDValue getCondCode (ISD::CondCode Cond)
SDValue getConvertRndSat (MVT VT, SDValue Val, SDValue DTy, SDValue STy, SDValue Rnd, SDValue Sat, ISD::CvtCode Code)
SDValue getZeroExtendInReg (SDValue Op, MVT SrcTy)
SDValue getCALLSEQ_START (SDValue Chain, SDValue Op)
SDValue getCALLSEQ_END (SDValue Chain, SDValue Op1, SDValue Op2, SDValue InFlag)
SDValue getNode (unsigned Opcode, MVT VT)
SDValue getNode (unsigned Opcode, MVT VT, SDValue N)
SDValue getNode (unsigned Opcode, MVT VT, SDValue N1, SDValue N2)
SDValue getNode (unsigned Opcode, MVT VT, SDValue N1, SDValue N2, SDValue N3)
SDValue getNode (unsigned Opcode, MVT VT, SDValue N1, SDValue N2, SDValue N3, SDValue N4)
SDValue getNode (unsigned Opcode, MVT VT, SDValue N1, SDValue N2, SDValue N3, SDValue N4, SDValue N5)
SDValue getNode (unsigned Opcode, MVT VT, const SDValue *Ops, unsigned NumOps)
SDValue getNode (unsigned Opcode, MVT VT, const SDUse *Ops, unsigned NumOps)
SDValue getNode (unsigned Opcode, const std::vector< MVT > &ResultTys, const SDValue *Ops, unsigned NumOps)
SDValue getNode (unsigned Opcode, const MVT *VTs, unsigned NumVTs, const SDValue *Ops, unsigned NumOps)
SDValue getNode (unsigned Opcode, SDVTList VTs)
SDValue getNode (unsigned Opcode, SDVTList VTs, SDValue N)
SDValue getNode (unsigned Opcode, SDVTList VTs, SDValue N1, SDValue N2)
SDValue getNode (unsigned Opcode, SDVTList VTs, SDValue N1, SDValue N2, SDValue N3)
SDValue getNode (unsigned Opcode, SDVTList VTs, SDValue N1, SDValue N2, SDValue N3, SDValue N4)
SDValue getNode (unsigned Opcode, SDVTList VTs, SDValue N1, SDValue N2, SDValue N3, SDValue N4, SDValue N5)
SDValue getNode (unsigned Opcode, SDVTList VTs, const SDValue *Ops, unsigned NumOps)
SDValue getMemcpy (SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool AlwaysInline, const Value *DstSV, uint64_t DstSVOff, const Value *SrcSV, uint64_t SrcSVOff)
SDValue getMemmove (SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, const Value *DstSV, uint64_t DstOSVff, const Value *SrcSV, uint64_t SrcSVOff)
SDValue getMemset (SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, const Value *DstSV, uint64_t DstSVOff)
SDValue getSetCC (MVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond)
SDValue getVSetCC (MVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond)
SDValue getSelectCC (SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond)
SDValue getVAArg (MVT VT, SDValue Chain, SDValue Ptr, SDValue SV)
SDValue getAtomic (unsigned Opcode, MVT MemVT, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp, const Value *PtrVal, unsigned Alignment=0)
SDValue getAtomic (unsigned Opcode, MVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, const Value *PtrVal, unsigned Alignment=0)
SDValue getMemIntrinsicNode (unsigned Opcode, const MVT *VTs, unsigned NumVTs, const SDValue *Ops, unsigned NumOps, MVT MemVT, const Value *srcValue, int SVOff, unsigned Align=0, bool Vol=false, bool ReadMem=true, bool WriteMem=true)
SDValue getMemIntrinsicNode (unsigned Opcode, SDVTList VTList, const SDValue *Ops, unsigned NumOps, MVT MemVT, const Value *srcValue, int SVOff, unsigned Align=0, bool Vol=false, bool ReadMem=true, bool WriteMem=true)
SDValue getMergeValues (const SDValue *Ops, unsigned NumOps)
 getMergeValues - Create a MERGE_VALUES node from the given operands.
SDValue getCall (unsigned CallingConv, bool IsVarArgs, bool IsTailCall, bool isInreg, SDVTList VTs, const SDValue *Operands, unsigned NumOperands)
SDValue getLoad (MVT VT, SDValue Chain, SDValue Ptr, const Value *SV, int SVOffset, bool isVolatile=false, unsigned Alignment=0)
SDValue getExtLoad (ISD::LoadExtType ExtType, MVT VT, SDValue Chain, SDValue Ptr, const Value *SV, int SVOffset, MVT EVT, bool isVolatile=false, unsigned Alignment=0)
SDValue getIndexedLoad (SDValue OrigLoad, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
SDValue getLoad (ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, MVT VT, SDValue Chain, SDValue Ptr, SDValue Offset, const Value *SV, int SVOffset, MVT EVT, bool isVolatile=false, unsigned Alignment=0)
SDValue getStore (SDValue Chain, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, bool isVolatile=false, unsigned Alignment=0)
SDValue getTruncStore (SDValue Chain, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, MVT TVT, bool isVolatile=false, unsigned Alignment=0)
SDValue getIndexedStore (SDValue OrigStoe, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
SDValue getSrcValue (const Value *v)
SDValue getMemOperand (const MachineMemOperand &MO)
SDValue UpdateNodeOperands (SDValue N, SDValue Op)
SDValue UpdateNodeOperands (SDValue N, SDValue Op1, SDValue Op2)
SDValue UpdateNodeOperands (SDValue N, SDValue Op1, SDValue Op2, SDValue Op3)
SDValue UpdateNodeOperands (SDValue N, SDValue Op1, SDValue Op2, SDValue Op3, SDValue Op4)
SDValue UpdateNodeOperands (SDValue N, SDValue Op1, SDValue Op2, SDValue Op3, SDValue Op4, SDValue Op5)
SDValue UpdateNodeOperands (SDValue N, const SDValue *Ops, unsigned NumOps)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT, SDValue Op1)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT, SDValue Op1, SDValue Op2)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT, SDValue Op1, SDValue Op2, SDValue Op3)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT, const SDValue *Ops, unsigned NumOps)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, const SDValue *Ops, unsigned NumOps)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, MVT VT3, const SDValue *Ops, unsigned NumOps)
SDNodeSelectNodeTo (SDNode *N, unsigned MachineOpc, MVT VT1, MVT VT2, MVT VT3, MVT VT4, const SDValue *Ops, unsigned NumOps)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDValue Op1)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDValue Op1, SDValue Op2)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDValue Op1, SDValue Op2, SDValue Op3)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, MVT VT3, SDValue Op1, SDValue Op2, SDValue Op3)
SDNodeSelectNodeTo (SDNode *N, unsigned TargetOpc, SDVTList VTs, const SDValue *Ops, unsigned NumOps)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT, SDValue Op1)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT, SDValue Op1, SDValue Op2)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT, SDValue Op1, SDValue Op2, SDValue Op3)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT, const SDValue *Ops, unsigned NumOps)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT1, MVT VT2)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT1, MVT VT2, const SDValue *Ops, unsigned NumOps)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT1, MVT VT2, MVT VT3, const SDValue *Ops, unsigned NumOps)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT1, MVT VT2, SDValue Op1)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT1, MVT VT2, SDValue Op1, SDValue Op2)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, MVT VT1, MVT VT2, SDValue Op1, SDValue Op2, SDValue Op3)
SDNodeMorphNodeTo (SDNode *N, unsigned Opc, SDVTList VTs, const SDValue *Ops, unsigned NumOps)
SDNodegetTargetNode (unsigned Opcode, MVT VT)
SDNodegetTargetNode (unsigned Opcode, MVT VT, SDValue Op1)
SDNodegetTargetNode (unsigned Opcode, MVT VT, SDValue Op1, SDValue Op2)
SDNodegetTargetNode (unsigned Opcode, MVT VT, SDValue Op1, SDValue Op2, SDValue Op3)
SDNodegetTargetNode (unsigned Opcode, MVT VT, const SDValue *Ops, unsigned NumOps)
SDNodegetTargetNode (unsigned Opcode, MVT VT1, MVT VT2)
SDNodegetTargetNode (unsigned Opcode, MVT VT1, MVT VT2, SDValue Op1)
SDNodegetTargetNode (unsigned Opcode, MVT VT1, MVT VT2, SDValue Op1, SDValue Op2)
SDNodegetTargetNode (unsigned Opcode, MVT VT1, MVT VT2, SDValue Op1, SDValue Op2, SDValue Op3)
SDNodegetTargetNode (unsigned Opcode, MVT VT1, MVT VT2, const SDValue *Ops, unsigned NumOps)
SDNodegetTargetNode (unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, SDValue Op1, SDValue Op2)
SDNodegetTargetNode (unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, SDValue Op1, SDValue Op2, SDValue Op3)
SDNodegetTargetNode (unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, const SDValue *Ops, unsigned NumOps)
SDNodegetTargetNode (unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, MVT VT4, const SDValue *Ops, unsigned NumOps)
SDNodegetTargetNode (unsigned Opcode, const std::vector< MVT > &ResultTys, const SDValue *Ops, unsigned NumOps)
SDNodegetNodeIfExists (unsigned Opcode, SDVTList VTs, const SDValue *Ops, unsigned NumOps)
void RemoveDeadNode (SDNode *N, DAGUpdateListener *UpdateListener=0)
void RemoveDeadNodes (SmallVectorImpl< SDNode * > &DeadNodes, DAGUpdateListener *UpdateListener=0)
void ReplaceAllUsesWith (SDValue From, SDValue Op, DAGUpdateListener *UpdateListener=0)
void ReplaceAllUsesWith (SDNode *From, SDNode *To, DAGUpdateListener *UpdateListener=0)
void ReplaceAllUsesWith (SDNode *From, const SDValue *To, DAGUpdateListener *UpdateListener=0)
void ReplaceAllUsesOfValueWith (SDValue From, SDValue To, DAGUpdateListener *UpdateListener=0)
void ReplaceAllUsesOfValuesWith (const SDValue *From, const SDValue *To, unsigned Num, DAGUpdateListener *UpdateListener=0)
unsigned AssignTopologicalOrder ()
void RepositionNode (allnodes_iterator Position, SDNode *N)
void dump () const
SDValue CreateStackTemporary (MVT VT, unsigned minAlign=1)
SDValue CreateStackTemporary (MVT VT1, MVT VT2)
SDValue FoldConstantArithmetic (unsigned Opcode, MVT VT, ConstantSDNode *Cst1, ConstantSDNode *Cst2)
 FoldConstantArithmetic -.
SDValue FoldSetCC (MVT VT, SDValue N1, SDValue N2, ISD::CondCode Cond)
 FoldSetCC - Constant fold a setcc to true or false.
bool SignBitIsZero (SDValue Op, unsigned Depth=0) const
bool MaskedValueIsZero (SDValue Op, const APInt &Mask, unsigned Depth=0) const
void ComputeMaskedBits (SDValue Op, const APInt &Mask, APInt &KnownZero, APInt &KnownOne, unsigned Depth=0) const
unsigned ComputeNumSignBits (SDValue Op, unsigned Depth=0) const
bool isVerifiedDebugInfoDesc (SDValue Op) const
SDValue getShuffleScalarElt (const SDNode *N, unsigned Idx)

Static Public Member Functions

static bool isCommutativeBinOp (unsigned Opcode)

Public Attributes

std::map< const SDNode
*, std::string > 
NodeGraphAttrs

Classes

class  DAGUpdateListener


Detailed Description

SelectionDAG class - This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representation suitable for instruction selection. This DAG is constructed as the first step of instruction selection in order to allow implementation of machine specific optimizations and code simplifications.

The representation used by the SelectionDAG is a target-independent representation, which has some similarities to the GCC RTL representation, but is significantly more simple, powerful, and is a graph form instead of a linear form.

Definition at line 74 of file SelectionDAG.h.


Member Typedef Documentation

Definition at line 167 of file SelectionDAG.h.

Definition at line 170 of file SelectionDAG.h.


Constructor & Destructor Documentation

SelectionDAG::SelectionDAG ( TargetLowering tli,
FunctionLoweringInfo fli 
)

Definition at line 768 of file SelectionDAG.cpp.

SelectionDAG::~SelectionDAG (  ) 

Definition at line 780 of file SelectionDAG.cpp.


Member Function Documentation

void SelectionDAG::init ( MachineFunction mf,
MachineModuleInfo mmi 
)

init - Prepare this SelectionDAG to process code in the given MachineFunction.

Definition at line 775 of file SelectionDAG.cpp.

References MF, and MMI.

Referenced by llvm::SelectionDAGISel::runOnFunction().

void SelectionDAG::clear (  ) 

clear - Clear state and free memory necessary to make this SelectionDAG ready to process a new block.

Definition at line 800 of file SelectionDAG.cpp.

References getEntryNode(), llvm::BumpPtrAllocator::Reset(), Root, and llvm::SDNode::Uses.

Referenced by llvm::SelectionDAGLowering::clear().

MachineFunction& llvm::SelectionDAG::getMachineFunction (  )  const [inline]

const TargetMachine & SelectionDAG::getTarget (  )  const

TargetLowering& llvm::SelectionDAG::getTargetLoweringInfo (  )  const [inline]

FunctionLoweringInfo& llvm::SelectionDAG::getFunctionLoweringInfo (  )  const [inline]

Definition at line 135 of file SelectionDAG.h.

Referenced by llvm::RegsForValue::getCopyFromRegs().

MachineModuleInfo* llvm::SelectionDAG::getMachineModuleInfo (  )  const [inline]

void SelectionDAG::viewGraph ( const std::string &  Title  ) 

viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'.

viewGraph - Pop up a ghostview window with the reachable parts of the DAG rendered using 'dot'.

Definition at line 259 of file SelectionDAGPrinter.cpp.

References llvm::cerr(), getMachineFunction(), llvm::Intrinsic::getName(), and