aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2005-04-21 21:13:18 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2005-04-21 21:13:18 +0000
commit2b37d7cf28b1382420b5e4007042feeb66d21ac8 (patch)
treeedf1e11bc9d3208c7e04392a840f8812b506a751 /lib/Analysis/DataStructure
parent019b63931b946a7dbf55282f4dce7d94d617c5fb (diff)
Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21416 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure')
-rw-r--r--lib/Analysis/DataStructure/BottomUpClosure.cpp36
-rw-r--r--lib/Analysis/DataStructure/CompleteBottomUp.cpp22
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp116
-rw-r--r--lib/Analysis/DataStructure/DataStructureAA.cpp18
-rw-r--r--lib/Analysis/DataStructure/DataStructureOpt.cpp6
-rw-r--r--lib/Analysis/DataStructure/DataStructureStats.cpp10
-rw-r--r--lib/Analysis/DataStructure/EquivClassGraphs.cpp52
-rw-r--r--lib/Analysis/DataStructure/GraphChecker.cpp14
-rw-r--r--lib/Analysis/DataStructure/Local.cpp44
-rw-r--r--lib/Analysis/DataStructure/Printer.cpp16
-rw-r--r--lib/Analysis/DataStructure/Steensgaard.cpp16
-rw-r--r--lib/Analysis/DataStructure/TopDownClosure.cpp16
12 files changed, 183 insertions, 183 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index 4f244b3a36..aa5144437d 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp
@@ -1,10 +1,10 @@
//===- BottomUpClosure.cpp - Compute bottom-up interprocedural closure ----===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file implements the BUDataStructures class, which represents the
@@ -26,7 +26,7 @@ namespace {
Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph");
Statistic<> NumBUInlines("budatastructures", "Number of graphs inlined");
Statistic<> NumCallEdges("budatastructures", "Number of 'actual' call edges");
-
+
RegisterAnalysis<BUDataStructures>
X("budatastructure", "Bottom-up Data Structure Analysis");
}
@@ -48,23 +48,23 @@ static void BuildGlobalECs(DSGraph &GG, std::set<GlobalValue*> &ECGlobals) {
GlobalValue *First = GVs[0];
for (unsigned i = 1, e = GVs.size(); i != e; ++i)
GlobalECs.unionSets(First, GVs[i]);
-
+
// Next, get the leader element.
assert(First == GlobalECs.getLeaderValue(First) &&
"First did not end up being the leader?");
-
+
// Next, remove all globals from the scalar map that are not the leader.
assert(GVs[0] == First && "First had to be at the front!");
for (unsigned i = 1, e = GVs.size(); i != e; ++i) {
ECGlobals.insert(GVs[i]);
SM.erase(SM.find(GVs[i]));
}
-
+
// Finally, change the global node to only contain the leader.
I->clearGlobals();
I->addGlobal(First);
}
-
+
DEBUG(GG.AssertGraphOK());
}
@@ -161,7 +161,7 @@ bool BUDataStructures::runOnModule(Module &M) {
// nothing! In particular, externally visible globals and unresolvable call
// nodes at the end of the BU phase should make things that they point to
// incomplete in the globals graph.
- //
+ //
GlobalsGraph->removeTriviallyDeadNodes();
GlobalsGraph->maskIncompleteMarkers();
@@ -186,7 +186,7 @@ bool BUDataStructures::runOnModule(Module &M) {
if (MainFunc && !MainFunc->isExternal()) {
DSGraph &MainGraph = getOrCreateGraph(MainFunc);
const DSGraph &GG = *MainGraph.getGlobalsGraph();
- ReachabilityCloner RC(MainGraph, GG,
+ ReachabilityCloner RC(MainGraph, GG,
DSGraph::DontCloneCallNodes |
DSGraph::DontCloneAuxCallNodes);
@@ -197,7 +197,7 @@ bool BUDataStructures::runOnModule(Module &M) {
RC.getClonedNH(GG.getNodeForValue(*I));
MainGraph.maskIncompleteMarkers();
- MainGraph.markIncompleteNodes(DSGraph::MarkFormalArgs |
+ MainGraph.markIncompleteNodes(DSGraph::MarkFormalArgs |
DSGraph::IgnoreGlobals);
}
@@ -210,7 +210,7 @@ DSGraph &BUDataStructures::getOrCreateGraph(Function *F) {
if (Graph) return *Graph;
DSGraph &LocGraph = getAnalysis<LocalDataStructures>().getDSGraph(*F);
-
+
// Steal the local graph.
Graph = new DSGraph(GlobalECs, LocGraph.getTargetData());
Graph->spliceFrom(LocGraph);
@@ -235,7 +235,7 @@ static bool isResolvableFunc(const Function* callee) {
return !callee->isExternal() || isVAHackFn(callee);
}
-static void GetAllCallees(const DSCallSite &CS,
+static void GetAllCallees(const DSCallSite &CS,
std::vector<Function*> &Callees) {
if (CS.isDirectCall()) {
if (isResolvableFunc(CS.getCalleeFunc()))
@@ -244,7 +244,7 @@ static void GetAllCallees(const DSCallSite &CS,
// Get all callees.
unsigned OldSize = Callees.size();
CS.getCalleeNode()->addFullFunctionList(Callees);
-
+
// If any of the callees are unresolvable, remove the whole batch!
for (unsigned i = OldSize, e = Callees.size(); i != e; ++i)
if (!isResolvableFunc(Callees[i])) {
@@ -265,7 +265,7 @@ static void GetAllAuxCallees(DSGraph &G, std::vector<Function*> &Callees) {
unsigned BUDataStructures::calculateGraphs(Function *F,
std::vector<Function*> &Stack,
- unsigned &NextID,
+ unsigned &NextID,
hash_map<Function*, unsigned> &ValMap) {
assert(!ValMap.count(F) && "Shouldn't revisit functions!");
unsigned Min = NextID++, MyID = Min;
@@ -488,7 +488,7 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
if (!Printed)
std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
std::cerr << " calls " << CalledFuncs.size()
- << " fns from site: " << CS.getCallSite().getInstruction()
+ << " fns from site: " << CS.getCallSite().getInstruction()
<< " " << *CS.getCallSite().getInstruction();
std::cerr << " Fns =";
unsigned NumPrinted = 0;
@@ -510,7 +510,7 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
if (IndCallGraph.first == 0) {
std::vector<Function*>::iterator I = CalledFuncs.begin(),
E = CalledFuncs.end();
-
+
// Start with a copy of the first graph.
GI = IndCallGraph.first = new DSGraph(getDSGraph(**I), GlobalECs);
GI->setGlobalsGraph(Graph.getGlobalsGraph());
@@ -539,7 +539,7 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
for (e = NextArgs.size(); i != e; ++i)
Args.push_back(NextArgs[i]);
}
-
+
// Clean up the final graph!
GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
} else {
@@ -580,7 +580,7 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
// Clone everything reachable from globals in the function graph into the
// globals graph.
for (DSScalarMap::global_iterator I = MainSM.global_begin(),
- E = MainSM.global_end(); I != E; ++I)
+ E = MainSM.global_end(); I != E; ++I)
RC.getClonedNH(MainSM[*I]);
//Graph.writeGraphToFile(std::cerr, "bu_" + F.getName());
diff --git a/lib/Analysis/DataStructure/CompleteBottomUp.cpp b/lib/Analysis/DataStructure/CompleteBottomUp.cpp
index 9eb593825e..5cf4bcf66e 100644
--- a/lib/Analysis/DataStructure/CompleteBottomUp.cpp
+++ b/lib/Analysis/DataStructure/CompleteBottomUp.cpp
@@ -1,10 +1,10 @@
//===- CompleteBottomUp.cpp - Complete Bottom-Up Data Structure Graphs ----===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This is the exact same as the bottom-up graphs, but we use take a completed
@@ -52,7 +52,7 @@ bool CompleteBUDataStructures::runOnModule(Module &M) {
} else {
std::cerr << "CBU-DSA: No 'main' function found!\n";
}
-
+
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (!I->isExternal() && !DSInfo.count(I))
calculateSCCGraphs(getOrCreateGraph(*I), Stack, NextID, ValMap);
@@ -66,7 +66,7 @@ bool CompleteBUDataStructures::runOnModule(Module &M) {
if (MainFunc && !MainFunc->isExternal()) {
DSGraph &MainGraph = getOrCreateGraph(*MainFunc);
const DSGraph &GG = *MainGraph.getGlobalsGraph();
- ReachabilityCloner RC(MainGraph, GG,
+ ReachabilityCloner RC(MainGraph, GG,
DSGraph::DontCloneCallNodes |
DSGraph::DontCloneAuxCallNodes);
@@ -77,7 +77,7 @@ bool CompleteBUDataStructures::runOnModule(Module &M) {
RC.getClonedNH(GG.getNodeForValue(*I));
MainGraph.maskIncompleteMarkers();
- MainGraph.markIncompleteNodes(DSGraph::MarkFormalArgs |
+ MainGraph.markIncompleteNodes(DSGraph::MarkFormalArgs |
DSGraph::IgnoreGlobals);
}
@@ -107,7 +107,7 @@ DSGraph &CompleteBUDataStructures::getOrCreateGraph(Function &F) {
unsigned CompleteBUDataStructures::calculateSCCGraphs(DSGraph &FG,
std::vector<DSGraph*> &Stack,
- unsigned &NextID,
+ unsigned &NextID,
hash_map<DSGraph*, unsigned> &ValMap) {
assert(!ValMap.count(&FG) && "Shouldn't revisit functions!");
unsigned Min = NextID++, MyID = Min;
@@ -157,7 +157,7 @@ unsigned CompleteBUDataStructures::calculateSCCGraphs(DSGraph &FG,
// Remove NG from the ValMap since the pointer may get recycled.
ValMap.erase(NG);
delete NG;
-
+
Stack.pop_back();
IsMultiNodeSCC = true;
}
@@ -165,7 +165,7 @@ unsigned CompleteBUDataStructures::calculateSCCGraphs(DSGraph &FG,
// Clean up the graph before we start inlining a bunch again...
if (IsMultiNodeSCC)
FG.removeTriviallyDeadNodes();
-
+
Stack.pop_back();
processGraph(FG);
ValMap[&FG] = ~0U;
@@ -187,7 +187,7 @@ void CompleteBUDataStructures::processGraph(DSGraph &G) {
assert(calls.insert(TheCall).second &&
"Call instruction occurs multiple times in graph??");
-
+
// Fast path for noop calls. Note that we don't care about merging globals
// in the callee with nodes in the caller here.
if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0)
@@ -196,7 +196,7 @@ void CompleteBUDataStructures::processGraph(DSGraph &G) {
// Loop over all of the potentially called functions...
// Inline direct calls as well as indirect calls because the direct
// callee may have indirect callees and so may have changed.
- //
+ //
callee_iterator I = callee_begin(TheCall),E = callee_end(TheCall);
unsigned TNum = 0, Num = 0;
DEBUG(Num = std::distance(I, E));
@@ -208,7 +208,7 @@ void CompleteBUDataStructures::processGraph(DSGraph &G) {
// calls or for self recursion within an SCC.
DSGraph &GI = getOrCreateGraph(*CalleeFunc);
++NumCBUInlines;
- G.mergeInGraph(CS, *CalleeFunc, GI,
+ G.mergeInGraph(CS, *CalleeFunc, GI,
DSGraph::StripAllocaBit | DSGraph::DontCloneCallNodes |
DSGraph::DontCloneAuxCallNodes);
DEBUG(std::cerr << " Inlining graph [" << i << "/"
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index c3d1705e35..a95d2522a0 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -1,10 +1,10 @@
//===- DataStructure.cpp - Implement the core data structure analysis -----===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file implements the core data structure functionality.
@@ -95,7 +95,7 @@ DSNodeHandle &DSScalarMap::AddGlobal(GlobalValue *GV) {
return I->second;
}
}
-
+
// Okay, this is either not an equivalenced global or it is the leader, it
// will be inserted into the scalar map now.
GlobalSet.insert(GV);
@@ -163,7 +163,7 @@ void DSNode::forwardNode(DSNode *To, unsigned Offset) {
Ty = Type::VoidTy;
// Remove this node from the parent graph's Nodes list.
- ParentGraph->unlinkNode(this);
+ ParentGraph->unlinkNode(this);
ParentGraph = 0;
}
@@ -221,16 +221,16 @@ void DSNode::foldNodeCompletely() {
DestNode->Ty = Type::VoidTy;
DestNode->Size = 1;
DestNode->Globals.swap(Globals);
-
+
// Start forwarding to the destination node...
forwardNode(DestNode, 0);
-
+
if (!Links.empty()) {
DestNode->Links.reserve(1);
-
+
DSNodeHandle NH(DestNode);
DestNode->Links.push_back(Links[0]);
-
+
// If we have links, merge all of our outgoing links together...
for (unsigned i = Links.size()-1; i != 0; --i)
NH.getNode()->Links[0].mergeWith(Links[i]);
@@ -328,7 +328,7 @@ namespace {
++SS.Idx;
if (SS.Idx != ST->getNumElements()) {
const StructLayout *SL = TD.getStructLayout(ST);
- SS.Offset +=
+ SS.Offset +=
unsigned(SL->MemberOffsets[SS.Idx]-SL->MemberOffsets[SS.Idx-1]);
return;
}
@@ -388,7 +388,7 @@ namespace {
static bool ElementTypesAreCompatible(const Type *T1, const Type *T2,
bool AllowLargerT1, const TargetData &TD){
TypeElementWalker T1W(T1, TD), T2W(T2, TD);
-
+
while (!T1W.isDone() && !T2W.isDone()) {
if (T1W.getCurrentOffset() != T2W.getCurrentOffset())
return false;
@@ -397,11 +397,11 @@ static bool ElementTypesAreCompatible(const Type *T1, const Type *T2,
const Type *T2 = T2W.getCurrentType();
if (T1 != T2 && !T1->isLosslesslyConvertibleTo(T2))
return false;
-
+
T1W.StepToNextType();
T2W.StepToNextType();
}
-
+
return AllowLargerT1 || T1W.isDone();
}
@@ -573,13 +573,13 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
if (isa<FunctionType>(SubType) &&
isa<FunctionType>(NewTy)) return false;
- unsigned SubTypeSize = SubType->isSized() ?
+ unsigned SubTypeSize = SubType->isSized() ?
(unsigned)TD.getTypeSize(SubType) : 0;
// Ok, we are getting desperate now. Check for physical subtyping, where we
// just require each element in the node to be compatible.
if (NewTySize <= SubTypeSize && NewTySize && NewTySize < 256 &&
- SubTypeSize && SubTypeSize < 256 &&
+ SubTypeSize && SubTypeSize < 256 &&
ElementTypesAreCompatible(NewTy, SubType, !isArray(), TD))
return false;
@@ -611,7 +611,7 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
NextPadSize = NextSubTypeSize;
break;
default: ;
- // fall out
+ // fall out
}
if (NextSubType == 0)
@@ -707,14 +707,14 @@ static void MergeSortedVectors(std::vector<GlobalValue*> &Dest,
} else {
// Make a copy to the side of Dest...
std::vector<GlobalValue*> Old(Dest);
-
+
// Make space for all of the type entries now...
Dest.resize(Dest.size()+Src.size());
-
+
// Merge the two sorted ranges together... into Dest.
std::merge(Old.begin(), Old.end(), Src.begin(), Src.end(), Dest.begin());
-
- // Now erase any duplicate entries that may have accumulated into the
+
+ // Now erase any duplicate entries that may have accumulated into the
// vectors (because they were in both of the input sets)
Dest.erase(std::unique(Dest.begin(), Dest.end()), Dest.end());
}
@@ -728,7 +728,7 @@ void DSNode::mergeGlobals(const std::vector<GlobalValue*> &RHS) {
// This function does the hard work of merging two nodes, CurNodeH
// and NH after filtering out trivial cases and making sure that
// CurNodeH.offset >= NH.offset.
-//
+//
// ***WARNING***
// Since merging may cause either node to go away, we must always
// use the node-handles to refer to the nodes. These node handles are
@@ -761,7 +761,7 @@ void DSNode::MergeNodes(DSNodeHandle& CurNodeH, DSNodeHandle& NH) {
#endif
}
- // Merge the type entries of the two nodes together...
+ // Merge the type entries of the two nodes together...
if (NH.getNode()->Ty != Type::VoidTy)
CurNodeH.getNode()->mergeTypeInfo(NH.getNode()->Ty, NOffset);
assert(!CurNodeH.getNode()->isDeadNode());
@@ -916,7 +916,7 @@ DSNodeHandle ReachabilityCloner::getClonedNH(const DSNodeHandle &SrcNH) {
DSNode *DN = new DSNode(*SN, &Dest, true /* Null out all links */);
DN->maskNodeTypes(BitsToKeep);
NH = DN;
-
+
// Next, recursively clone all outgoing links as necessary. Note that
// adding these links can cause the node to collapse itself at any time, and
// the current node may be merged with arbitrary other nodes. For this
@@ -939,7 +939,7 @@ DSNodeHandle ReachabilityCloner::getClonedNH(const DSNodeHandle &SrcNH) {
CN->addEdgeTo(MergeOffset, DestEdge);
}
}
-
+
// If this node contains any globals, make sure they end up in the scalar
// map with the correct offset.
for (DSNode::globals_iterator I = SN->globals_begin(), E = SN->globals_end();
@@ -977,7 +977,7 @@ void ReachabilityCloner::merge(const DSNodeHandle &NH,
SCNH.getOffset()+SrcNH.getOffset()));
return; // Nothing to do!
}
-
+
// Okay, so the source node has not already been cloned. Instead of creating
// a new DSNode, only to merge it into the one we already have, try to perform
// the merge in-place. The only case we cannot handle here is when the offset
@@ -1006,8 +1006,8 @@ void ReachabilityCloner::merge(const DSNodeHandle &NH,
}
#endif
}
-
- // Merge the type entries of the two nodes together...
+
+ // Merge the type entries of the two nodes together...
if (SN->getType() != Type::VoidTy && !DN->isNodeCompletelyFolded()) {
DN->mergeTypeInfo(SN->getType(), NH.getOffset()-SrcNH.getOffset());
DN = NH.getNode();
@@ -1015,7 +1015,7 @@ void ReachabilityCloner::merge(const DSNodeHandle &NH,
}
assert(!DN->isDeadNode());
-
+
// Merge the NodeType information.
DN->mergeNodeFlags(SN->getNodeFlags() & BitsToKeep);
@@ -1060,7 +1060,7 @@ void ReachabilityCloner::merge(const DSNodeHandle &NH,
// sure it is known that this is the representative node for the src node.
SCNH = DSNodeHandle(NH.getNode(), NH.getOffset()-SrcNH.getOffset());
- // If the source node contained any globals, make sure to create entries
+ // If the source node contained any globals, make sure to create entries
// in the scalar map for them!
for (DSNode::globals_iterator I = SN->globals_begin(),
E = SN->globals_end(); I != E; ++I) {
@@ -1092,7 +1092,7 @@ void ReachabilityCloner::merge(const DSNodeHandle &NH,
DSNode *CN = SCNH.getNode();
unsigned MergeOffset =
((i << DS::PointerShift)+SCNH.getOffset()) % CN->getSize();
-
+
DSNodeHandle Tmp = CN->getLink(MergeOffset);
if (!Tmp.isNull()) {
// Perform the recursive merging. Make sure to create a temporary NH,
@@ -1120,7 +1120,7 @@ void ReachabilityCloner::mergeCallSite(DSCallSite &DestCS,
merge(DestCS.getRetVal(), SrcCS.getRetVal());
unsigned MinArgs = DestCS.getNumPtrArgs();
if (SrcCS.getNumPtrArgs() < MinArgs) MinArgs = SrcCS.getNumPtrArgs();
-
+
for (unsigned a = 0; a != MinArgs; ++a)
merge(DestCS.getPtrArg(a), SrcCS.getPtrArg(a));
@@ -1253,11 +1253,11 @@ void DSGraph::cloneInto(const DSGraph &G, unsigned CloneFlags) {
New->maskNodeTypes(~BitsToClear);
OldNodeMap[I] = New;
}
-
+
#ifndef NDEBUG
Timer::addPeakMemoryMeasurement();
#endif
-
+
// Rewrite the links in the new nodes to point into the current graph now.
// Note that we don't loop over the node's list to do this. The problem is
// that remaping links can cause recursive merging to happen, which means
@@ -1314,7 +1314,7 @@ void DSGraph::spliceFrom(DSGraph &RHS) {
I->setParentGraph(this);
// Take all of the nodes.
Nodes.splice(Nodes.end(), RHS.Nodes);
-
+
// Take all of the calls.
FunctionCalls.splice(FunctionCalls.end(), RHS.FunctionCalls);
AuxFunctionCalls.splice(AuxFunctionCalls.end(), RHS.AuxFunctionCalls);
@@ -1376,7 +1376,7 @@ namespace {
unsigned CurNodeId;
std::vector<const DSNode*> SCCStack;
std::map<const DSNode*, std::pair<unsigned, bool> > NodeInfo;
-
+
HackedGraphSCCFinder(ReachabilityCloner &rc) : RC(rc), CurNodeId(1) {
// Remove null pointer as a special case.
NodeInfo[0] = std::make_pair(0, false);
@@ -1473,7 +1473,7 @@ OutOfLoop:
/// call site (in this graph) with the bindings specified by the vector in G2.
/// The two DSGraphs must be different.
///
-void DSGraph::mergeInGraph(const DSCallSite &CS,
+void DSGraph::mergeInGraph(const DSCallSite &CS,
std::vector<DSNodeHandle> &Args,
const DSGraph &Graph, unsigned CloneFlags) {
TIME_REGION(X, "mergeInGraph");
@@ -1485,12 +1485,12 @@ void DSGraph::mergeInGraph(const DSCallSite &CS,
if (&Graph == this) {
// Merge the return value with the return value of the context.
Args[0].mergeWith(CS.getRetVal());
-
+
// Resolve all of the function arguments.
for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i) {
if (i == Args.size()-1)
break;
-
+
// Add the link from the argument scalar to the provided value.
Args[i+1].mergeWith(CS.getPtrArg(i));
}
@@ -1501,7 +1501,7 @@ void DSGraph::mergeInGraph(const DSCallSite &CS,
// scalars in the old graph _used_ to point, and of the new nodes matching
// nodes of the old graph.
ReachabilityCloner RC(*this, Graph, CloneFlags);
-
+
// Map the return node pointer over.
if (!CS.getRetVal().isNull())
RC.merge(CS.getRetVal(), Args[0]);
@@ -1510,11 +1510,11 @@ void DSGraph::mergeInGraph(const DSCallSite &CS,
for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i) {
if (i == Args.size()-1)
break;
-
+
// Add the link from the argument scalar to the provided value.
RC.merge(CS.getPtrArg(i), Args[i+1]);
}
-
+
// We generally don't want to copy global nodes or aux calls from the callee
// graph to the caller graph. However, we have to copy them if there is a
// path from the node to a node we have already copied which does not go
@@ -1548,7 +1548,7 @@ void DSGraph::mergeInGraph(const DSCallSite &CS,
// Copy aux calls that are needed.
for (unsigned i = 0, e = AuxCallToCopy.size(); i != e; ++i)
AuxFunctionCalls.push_back(DSCallSite(*AuxCallToCopy[i], RC));
-
+
// Copy globals that are needed.
for (unsigned i = 0, e = GlobalsToCopy.size(); i != e; ++i)
RC.getClonedNH(Graph.getNodeForValue(GlobalsToCopy[i]));
@@ -1759,7 +1759,7 @@ static void removeIdenticalCalls(std::list<DSCallSite> &Calls) {
killIfUselessEdge(CS.getRetVal());
for (unsigned a = 0, e = CS.getNumPtrArgs(); a != e; ++a)
killIfUselessEdge(CS.getPtrArg(a));
-
+
#if 0
// If this call site calls the same function as the last call site, and if
// the function pointer contains an external function, this node will
@@ -1776,7 +1776,7 @@ static void removeIdenticalCalls(std::list<DSCallSite> &Calls) {
else
LastCalleeContainsExternalFunction = LastCalleeFunc->isExternal();
}
-
+
// It is not clear why, but enabling this code makes DSA really
// sensitive to node forwarding. Basically, with this enabled, DSA
// performs different number of inlinings based on which nodes are
@@ -1791,11 +1791,11 @@ static void removeIdenticalCalls(std::list<DSCallSite> &Calls) {
NumDuplicateCalls > 20
#endif
) {
-
+
std::list<DSCallSite>::iterator PrevIt = OldIt;
--PrevIt;
PrevIt->mergeWith(CS);
-
+
// No need to keep this call anymore.
Calls.erase(OldIt);
++NumDeleted;
@@ -1957,7 +1957,7 @@ void DSNode::markReachableNodes(hash_set<const DSNode*> &ReachableNodes) const {
void DSCallSite::markReachableNodes(hash_set<const DSNode*> &Nodes) const {
getRetVal().getNode()->markReachableNodes(Nodes);
if (isIndirectCall()) getCalleeNode()->markReachableNodes(Nodes);
-
+
for (unsigned i = 0, e = getNumPtrArgs(); i != e; ++i)
getPtrArg(i).getNode()->markReachableNodes(Nodes);
}
@@ -2055,7 +2055,7 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
// Make sure that all globals are cloned over as roots.
if (!(Flags & DSGraph::RemoveUnreachableGlobals) && GlobalsGraph) {
- DSGraph::ScalarMapTy::iterator SMI =
+ DSGraph::ScalarMapTy::iterator SMI =
GlobalsGraph->getScalarMap().find(I->first);
if (SMI != GlobalsGraph->getScalarMap().end())
GGCloner.merge(SMI->second, I->second);
@@ -2079,7 +2079,7 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
// Now find globals and aux call nodes that are already live or reach a live
// value (which makes them live in turn), and continue till no more are found.
- //
+ //
bool Iterate;
hash_set<const DSNode*> Visited;
hash_set<const DSCallSite*> AuxFCallsAlive;
@@ -2092,7 +2092,7 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
Iterate = false;
if (!(Flags & DSGraph::RemoveUnreachableGlobals))
for (unsigned i = 0; i != GlobalNodes.size(); ++i)
- if (CanReachAliveNodes(GlobalNodes[i].second, Alive, Visited,
+ if (CanReachAliveNodes(GlobalNodes[i].second, Alive, Visited,
Flags & DSGraph::RemoveUnreachableGlobals)) {
std::swap(GlobalNodes[i--], GlobalNodes.back()); // Move to end to...
GlobalNodes.pop_back(); // erase efficiently
@@ -2124,7 +2124,7 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
// Copy and merge global nodes and dead aux call nodes into the
// GlobalsGraph, and all nodes reachable from those nodes. Update their
// target pointers using the GGCloner.
- //
+ //
if (!(Flags & DSGraph::RemoveUnreachableGlobals))
GlobalsGraph->AuxFunctionCalls.push_back(DSCallSite(*CI, GGCloner));
@@ -2180,7 +2180,7 @@ void DSGraph::AssertCallSiteInGraph(const DSCallSite &CS) const {
#if 0
if (CS.getNumPtrArgs() && CS.getCalleeNode() == CS.getPtrArg(0).getNode() &&
CS.getCalleeNode() && CS.getCalleeNode()->getGlobals().empty())
- std::cerr << "WARNING: WEIRD CALL SITE FOUND!\n";
+ std::cerr << "WARNING: WEIRD CALL SITE FOUND!\n";
#endif
}
AssertNodeInGraph(CS.getRetVal().getNode());
@@ -2250,7 +2250,7 @@ void DSGraph::computeNodeMapping(const DSNodeHandle &NH1,
}
return;
}
-
+
Entry.setTo(N2, NH2.getOffset()-NH1.getOffset());
// Loop over all of the fields that N1 and N2 have in common, recursively
@@ -2284,7 +2284,7 @@ void DSGraph::computeGToGGMapping(NodeMapTy &NodeMap) {
E = SM.global_end(); I != E; ++I)
DSGraph::computeNodeMapping(SM[*I], GG.getNodeForValue(*I), NodeMap);
}
-
+
/// computeGGToGMapping - Compute the mapping of nodes in the global graph to
/// nodes in this graph. Note that any uses of this method are probably bugs,
/// unless it is known that the globals graph has been merged into this graph!
@@ -2298,7 +2298,7 @@ void DSGraph::computeGGToGMapping(InvNodeMapTy &InvNodeMap) {
NodeMap.erase(NodeMap.begin());
}
}
-
+
/// computeCalleeCallerMapping - Given a call from a function in the current
/// graph to the 'Callee' function (which lives in 'CalleeGraph'), compute the
@@ -2309,7 +2309,7 @@ void DSGraph::computeCalleeCallerMapping(DSCallSite CS, const Function &Callee,
DSCallSite CalleeArgs =
CalleeGraph.getCallSiteForArguments(const_cast<Function&>(Callee));
-
+
computeNodeMapping(CalleeArgs.getRetVal(), CS.getRetVal(), NodeMap);
unsigned NumArgs = CS.getNumPtrArgs();
@@ -2318,18 +2318,18 @@ void DSGraph::computeCalleeCallerMapping(DSCallSite CS, const Function &Callee,
for (unsigned i = 0; i != NumArgs; ++i)
computeNodeMapping(CalleeArgs.getPtrArg(i), CS.getPtrArg(i), NodeMap);
-
+
// Map the nodes that are pointed to by globals.
DSScalarMap &CalleeSM = CalleeGraph.getScalarMap();
DSScalarMap &CallerSM = getScalarMap();
if (CalleeSM.global_size() >= CallerSM.global_size()) {
- for (DSScalarMap::global_iterator GI = CallerSM.global_begin(),
+ for (DSScalarMap::global_iterator GI = CallerSM.global_begin(),
E = CallerSM.global_end(); GI != E; ++GI)
if (CalleeSM.global_count(*GI))
computeNodeMapping(CalleeSM[*GI], CallerSM[*GI], NodeMap);
} else {
- for (DSScalarMap::global_iterator GI = CalleeSM.global_begin(),
+ for (DSScalarMap::global_iterator GI = CalleeSM.global_begin(),
E = CalleeSM.global_end(); GI != E; ++GI)
if (CallerSM.global_count(*GI))
computeNodeMapping(CalleeSM[*GI], CallerSM[*GI], NodeMap);
diff --git a/lib/Analysis/DataStructure/DataStructureAA.cpp b/lib/Analysis/DataStructure/DataStructureAA.cpp
index 65b9b129f3..1ea1d88947 100644
--- a/lib/Analysis/DataStructure/DataStructureAA.cpp
+++ b/lib/Analysis/DataStructure/DataStructureAA.cpp
@@ -1,10 +1,10 @@
//===- DataStructureAA.cpp - Data Structure Based Alias Analysis ----------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This pass uses the top-down data structure graphs to implement a simple
@@ -68,7 +68,7 @@ namespace {
//------------------------------------------------
// Implement the AliasAnalysis API
- //
+ //
AliasResult alias(const Value *V1, unsigned V1Size,
const Value *V2, unsigned V2Size);
@@ -124,14 +124,14 @@ AliasAnalysis::AliasResult DSAA::alias(const Value *V1, unsigned V1Size,
DSGraph *G1 = getGraphForValue(V1);
DSGraph *G2 = getGraphForValue(V2);
assert((!G1 || !G2 || G1 == G2) && "Alias query for 2 different functions?");
-
+
// Get the graph to use...
DSGraph &G = *(G1 ? G1 : (G2 ? G2 : &TD->getGlobalsGraph()));
const DSGraph::ScalarMapTy &GSM = G.getScalarMap();
DSGraph::ScalarMapTy::const_iterator I = GSM.find((Value*)V1);
if (I == GSM.end()) return NoAlias;
-
+
DSGraph::ScalarMapTy::const_iterator J = GSM.find((Value*)V2);
if (J == GSM.end()) return NoAlias;
@@ -188,10 +188,10 @@ DSAA::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
HaveMappingInfo:
assert(N && "Null pointer in scalar map??");
-
+
typedef std::multimap<DSNode*, const DSNode*>::iterator NodeMapIt;
std::pair<NodeMapIt, NodeMapIt> Range = CallerCalleeMap.equal_range(N);
-
+
// Loop over all of the nodes in the callee that correspond to "N", keeping
// track of aggregate mod/ref info.
bool NeverReads = true, NeverWrites = true;
@@ -203,13 +203,13 @@ DSAA::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
if (NeverReads == false && NeverWrites == false)
return AliasAnalysis::getModRefInfo(CS, P, Size);
}
-
+
ModRefResult Result = ModRef;
if (NeverWrites) // We proved it was not modified.
Result = ModRefResult(Result & ~Mod);
if (NeverReads) // We proved it was not read.
Result = ModRefResult(Result & ~Ref);
-
+
return ModRefResult(Result & AliasAnalysis::getModRefInfo(CS, P, Size));
}
diff --git a/lib/Analysis/DataStructure/DataStructureOpt.cpp b/lib/Analysis/DataStructure/DataStructureOpt.cpp
index 6315041089..c464aee1a1 100644
--- a/lib/Analysis/DataStructure/DataStructureOpt.cpp
+++ b/lib/Analysis/DataStructure/DataStructureOpt.cpp
@@ -1,10 +1,10 @@
//===- DataStructureOpt.cpp - Data Structure Analysis Based Optimizations -===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This pass uses DSA to a series of simple optimizations, like marking
@@ -66,7 +66,7 @@ bool DSOpt::OptimizeGlobals(Module &M) {
DSNode *GNode = 0;
DSGraph::ScalarMapTy::const_iterator SMI = SM.find(I);
if (SMI != SM.end()) GNode = SMI->second.getNode();
-
+
if (GNode == 0 && I->hasInternalLinkage()) {
// If there is no entry in the scalar map for this global, it was never
// referenced in the program. If it has internal linkage, that means we
diff --git a/lib/Analysis/DataStructure/DataStructureStats.cpp b/lib/Analysis/DataStructure/DataStructureStats.cpp
index afb69b8387..d86c2a24b0 100644
--- a/lib/Analysis/DataStructure/DataStructureStats.cpp
+++ b/