- /// mergeMappedValues - This is the higher level form of rewriteMergeMap. It
- /// is fully capable of merging links together if neccesary as well as simply
- /// rewriting the map entries.
- ///
- void mergeMappedValues(signed char V1, signed char V2);
-};
-
-
-//===----------------------------------------------------------------------===//
-// Define inline DSNodeHandle functions that depend on the definition of DSNode
-//
-
-inline void DSNodeHandle::setNode(DSNode *n) {
- if (N) N->removeReferrer(this);
- N = n;
- if (N) N->addReferrer(this);
-}
-
-inline bool DSNodeHandle::hasLink(unsigned Num) const {
- assert(N && "DSNodeHandle does not point to a node yet!");
- return N->hasLink(Num+Offset);
-}
-
-
-/// getLink - Treat this current node pointer as a pointer to a structure of
-/// some sort. This method will return the pointer a mem[this+Num]
-///
-inline const DSNodeHandle *DSNodeHandle::getLink(unsigned Num) const {
- assert(N && "DSNodeHandle does not point to a node yet!");
- return N->getLink(Num+Offset);
-}
-inline DSNodeHandle *DSNodeHandle::getLink(unsigned Num) {
- assert(N && "DSNodeHandle does not point to a node yet!");
- return N->getLink(Num+Offset);
-}
-
-inline void DSNodeHandle::setLink(unsigned Num, const DSNodeHandle &NH) {
- assert(N && "DSNodeHandle does not point to a node yet!");
- N->setLink(Num+Offset, NH);
-}
-
-/// addEdgeTo - Add an edge from the current node to the specified node. This
-/// can cause merging of nodes in the graph.
-///
-inline void DSNodeHandle::addEdgeTo(unsigned LinkNo, const DSNodeHandle &Node) {
- assert(N && "DSNodeHandle does not point to a node yet!");
- N->addEdgeTo(LinkNo+Offset, Node);
-}
-
-/// mergeWith - Merge the logical node pointed to by 'this' with the node
-/// pointed to by 'N'.
-///
-inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) {
- assert(N && "DSNodeHandle does not point to a node yet!");
- N->mergeWith(Node, Offset);
-}
-
-
-//===----------------------------------------------------------------------===//
-/// DSGraph - The graph that represents a function.
-///
-class DSGraph {
- Function *Func;
- std::vector<DSNode*> Nodes;
- DSNodeHandle RetNode; // Node that gets returned...
- std::map<Value*, DSNodeHandle> ValueMap;
-
-#if 0
- // GlobalsGraph -- Reference to the common graph of globally visible objects.
- // This includes GlobalValues, New nodes, Cast nodes, and Calls.
- //
- GlobalDSGraph* GlobalsGraph;
-#endif
-
- // FunctionCalls - This vector maintains a single entry for each call
- // instruction in the current graph. Each call entry contains DSNodeHandles
- // that refer to the arguments that are passed into the function call. The
- // first entry in the vector is the scalar that holds the return value for the
- // call, the second is the function scalar being invoked, and the rest are
- // pointer arguments to the function.
- //
- std::vector<std::vector<DSNodeHandle> > FunctionCalls;
-
-#if 0
- // OrigFunctionCalls - This vector retains a copy of the original function
- // calls of the current graph. This is needed to support top-down inlining
- // after bottom-up inlining is complete, since the latter deletes call nodes.
- //
- std::vector<std::vector<DSNodeHandle> > OrigFunctionCalls;
-
- // PendingCallers - This vector records all unresolved callers of the
- // current function, i.e., ones whose graphs have not been inlined into
- // the current graph. As long as there are unresolved callers, the nodes
- // for formal arguments in the current graph cannot be eliminated, and
- // nodes in the graph reachable from the formal argument nodes or
- // global variable nodes must be considered incomplete.
- std::set<Function*> PendingCallers;
-#endif
-
-protected:
-
-#if 0
- // clone all the call nodes and save the copies in OrigFunctionCalls
- void saveOrigFunctionCalls() {
- assert(OrigFunctionCalls.size() == 0 && "Do this only once!");
- OrigFunctionCalls = FunctionCalls;