Constness changes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7002 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-06-30 05:10:09 +00:00
parent 0eea61863b
commit fa45c7a938
2 changed files with 26 additions and 20 deletions

View File

@ -33,7 +33,7 @@ namespace DataStructureAnalysis {
// //
class LocalDataStructures : public Pass { class LocalDataStructures : public Pass {
// DSInfo, one graph for each function // DSInfo, one graph for each function
hash_map<const Function*, DSGraph*> DSInfo; hash_map<Function*, DSGraph*> DSInfo;
DSGraph *GlobalsGraph; DSGraph *GlobalsGraph;
public: public:
~LocalDataStructures() { releaseMemory(); } ~LocalDataStructures() { releaseMemory(); }
@ -41,12 +41,13 @@ public:
virtual bool run(Module &M); virtual bool run(Module &M);
bool hasGraph(const Function &F) const { bool hasGraph(const Function &F) const {
return DSInfo.find(&F) != DSInfo.end(); return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
} }
// getDSGraph - Return the data structure graph for the specified function. // getDSGraph - Return the data structure graph for the specified function.
DSGraph &getDSGraph(const Function &F) const { DSGraph &getDSGraph(const Function &F) const {
hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F); hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
assert(I != DSInfo.end() && "Function not in module!"); assert(I != DSInfo.end() && "Function not in module!");
return *I->second; return *I->second;
} }
@ -72,7 +73,7 @@ public:
// //
class BUDataStructures : public Pass { class BUDataStructures : public Pass {
// DSInfo, one graph for each function // DSInfo, one graph for each function
hash_map<const Function*, DSGraph*> DSInfo; hash_map<Function*, DSGraph*> DSInfo;
DSGraph *GlobalsGraph; DSGraph *GlobalsGraph;
public: public:
~BUDataStructures() { releaseMemory(); } ~BUDataStructures() { releaseMemory(); }
@ -80,12 +81,13 @@ public:
virtual bool run(Module &M); virtual bool run(Module &M);
bool hasGraph(const Function &F) const { bool hasGraph(const Function &F) const {
return DSInfo.find(&F) != DSInfo.end(); return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
} }
// getDSGraph - Return the data structure graph for the specified function. // getDSGraph - Return the data structure graph for the specified function.
DSGraph &getDSGraph(const Function &F) const { DSGraph &getDSGraph(const Function &F) const {
hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F); hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
assert(I != DSInfo.end() && "Function not in module!"); assert(I != DSInfo.end() && "Function not in module!");
return *I->second; return *I->second;
} }
@ -103,7 +105,7 @@ public:
AU.addRequired<LocalDataStructures>(); AU.addRequired<LocalDataStructures>();
} }
private: private:
DSGraph &calculateGraph(Function &F); void calculateGraph(DSGraph &G);
// inlineNonSCCGraphs - This method is almost like the other two calculate // inlineNonSCCGraphs - This method is almost like the other two calculate
// graph methods. This one is used to inline function graphs (from functions // graph methods. This one is used to inline function graphs (from functions
@ -132,7 +134,7 @@ private:
// //
class TDDataStructures : public Pass { class TDDataStructures : public Pass {
// DSInfo, one graph for each function // DSInfo, one graph for each function
hash_map<const Function*, DSGraph*> DSInfo; hash_map<Function*, DSGraph*> DSInfo;
hash_set<const Function*> GraphDone; hash_set<const Function*> GraphDone;
DSGraph *GlobalsGraph; DSGraph *GlobalsGraph;
public: public:
@ -141,12 +143,13 @@ public:
virtual bool run(Module &M); virtual bool run(Module &M);
bool hasGraph(const Function &F) const { bool hasGraph(const Function &F) const {
return DSInfo.find(&F) != DSInfo.end(); return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
} }
// getDSGraph - Return the data structure graph for the specified function. // getDSGraph - Return the data structure graph for the specified function.
DSGraph &getDSGraph(const Function &F) const { DSGraph &getDSGraph(const Function &F) const {
hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F); hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
assert(I != DSInfo.end() && "Function not in module!"); assert(I != DSInfo.end() && "Function not in module!");
return *I->second; return *I->second;
} }

View File

@ -33,7 +33,7 @@ namespace DataStructureAnalysis {
// //
class LocalDataStructures : public Pass { class LocalDataStructures : public Pass {
// DSInfo, one graph for each function // DSInfo, one graph for each function
hash_map<const Function*, DSGraph*> DSInfo; hash_map<Function*, DSGraph*> DSInfo;
DSGraph *GlobalsGraph; DSGraph *GlobalsGraph;
public: public:
~LocalDataStructures() { releaseMemory(); } ~LocalDataStructures() { releaseMemory(); }
@ -41,12 +41,13 @@ public:
virtual bool run(Module &M); virtual bool run(Module &M);
bool hasGraph(const Function &F) const { bool hasGraph(const Function &F) const {
return DSInfo.find(&F) != DSInfo.end(); return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
} }
// getDSGraph - Return the data structure graph for the specified function. // getDSGraph - Return the data structure graph for the specified function.
DSGraph &getDSGraph(const Function &F) const { DSGraph &getDSGraph(const Function &F) const {
hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F); hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
assert(I != DSInfo.end() && "Function not in module!"); assert(I != DSInfo.end() && "Function not in module!");
return *I->second; return *I->second;
} }
@ -72,7 +73,7 @@ public:
// //
class BUDataStructures : public Pass { class BUDataStructures : public Pass {
// DSInfo, one graph for each function // DSInfo, one graph for each function
hash_map<const Function*, DSGraph*> DSInfo; hash_map<Function*, DSGraph*> DSInfo;
DSGraph *GlobalsGraph; DSGraph *GlobalsGraph;
public: public:
~BUDataStructures() { releaseMemory(); } ~BUDataStructures() { releaseMemory(); }
@ -80,12 +81,13 @@ public:
virtual bool run(Module &M); virtual bool run(Module &M);
bool hasGraph(const Function &F) const { bool hasGraph(const Function &F) const {
return DSInfo.find(&F) != DSInfo.end(); return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
} }
// getDSGraph - Return the data structure graph for the specified function. // getDSGraph - Return the data structure graph for the specified function.
DSGraph &getDSGraph(const Function &F) const { DSGraph &getDSGraph(const Function &F) const {
hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F); hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
assert(I != DSInfo.end() && "Function not in module!"); assert(I != DSInfo.end() && "Function not in module!");
return *I->second; return *I->second;
} }
@ -103,7 +105,7 @@ public:
AU.addRequired<LocalDataStructures>(); AU.addRequired<LocalDataStructures>();
} }
private: private:
DSGraph &calculateGraph(Function &F); void calculateGraph(DSGraph &G);
// inlineNonSCCGraphs - This method is almost like the other two calculate // inlineNonSCCGraphs - This method is almost like the other two calculate
// graph methods. This one is used to inline function graphs (from functions // graph methods. This one is used to inline function graphs (from functions
@ -132,7 +134,7 @@ private:
// //
class TDDataStructures : public Pass { class TDDataStructures : public Pass {
// DSInfo, one graph for each function // DSInfo, one graph for each function
hash_map<const Function*, DSGraph*> DSInfo; hash_map<Function*, DSGraph*> DSInfo;
hash_set<const Function*> GraphDone; hash_set<const Function*> GraphDone;
DSGraph *GlobalsGraph; DSGraph *GlobalsGraph;
public: public:
@ -141,12 +143,13 @@ public:
virtual bool run(Module &M); virtual bool run(Module &M);
bool hasGraph(const Function &F) const { bool hasGraph(const Function &F) const {
return DSInfo.find(&F) != DSInfo.end(); return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
} }
// getDSGraph - Return the data structure graph for the specified function. // getDSGraph - Return the data structure graph for the specified function.
DSGraph &getDSGraph(const Function &F) const { DSGraph &getDSGraph(const Function &F) const {
hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F); hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
assert(I != DSInfo.end() && "Function not in module!"); assert(I != DSInfo.end() && "Function not in module!");
return *I->second; return *I->second;
} }