[llvm-commits] [poolalloc] r114744 - /poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
John Criswell
criswell at uiuc.edu
Fri Sep 24 12:05:43 PDT 2010
Author: criswell
Date: Fri Sep 24 14:05:42 2010
New Revision: 114744
URL: http://llvm.org/viewvc/llvm-project?rev=114744&view=rev
Log:
Removed dead code (the MarkNodesWhichMustBePassedIn() functions).
No functionality changes.
Modified:
poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=114744&r1=114743&r2=114744&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Fri Sep 24 14:05:42 2010
@@ -550,186 +550,6 @@
}
//
-// Function: MarkNodesWhichMustBePassedIn()
-//
-// Description:
-// Given a function and its DSGraph, determine which values will need to have
-// their pools passed in from the caller.
-//
-// Inputs:
-// F - A reference to the function to analyze.
-// G - The DSGraph of the function F.
-// PassAllArguments - Flags whether all arguments should have their pool
-// handles passed into the function.
-//
-// Outputs:
-// MarkedNodes - A set of DSNodes whose associated pools should be
-// passed into the function when it is called.
-//
-static inline void
-MarkNodesWhichMustBePassedIn (DenseSet<const DSNode*> &MarkedNodes,
- Function &F, DSGraph* G,
- bool PassAllArguments) {
- // Mark globals and incomplete nodes as live... (this handles arguments)
-
- //
- // Scan through all of the function's arguments. If they have an associated
- // DSNode, then we need to pass the argument's pool handle into the function.
- // The only exception is for byval arguments. These may have a DSNode, but
- // they are allocated magically by the code generator; the caller has no
- // pool for them.
- //
- // We also need to pass in pools for any value that is reachable via a
- // function argument.
- //
- // Of course, skip this if this function is the main() function. We can't
- // really add pools to main(). :)
- //
- // FIXME: This needs to handle varargs properly.
- //
- if (F.getName() != "main") {
- //
- // Scan through all of the argument of this function.
- //
- for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end();
- I != E; ++I) {
- //
- // All DSNodes reachable from arguments must be passed in.
- //
- DSGraph::ScalarMapTy::iterator AI = G->getScalarMap().find(I);
-
- //
- // Assert that we either have a non-pointer parameter or that we have a
- // an entry in the Scalar Map for this item.
- //
- if (AI != G->getScalarMap().end()) {
- if (DSNode *N = AI->second.getNode()) {
- //
- // Find all nodes reachable from this node. Include this node, even
- // if it is a byval argument.
- //
- // Now, I hear what you're thinking: "Why pass pools for byval
- // arguments?" Well, we want to pass pools for byval arguments
- // because the function may be the target of an indirect function
- // call, and the byval parameter could therefore alias with a
- // non-byval argument from another function that is a target of the
- // indirect function call. Passing pools for byval arguments helps
- // ensure that all targets of an indirect function call get
- // transformed identically.
- //
-
- //
- // Add all nodes reachable from this parameter into our set of
- // nodes needing pools.
- //
- N->markReachableNodes(MarkedNodes);
- }
- }
- }
-
- //
- // Mark the returned node as needing to be passed in.
- //
- if (DSNode *RetNode = G->getReturnNodeFor(F).getNode())
- RetNode->markReachableNodes(MarkedNodes);
- }
-
- //
- // Calculate which DSNodes are reachable from globals. If a node is reachable
- // from a global, we will create a global pool for it, so no argument passage
- // is required.
- //
- DenseSet<const DSNode*> NodesFromGlobals;
- GetNodesReachableFromGlobals(G, NodesFromGlobals);
-
- //
- // Remove any nodes reachable from a global. These nodes will be put into
- // global pools, which do not require arguments to be passed in. Also, erase
- // any marked node that is not a heap node. Since no allocations or frees
- // will be done with it, it needs no argument.
- //
- // FIXME:
- // 1) PassAllArguments seems to be ignored here. Why is that?
- // 2) Should the heap node check be part of the PassAllArguments check?
- // 3) SAFECode probably needs to pass the pool even if it's not a heap node.
- // We should probably just do what the heuristic tells us to do.
- //
- for (DenseSet<const DSNode*>::iterator I = MarkedNodes.begin(),
- E = MarkedNodes.end(); I != E; ) {
- const DSNode *N = *I; ++I;
- if ((!(1 || N->isHeapNode()) && !PassAllArguments) || NodesFromGlobals.count(N))
- MarkedNodes.erase(N);
- }
-}
-
-//
-// Function: RemoveGlobalNodes()
-//
-// Description:
-// Given a function and its DSGraph, determine which values will need to have
-// their pools passed in from the caller.
-//
-// Inputs:
-// RootNodes - The root DSNodes for which pools may need to be passed
-// in. These include the DSNodes of any arguments, the
-// DSNode of the return value, and the VarArgs DSNode.
-// G - The DSGraph of the function F.
-// PassAllArguments - Flags whether all arguments should have their pool
-// handles passed into the function.
-//
-// Outputs:
-// MarkedNodes - A set of DSNodes whose associated pools should be
-// passed into the function when it is called.
-//
-static inline void
-MarkNodesWhichMustBePassedIn (DenseSet<const DSNode*> &MarkedNodes,
- const std::vector<DSNodeHandle> & RootNodes,
- DSGraph* G,
- bool PassAllArguments) {
- //
- // Loop through all of the root DSNodes. Insert them and any DSNode
- // reachable from them into the set of DSNodes for which a pool descriptor
- // must be passed.
- //
- for (unsigned index = 0; index < RootNodes.size(); ++index) {
- if (DSNode * N = RootNodes[index].getNode()) {
- MarkedNodes.insert (N);
- N->markReachableNodes(MarkedNodes);
- }
- }
-
- //
- // Determine which DSNodes are reachable from globals. If a node is
- // reachable from a global, we will create a global pool for it, so no
- // argument passage is required.
- //
- DenseSet<const DSNode*> NodesFromGlobals;
- GetNodesReachableFromGlobals (G, NodesFromGlobals);
-
- //
- // Remove any nodes reachable from a global. These nodes will be put into
- // global pools, which do not require arguments to be passed in. Also, erase
- // any marked node that is not a heap node. Since no allocations or frees
- // will be done with it, it needs no argument.
- //
- // FIXME:
- // 1) PassAllArguments seems to be ignored here. Why is that?
- // 2) Should the heap node check be part of the PassAllArguments check?
- // 3) SAFECode probably needs to pass the pool even if it's not a heap node.
- // We should probably just do what the heuristic tells us to do.
- //
- for (DenseSet<const DSNode*>::iterator I = MarkedNodes.begin(),
- E = MarkedNodes.end(); I != E; ) {
- const DSNode *N = *I; ++I;
- if ((!(1 || N->isHeapNode()) && !PassAllArguments) || NodesFromGlobals.count(N))
- MarkedNodes.erase(N);
- }
-
- return;
-}
-
-
-//
// Method: FindPoolArgs()
//
// Description:
More information about the llvm-commits
mailing list