aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-10-20 18:07:37 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-10-20 18:07:37 +0000
commit42fd16931099f528228f020596f7fb5ef5ea8b7f (patch)
tree498b7b2b1e394707ab5e23938a63e2265c732c1a /lib/Analysis/DataStructure/BottomUpClosure.cpp
parent726bafda652754096ee4d3c8ceb07aa8d105f8b9 (diff)
downloadexternal_llvm-42fd16931099f528228f020596f7fb5ef5ea8b7f.zip
external_llvm-42fd16931099f528228f020596f7fb5ef5ea8b7f.tar.gz
external_llvm-42fd16931099f528228f020596f7fb5ef5ea8b7f.tar.bz2
Added a first-class representation for each call site that can be
used in the DS graphs. Essentially, what was vector<DSNodeHandle> before is now a DSCallSite with the same vector, plus pointers to the CallInst and the caller Function. The special-purpose class BUDataStructure::CallSite is no longer needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4228 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/BottomUpClosure.cpp')
-rw-r--r--lib/Analysis/DataStructure/BottomUpClosure.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index acb90a2..e65a06c 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp
@@ -56,7 +56,7 @@ bool BUDataStructures::run(Module &M) {
// ResolveArguments - Resolve the formal and actual arguments for a function
// call.
//
-static void ResolveArguments(std::vector<DSNodeHandle> &Call, Function &F,
+static void ResolveArguments(DSCallSite &Call, Function &F,
map<Value*, DSNodeHandle> &ValueMap) {
// Resolve all of the function arguments...
Function::aiterator AI = F.abegin();
@@ -87,7 +87,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
#endif
// Start resolving calls...
- std::vector<std::vector<DSNodeHandle> > &FCs = Graph->getFunctionCalls();
+ std::vector<DSCallSite> &FCs = Graph->getFunctionCalls();
DEBUG(std::cerr << " [BU] Inlining: " << F.getName() << "\n");
@@ -97,14 +97,14 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
for (unsigned i = 0; i != FCs.size(); ++i) {
// Copy the call, because inlining graphs may invalidate the FCs vector.
- std::vector<DSNodeHandle> Call = FCs[i];
+ DSCallSite Call = FCs[i];
// If the function list is complete...
- if ((Call[1].getNode()->NodeType & DSNode::Incomplete) == 0) {
+ if ((Call.getCalleeNode().getNode()->NodeType & DSNode::Incomplete)==0) {
// Start inlining all of the functions we can... some may not be
// inlinable if they are external...
//
- std::vector<GlobalValue*> Callees(Call[1].getNode()->getGlobals());
+ std::vector<GlobalValue*> Callees(Call.getCalleeNode().getNode()->getGlobals());
// Loop over the functions, inlining whatever we can...
for (unsigned c = 0; c != Callees.size(); ++c) {
@@ -112,7 +112,8 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
Function &FI = cast<Function>(*Callees[c]);
// Record that this is a call site of FI.
- CallSites[&FI].push_back(CallSite(F, Call));
+ assert(&Call.getCaller() == &F && "Invalid caller in DSCallSite?");
+ CallSites[&FI].push_back(DSCallSite(Call));
if (&FI == &F) {
// Self recursion... simply link up the formal arguments with the
@@ -120,8 +121,8 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
DEBUG(std::cerr << "\t[BU] Self Inlining: " << F.getName() << "\n");
- if (Call[0].getNode()) // Handle the return value if present...
- Graph->getRetNode().mergeWith(Call[0]);
+ if (Call.getReturnValueNode().getNode()) // Handle the return value if present...
+ Graph->getRetNode().mergeWith(Call.getReturnValueNode());
// Resolve the arguments in the call to the actual values...
ResolveArguments(Call, F, Graph->getValueMap());
@@ -159,8 +160,8 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
// Resolve the arguments in the call to the actual values...
ResolveArguments(Call, FI, OldValMap);
- if (Call[0].getNode()) // Handle the return value if present
- RetVal.mergeWith(Call[0]);
+ if (Call.getReturnValueNode().getNode()) // Handle the return value if present
+ RetVal.mergeWith(Call.getReturnValueNode());
// Erase the entry in the Callees vector
Callees.erase(Callees.begin()+c--);
@@ -178,7 +179,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
// Erase the call if it is resolvable...
FCs.erase(FCs.begin()+i--); // Don't skip a the next call...
Inlined = true;
- } else if (Callees.size() != Call[1].getNode()->getGlobals().size()) {
+ } else if (Callees.size() != Call.getCalleeNode().getNode()->getGlobals().size()) {
// Was able to inline SOME, but not all of the functions. Construct a
// new global node here.
//