#endif
// Handle self recursion by resolving the arguments and return value
- Graph.mergeInGraph(CS, GI, DSGraph::StripAllocaBit |
- DSGraph::DontCloneCallNodes);
+ Graph.mergeInGraph(CS, GI,
+ DSGraph::KeepModRefBits |
+ DSGraph::StripAllocaBit | DSGraph::DontCloneCallNodes);
#if 0
Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" +
<< GI.getAuxFunctionCalls().size() << "]\n");
// Handle self recursion by resolving the arguments and return value
- Graph.mergeInGraph(CS, GI, DSGraph::StripAllocaBit |
+ Graph.mergeInGraph(CS, GI,
+ DSGraph::KeepModRefBits | DSGraph::StripAllocaBit |
DSGraph::DontCloneCallNodes);
}
}
<< GI.getAuxFunctionCalls().size() << "]\n");
// Handle self recursion by resolving the arguments and return value
- Graph.mergeInGraph(CS, GI, DSGraph::StripAllocaBit |
+ Graph.mergeInGraph(CS, GI,
+ DSGraph::KeepModRefBits | DSGraph::StripAllocaBit |
DSGraph::DontCloneCallNodes);
if (SCCFunctions.count(Callee))
Nodes[i]->remapLinks(OldNodeMap);
// Remove alloca markers as specified
- if (CloneFlags & StripAllocaBit)
+ if (CloneFlags & (StripAllocaBit | StripModRefBits)) {
+ unsigned short clearBits = (CloneFlags & StripAllocaBit
+ ? DSNode::AllocaNode : 0)
+ | (CloneFlags & StripModRefBits
+ ? (DSNode::Modified | DSNode::Read) : 0);
for (unsigned i = FN, e = Nodes.size(); i != e; ++i)
- Nodes[i]->NodeType &= ~DSNode::AllocaNode;
+ Nodes[i]->NodeType &= ~clearBits;
+ }
// Copy the value map... and merge all of the global nodes...
for (std::map<Value*, DSNodeHandle>::const_iterator I = G.ScalarMap.begin(),
const std::vector<DSCallSite> &CallSites = Graph.getFunctionCalls();
if (CallSites.empty()) {
DEBUG(std::cerr << " [TD] No callees for: " << F.getName() << "\n");
- return; // If no call sites, the graph is the same as the BU graph!
+ return; // If no call sites, there is nothing more to do here
}
// Loop over all of the call sites, building a multi-map from Callees to
std::map<Value*, DSNodeHandle> OldValMap;
std::map<const DSNode*, DSNodeHandle> OldNodeMap;
CG.cloneInto(Graph, OldValMap, OldNodeMap,
+ DSGraph::StripModRefBits |
DSGraph::KeepAllocaBit | DSGraph::DontCloneCallNodes);
OldValMap.clear(); // We don't care about the ValMap
-
+
// Loop over all of the invocation sites of the callee, resolving
// arguments to our graph. This loop may iterate multiple times if the
// current function calls this callee multiple times with different