1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00

Remove using declarations

llvm-svn: 5456
This commit is contained in:
Chris Lattner 2003-02-01 04:01:21 +00:00
parent f5c4b08e31
commit 6051f888b4
4 changed files with 24 additions and 30 deletions

View File

@ -11,7 +11,6 @@
#include "llvm/Analysis/DSGraph.h" #include "llvm/Analysis/DSGraph.h"
#include "llvm/Module.h" #include "llvm/Module.h"
#include "Support/Statistic.h" #include "Support/Statistic.h"
using std::map;
namespace { namespace {
Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph"); Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph");
@ -284,7 +283,7 @@ unsigned BUDataStructures::calculateGraphs(Function *F,
// our memory... here... // our memory... here...
// //
void BUDataStructures::releaseMemory() { void BUDataStructures::releaseMemory() {
for (map<const Function*, DSGraph*>::iterator I = DSInfo.begin(), for (std::map<const Function*, DSGraph*>::iterator I = DSInfo.begin(),
E = DSInfo.end(); I != E; ++I) E = DSInfo.end(); I != E; ++I)
delete I->second; delete I->second;

View File

@ -14,8 +14,6 @@
#include "Support/Timer.h" #include "Support/Timer.h"
#include <algorithm> #include <algorithm>
using std::vector;
namespace { namespace {
Statistic<> NumFolds ("dsnode", "Number of nodes completely folded"); Statistic<> NumFolds ("dsnode", "Number of nodes completely folded");
Statistic<> NumCallNodesMerged("dsnode", "Number of call nodes merged"); Statistic<> NumCallNodesMerged("dsnode", "Number of call nodes merged");
@ -45,7 +43,7 @@ DSNode::DSNode(const DSNode &N)
void DSNode::removeReferrer(DSNodeHandle *H) { void DSNode::removeReferrer(DSNodeHandle *H) {
// Search backwards, because we depopulate the list from the back for // Search backwards, because we depopulate the list from the back for
// efficiency (because it's a vector). // efficiency (because it's a vector).
vector<DSNodeHandle*>::reverse_iterator I = std::vector<DSNodeHandle*>::reverse_iterator I =
std::find(Referrers.rbegin(), Referrers.rend(), H); std::find(Referrers.rbegin(), Referrers.rend(), H);
assert(I != Referrers.rend() && "Referrer not pointing to node!"); assert(I != Referrers.rend() && "Referrer not pointing to node!");
Referrers.erase(I.base()-1); Referrers.erase(I.base()-1);
@ -56,7 +54,7 @@ void DSNode::removeReferrer(DSNodeHandle *H) {
// //
void DSNode::addGlobal(GlobalValue *GV) { void DSNode::addGlobal(GlobalValue *GV) {
// Keep the list sorted. // Keep the list sorted.
vector<GlobalValue*>::iterator I = std::vector<GlobalValue*>::iterator I =
std::lower_bound(Globals.begin(), Globals.end(), GV); std::lower_bound(Globals.begin(), Globals.end(), GV);
if (I == Globals.end() || *I != GV) { if (I == Globals.end() || *I != GV) {
@ -83,8 +81,8 @@ void DSNode::foldNodeCompletely() {
// Loop over all of our referrers, making them point to our zero bytes of // Loop over all of our referrers, making them point to our zero bytes of
// space. // space.
for (vector<DSNodeHandle*>::iterator I = Referrers.begin(), E=Referrers.end(); for (std::vector<DSNodeHandle*>::iterator I = Referrers.begin(),
I != E; ++I) E = Referrers.end(); I != E; ++I)
(*I)->setOffset(0); (*I)->setOffset(0);
// If we have links, merge all of our outgoing links together... // If we have links, merge all of our outgoing links together...
@ -339,8 +337,8 @@ void DSNode::addEdgeTo(unsigned Offset, const DSNodeHandle &NH) {
// duplicates are not allowed and both are sorted. This assumes that 'T's are // duplicates are not allowed and both are sorted. This assumes that 'T's are
// efficiently copyable and have sane comparison semantics. // efficiently copyable and have sane comparison semantics.
// //
static void MergeSortedVectors(vector<GlobalValue*> &Dest, static void MergeSortedVectors(std::vector<GlobalValue*> &Dest,
const vector<GlobalValue*> &Src) { const std::vector<GlobalValue*> &Src) {
// By far, the most common cases will be the simple ones. In these cases, // By far, the most common cases will be the simple ones. In these cases,
// avoid having to allocate a temporary vector... // avoid having to allocate a temporary vector...
// //
@ -350,21 +348,21 @@ static void MergeSortedVectors(vector<GlobalValue*> &Dest,
Dest = Src; Dest = Src;
} else if (Src.size() == 1) { // Insert a single element... } else if (Src.size() == 1) { // Insert a single element...
const GlobalValue *V = Src[0]; const GlobalValue *V = Src[0];
vector<GlobalValue*>::iterator I = std::vector<GlobalValue*>::iterator I =
std::lower_bound(Dest.begin(), Dest.end(), V); std::lower_bound(Dest.begin(), Dest.end(), V);
if (I == Dest.end() || *I != Src[0]) // If not already contained... if (I == Dest.end() || *I != Src[0]) // If not already contained...
Dest.insert(I, Src[0]); Dest.insert(I, Src[0]);
} else if (Dest.size() == 1) { } else if (Dest.size() == 1) {
GlobalValue *Tmp = Dest[0]; // Save value in temporary... GlobalValue *Tmp = Dest[0]; // Save value in temporary...
Dest = Src; // Copy over list... Dest = Src; // Copy over list...
vector<GlobalValue*>::iterator I = std::vector<GlobalValue*>::iterator I =
std::lower_bound(Dest.begin(), Dest.end(), Tmp); std::lower_bound(Dest.begin(), Dest.end(), Tmp);
if (I == Dest.end() || *I != Tmp) // If not already contained... if (I == Dest.end() || *I != Tmp) // If not already contained...
Dest.insert(I, Tmp); Dest.insert(I, Tmp);
} else { } else {
// Make a copy to the side of Dest... // Make a copy to the side of Dest...
vector<GlobalValue*> Old(Dest); std::vector<GlobalValue*> Old(Dest);
// Make space for all of the type entries now... // Make space for all of the type entries now...
Dest.resize(Dest.size()+Src.size()); Dest.resize(Dest.size()+Src.size());
@ -847,7 +845,7 @@ static inline bool nodeContainsExternalFunction(const DSNode *N) {
return false; return false;
} }
static void removeIdenticalCalls(vector<DSCallSite> &Calls, static void removeIdenticalCalls(std::vector<DSCallSite> &Calls,
const std::string &where) { const std::string &where) {
// Remove trivially identical function calls // Remove trivially identical function calls
unsigned NumFns = Calls.size(); unsigned NumFns = Calls.size();
@ -1097,7 +1095,7 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
ScalarMap.erase(GlobalNodes[i].first); ScalarMap.erase(GlobalNodes[i].first);
// Loop over all unreachable nodes, dropping their references... // Loop over all unreachable nodes, dropping their references...
vector<DSNode*> DeadNodes; std::vector<DSNode*> DeadNodes;
DeadNodes.reserve(Nodes.size()); // Only one allocation is allowed. DeadNodes.reserve(Nodes.size()); // Only one allocation is allowed.
for (unsigned i = 0; i != Nodes.size(); ++i) for (unsigned i = 0; i != Nodes.size(); ++i)
if (!Alive.count(Nodes[i])) { if (!Alive.count(Nodes[i])) {
@ -1211,7 +1209,7 @@ DSNode* GlobalDSGraph::cloneNodeInto(DSNode *OldNode,
// //
void GlobalDSGraph::cloneCalls(DSGraph& Graph) { void GlobalDSGraph::cloneCalls(DSGraph& Graph) {
std::map<const DSNode*, DSNode*> NodeCache; std::map<const DSNode*, DSNode*> NodeCache;
vector<DSCallSite >& FromCalls =Graph.FunctionCalls; std::vector<DSCallSite >& FromCalls =Graph.FunctionCalls;
FunctionCalls.reserve(FunctionCalls.size() + FromCalls.size()); FunctionCalls.reserve(FunctionCalls.size() + FromCalls.size());

View File

@ -25,9 +25,6 @@
// //
#include "llvm/Module.h" #include "llvm/Module.h"
using std::map;
using std::vector;
static RegisterAnalysis<LocalDataStructures> static RegisterAnalysis<LocalDataStructures>
X("datastructure", "Local Data Structure Analysis"); X("datastructure", "Local Data Structure Analysis");
@ -57,15 +54,15 @@ namespace {
/// ///
class GraphBuilder : InstVisitor<GraphBuilder> { class GraphBuilder : InstVisitor<GraphBuilder> {
DSGraph &G; DSGraph &G;
vector<DSNode*> &Nodes; std::vector<DSNode*> &Nodes;
DSNodeHandle &RetNode; // Node that gets returned... DSNodeHandle &RetNode; // Node that gets returned...
map<Value*, DSNodeHandle> &ScalarMap; std::map<Value*, DSNodeHandle> &ScalarMap;
vector<DSCallSite> &FunctionCalls; std::vector<DSCallSite> &FunctionCalls;
public: public:
GraphBuilder(DSGraph &g, vector<DSNode*> &nodes, DSNodeHandle &retNode, GraphBuilder(DSGraph &g, std::vector<DSNode*> &nodes, DSNodeHandle &retNode,
map<Value*, DSNodeHandle> &SM, std::map<Value*, DSNodeHandle> &SM,
vector<DSCallSite> &fc) std::vector<DSCallSite> &fc)
: G(g), Nodes(nodes), RetNode(retNode), ScalarMap(SM), FunctionCalls(fc) { : G(g), Nodes(nodes), RetNode(retNode), ScalarMap(SM), FunctionCalls(fc) {
// Create scalar nodes for all pointer arguments... // Create scalar nodes for all pointer arguments...

View File

@ -14,7 +14,6 @@
#include "Support/Statistic.h" #include "Support/Statistic.h"
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
using std::string;
// OnlyPrintMain - The DataStructure printer exposes this option to allow // OnlyPrintMain - The DataStructure printer exposes this option to allow
// printing of only the graph for "main". // printing of only the graph for "main".
@ -28,7 +27,7 @@ namespace {
void DSNode::dump() const { print(std::cerr, 0); } void DSNode::dump() const { print(std::cerr, 0); }
static string getCaption(const DSNode *N, const DSGraph *G) { static std::string getCaption(const DSNode *N, const DSGraph *G) {
std::stringstream OS; std::stringstream OS;
Module *M = G && &G->getFunction() ? G->getFunction().getParent() : 0; Module *M = G && &G->getFunction() ? G->getFunction().getParent() : 0;
@ -153,8 +152,9 @@ void DSGraph::print(std::ostream &O) const {
WriteGraph(O, this, "DataStructures"); WriteGraph(O, this, "DataStructures");
} }
void DSGraph::writeGraphToFile(std::ostream &O, const string &GraphName) const { void DSGraph::writeGraphToFile(std::ostream &O,
string Filename = GraphName + ".dot"; const std::string &GraphName) const {
std::string Filename = GraphName + ".dot";
O << "Writing '" << Filename << "'..."; O << "Writing '" << Filename << "'...";
std::ofstream F(Filename.c_str()); std::ofstream F(Filename.c_str());
@ -170,7 +170,7 @@ void DSGraph::writeGraphToFile(std::ostream &O, const string &GraphName) const {
template <typename Collection> template <typename Collection>
static void printCollection(const Collection &C, std::ostream &O, static void printCollection(const Collection &C, std::ostream &O,
const Module *M, const string &Prefix) { const Module *M, const std::string &Prefix) {
if (M == 0) { if (M == 0) {
O << "Null Module pointer, cannot continue!\n"; O << "Null Module pointer, cannot continue!\n";
return; return;