LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvm::DSNode Class Reference

#include <DSNode.h>

Collaboration diagram for llvm::DSNode:

Collaboration graph
[legend]
List of all members.

Public Types

typedef DSNodeIterator< DSNodeiterator
typedef DSNodeIterator< const
DSNode
const_iterator
typedef std::vector< GlobalValue
* >::const_iterator 
global_iterator
enum  NodeTy {
  ShadowNode = 0, AllocaNode = 1 << 0, HeapNode = 1 << 1, GlobalNode = 1 << 2,
  UnknownNode = 1 << 3, Incomplete = 1 << 4, Modified = 1 << 5, Read = 1 << 6,
  Array = 1 << 7, DEAD = 1 << 8, Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode
}

Public Member Functions

 DSNode (const Type *T, DSGraph *G)
 DSNode (const DSNode &, DSGraph *G, bool NullLinks=false)
 ~DSNode ()
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
unsigned getSize () const
const TypegetType () const
bool isArray () const
bool hasNoReferrers () const
unsigned getNumReferrers () const
DSGraphgetParentGraph () const
void setParentGraph (DSGraph *G)
const TargetDatagetTargetData () const
DSNodegetForwardNode () const
bool isForwarding () const
void stopForwarding ()
bool hasLink (unsigned Offset) const
DSNodeHandlegetLink (unsigned Offset)
const DSNodeHandlegetLink (unsigned Offset) const
unsigned getNumLinks () const
bool mergeTypeInfo (const Type *Ty, unsigned Offset, bool FoldIfIncompatible=true)
void foldNodeCompletely ()
bool isNodeCompletelyFolded () const
void setLink (unsigned Offset, const DSNodeHandle &NH)
unsigned getPointerSize () const
void addEdgeTo (unsigned Offset, const DSNodeHandle &NH)
void mergeWith (const DSNodeHandle &NH, unsigned Offset)
void addGlobal (GlobalValue *GV)
void mergeGlobals (const std::vector< GlobalValue * > &RHS)
const std::vector< GlobalValue * > & getGlobals () const
global_iterator global_begin () const
global_iterator global_end () const
void maskNodeTypes (unsigned Mask)
void mergeNodeFlags (unsigned RHS)
unsigned getNodeFlags () const
bool isAllocaNode () const
bool isHeapNode () const
bool isGlobalNode () const
bool isUnknownNode () const
bool isModified () const
bool isRead () const
bool isIncomplete () const
bool isComplete () const
bool isDeadNode () const
DSNodesetAllocaNodeMarker ()
DSNodesetHeapNodeMarker ()
DSNodesetGlobalNodeMarker ()
DSNodesetUnknownNodeMarker ()
DSNodesetIncompleteMarker ()
DSNodesetModifiedMarker ()
DSNodesetReadMarker ()
DSNodesetArrayMarker ()
void makeNodeDead ()
void forwardNode (DSNode *To, unsigned Offset)
void print (std::ostream &O, const DSGraph *G) const
void dump () const
void assertOK () const
void dropAllReferences ()
void remapLinks (hash_map< const DSNode *, DSNodeHandle > &OldNodeMap)
void markReachableNodes (hash_set< DSNode * > &ReachableNodes)

Friends

struct ilist_traits< DSNode >
class DSNodeHandle

Detailed Description

DSNode - Data structure node class

This class represents an untyped memory object of Size bytes. It keeps track of any pointers that have been stored into the object as well as the different types represented in this object.

Definition at line 32 of file DSNode.h.


Member Typedef Documentation

typedef DSNodeIterator<const DSNode> llvm::DSNode::const_iterator
 

Definition at line 127 of file DSNode.h.

typedef std::vector<GlobalValue*>::const_iterator llvm::DSNode::global_iterator
 

Definition at line 278 of file DSNode.h.

typedef DSNodeIterator<DSNode> llvm::DSNode::iterator
 

Definition at line 126 of file DSNode.h.


Member Enumeration Documentation

enum llvm::DSNode::NodeTy
 

Enumerator:
ShadowNode 
AllocaNode 
HeapNode 
GlobalNode 
UnknownNode 
Incomplete 
Modified 
Read 
Array 
DEAD 
Composition 

Definition at line 81 of file DSNode.h.


Constructor & Destructor Documentation

DSNode::DSNode const Type T,
DSGraph G
 

DSNode ctor - Create a node of the specified type, inserting it into the specified graph.

Definition at line 79 of file DataStructure.cpp.

References llvm::DSGraph::addNode(), mergeTypeInfo(), and NumNodeAllocated.

DSNode::DSNode const DSNode ,
DSGraph G,
bool  NullLinks = false
 

DSNode "copy ctor" - Copy the specified node, inserting it into the specified graph. If NullLinks is true, then null out all of the links, but keep the same number of them. This can be used for efficiency if the links are just going to be clobbered anyway.

Definition at line 88 of file DataStructure.cpp.

References llvm::DSGraph::addNode(), Globals, Links, and NumNodeAllocated.

llvm::DSNode::~DSNode  )  [inline]
 

Definition at line 120 of file DSNode.h.

References dropAllReferences(), and hasNoReferrers().


Member Function Documentation

void DSNode::addEdgeTo unsigned  Offset,
const DSNodeHandle NH
 

addEdgeTo - Add an edge from the current node to the specified node. This can cause merging of nodes in the graph.

Definition at line 567 of file DataStructure.cpp.

References getLink(), llvm::DSNodeHandle::isNull(), llvm::DSNodeHandle::mergeWith(), and setLink().

Referenced by llvm::DSNodeHandle::addEdgeTo(), and llvm::ReachabilityCloner::getClonedNH().

void DSNode::addGlobal GlobalValue GV  ) 
 

addGlobal - Add an entry for a global value to the Globals list. This also marks the node with the 'G' flag if it does not already have it.

Definition at line 142 of file DataStructure.cpp.

References GlobalNode, and I.

void DSNode::assertOK  )  const
 

Definition at line 106 of file DataStructure.cpp.

References Array, llvm::DSScalarMap::count(), llvm::DSScalarMap::find(), llvm::DSNodeIterator< NodeTy >::getNode(), llvm::DSGraph::getScalarMap(), and llvm::Type::VoidTy.

DSNode::const_iterator llvm::DSNode::begin  )  const [inline]
 

Definition at line 87 of file DSGraphTraits.h.

DSNode::iterator llvm::DSNode::begin  )  [inline]
 

Definition at line 81 of file DSGraphTraits.h.

Referenced by llvm::GraphTraits< const DSGraph * >::child_begin(), llvm::GraphTraits< DSGraph * >::child_begin(), llvm::GraphTraits< const DSNode * >::child_begin(), llvm::GraphTraits< DSNode * >::child_begin(), and llvm::DOTGraphTraits< const DSGraph * >::getEdgeTarget().

void llvm::DSNode::dropAllReferences  )  [inline]
 

Definition at line 336 of file DSNode.h.

References isForwarding(), and llvm::DSNodeHandle::setTo().

Referenced by ~DSNode().

void DSNode::dump  )  const
 

Definition at line 37 of file Printer.cpp.

References print().

DSNode::const_iterator llvm::DSNode::end  )  const [inline]
 

Definition at line 90 of file DSGraphTraits.h.

DSNode::iterator llvm::DSNode::end  )  [inline]
 

Definition at line 84 of file DSGraphTraits.h.

Referenced by llvm::GraphTraits< const DSGraph * >::child_end(), llvm::GraphTraits< DSGraph * >::child_end(), llvm::GraphTraits< const DSNode * >::child_end(), and llvm::GraphTraits< DSNode * >::child_end().

void DSNode::foldNodeCompletely  ) 
 

foldNodeCompletely - If we determine that this node has some funny behavior happening to it that we cannot represent, we fold it down to a single, completely pessimistic, node. This node is represented as a single byte with a single TypeEntry of "void" with isArray = true.

Definition at line 159 of file DataStructure.cpp.

References Array, forwardNode(), llvm::DSNodeHandle::getNode(), getSize(), Globals, isNodeCompletelyFolded(), Links, NodeType, NumFolds, Size, Ty, and llvm::Type::VoidTy.

Referenced by llvm::ReachabilityCloner::merge(), mergeTypeInfo(), and mergeWith().

void DSNode::forwardNode DSNode To,
unsigned  Offset
 

forwardNode - Mark this node as being obsolete, and all references to it should be forwarded to the specified node and offset.

Definition at line 123 of file DataStructure.cpp.

References DEAD, llvm::DSNodeHandle::isNull(), llvm::DSNodeHandle::setTo(), Size, llvm::DSGraph::unlinkNode(), and llvm::Type::VoidTy.

Referenced by foldNodeCompletely().

DSNode* llvm::DSNode::getForwardNode  )  const [inline]
 

getForwardNode - This method returns the node that this node is forwarded to, if any.

Definition at line 166 of file DSNode.h.

References llvm::DSNodeHandle::getNode().

Referenced by CanReachAliveNodes(), and markReachableNodes().

const std::vector<GlobalValue*>& llvm::DSNode::getGlobals  )  const [inline]
 

Definition at line 276 of file DSNode.h.

Referenced by llvm::DSCallSiteIterator::advanceToValidCallee(), llvm::DSGraph::AssertCallSiteInGraph(), llvm::DSGraph::AssertNodeContainsGlobal(), getCaption(), llvm::ReachabilityCloner::getClonedNH(), llvm::DSCallSiteIterator::isCompleteNode(), isSinglePhysicalObject(), llvm::ReachabilityCloner::merge(), nodeContainsExternalFunction(), llvm::DSCallSiteIterator::operator *(), removeIdenticalCalls(), and llvm::DSGraph::removeTriviallyDeadNodes().

const DSNodeHandle& llvm::DSNode::getLink unsigned  Offset  )  const [inline]
 

Definition at line 203 of file DSNode.h.

References llvm::DS::PointerShift.

DSNodeHandle& llvm::DSNode::getLink unsigned  Offset  )  [inline]
 

getLink - Return the link at the specified offset.

Definition at line 196 of file DSNode.h.

References llvm::DS::PointerShift.

Referenced by addEdgeTo(), CanReachAliveNodes(), llvm::DSGraph::computeNodeMapping(), llvm::DOTGraphTraits< const DSGraph * >::edgeTargetsEdgeSource(), llvm::ReachabilityCloner::getClonedNH(), llvm::DOTGraphTraits< const DSGraph * >::getEdgeTarget(), llvm::DSNodeHandle::getLink(), markIncompleteNode(), markReachableNodes(), llvm::ReachabilityCloner::merge(), and llvm::DSGraph::removeTriviallyDeadNodes().

unsigned llvm::DSNode::getNodeFlags  )  const [inline]
 

getNodeFlags - Return all of the flags set on the node. If the DEAD flag is set, hide it from the caller.

Definition at line 296 of file DSNode.h.

References DEAD.

Referenced by getCaption(), killIfUselessEdge(), llvm::ReachabilityCloner::merge(), llvm::DSGraph::removeDeadNodes(), and llvm::DSGraph::removeTriviallyDeadNodes().

unsigned llvm::DSNode::getNumLinks  )  const [inline]
 

getNumLinks - Return the number of links in a node...

Definition at line 213 of file DSNode.h.

Referenced by llvm::ReachabilityCloner::getClonedNH(), llvm::ReachabilityCloner::merge(), and llvm::DSGraph::removeTriviallyDeadNodes().

unsigned llvm::DSNode::getNumReferrers  )  const [inline]
 

getNumReferrers - This method returns the number of referrers to the current node. Note that if this node is a forwarding node, this will return the number of nodes forwarding over the node!

Definition at line 153 of file DSNode.h.

Referenced by hasNoReferrers(), killIfUselessEdge(), removeIdenticalCalls(), and llvm::DSGraph::removeTriviallyDeadNodes().

DSGraph* llvm::DSNode::getParentGraph  )  const [inline]
 

Definition at line 155 of file DSNode.h.

Referenced by llvm::DSGraph::AssertNodeInGraph(), getCaption(), and mergeTypeInfo().

unsigned llvm::DSNode::getPointerSize  )  const [inline]
 

getPointerSize - Return the size of a pointer for the current target.

Definition at line 255 of file DSNode.h.

References llvm::DS::PointerSize.

Referenced by llvm::DSGraph::removeTriviallyDeadNodes().

unsigned llvm::DSNode::getSize  )  const [inline]
 

getSize - Return the maximum number of bytes occupied by this object...

Definition at line 138 of file DSNode.h.

Referenced by CanReachAliveNodes(), llvm::DSGraph::computeNodeMapping(), foldNodeCompletely(), llvm::ReachabilityCloner::getClonedNH(), isNodeCompletelyFolded(), markIncompleteNode(), markReachableNodes(), llvm::ReachabilityCloner::merge(), and mergeWith().

const TargetData & DSNode::getTargetData  )  const
 

getTargetData - Get the target data object used to construct this node.

Definition at line 102 of file DataStructure.cpp.

References llvm::DSGraph::getTargetData().

Referenced by mergeTypeInfo().

const Type* llvm::DSNode::getType  )  const [inline]
 

getType - Return the node type of this object...

Definition at line 142 of file DSNode.h.

Referenced by getCaption(), killIfUselessEdge(), and llvm::ReachabilityCloner::merge().

global_iterator llvm::DSNode::global_begin  )  const [inline]
 

Definition at line 279 of file DSNode.h.

Referenced by llvm::ReachabilityCloner::getClonedNH(), and llvm::ReachabilityCloner::merge().

global_iterator llvm::DSNode::global_end  )  const [inline]
 

Definition at line 280 of file DSNode.h.

Referenced by llvm::ReachabilityCloner::getClonedNH(), and llvm::ReachabilityCloner::merge().

bool llvm::DSNode::hasLink unsigned  Offset  )  const [inline]
 

hasLink - Return true if this memory object has a link in slot LinkNo

Definition at line 186 of file DSNode.h.

References llvm::DS::PointerShift.

Referenced by llvm::DSNodeHandle::hasLink().

bool llvm::DSNode::hasNoReferrers  )  const [inline]
 

hasNoReferrers - Return true if nothing is pointing to this node at all.

Definition at line 148 of file DSNode.h.

References getNumReferrers().

Referenced by makeNodeDead(), mergeWith(), llvm::DSGraph::removeTriviallyDeadNodes(), and ~DSNode().

bool llvm::DSNode::isAllocaNode  )  const [inline]
 

Definition at line 298 of file DSNode.h.

References AllocaNode.

Referenced by isSinglePhysicalObject().

bool llvm::DSNode::isArray  )  const [inline]
 

Definition at line 144 of file DSNode.h.

References Array.

Referenced by getCaption(), isNodeCompletelyFolded(), llvm::ReachabilityCloner::merge(), and mergeTypeInfo().

bool llvm::DSNode::isComplete  )  const [inline]
 

Definition at line 307 of file DSNode.h.

References isIncomplete().

Referenced by isSinglePhysicalObject(), removeIdenticalCalls(), and llvm::DSGraph::removeTriviallyDeadNodes().

bool llvm::DSNode::isDeadNode  )  const [inline]
 

Definition at line 308 of file DSNode.h.

References DEAD.

Referenced by llvm::ReachabilityCloner::merge(), and mergeWith().

bool llvm::DSNode::isForwarding  )  const [inline]
 

isForwarding - Return true if this node is forwarding to another.

Definition at line 170 of file DSNode.h.

References llvm::DSNodeHandle::isNull().

Referenced by dropAllReferences(), llvm::DSNodeHandle::getNode(), llvm::DSGraph::removeDeadNodes(), llvm::DSNodeHandle::setTo(), and stopForwarding().

bool llvm::DSNode::isGlobalNode  )  const [inline]
 

Definition at line 300 of file DSNode.h.

References GlobalNode.

Referenced by CanReachAliveNodes(), isSinglePhysicalObject(), and llvm::DSGraph::removeTriviallyDeadNodes().

bool llvm::DSNode::isHeapNode  )  const [inline]
 

Definition at line 299 of file DSNode.h.

References HeapNode.

Referenced by isSinglePhysicalObject().

bool llvm::DSNode::isIncomplete  )  const [inline]
 

Definition at line 306 of file DSNode.h.

References Incomplete.

Referenced by isComplete(), llvm::DSCallSiteIterator::isCompleteNode(), and markIncompleteNode().

bool llvm::DSNode::isModified  )  const [inline]
 

Definition at line 303 of file DSNode.h.

References Modified.

Referenced by llvm::DSGraph::removeTriviallyDeadNodes().

bool DSNode::isNodeCompletelyFolded  )  const
 

isNodeCompletelyFolded - Return true if this node has been completely folded down to something that can never be expanded, effectively losing all of the field sensitivity that may be present in the node.

Definition at line 205 of file DataStructure.cpp.

References getSize(), isArray(), and llvm::Type::VoidTy.

Referenced by llvm::DSGraph::computeNodeMapping(), foldNodeCompletely(), getCaption(), llvm::DSNodeHandle::getNode(), killIfUselessEdge(), llvm::ReachabilityCloner::merge(), and mergeTypeInfo().

bool llvm::DSNode::isRead  )  const [inline]
 

Definition at line 304 of file DSNode.h.

References Read.

Referenced by llvm::DSGraph::removeTriviallyDeadNodes().

bool llvm::DSNode::isUnknownNode  )  const [inline]
 

Definition at line 301 of file DSNode.h.

References UnknownNode.

Referenced by isSinglePhysicalObject().

void llvm::DSNode::makeNodeDead  )  [inline]
 

Definition at line 320 of file DSNode.h.

References DEAD, and hasNoReferrers().

Referenced by llvm::DSGraph::removeTriviallyDeadNodes().

void DSNode::markReachableNodes hash_set< DSNode * > &  ReachableNodes  ) 
 

markReachableNodes - This method recursively traverses the specified DSNodes, marking any nodes which are reachable. All reachable nodes it adds to the set, which allows it to only traverse visited nodes once.

Definition at line 1693 of file DataStructure.cpp.

References getForwardNode(), getLink(), llvm::DSNodeHandle::getNode(), getSize(), markReachableNodes(), and llvm::DS::PointerSize.

Referenced by CanReachAliveNodes(), llvm::DSCallSite::markReachableNodes(), markReachableNodes(), and llvm::DSGraph::removeDeadNodes().

void llvm::DSNode::maskNodeTypes unsigned  Mask  )  [inline]
 

maskNodeTypes - Apply a mask to the node types bitfield.

Definition at line 285 of file DSNode.h.

Referenced by llvm::DSGraph::cloneInto(), llvm::ReachabilityCloner::getClonedNH(), and llvm::ReachabilityCloner::merge().

void DSNode::mergeGlobals const std::vector< GlobalValue * > &  RHS  ) 
 

Definition at line 623 of file DataStructure.cpp.

References MergeSortedVectors().

Referenced by llvm::ReachabilityCloner::getClonedNH(), and llvm::ReachabilityCloner::merge().

void llvm::DSNode::mergeNodeFlags unsigned  RHS  )  [inline]
 

Definition at line 289 of file DSNode.h.

Referenced by llvm::ReachabilityCloner::merge().

bool DSNode::mergeTypeInfo const Type Ty,
unsigned  Offset,
bool  FoldIfIncompatible = true
 

mergeTypeInfo - This method merges the specified type into the current node at the specified offset. This may update the current node's type record if this gives more information to the node, it may do nothing to the node if this information is already known, or it may merge the node completely (and return true) if the information is incompatible with what is already known.

This method returns true if the node is completely folded, otherwise false.

Definition at line 335 of file DataStructure.cpp.

References Array, llvm::Type::ArrayTyID, DEBUG, ElementTypesAreCompatible(), foldNodeCompletely(), llvm::StructType::getElementType(), llvm::SequentialType::getElementType(), getParentGraph(), llvm::DSGraph::getReturnNodes(), llvm::TargetData::getStructLayout(), getTargetData(), llvm::Type::getTypeID(), llvm::TargetData::getTypeSize(), isArray(), isNodeCompletelyFolded(), llvm::Type::isSized(), M, llvm::StructLayout::MemberOffsets, llvm::DS::PointerShift, llvm::DS::PointerSize, llvm::Type::StructTyID, llvm::Type::VoidTy, and llvm::WriteTypeSymbolic().

Referenced by DSNode(), and llvm::ReachabilityCloner::merge().

void DSNode::mergeWith const DSNodeHandle NH,
unsigned  Offset
 

mergeWith - Merge this node and the specified node, moving all links to and from the argument node into the current node, deleting the node argument. Offset indicates what offset the specified node is to be merged into the current node.

The specified node may be a null pointer (in which case, nothing happens).

Definition at line 739 of file DataStructure.cpp.

References DEBUG, DSNodeHandle, foldNodeCompletely(), llvm::DSNodeHandle::getNode(), llvm::DSNodeHandle::getOffset(), getSize(), hasNoReferrers(), isDeadNode(), mergeWith(), and llvm::DSNodeHandle::mergeWith().

Referenced by llvm::DSNodeHandle::mergeWith(), and mergeWith().

void DSNode::print std::ostream &  O,
const DSGraph G
const
 

Definition at line 216 of file Printer.cpp.

References llvm::GraphWriter< GraphType >::writeNode().

Referenced by dump().

void llvm::DSNode::remapLinks hash_map< const DSNode *, DSNodeHandle > &  OldNodeMap  ) 
 

remapLinks - Change all of the Links in the current node according to the specified mapping.

DSNode* llvm::DSNode::setAllocaNodeMarker  )  [inline]
 

Definition at line 310 of file DSNode.h.

References AllocaNode.

DSNode* llvm::DSNode::setArrayMarker  )  [inline]
 

Definition at line 318 of file DSNode.h.

References Array.

DSNode* llvm::DSNode::setGlobalNodeMarker  )  [inline]
 

Definition at line 312 of file DSNode.h.

References GlobalNode.

DSNode* llvm::DSNode::setHeapNodeMarker  )  [inline]
 

Definition at line 311 of file DSNode.h.

References HeapNode.

DSNode* llvm::DSNode::setIncompleteMarker  )  [inline]
 

Definition at line 315 of file DSNode.h.

References Incomplete.

Referenced by markIncompleteNode().

void llvm::DSNode::setLink unsigned  Offset,
const DSNodeHandle NH
[inline]
 

setLink - Set the link at the specified offset to the specified NodeHandle, replacing what was there. It is uncommon to use this method, instead one of the higher level methods should be used, below.

Definition at line 245 of file DSNode.h.

References llvm::DS::PointerShift.

Referenced by addEdgeTo(), and llvm::DSNodeHandle::setLink().

DSNode* llvm::DSNode::setModifiedMarker  )  [inline]
 

Definition at line 316 of file DSNode.h.

References Modified.

void llvm::DSNode::setParentGraph DSGraph G  )  [inline]
 

Definition at line 156 of file DSNode.h.

DSNode* llvm::DSNode::setReadMarker  )  [inline]
 

Definition at line 317 of file DSNode.h.

References Read.

DSNode* llvm::DSNode::setUnknownNodeMarker  )  [inline]
 

Definition at line 313 of file DSNode.h.

References UnknownNode.

void llvm::DSNode::stopForwarding  )  [inline]
 

stopForwarding - When the last reference to this forwarding node has been dropped, delete the node.

Definition at line 175 of file DSNode.h.

References isForwarding(), and llvm::DSNodeHandle::setTo().


Friends And Related Function Documentation

friend class DSNodeHandle [friend]
 

Definition at line 354 of file DSNode.h.

Referenced by mergeWith().

friend struct ilist_traits< DSNode > [friend]
 

Definition at line 50 of file DSNode.h.


The documentation for this class was generated from the following files: