diff options
author | Chris Lattner <sabre@nondot.org> | 2002-01-20 22:54:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-01-20 22:54:45 +0000 |
commit | 697954c15da58bd8b186dbafdedd8b06db770201 (patch) | |
tree | e119a71f09b5c2513c8c270161ae2a858c6f3b96 /include | |
parent | 13c4659220bc78a0a3529f4d9e57546e898088e3 (diff) | |
download | external_llvm-697954c15da58bd8b186dbafdedd8b06db770201.zip external_llvm-697954c15da58bd8b186dbafdedd8b06db770201.tar.gz external_llvm-697954c15da58bd8b186dbafdedd8b06db770201.tar.bz2 |
Changes to build successfully with GCC 3.02
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1503 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
81 files changed, 512 insertions, 540 deletions
diff --git a/include/Support/Annotation.h b/include/Support/Annotation.h index 9919732..c0642e1 100644 --- a/include/Support/Annotation.h +++ b/include/Support/Annotation.h @@ -166,12 +166,13 @@ struct AnnotationManager { //===--------------------------------------------------------------------===// // Basic ID <-> Name map functionality - static AnnotationID getID (const string &Name); // Name -> ID - static const string &getName(AnnotationID ID); // ID -> Name + static AnnotationID getID(const std::string &Name); // Name -> ID + static const std::string &getName(AnnotationID ID); // ID -> Name // getID - Name -> ID + registration of a factory function for demand driven // annotation support. - static AnnotationID getID (const string &Name, Factory Fact, void *Data=0); + static AnnotationID getID(const std::string &Name, Factory Fact, + void *Data = 0); //===--------------------------------------------------------------------===// // Annotation creation on demand support... diff --git a/include/Support/CommandLine.h b/include/Support/CommandLine.h index 84a3bc9..3c0ac1a 100644 --- a/include/Support/CommandLine.h +++ b/include/Support/CommandLine.h @@ -100,7 +100,7 @@ class Option { // an argument. Should return true if there was an error processing the // argument and the program should exit. // - virtual bool handleOccurance(const char *ArgName, const string &Arg) = 0; + virtual bool handleOccurance(const char *ArgName, const std::string &Arg) = 0; virtual enum NumOccurances getNumOccurancesFlagDefault() const { return Optional; @@ -146,10 +146,10 @@ public: // addOccurance - Wrapper around handleOccurance that enforces Flags // - bool addOccurance(const char *ArgName, const string &Value); + bool addOccurance(const char *ArgName, const std::string &Value); // Prints option name followed by message. Always returns true. - bool error(string Message, const char *ArgName = 0); + bool error(std::string Message, const char *ArgName = 0); public: inline int getNumOccurances() const { return NumOccurances; } @@ -162,7 +162,7 @@ public: // class Alias : public Option { Option &AliasFor; - virtual bool handleOccurance(const char *ArgName, const string &Arg) { + virtual bool handleOccurance(const char *ArgName, const std::string &Arg) { return AliasFor.handleOccurance(AliasFor.ArgStr, Arg); } virtual enum OptionHidden getOptionHiddenFlagDefault() const {return Hidden;} @@ -177,7 +177,7 @@ public: // class Flag : public Option { bool Value; - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); public: inline Flag(const char *ArgStr, const char *Message, int Flags = 0, bool DefaultVal = 0) : Option(ArgStr, Message, Flags), @@ -193,7 +193,7 @@ public: // class Int : public Option { int Value; - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); virtual enum ValueExpected getValueExpectedFlagDefault() const { return ValueRequired; } @@ -209,18 +209,18 @@ public: //===----------------------------------------------------------------------===// // String valued command line option // -class String : public Option, public string { - virtual bool handleOccurance(const char *ArgName, const string &Arg); +class String : public Option, public std::string { + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); virtual enum ValueExpected getValueExpectedFlagDefault() const { return ValueRequired; } public: inline String(const char *ArgStr, const char *Help, int Flags = 0, const char *DefaultVal = "") - : Option(ArgStr, Help, Flags), string(DefaultVal) {} + : Option(ArgStr, Help, Flags), std::string(DefaultVal) {} - inline const string &operator=(const string &Val) { - return string::operator=(Val); + inline const std::string &operator=(const std::string &Val) { + return std::string::operator=(Val); } }; @@ -228,7 +228,7 @@ public: //===----------------------------------------------------------------------===// // String list command line option // -class StringList : public Option, public vector<string> { +class StringList : public Option, public std::vector<std::string> { virtual enum NumOccurances getNumOccurancesFlagDefault() const { return ZeroOrMore; @@ -236,7 +236,7 @@ class StringList : public Option, public vector<string> { virtual enum ValueExpected getValueExpectedFlagDefault() const { return ValueRequired; } - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); public: inline StringList(const char *ArgStr, const char *Help, int Flags = 0) @@ -256,7 +256,7 @@ protected: // Use a vector instead of a map, because the lists should be short, // the overhead is less, and most importantly, it keeps them in the order // inserted so we can print our option out nicely. - vector<pair<const char *, pair<int, const char *> > > ValueMap; + std::vector<std::pair<const char *, std::pair<int, const char *> > > ValueMap; inline EnumBase(const char *ArgStr, const char *Help, int Flags) : Option(ArgStr, Help, Flags) {} @@ -284,7 +284,7 @@ protected: inline EnumValueBase(int Flags) : EnumBase(Flags) {} // handleOccurance - Set Value to the enum value specified by Arg - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); // Return the width of the option tag for printing... virtual unsigned getOptionWidth() const; @@ -323,7 +323,7 @@ class EnumFlagsBase : public EnumValueBase { return ValueDisallowed; } protected: - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); inline EnumFlagsBase(int Flags) : EnumValueBase(Flags) {} // Return the width of the option tag for printing... @@ -363,11 +363,11 @@ class EnumListBase : public EnumBase { return ValueDisallowed; } protected: - vector<int> Values; // The options specified so far. + std::vector<int> Values; // The options specified so far. inline EnumListBase(int Flags) : EnumBase(Flags) {} - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); // Return the width of the option tag for printing... virtual unsigned getOptionWidth() const; diff --git a/include/Support/DepthFirstIterator.h b/include/Support/DepthFirstIterator.h index a2d5a9d..2961497 100644 --- a/include/Support/DepthFirstIterator.h +++ b/include/Support/DepthFirstIterator.h @@ -20,21 +20,21 @@ class df_iterator : public std::forward_iterator<typename GT::NodeType, typedef typename GT::NodeType NodeType; typedef typename GT::ChildIteratorType ChildItTy; - set<NodeType *> Visited; // All of the blocks visited so far... + std::set<NodeType *> Visited; // All of the blocks visited so far... // VisitStack - Used to maintain the ordering. Top = current block // First element is node pointer, second is the 'next child' to visit - stack<pair<NodeType *, ChildItTy> > VisitStack; + std::stack<std::pair<NodeType *, ChildItTy> > VisitStack; const bool Reverse; // Iterate over children before self? private: void reverseEnterNode() { - pair<NodeType *, ChildItTy> &Top = VisitStack.top(); + std::pair<NodeType *, ChildItTy> &Top = VisitStack.top(); NodeType *Node = Top.first; ChildItTy &It = Top.second; for (; It != GT::child_end(Node); ++It) { NodeType *Child = *It; if (!Visited.count(Child)) { Visited.insert(Child); - VisitStack.push(make_pair(Child, GT::child_begin(Child))); + VisitStack.push(std::make_pair(Child, GT::child_begin(Child))); reverseEnterNode(); return; } @@ -43,7 +43,7 @@ private: inline df_iterator(NodeType *Node, bool reverse) : Reverse(reverse) { Visited.insert(Node); - VisitStack.push(make_pair(Node, GT::child_begin(Node))); + VisitStack.push(std::make_pair(Node, GT::child_begin(Node))); if (Reverse) reverseEnterNode(); } inline df_iterator() { /* End is when stack is empty */ } @@ -81,7 +81,7 @@ public: reverseEnterNode(); } else { // Normal Depth First Iterator do { - pair<NodeType *, ChildItTy> &Top = VisitStack.top(); + std::pair<NodeType *, ChildItTy> &Top = VisitStack.top(); NodeType *Node = Top.first; ChildItTy &It = Top.second; @@ -90,7 +90,7 @@ public: if (!Visited.count(Next)) { // Has our next sibling been visited? // No, do it now. Visited.insert(Next); - VisitStack.push(make_pair(Next, GT::child_begin(Next))); + VisitStack.push(std::make_pair(Next, GT::child_begin(Next))); return *this; } } diff --git a/include/Support/HashExtras.h b/include/Support/HashExtras.h index 6ea831e..d7e48a3 100644 --- a/include/Support/HashExtras.h +++ b/include/Support/HashExtras.h @@ -11,7 +11,10 @@ #define LLVM_SUPPORT_HASHEXTRAS_H #include <string> -#include <hash_map> +#include <ext/hash_map> + +// Cannot specialize hash template from outside of the std namespace. +namespace std { template <> struct hash<string> { size_t operator()(string const &str) const { @@ -24,4 +27,6 @@ template <class T> struct hash<T *> { inline size_t operator()(const T *Val) const { return (size_t)Val; } }; +} // End namespace std + #endif diff --git a/include/Support/PostOrderIterator.h b/include/Support/PostOrderIterator.h index 89a9b4d..85b3bf6 100644 --- a/include/Support/PostOrderIterator.h +++ b/include/Support/PostOrderIterator.h @@ -20,10 +20,10 @@ class po_iterator : public std::forward_iterator<typename GT::NodeType, typedef typename GT::NodeType NodeType; typedef typename GT::ChildIteratorType ChildItTy; - set<NodeType *> Visited; // All of the blocks visited so far... + std::set<NodeType *> Visited; // All of the blocks visited so far... // VisitStack - Used to maintain the ordering. Top = current block // First element is basic block pointer, second is the 'next child' to visit - stack<pair<NodeType *, ChildItTy> > VisitStack; + std::stack<std::pair<NodeType *, ChildItTy> > VisitStack; void traverseChild() { while (VisitStack.top().second != GT::child_end(VisitStack.top().first)) { @@ -122,10 +122,10 @@ ipo_iterator<T> ipo_end(T G){ // } // -typedef reverse_iterator<vector<BasicBlock*>::iterator> rpo_iterator; +typedef std::vector<BasicBlock*>::reverse_iterator rpo_iterator; // TODO: FIXME: ReversePostOrderTraversal is not generic! class ReversePostOrderTraversal { - vector<BasicBlock*> Blocks; // Block list in normal PO order + std::vector<BasicBlock*> Blocks; // Block list in normal PO order inline void Initialize(BasicBlock *BB) { copy(po_begin(BB), po_end(BB), back_inserter(Blocks)); } diff --git a/include/Support/STLExtras.h b/include/Support/STLExtras.h index 44d789d..0168bf2 100644 --- a/include/Support/STLExtras.h +++ b/include/Support/STLExtras.h @@ -36,7 +36,7 @@ // arguments to get a boolean result. // template<class Ty> -struct bitwise_or : public binary_function<Ty, Ty, bool> { +struct bitwise_or : public std::binary_function<Ty, Ty, bool> { bool operator()(const Ty& left, const Ty& right) const { return left | right; } @@ -70,9 +70,9 @@ class mapped_iterator { RootIt current; UnaryFunc Fn; public: - typedef typename iterator_traits<RootIt>::iterator_category + typedef typename std::iterator_traits<RootIt>::iterator_category iterator_category; - typedef typename iterator_traits<RootIt>::difference_type + typedef typename std::iterator_traits<RootIt>::difference_type difference_type; typedef typename UnaryFunc::result_type value_type; typedef typename UnaryFunc::result_type *pointer; @@ -102,6 +102,7 @@ public: _Self& operator-= (difference_type n) { current -= n; return *this; } reference operator[](difference_type n) const { return *(*this + n); } + inline bool operator!=(const _Self &X) const { return !operator==(X); } inline bool operator==(const _Self &X) const { return current == X.current; } inline bool operator< (const _Self &X) const { return current < X.current; } diff --git a/include/Support/StringExtras.h b/include/Support/StringExtras.h index e67e25c..46e2c5a 100644 --- a/include/Support/StringExtras.h +++ b/include/Support/StringExtras.h @@ -11,7 +11,7 @@ #include <string> #include <stdio.h> -static inline string utostr(uint64_t X, bool isNeg = false) { +static inline std::string utostr(uint64_t X, bool isNeg = false) { char Buffer[40]; char *BufPtr = Buffer+39; @@ -25,10 +25,10 @@ static inline string utostr(uint64_t X, bool isNeg = false) { if (isNeg) *--BufPtr = '-'; // Add negative sign... - return string(BufPtr); + return std::string(BufPtr); } -static inline string itostr(int64_t X) { +static inline std::string itostr(int64_t X) { if (X < 0) return utostr((uint64_t)-X, true); else @@ -36,7 +36,7 @@ static inline string itostr(int64_t X) { } -static inline string utostr(unsigned X, bool isNeg = false) { +static inline std::string utostr(unsigned X, bool isNeg = false) { char Buffer[20]; char *BufPtr = Buffer+19; @@ -50,17 +50,17 @@ static inline string utostr(unsigned X, bool isNeg = false) { if (isNeg) *--BufPtr = '-'; // Add negative sign... - return string(BufPtr); + return std::string(BufPtr); } -static inline string itostr(int X) { +static inline std::string itostr(int X) { if (X < 0) return utostr((unsigned)-X, true); else return utostr((unsigned)X); } -static inline string ftostr(double V) { +static inline std::string ftostr(double V) { char Buffer[200]; snprintf(Buffer, 200, "%e", V); return Buffer; diff --git a/include/Support/Tree.h b/include/Support/Tree.h index 33b0bb7..9e8d5ae 100644 --- a/include/Support/Tree.h +++ b/include/Support/Tree.h @@ -12,21 +12,21 @@ template<class ConcreteTreeNode, class Payload> class Tree { - vector<ConcreteTreeNode*> Children; // This nodes children, if any - ConcreteTreeNode *Parent; // Parent of this node... - Payload Data; // Data held in this node... + std::vector<ConcreteTreeNode*> Children; // This nodes children, if any + ConcreteTreeNode *Parent; // Parent of this node... + Payload Data; // Data held in this node... protected: - void setChildren(const vector<ConcreteTreeNode*> &children) { + void setChildren(const std::vector<ConcreteTreeNode*> &children) { Children = children; } public: inline Tree(ConcreteTreeNode *parent) : Parent(parent) {} - inline Tree(const vector<ConcreteTreeNode*> &children, ConcreteTreeNode *par) - : Children(children), Parent(par) {} + inline Tree(const std::vector<ConcreteTreeNode*> &children, + ConcreteTreeNode *par) : Children(children), Parent(par) {} - inline Tree(const vector<ConcreteTreeNode*> &children, ConcreteTreeNode *par, - const Payload &data) + inline Tree(const std::vector<ConcreteTreeNode*> &children, + ConcreteTreeNode *par, const Payload &data) : Children(children), Parent(parent), Data(data) {} // Tree dtor - Free all children diff --git a/include/llvm/ADT/DepthFirstIterator.h b/include/llvm/ADT/DepthFirstIterator.h index a2d5a9d..2961497 100644 --- a/include/llvm/ADT/DepthFirstIterator.h +++ b/include/llvm/ADT/DepthFirstIterator.h @@ -20,21 +20,21 @@ class df_iterator : public std::forward_iterator<typename GT::NodeType, typedef typename GT::NodeType NodeType; typedef typename GT::ChildIteratorType ChildItTy; - set<NodeType *> Visited; // All of the blocks visited so far... + std::set<NodeType *> Visited; // All of the blocks visited so far... // VisitStack - Used to maintain the ordering. Top = current block // First element is node pointer, second is the 'next child' to visit - stack<pair<NodeType *, ChildItTy> > VisitStack; + std::stack<std::pair<NodeType *, ChildItTy> > VisitStack; const bool Reverse; // Iterate over children before self? private: void reverseEnterNode() { - pair<NodeType *, ChildItTy> &Top = VisitStack.top(); + std::pair<NodeType *, ChildItTy> &Top = VisitStack.top(); NodeType *Node = Top.first; ChildItTy &It = Top.second; for (; It != GT::child_end(Node); ++It) { NodeType *Child = *It; if (!Visited.count(Child)) { Visited.insert(Child); - VisitStack.push(make_pair(Child, GT::child_begin(Child))); + VisitStack.push(std::make_pair(Child, GT::child_begin(Child))); reverseEnterNode(); return; } @@ -43,7 +43,7 @@ private: inline df_iterator(NodeType *Node, bool reverse) : Reverse(reverse) { Visited.insert(Node); - VisitStack.push(make_pair(Node, GT::child_begin(Node))); + VisitStack.push(std::make_pair(Node, GT::child_begin(Node))); if (Reverse) reverseEnterNode(); } inline df_iterator() { /* End is when stack is empty */ } @@ -81,7 +81,7 @@ public: reverseEnterNode(); } else { // Normal Depth First Iterator do { - pair<NodeType *, ChildItTy> &Top = VisitStack.top(); + std::pair<NodeType *, ChildItTy> &Top = VisitStack.top(); NodeType *Node = Top.first; ChildItTy &It = Top.second; @@ -90,7 +90,7 @@ public: if (!Visited.count(Next)) { // Has our next sibling been visited? // No, do it now. Visited.insert(Next); - VisitStack.push(make_pair(Next, GT::child_begin(Next))); + VisitStack.push(std::make_pair(Next, GT::child_begin(Next))); return *this; } } diff --git a/include/llvm/ADT/HashExtras.h b/include/llvm/ADT/HashExtras.h index 6ea831e..d7e48a3 100644 --- a/include/llvm/ADT/HashExtras.h +++ b/include/llvm/ADT/HashExtras.h @@ -11,7 +11,10 @@ #define LLVM_SUPPORT_HASHEXTRAS_H #include <string> -#include <hash_map> +#include <ext/hash_map> + +// Cannot specialize hash template from outside of the std namespace. +namespace std { template <> struct hash<string> { size_t operator()(string const &str) const { @@ -24,4 +27,6 @@ template <class T> struct hash<T *> { inline size_t operator()(const T *Val) const { return (size_t)Val; } }; +} // End namespace std + #endif diff --git a/include/llvm/ADT/PostOrderIterator.h b/include/llvm/ADT/PostOrderIterator.h index 89a9b4d..85b3bf6 100644 --- a/include/llvm/ADT/PostOrderIterator.h +++ b/include/llvm/ADT/PostOrderIterator.h @@ -20,10 +20,10 @@ class po_iterator : public std::forward_iterator<typename GT::NodeType, typedef typename GT::NodeType NodeType; typedef typename GT::ChildIteratorType ChildItTy; - set<NodeType *> Visited; // All of the blocks visited so far... + std::set<NodeType *> Visited; // All of the blocks visited so far... // VisitStack - Used to maintain the ordering. Top = current block // First element is basic block pointer, second is the 'next child' to visit - stack<pair<NodeType *, ChildItTy> > VisitStack; + std::stack<std::pair<NodeType *, ChildItTy> > VisitStack; void traverseChild() { while (VisitStack.top().second != GT::child_end(VisitStack.top().first)) { @@ -122,10 +122,10 @@ ipo_iterator<T> ipo_end(T G){ // } // -typedef reverse_iterator<vector<BasicBlock*>::iterator> rpo_iterator; +typedef std::vector<BasicBlock*>::reverse_iterator rpo_iterator; // TODO: FIXME: ReversePostOrderTraversal is not generic! class ReversePostOrderTraversal { - vector<BasicBlock*> Blocks; // Block list in normal PO order + std::vector<BasicBlock*> Blocks; // Block list in normal PO order inline void Initialize(BasicBlock *BB) { copy(po_begin(BB), po_end(BB), back_inserter(Blocks)); } diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index 44d789d..0168bf2 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -36,7 +36,7 @@ // arguments to get a boolean result. // template<class Ty> -struct bitwise_or : public binary_function<Ty, Ty, bool> { +struct bitwise_or : public std::binary_function<Ty, Ty, bool> { bool operator()(const Ty& left, const Ty& right) const { return left | right; } @@ -70,9 +70,9 @@ class mapped_iterator { RootIt current; UnaryFunc Fn; public: - typedef typename iterator_traits<RootIt>::iterator_category + typedef typename std::iterator_traits<RootIt>::iterator_category iterator_category; - typedef typename iterator_traits<RootIt>::difference_type + typedef typename std::iterator_traits<RootIt>::difference_type difference_type; typedef typename UnaryFunc::result_type value_type; typedef typename UnaryFunc::result_type *pointer; @@ -102,6 +102,7 @@ public: _Self& operator-= (difference_type n) { current -= n; return *this; } reference operator[](difference_type n) const { return *(*this + n); } + inline bool operator!=(const _Self &X) const { return !operator==(X); } inline bool operator==(const _Self &X) const { return current == X.current; } inline bool operator< (const _Self &X) const { return current < X.current; } diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h index e67e25c..46e2c5a 100644 --- a/include/llvm/ADT/StringExtras.h +++ b/include/llvm/ADT/StringExtras.h @@ -11,7 +11,7 @@ #include <string> #include <stdio.h> -static inline string utostr(uint64_t X, bool isNeg = false) { +static inline std::string utostr(uint64_t X, bool isNeg = false) { char Buffer[40]; char *BufPtr = Buffer+39; @@ -25,10 +25,10 @@ static inline string utostr(uint64_t X, bool isNeg = false) { if (isNeg) *--BufPtr = '-'; // Add negative sign... - return string(BufPtr); + return std::string(BufPtr); } -static inline string itostr(int64_t X) { +static inline std::string itostr(int64_t X) { if (X < 0) return utostr((uint64_t)-X, true); else @@ -36,7 +36,7 @@ static inline string itostr(int64_t X) { } -static inline string utostr(unsigned X, bool isNeg = false) { +static inline std::string utostr(unsigned X, bool isNeg = false) { char Buffer[20]; char *BufPtr = Buffer+19; @@ -50,17 +50,17 @@ static inline string utostr(unsigned X, bool isNeg = false) { if (isNeg) *--BufPtr = '-'; // Add negative sign... - return string(BufPtr); + return std::string(BufPtr); } -static inline string itostr(int X) { +static inline std::string itostr(int X) { if (X < 0) return utostr((unsigned)-X, true); else return utostr((unsigned)X); } -static inline string ftostr(double V) { +static inline std::string ftostr(double V) { char Buffer[200]; snprintf(Buffer, 200, "%e", V); return Buffer; diff --git a/include/llvm/ADT/Tree.h b/include/llvm/ADT/Tree.h index 33b0bb7..9e8d5ae 100644 --- a/include/llvm/ADT/Tree.h +++ b/include/llvm/ADT/Tree.h @@ -12,21 +12,21 @@ template<class ConcreteTreeNode, class Payload> class Tree { - vector<ConcreteTreeNode*> Children; // This nodes children, if any - ConcreteTreeNode *Parent; // Parent of this node... - Payload Data; // Data held in this node... + std::vector<ConcreteTreeNode*> Children; // This nodes children, if any + ConcreteTreeNode *Parent; // Parent of this node... + Payload Data; // Data held in this node... protected: - void setChildren(const vector<ConcreteTreeNode*> &children) { + void setChildren(const std::vector<ConcreteTreeNode*> &children) { Children = children; } public: inline Tree(ConcreteTreeNode *parent) : Parent(parent) {} - inline Tree(const vector<ConcreteTreeNode*> &children, ConcreteTreeNode *par) - : Children(children), Parent(par) {} + inline Tree(const std::vector<ConcreteTreeNode*> &children, + ConcreteTreeNode *par) : Children(children), Parent(par) {} - inline Tree(const vector<ConcreteTreeNode*> &children, ConcreteTreeNode *par, - const Payload &data) + inline Tree(const std::vector<ConcreteTreeNode*> &children, + ConcreteTreeNode *par, const Payload &data) : Children(children), Parent(parent), Data(data) {} // Tree dtor - Free all children diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index 8365a4f..f5b0202 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -27,12 +27,12 @@ namespace cfg { class CallGraph; class CallGraphNode { Method *Meth; - vector<CallGraphNode*> CalledMethods; + std::vector<CallGraphNode*> CalledMethods; CallGraphNode(const CallGraphNode &); // Do not implement public: - typedef vector<CallGraphNode*>::iterator iterator; - typedef vector<CallGraphNode*>::const_iterator const_iterator; + typedef std::vector<CallGraphNode*>::iterator iterator; + typedef std::vector<CallGraphNode*>::const_iterator const_iterator; // getMethod - Return the method that this call graph node represents... Method *getMethod() const { return Meth; } @@ -65,7 +65,7 @@ private: // Stuff to construct the node, used by CallGraph class CallGraph { Module *Mod; // The module this call graph represents - typedef map<const Method *, CallGraphNode *> MethodMapTy; + typedef std::map<const Method *, CallGraphNode *> MethodMapTy; MethodMapTy MethodMap; // Map from a method to its node CallGraphNode *Root; diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 6639b64..c018eaf 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -47,8 +47,9 @@ public: // class DominatorSet : public DominatorBase { public: - typedef set<const BasicBlock*> DomSetType; // Dom set for a bb - typedef map<const BasicBlock *, DomSetType> DomSetMapType; // Map of dom sets + typedef std::set<const BasicBlock*> DomSetType; // Dom set for a bb + // Map of dom sets + typedef std::map<const BasicBlock*, DomSetType> DomSetMapType; private: DomSetMapType Doms; @@ -91,7 +92,7 @@ public: // method. // class ImmediateDominators : public DominatorBase { - map<const BasicBlock*, const BasicBlock*> IDoms; + std::map<const BasicBlock*, const BasicBlock*> IDoms; void calcIDoms(const DominatorSet &DS); public: @@ -104,7 +105,7 @@ public: } // Accessor interface: - typedef map<const BasicBlock*, const BasicBlock*> IDomMapType; + typedef std::map<const BasicBlock*, const BasicBlock*> IDomMapType; typedef IDomMapType::const_iterator const_iterator; inline const_iterator begin() const { return IDoms.begin(); } inline const_iterator end() const { return IDoms.end(); } @@ -114,7 +115,7 @@ public: // node returns null, because it does not have an immediate dominator. // inline const BasicBlock *operator[](const BasicBlock *BB) const { - map<const BasicBlock*, const BasicBlock*>::const_iterator I = + std::map<const BasicBlock*, const BasicBlock*>::const_iterator I = IDoms.find(BB); return I != IDoms.end() ? I->second : 0; } @@ -130,18 +131,18 @@ class DominatorTree : public DominatorBase { public: typedef Node2 Node; private: - map<const BasicBlock*, Node*> Nodes; + std::map<const BasicBlock*, Node*> Nodes; void calculate(const DominatorSet &DS); - typedef map<const BasicBlock*, Node*> NodeMapType; + typedef std::map<const BasicBlock*, Node*> NodeMapType; public: - class Node2 : public vector<Node*> { + class Node2 : public std::vector<Node*> { friend class DominatorTree; const BasicBlock *TheNode; Node2 * const IDom; public: inline const BasicBlock *getNode() const { return TheNode; } inline Node2 *getIDom() const { return IDom; } - inline const vector<Node*> &getChildren() const { return *this; } + inline const std::vector<Node*> &getChildren() const { return *this; } // dominates - Returns true iff this dominates N. Note that this is not a // constant time operation! @@ -181,8 +182,8 @@ public: // class DominanceFrontier : public DominatorBase { public: - typedef set<const BasicBlock*> DomSetType; // Dom set for a bb - typedef map<const BasicBlock *, DomSetType> DomSetMapType; // Map of dom sets + typedef std::set<const BasicBlock*> DomSetType; // Dom set for a bb + typedef std::map<const BasicBlock*, DomSetType> DomSetMapType; // Dom set map private: DomSetMapType Frontiers; const DomSetType &calcDomFrontier(const DominatorTree &DT, diff --git a/include/llvm/Analysis/FindUnsafePointerTypes.h b/include/llvm/Analysis/FindUnsafePointerTypes.h index 3f66f33..c52ca2f 100644 --- a/include/llvm/Analysis/FindUnsafePointerTypes.h +++ b/include/llvm/Analysis/FindUnsafePointerTypes.h @@ -24,11 +24,11 @@ class PointerType; struct FindUnsafePointerTypes : public Pass { // UnsafeTypes - Set of types that are not safe to transform. - set<PointerType*> UnsafeTypes; + std::set<PointerType*> UnsafeTypes; public: // Accessor for underlying type set... - inline const set<PointerType*> &getUnsafeTypes() const { + inline const std::set<PointerType*> &getUnsafeTypes() const { return UnsafeTypes; } @@ -41,7 +41,7 @@ public: // printResults - Loop over the results of the analysis, printing out unsafe // types. // - void printResults(const Module *Mod, ostream &o); + void printResults(const Module *Mod, std::ostream &o); }; #endif diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index aa00e5f..956901d 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -12,7 +12,7 @@ class SymbolTable; class FindUsedTypes : public Pass { - set<const Type *> UsedTypes; + std::set<const Type *> UsedTypes; bool IncludeSymbolTables; public: @@ -25,13 +25,13 @@ public: // getTypes - After the pass has been run, return the set containing all of // the types used in the module. // - inline const set<const Type *> &getTypes() const { return UsedTypes; } + inline const std::set<const Type *> &getTypes() const { return UsedTypes; } // Print the types found in the module. If the optional Module parameter is // passed in, then the types are printed symbolically if possible, using the // symbol table from the module. // - void printTypes(ostream &o, const Module *M = 0) const; + void printTypes(std::ostream &o, const Module *M = 0) const; private: // IncorporateType - Incorporate one type and all of its subtypes into the diff --git a/include/llvm/Analysis/InstForest.h b/include/llvm/Analysis/InstForest.h index e8ab0aa..13eb54f 100644 --- a/include/llvm/Analysis/InstForest.h +++ b/include/llvm/Analysis/InstForest.h @@ -35,10 +35,12 @@ template<class Payload> class InstForest; // template<class Payload> class InstTreeNode : - public Tree<InstTreeNode<Payload>, pair<pair<Value*, char>, Payload> > { + public Tree<InstTreeNode<Payload>, + std::pair<std::pair<Value*, char>, Payload> > { friend class InstForest<Payload>; - typedef Tree<InstTreeNode<Payload>, pair<pair<Value*, char>, Payload> > super; + typedef Tree<InstTreeNode<Payload>, + std::pair<std::pair<Value*, char>, Payload> > super; // Constants used for the node type value enum NodeTypeTy { @@ -104,15 +106,15 @@ public: public: // print - Called by operator<< below... - void print(ostream &o, unsigned Indent) const { - o << string(Indent*2, ' '); + void print(std::ostream &o, unsigned Indent) const { + o << std::string(Indent*2, ' '); switch (getNodeType()) { case ConstNode : o << "Constant : "; break; - case BasicBlockNode : o << "BasicBlock : " << getValue()->getName() << endl; + case BasicBlockNode : o << "BasicBlock : " << getValue()->getName() << "\n"; return; case InstructionNode: o << "Instruction: "; break; case TemporaryNode : o << "Temporary : "; break; - default: o << "UNKNOWN NODE TYPE: " << getNodeType() << endl; abort(); + default: o << "UNKNOWN NODE TYPE: " << getNodeType() << "\n"; abort(); } o << getValue(); @@ -124,7 +126,8 @@ public: }; template<class Payload> -inline ostream &operator<<(ostream &o, const InstTreeNode<Payload> *N) { +inline std::ostream &operator<<(std::ostream &o, + const InstTreeNode<Payload> *N) { N->print(o, 0); return o; } @@ -137,16 +140,16 @@ inline ostream &operator<<(ostream &o, const InstTreeNode<Payload> *N) { // guaranteed to be an instruction node. The constructor builds the forest. // template<class Payload> -class InstForest : public vector<InstTreeNode<Payload> *> { +class InstForest : public std::vector<InstTreeNode<Payload> *> { friend class InstTreeNode<Payload>; // InstMap - Map contains entries for ALL instructions in the method and the // InstTreeNode that they correspond to. // - map<Instruction*, InstTreeNode<Payload> *> InstMap; + std::map<Instruction*, InstTreeNode<Payload> *> InstMap; void addInstMapping(Instruction *I, InstTreeNode<Payload> *IN) { - InstMap.insert(make_pair(I, IN)); + InstMap.insert(std::make_pair(I, IN)); } void removeInstFromRootList(Instruction *I) { @@ -180,26 +183,27 @@ public: // the parent pointer can be used to find the root of the tree. // inline InstTreeNode<Payload> *getInstNode(Instruction *Inst) { - map<Instruction*, InstTreeNode<Payload> *>::iterator I = InstMap.find(Inst); + std::map<Instruction*, InstTreeNode<Payload> *>::iterator I = + InstMap.find(Inst); if (I != InstMap.end()) return I->second; return 0; } inline const InstTreeNode<Payload> *getInstNode(const Instruction *Inst)const{ - map<Instruction*, InstTreeNode<Payload>*>::const_iterator I = + std::map<Instruction*, InstTreeNode<Payload>*>::const_iterator I = InstMap.find(Inst); if (I != InstMap.end()) return I->second; return 0; } // print - Called by operator<< below... - void print(ostream &out) const { + void print(std::ostream &out) const { for (const_iterator I = begin(), E = end(); I != E; ++I) out << *I; } }; template<class Payload> -inline ostream &operator<<(ostream &o, const InstForest<Payload> &IF) { +inline std::ostream &operator<<(std::ostream &o, const InstForest<Payload> &IF){ IF.print(o); return o; } @@ -254,7 +258,7 @@ InstTreeNode<Payload>::InstTreeNode(InstForest<Payload> &IF, Value *V, // Otherwise, we are an internal instruction node. We must process our // uses and add them as children of this node. // - vector<InstTreeNode*> Children; + std::vector<InstTreeNode*> Children; // Make sure that the forest knows about us! IF.addInstMapping(I, this); diff --git a/include/llvm/Analysis/Interval.h b/include/llvm/Analysis/Interval.h index db9d67c..18f3a88 100644 --- a/include/llvm/Analysis/Interval.h +++ b/include/llvm/Analysis/Interval.h @@ -31,9 +31,9 @@ class Interval { // BasicBlock *HeaderNode; public: - typedef vector<BasicBlock*>::iterator succ_iterator; - typedef vector<BasicBlock*>::iterator pred_iterator; - typedef vector<BasicBlock*>::iterator node_iterator; + typedef std::vector<BasicBlock*>::iterator succ_iterator; + typedef std::vector<BasicBlock*>::iterator pred_iterator; + typedef std::vector<BasicBlock*>::iterator node_iterator; inline Interval(BasicBlock *Header) : HeaderNode(Header) { Nodes.push_back(Header); @@ -46,18 +46,18 @@ public: // Nodes - The basic blocks in this interval. // - vector<BasicBlock*> Nodes; + std::vector<BasicBlock*> Nodes; // Successors - List of BasicBlocks that are reachable directly from nodes in // this interval, but are not in the interval themselves. // These nodes neccesarily must be header nodes for other intervals. // - vector<BasicBlock*> Successors; + std::vector<BasicBlock*> Successors; // Predecessors - List of BasicBlocks that have this Interval's header block // as one of their successors. // - vector<BasicBlock*> Predecessors; + std::vector<BasicBlock*> Predecessors; // contains - Find out if a basic block is in this interval inline bool contains(BasicBlock *BB) const { diff --git a/include/llvm/Analysis/IntervalIterator.h b/include/llvm/Analysis/IntervalIterator.h index 454c0ca..52d2cc8 100644 --- a/include/llvm/Analysis/IntervalIterator.h +++ b/include/llvm/Analysis/IntervalIterator.h @@ -79,8 +79,8 @@ inline void addNodeToInterval(Interval *Int, Interval *I) { template<class NodeTy, class OrigContainer_t> class IntervalIterator { - stack<pair<Interval*, typename Interval::succ_iterator> > IntStack; - set<BasicBlock*> Visited; + std::stack<std::pair<Interval*, typename Interval::succ_iterator> > IntStack; + std::set<BasicBlock*> Visited; OrigContainer_t *OrigContainer; bool IOwnMem; // If True, delete intervals when done with them // See file header for conditions of use @@ -88,7 +88,7 @@ public: typedef BasicBlock* _BB; typedef IntervalIterator<NodeTy, OrigContainer_t> _Self; - typedef forward_iterator_tag iterator_category; + typedef std::forward_iterator_tag iterator_category; IntervalIterator() {} // End iterator, empty stack IntervalIterator(Method *M, bool OwnMemory) : IOwnMem(OwnMemory) { diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index 494ccd2..f05408b 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -31,11 +31,11 @@ namespace cfg { // BasicBlock is a (possibly nonexistent) loop with a "tail" of non looping // nodes following it. // -class IntervalPartition : public vector<Interval*> { - typedef map<BasicBlock*, Interval*> IntervalMapTy; +class IntervalPartition : public std::vector<Interval*> { + typedef std::map<BasicBlock*, Interval*> IntervalMapTy; IntervalMapTy IntervalMap; - typedef vector<Interval*> IntervalListTy; + typedef std::vector<Interval*> IntervalListTy; Interval *RootInterval; public: diff --git a/include/llvm/Analysis/LiveVar/LiveVarMap.h b/include/llvm/Analysis/LiveVar/LiveVarMap.h index bc00d4f..44b3bbb 100644 --- a/include/llvm/Analysis/LiveVar/LiveVarMap.h +++ b/include/llvm/Analysis/LiveVar/LiveVarMap.h @@ -12,7 +12,7 @@ #ifndef LIVE_VAR_MAP_H #define LIVE_VAR_MAP_H -#include <hash_map> +#include <ext/hash_map> class BasicBlock; class BBLiveVar; @@ -34,11 +34,11 @@ struct hashFuncBB { // sturcture containing the hash function for BB -typedef hash_map<const BasicBlock *, - BBLiveVar *, hashFuncBB > BBToBBLiveVarMapType; +typedef std::hash_map<const BasicBlock *, + BBLiveVar *, hashFuncBB > BBToBBLiveVarMapType; -typedef hash_map<const MachineInstr *, const LiveVarSet *, - hashFuncMInst> MInstToLiveVarSetMapType; +typedef std::hash_map<const MachineInstr *, const LiveVarSet *, + hashFuncMInst> MInstToLiveVarSetMapType; #endif diff --git a/include/llvm/Analysis/LiveVar/LiveVarSet.h b/include/llvm/Analysis/LiveVar/LiveVarSet.h index 17524fc..d7761cf 100644 --- a/include/llvm/Analysis/LiveVar/LiveVarSet.h +++ b/include/llvm/Analysis/LiveVar/LiveVarSet.h @@ -8,7 +8,7 @@ #ifndef LIVE_VAR_SET_H #define LIVE_VAR_SET_H -#include "ValueSet.h" +#include "llvm/Analysis/LiveVar/ValueSet.h" #include "llvm/Instruction.h" #include "llvm/Type.h" diff --git a/include/llvm/Analysis/LiveVar/ValueSet.h b/include/llvm/Analysis/LiveVar/ValueSet.h index ee6aa15..d17e022 100644 --- a/include/llvm/Analysis/LiveVar/ValueSet.h +++ b/include/llvm/Analysis/LiveVar/ValueSet.h @@ -1,4 +1,4 @@ -/* Title: ValueSet.h +/* Title: ValueSet.h -*- C++ -*- Author: Ruchira Sasanka Date: Jun 30, 01 Purpose: Contains a mathematical set of Values. LiveVarSet is derived from @@ -8,24 +8,9 @@ #ifndef VALUE_SET_H #define VALUE_SET_H -#include <stdlib.h> - -#include <hash_set> -#include <algorithm> -//#include <fstream> -#include <iostream> - -#include "llvm/Value.h" - - -//------------------------ Support functions --------------------------------- - -struct hashFuncValue { // sturcture containing the hash func - inline size_t operator () (const Value *const val) const - { return (size_t) val; } -}; - - +class Value; +#include "Support/HashExtras.h" +#include <ext/hash_set> //------------------- Class Definition for ValueSet -------------------------- @@ -33,12 +18,8 @@ void printValue( const Value *const v); // func to print a Value -class ValueSet : public hash_set<const Value *, hashFuncValue > -{ - +class ValueSet : public std::hash_set<const Value *> { public: - ValueSet(); // constructor - inline void add(const Value *const val) { assert( val ); insert(val);} // for adding a live variable to set diff --git a/include/llvm/Analysis/LoopDepth.h b/include/llvm/Analysis/LoopDepth.h index 76a590c..89068d6 100644 --- a/include/llvm/Analysis/LoopDepth.h +++ b/include/llvm/Analysis/LoopDepth.h @@ -14,14 +14,14 @@ class Method; namespace cfg {class Interval; } class LoopDepthCalculator { - map<const BasicBlock*, unsigned> LoopDepth; + std::map<const BasicBlock*, unsigned> LoopDepth; inline void AddBB(const BasicBlock *BB); // Increment count for this block inline void ProcessInterval(cfg::Interval *I); public: LoopDepthCalculator(Method *M); inline unsigned getLoopDepth(const BasicBlock *BB) const { - map<const BasicBlock*, unsigned>::const_iterator I = LoopDepth.find(BB); + std::map<const BasicBlock*,unsigned>::const_iterator I = LoopDepth.find(BB); return I != LoopDepth.end() ? I->second : 0; } }; diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 3a20226..10fcfe9 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -25,8 +25,8 @@ namespace cfg { // class Loop { Loop *ParentLoop; - vector<const BasicBlock *> Blocks; // First entry is the header node - vector<Loop*> SubLoops; // Loops contained entirely within this one + std::vector<const BasicBlock *> Blocks; // First entry is the header node + std::vector<Loop*> SubLoops; // Loops contained entirely within this one unsigned LoopDepth; // Nesting depth of this loop Loop(const Loop &); // DO NOT IMPLEMENT @@ -40,8 +40,10 @@ public: bool contains(const BasicBlock *BB) const; // getSubLoops - Return the loops contained entirely within this loop - inline const vector<Loop*> &getSubLoops() const { return SubLoops; } - inline const vector<const BasicBlock*> &getBlocks() const { return Blocks; } + inline const std::vector<Loop*> &getSubLoops() const { return SubLoops; } + inline const std::vector<const BasicBlock*> &getBlocks() const { + return Blocks; + } private: friend class LoopInfo; @@ -62,19 +64,19 @@ private: // class LoopInfo { // BBMap - Mapping of basic blocks to the inner most loop they occur in - map<const BasicBlock *, Loop*> BBMap; - vector<Loop*> TopLevelLoops; + std::map<const BasicBlock *, Loop*> BBMap; + std::vector<Loop*> TopLevelLoops; public: // LoopInfo ctor - Calculate the natural loop information for a CFG LoopInfo(const DominatorSet &DS); - const vector<Loop*> &getTopLevelLoops() const { return TopLevelLoops; } + const std::vector<Loop*> &getTopLevelLoops() const { return TopLevelLoops; } // getLoopFor - Return the inner most loop that BB lives in. If a basic block // is in no loop (for example the entry node), null is returned. // const Loop *getLoopFor(const BasicBlock *BB) const { - map<const BasicBlock *, Loop*>::const_iterator I = BBMap.find(BB); + std::map<const BasicBlock *, Loop*>::const_iterator I = BBMap.find(BB); return I != BBMap.end() ? I->second : 0; } inline const Loop *operator[](const BasicBlock *BB) const { diff --git a/include/llvm/Analysis/ModuleAnalyzer.h b/include/llvm/Analysis/ModuleAnalyzer.h index a0baa8a..8493bec 100644 --- a/include/llvm/Analysis/ModuleAnalyzer.h +++ b/include/llvm/Analysis/ModuleAnalyzer.h @@ -78,7 +78,7 @@ protected: virtual bool processInstruction(const Instruction *I) { return false; } private: - bool handleType(set<const Type *> &TypeSet, const Type *T); + bool handleType(std::set<const Type *> &TypeSet, const Type *T); }; #endif diff --git a/include/llvm/Analysis/SlotCalculator.h b/include/llvm/Analysis/SlotCalculator.h index c7b3149..9528244 100644 --- a/include/llvm/Analysis/SlotCalculator.h +++ b/include/llvm/Analysis/SlotCalculator.h @@ -23,14 +23,14 @@ class SlotCalculator { const Module *TheModule; bool IgnoreNamedNodes; // Shall we not count named nodes? - typedef vector<const Value*> TypePlane; - vector<TypePlane> Table; - map<const Value *, unsigned> NodeMap; + typedef std::vector<const Value*> TypePlane; + std::vector<TypePlane> Table; + std::map<const Value *, unsigned> NodeMap; // ModuleLevel - Used to keep track of which values belong to the module, // and which values belong to the currently incorporated method. // - vector<unsigned> ModuleLevel; + std::vector<unsigned> ModuleLevel; public: SlotCalculator(const Module *M, bool IgnoreNamed); diff --git a/include/llvm/Analysis/Verifier.h b/include/llvm/Analysis/Verifier.h index 2feadca..eb12539 100644 --- a/include/llvm/Analysis/Verifier.h +++ b/include/llvm/Analysis/Verifier.h @@ -22,7 +22,7 @@ class Method; // error messages corresponding to the problem are added to the errorMsgs // vectors, and a value of true is returned. // -bool verify(const Module *M, vector<string> &ErrorMsgs); -bool verify(const Method *M, vector<string> &ErrorMsgs); +bool verify(const Module *M, std::vector<std::string> &ErrorMsgs); +bool verify(const Method *M, std::vector<std::string> &ErrorMsgs); #endif diff --git a/include/llvm/Analysis/Writer.h b/include/llvm/Analysis/Writer.h index 2b43231..daaf657 100644 --- a/include/llvm/Analysis/Writer.h +++ b/include/llvm/Analysis/Writer.h @@ -16,13 +16,14 @@ namespace cfg { class Interval; class IntervalPartition; - void WriteToOutput(const Interval *I, ostream &o); - inline ostream &operator <<(ostream &o, const Interval *I) { + void WriteToOutput(const Interval *I, std::ostream &o); + inline std::ostream &operator <<(std::ostream &o, const Interval *I) { WriteToOutput(I, o); return o; } - void WriteToOutput(const IntervalPartition &IP, ostream &o); - inline ostream &operator <<(ostream &o, const IntervalPartition &IP) { + void WriteToOutput(const IntervalPartition &IP, std::ostream &o); + inline std::ostream &operator <<(std::ostream &o, + const IntervalPartition &IP) { WriteToOutput(IP, o); return o; } @@ -32,23 +33,25 @@ namespace cfg { class DominatorTree; class DominanceFrontier; - void WriteToOutput(const DominatorSet &, ostream &o); - inline ostream &operator <<(ostream &o, const DominatorSet &DS) { + void WriteToOutput(const DominatorSet &, std::ostream &o); + inline std::ostream &operator <<(std::ostream &o, const DominatorSet &DS) { WriteToOutput(DS, o); return o; } - void WriteToOutput(const ImmediateDominators &, ostream &o); - inline ostream &operator <<(ostream &o, const ImmediateDominators &ID) { + void WriteToOutput(const ImmediateDominators &, std::ostream &o); + inline std::ostream &operator <<(std::ostream &o, + const ImmediateDominators &ID) { WriteToOutput(ID, o); return o; } - void WriteToOutput(const DominatorTree &, ostream &o); - inline ostream &operator <<(ostream &o, const DominatorTree &DT) { + void WriteToOutput(const DominatorTree &, std::ostream &o); + inline std::ostream &operator <<(std::ostream &o, const DominatorTree &DT) { WriteToOutput(DT, o); return o; } - void WriteToOutput(const DominanceFrontier &, ostream &o); - inline ostream &operator <<(ostream &o, const DominanceFrontier &DF) { + void WriteToOutput(const DominanceFrontier &, std::ostream &o); + inline std::ostream &operator <<(std::ostream &o, + const DominanceFrontier &DF) { WriteToOutput(DF, o); return o; } @@ -56,13 +59,13 @@ namespace cfg { class CallGraph; class CallGraphNode; - void WriteToOutput(const CallGraph &, ostream &o); - inline ostream &operator <<(ostream &o, const CallGraph &CG) { + void WriteToOutput(const CallGraph &, std::ostream &o); + inline std::ostream &operator <<(std::ostream &o, const CallGraph &CG) { WriteToOutput(CG, o); return o; } - void WriteToOutput(const CallGraphNode *, ostream &o); - inline ostream &operator <<(ostream &o, const CallGraphNode *CGN) { + void WriteToOutput(const CallGraphNode *, std::ostream &o); + inline std::ostream &operator <<(std::ostream &o, const CallGraphNode *CGN) { WriteToOutput(CGN, o); return o; } @@ -70,21 +73,21 @@ namespace cfg { class Loop; class LoopInfo; - void WriteToOutput(const LoopInfo &, ostream &o); - inline ostream &operator <<(ostream &o, const LoopInfo &LI) { + void WriteToOutput(const LoopInfo &, std::ostream &o); + inline std::ostream &operator <<(std::ostream &o, const LoopInfo &LI) { WriteToOutput(LI, o); return o; } - void WriteToOutput(const Loop *, ostream &o); - inline ostream &operator <<(ostream &o, const Loop *L) { + void WriteToOutput(const Loop *, std::ostream &o); + inline std::ostream &operator <<(std::ostream &o, const Loop *L) { WriteToOutput(L, o); return o; } } // End namespace CFG class InductionVariable; -void WriteToOutput(const InductionVariable &, ostream &o); -inline ostream &operator <<(ostream &o, const InductionVariable &IV) { +void WriteToOutput(const InductionVariable &, std::ostream &o); +inline std::ostream &operator <<(std::ostream &o, const InductionVariable &IV) { WriteToOutput(IV, o); return o; } diff --git a/include/llvm/Annotation.h b/include/llvm/Annotation.h index 9919732..c0642e1 100644 --- a/include/llvm/Annotation.h +++ b/include/llvm/Annotation.h @@ -166,12 +166,13 @@ struct AnnotationManager { //===--------------------------------------------------------------------===// // Basic ID <-> Name map functionality - static AnnotationID getID (const string &Name); // Name -> ID - static const string &getName(AnnotationID ID); // ID -> Name + static AnnotationID getID(const std::string &Name); // Name -> ID + static const std::string &getName(AnnotationID ID); // ID -> Name // getID - Name -> ID + registration of a factory function for demand driven // annotation support. - static AnnotationID getID (const string &Name, Factory Fact, void *Data=0); + static AnnotationID getID(const std::string &Name, Factory Fact, + void *Data = 0); //===--------------------------------------------------------------------===// // Annotation creation on demand support... diff --git a/include/llvm/Assembly/CachedWriter.h b/include/llvm/Assembly/CachedWriter.h index b5171b4..cccf037 100644 --- a/include/llvm/Assembly/CachedWriter.h +++ b/include/llvm/Assembly/CachedWriter.h @@ -11,6 +11,7 @@ #define LLVM_ASSEMBLY_CACHED_WRITER_H #include "llvm/Assembly/Writer.h" +#include <iostream> class AssemblyWriter; // Internal private class class SlotCalculator; @@ -19,10 +20,11 @@ class CachedWriter { AssemblyWriter *AW; SlotCalculator *SC; public: - ostream &Out; + std::ostream &Out; public: - CachedWriter(ostream &O = cout) : AW(0), SC(0), Out(O) { } - CachedWriter(const Module *M, ostream &O = cout) : AW(0), SC(0), Out(O) { + CachedWriter(std::ostream &O = std::cout) : AW(0), SC(0), Out(O) { } + CachedWriter(const Module *M, std::ostream &O = std::cout) + : AW(0), SC(0), Out(O) { setModule(M); } ~CachedWriter(); @@ -63,7 +65,7 @@ public: return *this << (const Value*)X; } - inline CachedWriter &operator<<(ostream &(&Manip)(ostream &)) { + inline CachedWriter &operator<<(std::ostream &(&Manip)(std::ostream &)) { Out << Manip; return *this; } diff --git a/include/llvm/Assembly/Parser.h b/include/llvm/Assembly/Parser.h index 011594d..02e5d4f 100644 --- a/include/llvm/Assembly/Parser.h +++ b/include/llvm/Assembly/Parser.h @@ -16,7 +16,7 @@ class ParseException; // The useful interface defined by this file... Parse an ascii file, and return // the internal representation in a nice slice'n'dice'able representation. // -Module *ParseAssemblyFile(const string &Filename);// throw (ParseException); +Module *ParseAssemblyFile(const std::string &Filename);// throw (ParseException) //===------------------------------------------------------------------------=== // Helper Classes @@ -27,7 +27,7 @@ Module *ParseAssemblyFile(const string &Filename);// throw (ParseException); // class ParseException { public: - ParseException(const string &filename, const string &message, + ParseException(const std::string &filename, const std::string &message, int LineNo = -1, int ColNo = -1); ParseException(const ParseException &E); @@ -35,13 +35,13 @@ public: // getMessage - Return the message passed in at construction time plus extra // information extracted from the options used to parse with... // - const string getMessage() const; + const std::string getMessage() const; - inline const string getRawMessage() const { // Just the raw message... + inline const std::string &getRawMessage() const { // Just the raw message... return Message; } - inline const string &getFilename() const { + inline const std::string &getFilename() const { return Filename; } @@ -55,8 +55,8 @@ public: } private : - string Filename; - string Message; + std::string Filename; + std::string Message; int LineNo, ColumnNo; // -1 if not relevant ParseException &operator=(const ParseException &E); // objects by reference diff --git a/include/llvm/Assembly/PrintModulePass.h b/include/llvm/Assembly/PrintModulePass.h index a03b349..72d8fab 100644 --- a/include/llvm/Assembly/PrintModulePass.h +++ b/include/llvm/Assembly/PrintModulePass.h @@ -10,14 +10,15 @@ #include "llvm/Pass.h" #include "llvm/Assembly/Writer.h" +#include <iostream> class PrintModulePass : public Pass { - string Banner; // String to print before each method - ostream *Out; // ostream to print on + std::string Banner; // String to print before each method + std::ostream *Out; // ostream to print on bool DeleteStream; // Delete the ostream in our dtor? bool PrintPerMethod; // Print one method at a time rather than the whole? public: - inline PrintModulePass(const string &B, ostream *o = &cout, + inline PrintModulePass(const std::string &B, std::ostream *o = &std::cout, bool DS = false, bool printPerMethod = true) : Banner(B), Out(o), DeleteStream(DS), PrintPerMethod(printPerMethod) { diff --git a/include/llvm/Assembly/Writer.h b/include/llvm/Assembly/Writer.h index 02c9fd0..6ef33ad 100644 --- a/include/llvm/Assembly/Writer.h +++ b/include/llvm/Assembly/Writer.h @@ -30,26 +30,26 @@ class SlotCalculator; // representation of an object into an ascii bytestream that the parser can // understand later... (the parser only understands whole classes though) // -void WriteToAssembly(const Module *Module, ostream &o); -void WriteToAssembly(const GlobalVariable *G, ostream &o); -void WriteToAssembly(const Method *Method, ostream &o); -void WriteToAssembly(const BasicBlock *BB, ostream &o); -void WriteToAssembly(const Instruction *In, ostream &o); -void WriteToAssembly(const Constant *V, ostream &o); +void WriteToAssembly(const Module *Module, std::ostream &o); +void WriteToAssembly(const GlobalVariable *G, std::ostream &o); +void WriteToAssembly(const Method *Method, std::ostream &o); +void WriteToAssembly(const BasicBlock *BB, std::ostream &o); +void WriteToAssembly(const Instruction *In, std::ostream &o); +void WriteToAssembly(const Constant *V, std::ostream &o); // WriteTypeSymbolic - This attempts to write the specified type as a symbolic // type, iff there is an entry in the modules symbol table for the specified // type or one of it's component types. This is slower than a simple x << Type; // -ostream &WriteTypeSymbolic(ostream &o, const Type *Ty, const Module *Module); +std::ostream &WriteTypeSymbolic(std::ostream &, const Type *, const Module *M); // WriteAsOperand - Write the name of the specified value out to the specified // ostream. This can be useful when you just want to print int %reg126, not the // whole instruction that generated it. // -ostream &WriteAsOperand(ostream &o, const Value *V, bool PrintType = true, - bool PrintName = true, SlotCalculator *Table = 0); +std::ostream &WriteAsOperand(std::ostream &, const Value *, bool PrintTy = true, + bool PrintName = true, SlotCalculator *Table = 0); // WriteToVCG - Dump the specified structure to a VCG file. If method is @@ -57,8 +57,8 @@ ostream &WriteAsOperand(ostream &o, const Value *V, bool PrintType = true, // family of files with a common base name is created, with a method name // suffix. // -void WriteToVCG(const Module *Module, const string &Filename); -void WriteToVCG(const Method *Method, const string &Filename); +void WriteToVCG(const Module *Module, const std::string &Filename); +void WriteToVCG(const Method *Method, const std::string &Filename); @@ -66,37 +66,37 @@ void WriteToVCG(const Method *Method, const string &Filename); // Define operator<< to work on the various classes that we can send to an // ostream... // -inline ostream &operator<<(ostream &o, const Module *C) { +inline std::ostream &operator<<(std::ostream &o, const Module *C) { WriteToAssembly(C, o); return o; } -inline ostream &operator<<(ostream &o, const GlobalVariable *G) { +inline std::ostream &operator<<(std::ostream &o, const GlobalVariable *G) { WriteToAssembly(G, o); return o; } -inline ostream &operator<<(ostream &o, const Method *M) { +inline std::ostream &operator<<(std::ostream &o, const Method *M) { WriteToAssembly(M, o); return o; } -inline ostream &operator<<(ostream &o, const BasicBlock *B) { +inline std::ostream &operator<<(std::ostream &o, const BasicBlock *B) { WriteToAssembly(B, o); return o; } -inline ostream &operator<<(ostream &o, const Instruction *I) { +inline std::ostream &operator<<(std::ostream &o, const Instruction *I) { WriteToAssembly(I, o); return o; } -inline ostream &operator<<(ostream &o, const Constant *I) { +inline std::ostream &operator<<(std::ostream &o, const Constant *I) { WriteToAssembly(I, o); return o; } -inline ostream &operator<<(ostream &o, const Type *T) { +inline std::ostream &operator<<(std::ostream &o, const Type *T) { if (!T) return o << "<null Type>"; return o << T->getDescription(); } -inline ostream &operator<<(ostream &o, const Value *I) { +inline std::ostream &operator<<(std::ostream &o, const Value *I) { switch (I->getValueType()) { case Value::TypeVal: return o << cast<const Type>(I); case Value::ConstantVal: WriteToAssembly(cast<Constant>(I) , o); break; diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h index 50de364..6770aa3 100644 --- a/include/llvm/BasicBlock.h +++ b/include/llvm/BasicBlock.h @@ -49,8 +49,8 @@ public: // Instruction iterators... typedef InstListType::iterator iterator; typedef InstListType::const_iterator const_iterator; - typedef reverse_iterator<const_iterator> const_reverse_iterator; - typedef reverse_iterator<iterator> reverse_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + typedef std::reverse_iterator<iterator> reverse_iterator; // Predecessor and successor iterators... typedef PredIterator<BasicBlock, Value::use_iterator> pred_iterator; @@ -61,11 +61,11 @@ public: const BasicBlock> succ_const_iterator; // Ctor, dtor - BasicBlock(const string &Name = "", Method *Parent = 0); + BasicBlock(const std::string &Name = "", Method *Parent = 0); ~BasicBlock(); // Specialize setName to take care of symbol table majik - virtual void setName(const string &name, SymbolTable *ST = 0); + virtual void setName(const std::string &name, SymbolTable *ST = 0); // getParent - Return the enclosing method, or null if none const Method *getParent() const { return InstList.getParent(); } diff --git a/include/llvm/Bytecode/Primitives.h b/include/llvm/Bytecode/Primitives.h index e0c25a1..4058bd2 100644 --- a/include/llvm/Bytecode/Primitives.h +++ b/include/llvm/Bytecode/Primitives.h @@ -116,12 +116,12 @@ static inline bool align32(const unsigned char *&Buf, } static inline bool read(const unsigned char *&Buf, const unsigned char *EndBuf, - string &Result, bool Aligned = true) { + std::string &Result, bool Aligned = true) { unsigned Size; if (read_vbr(Buf, EndBuf, Size)) return true; // Failure reading size? if (Buf+Size > EndBuf) return true; // Size invalid? - Result = string((char*)Buf, Size); + Result = std::string((char*)Buf, Size); Buf += Size; if (Aligned) // If we should stay aligned do so... @@ -157,7 +157,8 @@ static inline bool input_data(const unsigned char *&Buf, // string... note that this should be inlined always so only the relevant IF // body should be included... // -static inline void output(unsigned i, deque<unsigned char> &Out, int pos = -1){ +static inline void output(unsigned i, std::deque<unsigned char> &Out, + int pos = -1) { #ifdef LITTLE_ENDIAN if (pos == -1) Out.insert(Out.end(), (unsigned char*)&i, (unsigned char*)&i+4); @@ -178,7 +179,7 @@ static inline void output(unsigned i, deque<unsigned char> &Out, int pos = -1){ #endif } -static inline void output(int i, deque<unsigned char> &Out) { +static inline void output(int i, std::deque<unsigned char> &Out) { output((unsigned)i, Out); } @@ -191,7 +192,7 @@ static inline void output(int i, deque<unsigned char> &Out) { // // Note that using this may cause the output buffer to become unaligned... // -static inline void output_vbr(uint64_t i, deque<unsigned char> &out) { +static inline void output_vbr(uint64_t i, std::deque<unsigned char> &out) { while (1) { if (i < 0x80) { // done? out.push_back((unsigned char)i); // We know the high bit is clear... @@ -205,7 +206,7 @@ static inline void output_vbr(uint64_t i, deque<unsigned char> &out) { } } -static inline void output_vbr(unsigned i, deque<unsigned char> &out) { +static inline void output_vbr(unsigned i, std::deque<unsigned char> &out) { while (1) { if (i < 0x80) { // done? out.push_back((unsigned char)i); // We know the high bit is clear... @@ -219,7 +220,7 @@ static inline void output_vbr(unsigned i, deque<unsigned char> &out) { } } -static inline void output_vbr(int64_t i, deque<unsigned char> &out) { +static inline void output_vbr(int64_t i, std::deque<unsigned char> &out) { if (i < 0) output_vbr(((uint64_t)(-i) << 1) | 1, out); // Set low order sign bit... else @@ -227,7 +228,7 @@ static inline void output_vbr(int64_t i, deque<unsigned char> &out) { } -static inline void output_vbr(int i, deque<unsigned char> &out) { +static inline void output_vbr(int i, std::deque<unsigned char> &out) { if (i < 0) output_vbr(((unsigned)(-i) << 1) | 1, out); // Set low order sign bit... else @@ -237,12 +238,12 @@ static inline void output_vbr(int i, deque<unsigned char> &out) { // align32 - emit the minimal number of bytes that will bring us to 32 bit // alignment... // -static inline void align32(deque<unsigned char> &Out) { +static inline void align32(std::deque<unsigned char> &Out) { int NumPads = (4-(Out.size() & 3)) & 3; // Bytes to get padding to 32 bits while (NumPads--) Out.push_back((unsigned char)0xAB); } -static inline void output(const string &s, deque<unsigned char> &Out, +static inline void output(const std::string &s, std::deque<unsigned char> &Out, bool Aligned = true) { unsigned Len = s.length(); output_vbr(Len, Out); // Strings may have an arbitrary length... @@ -253,7 +254,8 @@ static inline void output(const string &s, deque<unsigned char> &Out, } static inline void output_data(void *Ptr, void *End, - deque<unsigned char> &Out, bool Align = false) { + std::deque<unsigned char> &Out, + bool Align = false) { #ifdef LITTLE_ENDIAN Out.insert(Out.end(), (unsigned char*)Ptr, (unsigned char*)End); #else diff --git a/include/llvm/Bytecode/Reader.h b/include/llvm/Bytecode/Reader.h index 2ef2532..7cd2365 100644 --- a/include/llvm/Bytecode/Reader.h +++ b/include/llvm/Bytecode/Reader.h @@ -18,8 +18,9 @@ class Module; // Parse and return a class... // -Module *ParseBytecodeFile(const string &Filename, string *ErrorStr = 0); +Module *ParseBytecodeFile(const std::string &Filename, + std::string *ErrorStr = 0); Module *ParseBytecodeBuffer(const char *Buffer, unsigned BufferSize, - string *ErrorStr = 0); + std::string *ErrorStr = 0); #endif diff --git a/include/llvm/CodeGen/InstrForest.h b/include/llvm/CodeGen/InstrForest.h index aa101f9..0f614a6 100644 --- a/include/llvm/CodeGen/InstrForest.h +++ b/include/llvm/CodeGen/InstrForest.h @@ -27,8 +27,7 @@ #include "llvm/Instruction.h" #include "Support/NonCopyable.h" #include "Support/HashExtras.h" -#include <hash_map> -#include <hash_set> +#include <ext/hash_set> class Constant; class BasicBlock; @@ -239,9 +238,9 @@ protected: // //------------------------------------------------------------------------ -class InstrForest : private hash_map<const Instruction *, InstructionNode*> { +class InstrForest : private std::hash_map<const Instruction *, InstructionNode*> { private: - hash_set<InstructionNode*> treeRoots; + std::hash_set<InstructionNode*> treeRoots; public: /*ctor*/ InstrForest (Method *M); @@ -251,7 +250,7 @@ public: return (*this)[instr]; } - inline const hash_set<InstructionNode*> &getRootSet() const { + inline const std::hash_set<InstructionNode*> &getRootSet() const { return treeRoots; } diff --git a/include/llvm/CodeGen/InstrSelection.h b/include/llvm/CodeGen/InstrSelection.h index 27e3ebe..287992a 100644 --- a/include/llvm/CodeGen/InstrSelection.h +++ b/include/llvm/CodeGen/InstrSelection.h @@ -84,7 +84,8 @@ class TmpInstruction : public Instruction { public: // Constructor that uses the type of S1 as the type of the temporary. // s1 must be a valid value. s2 may be NULL. - TmpInstruction(OtherOps opcode, Value *s1, Value* s2, const string &name="") + TmpInstruction(OtherOps opcode, Value *s1, Value* s2, + const std::string &name = "") : Instruction(s1->getType(), opcode, name) { assert(s1 != NULL && "Use different constructor if both operands are 0"); @@ -94,7 +95,7 @@ public: // Constructor that allows the type of the temporary to be specified. // Both S1 and S2 may be NULL. TmpInstruction(OtherOps opcode, const Type* tmpType, - Value *s1, Value* s2, const string &name = "") + Value *s1, Value* s2, const std::string &name = "") : Instruction(tmpType, opcode, name) { Initialize(opcode, s1, s2); diff --git a/include/llvm/CodeGen/InstrSelectionSupport.h b/include/llvm/CodeGen/InstrSelectionSupport.h index 2cce1dc..33af635 100644 --- a/include/llvm/CodeGen/InstrSelectionSupport.h +++ b/include/llvm/CodeGen/InstrSelectionSupport.h @@ -24,8 +24,6 @@ class TmpInstruction; class Constant; class TargetMachine; -//************************ Exported Functions ******************************/ - //--------------------------------------------------------------------------- // Function GetConstantValueAsSignedInt @@ -54,7 +52,7 @@ int64_t GetConstantValueAsSignedInt (const Value *V, //--------------------------------------------------------------------------- Value* FoldGetElemChain (const InstructionNode* getElemInstrNode, - vector<Value*>& chainIdxVec); + std::vector<Value*>& chainIdxVec); //------------------------------------------------------------------------ @@ -130,11 +128,8 @@ MachineOperand::MachineOperandType // fall under case 3; these must be inserted before `minstr'. //--------------------------------------------------------------------------- -vector<MachineInstr*> FixConstantOperandsForInstr (Instruction* vmInstr, - MachineInstr* minstr, - TargetMachine& target); - - -//**************************************************************************/ +std::vector<MachineInstr*> FixConstantOperandsForInstr (Instruction* vmInstr, + MachineInstr* minstr, + TargetMachine& target); #endif diff --git a/include/llvm/CodeGen/InterferenceGraph.h b/include/llvm/CodeGen/InterferenceGraph.h index 99dea8f..408bee4 100644 --- a/include/llvm/CodeGen/InterferenceGraph.h +++ b/include/llvm/CodeGen/InterferenceGraph.h @@ -1,4 +1,4 @@ -/* Title: InterferenceGraph.h +/* Title: InterferenceGraph.h -*- C++ -*- Author: Ruchira Sasanka Date: July 20, 01 Purpose: Interference Graph used for register coloring. @@ -24,7 +24,7 @@ #include "llvm/CodeGen/IGNode.h" -typedef vector <IGNode *> IGNodeListType; +typedef std::vector <IGNode *> IGNodeListType; class InterferenceGraph @@ -47,6 +47,8 @@ class InterferenceGraph // to create it after adding all IGNodes to the IGNodeList InterferenceGraph(RegClass *const RC); + ~InterferenceGraph(); + void createGraph(); void addLRToIG(LiveRange *const LR); @@ -65,12 +67,6 @@ class InterferenceGraph void printIG() const; void printIGNodeList() const; - - ~InterferenceGraph(); - - }; - #endif - diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index d6b8ef7..4c5dd10 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -22,8 +22,6 @@ #include "llvm/Annotation.h" #include "llvm/Method.h" #include <iterator> -#include <hash_map> -#include <hash_set> #include <values.h> template<class _MI, class _V> class ValOpIterator; @@ -131,7 +129,7 @@ public: } public: - friend ostream& operator<<(ostream& os, const MachineOperand& mop); + friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop); private: @@ -262,9 +260,9 @@ class MachineInstr : public NonCopyable { private: MachineOpCode opCode; OpCodeMask opCodeMask; // extra bits for variants of an opcode - vector<MachineOperand> operands; - vector<Value*> implicitRefs; // values implicitly referenced by this - vector<bool> implicitIsDef; // machine instruction (eg, call args) + std::vector<MachineOperand> operands; + std::vector<Value*> implicitRefs; // values implicitly referenced by this + std::vector<bool> implicitIsDef; // machine instruction (eg, call args) public: typedef ValOpIterator<const MachineInstr, const Value> val_const_op_iterator; @@ -306,9 +304,9 @@ public: public: - friend ostream& operator<<(ostream& os, const MachineInstr& minstr); - friend val_const_op_iterator; - friend val_op_iterator; + friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr); + friend class val_const_op_iterator; + friend class val_op_iterator; public: // Access to set the operands when building the machine instruction @@ -449,17 +447,17 @@ public: // //--------------------------------------------------------------------------- -class MachineCodeForVMInstr: public vector<MachineInstr*> +class MachineCodeForVMInstr: public std::vector<MachineInstr*> { private: - vector<Value*> tempVec; // used by m/c instr but not VM instr + std::vector<Value*> tempVec; // used by m/c instr but not VM instr public: /*ctor*/ MachineCodeForVMInstr () {} /*ctor*/ ~MachineCodeForVMInstr (); - const vector<Value*>& getTempValues () const { return tempVec; } - vector<Value*>& getTempValues () { return tempVec; } + const std::vector<Value*>& getTempValues () const { return tempVec; } + std::vector<Value*>& getTempValues () { return tempVec; } void addTempValue (Value* val) { tempVec.push_back(val); } @@ -499,10 +497,10 @@ MachineCodeForVMInstr::~MachineCodeForVMInstr() //--------------------------------------------------------------------------- -class MachineCodeForBasicBlock: public vector<MachineInstr*> { +class MachineCodeForBasicBlock: public std::vector<MachineInstr*> { public: - typedef vector<MachineInstr*>::iterator iterator; - typedef vector<const MachineInstr*>::const_iterator const_iterator; + typedef std::vector<MachineInstr*>::iterator iterator; + typedef std::vector<MachineInstr*>::const_iterator const_iterator; }; @@ -529,8 +527,8 @@ private: unsigned currentOptionalArgsSize; unsigned maxOptionalArgsSize; unsigned currentTmpValuesSize; - hash_set<const Constant*> constantsForConstPool; - hash_map<const Value*, int> offsets; + std::hash_set<const Constant*> constantsForConstPool; + std::hash_map<const Value*, int> offsets; // hash_map<const Value*, int> offsetsFromSP; public: @@ -572,7 +570,7 @@ public: inline unsigned getMaxOptionalArgsSize() const { return maxOptionalArgsSize;} inline unsigned getCurrentOptionalArgsSize() const { return currentOptionalArgsSize;} - inline const hash_set<const Constant*>& + inline const std::hash_set<const Constant*>& getConstantPoolValues() const {return constantsForConstPool;} // @@ -628,10 +626,10 @@ private: //--------------------------------------------------------------------------- -ostream& operator<< (ostream& os, const MachineInstr& minstr); +std::ostream& operator<< (std::ostream& os, const MachineInstr& minstr); -ostream& operator<< (ostream& os, const MachineOperand& mop); +std::ostream& operator<< (std::ostream& os, const MachineOperand& mop); void PrintMachineInstructions(const Method *method); diff --git a/include/llvm/CodeGen/RegClass.h b/include/llvm/CodeGen/RegClass.h index d6cbaf8..fe25986 100644 --- a/include/llvm/CodeGen/RegClass.h +++ b/include/llvm/CodeGen/RegClass.h @@ -13,8 +13,9 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineRegInfo.h" #include <stack> +#include <iostream> -typedef vector<unsigned int> ReservedColorListType; +typedef std::vector<unsigned int> ReservedColorListType; //----------------------------------------------------------------------------- @@ -46,7 +47,7 @@ class RegClass InterferenceGraph IG; // Interference graph - constructed by // buildInterferenceGraph - stack <IGNode *> IGNodeStack; // the stack used for coloring + std::stack<IGNode *> IGNodeStack; // the stack used for coloring const ReservedColorListType *const ReservedColorList; // @@ -117,21 +118,14 @@ class RegClass inline void printIGNodeList() const { - cerr << "IG Nodes for Register Class " << RegClassID << ":" << endl; + std::cerr << "IG Nodes for Register Class " << RegClassID << ":" << "\n"; IG.printIGNodeList(); } inline void printIG() { - cerr << "IG for Register Class " << RegClassID << ":" << endl; + std::cerr << "IG for Register Class " << RegClassID << ":" << "\n"; IG.printIG(); } - }; - - - - - - #endif diff --git a/include/llvm/CodeGen/ValueSet.h b/include/llvm/CodeGen/ValueSet.h index ee6aa15..d17e022 100644 --- a/include/llvm/CodeGen/ValueSet.h +++ b/include/llvm/CodeGen/ValueSet.h @@ -1,4 +1,4 @@ -/* Title: ValueSet.h +/* Title: ValueSet.h -*- C++ -*- Author: Ruchira Sasanka Date: Jun 30, 01 Purpose: Contains a mathematical set of Values. LiveVarSet is derived from @@ -8,24 +8,9 @@ #ifndef VALUE_SET_H #define VALUE_SET_H -#include <stdlib.h> - -#include <hash_set> -#include <algorithm> -//#include <fstream> -#include <iostream> - -#include "llvm/Value.h" - - -//------------------------ Support functions --------------------------------- - -struct hashFuncValue { // sturcture containing the hash func - inline size_t operator () (const Value *const val) const - { return (size_t) val; } -}; - - +class Value; +#include "Support/HashExtras.h" +#include <ext/hash_set> //------------------- Class Definition for ValueSet -------------------------- @@ -33,12 +18,8 @@ void printValue( const Value *const v); // func to print a Value -class ValueSet : public hash_set<const Value *, hashFuncValue > -{ - +class ValueSet : public std::hash_set<const Value *> { public: - ValueSet(); // constructor - inline void add(const Value *const val) { assert( val ); insert(val);} // for adding a live variable to set diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 7ce2fec..1a4ebda 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -36,9 +36,9 @@ protected: void destroyConstantImpl(); public: // Specialize setName to handle symbol table majik... - virtual void setName(const string &name, SymbolTable *ST = 0); + virtual void setName(const std::string &name, SymbolTable *ST = 0); - virtual string getStrValue() const = 0; + virtual std::string getStrValue() const = 0; // Static constructor to get a '0' constant of arbitrary type... static Constant *getNullConstant(const Type *Ty); @@ -78,7 +78,7 @@ public: // inverted - Return the opposite value of the current value. inline ConstantBool *inverted() const { return (this==True) ? False : True; } - virtual string getStrValue() const; + virtual std::string getStrValue() const; inline bool getValue() const { return Val; } // isNullValue - Return true if this is the value that would be returned by @@ -149,7 +149,7 @@ protected: public: static ConstantSInt *get(const Type *Ty, int64_t V); - virtual string getStrValue() const; + virtual std::string getStrValue() const; static bool isValueValidForType(const Type *Ty, int64_t V); inline int64_t getValue() const { return Val.Signed; } @@ -173,7 +173,7 @@ protected: public: static ConstantUInt *get(const Type *Ty, uint64_t V); - virtual string getStrValue() const; + virtual std::string getStrValue() const; static bool isValueValidForType(const Type *Ty, uint64_t V); inline uint64_t getValue() const { return Val.Unsigned; } @@ -199,7 +199,7 @@ protected: public: static ConstantFP *get(const Type *Ty, double V); - virtual string getStrValue() const; + virtual std::string getStrValue() const; static bool isValueValidForType(const Type *Ty, double V); inline double getValue() const { return Val; } @@ -223,20 +223,20 @@ public: class ConstantArray : public Constant { ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT protected: - ConstantArray(const ArrayType *T, const vector<Constant*> &Val); + ConstantArray(const ArrayType *T, const std::vector<Constant*> &Val); ~ConstantArray() {} virtual void destroyConstant(); public: - static ConstantArray *get(const ArrayType *T, const vector<Constant*> &); - static ConstantArray *get(const string &Initializer); + static ConstantArray *get(const ArrayType *T, const std::vector<Constant*> &); + static ConstantArray *get(const std::string &Initializer); - virtual string getStrValue() const; + virtual std::string getStrValue() const; inline const ArrayType *getType() const { return (ArrayType*)Value::getType(); } - inline const vector<Use> &getValues() const { return Operands; } + inline const std::vector<Use> &getValues() const { return Operands; } // isNullValue - Return true if this is the value that would be returned by // getNullConstant. @@ -257,20 +257,20 @@ public: class ConstantStruct : public Constant { ConstantStruct(const ConstantStruct &); // DO NOT IMPLEMENT protected: - ConstantStruct(const StructType *T, const vector<Constant*> &Val); + ConstantStruct(const StructType *T, const std::vector<Constant*> &Val); ~ConstantStruct() {} virtual void destroyConstant(); public: static ConstantStruct *get(const StructType *T, - const vector<Constant*> &V); + const std::vector<Constant*> &V); - virtual string getStrValue() const; + virtual std::string getStrValue() const; inline const StructType *getType() const { return (StructType*)Value::getType(); } - inline const vector<Use> &getValues() const { return Operands; } + inline const std::vector<Use> &getValues() const { return Operands; } // isNullValue - Return true if this is the value that would be returned by // getNullConstant. @@ -297,7 +297,7 @@ protected: inline ConstantPointer(const PointerType *T) : Constant((const Type*)T){} ~ConstantPointer() {} public: - virtual string getStrValue() const = 0; + virtual std::string getStrValue() const = 0; inline const PointerType *getType() const { return (PointerType*)Value::getType(); } @@ -322,7 +322,7 @@ protected: inline ConstantPointerNull(const PointerType *T) : ConstantPointer(T) {} inline ~ConstantPointerNull() {} public: - virtual string getStrValue() const; + virtual std::string getStrValue() const; static ConstantPointerNull *get(const PointerType *T); @@ -359,7 +359,7 @@ protected: public: static ConstantPointerRef *get(GlobalValue *GV); - virtual string getStrValue() const; + virtual std::string getStrValue() const; const GlobalValue *getValue() const { return cast<GlobalValue>(Operands[0].get()); diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index 4e69a8c..10ff57b 100644 --- a/include/llvm/DerivedTypes.h +++ b/include/llvm/DerivedTypes.h @@ -18,7 +18,7 @@ class DerivedType : public Type { // if I am a type, and I get resolved into a more concrete type. // ///// FIXME: kill mutable nonsense when Type's are not const - mutable vector<AbstractTypeUser *> AbstractTypeUsers; + mutable std::vector<AbstractTypeUser *> AbstractTypeUsers; char isRefining; // Used for recursive types @@ -94,7 +94,7 @@ public: class MethodType : public DerivedType { public: - typedef vector<PATypeHandle<Type> > ParamTypes; + typedef std::vector<PATypeHandle<Type> > ParamTypes; private: PATypeHandle<Type> ResultType; ParamTypes ParamTys; @@ -108,7 +108,7 @@ protected: // defines private constructors and has no friends // Private ctor - Only can be created by a static member... - MethodType(const Type *Result, const vector<const Type*> &Params, + MethodType(const Type *Result, const std::vector<const Type*> &Params, bool IsVarArgs); public: @@ -130,7 +130,8 @@ public: // virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy); - static MethodType *get(const Type *Result, const vector<const Type*> &Params, + static MethodType *get(const Type *Result, + const std::vector<const Type*> &Params, bool isVarArg); @@ -180,7 +181,7 @@ public: class StructType : public CompositeType { public: - typedef vector<PATypeHandle<Type> > ElementTypes; + typedef std::vector<PATypeHandle<Type> > ElementTypes; private: ElementTypes ETypes; // Element types of struct @@ -194,7 +195,7 @@ protected: // defines private constructors and has no friends // Private ctor - Only can be created by a static member... - StructType(const vector<const Type*> &Types); + StructType(const std::vector<const Type*> &Types); public: inline const ElementTypes &getElementTypes() const { return ETypes; } @@ -221,7 +222,7 @@ public: // virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy); - static StructType *get(const vector<const Type*> &Params); + static StructType *get(const std::vector<const Type*> &Params); // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const StructType *T) { return true; } diff --git a/include/llvm/Function.h b/include/llvm/Function.h index 9c026cc9..93b9dc6 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -29,8 +29,8 @@ public: // BasicBlock iterators... typedef BasicBlocksType::iterator iterator; typedef BasicBlocksType::const_iterator const_iterator; - typedef reverse_iterator<const_iterator> const_reverse_iterator; - typedef reverse_iterator<iterator> reverse_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + typedef std::reverse_iterator<iterator> reverse_iterator; private: @@ -42,11 +42,11 @@ private: void setParent(Module *parent); public: - Method(const MethodType *Ty, bool isInternal, const string &Name = ""); + Method(const MethodType *Ty, bool isInternal, const std::string &Name = ""); ~Method(); // Specialize setName to handle symbol table majik... - virtual void setName(const string &name, SymbolTable *ST = 0); + virtual void setName(const std::string &name, SymbolTable *ST = 0); const Type *getReturnType() const; // Return the return type of method const MethodType *getMethodType() const; // Return the MethodType for me @@ -129,11 +129,11 @@ public: _BB_i_t BB; // BasicBlocksType::iterator _BI_t BI; // BasicBlock::iterator public: - typedef bidirectional_iterator_tag iterator_category; - typedef IIty value_type; - typedef unsigned difference_type; - typedef BIty pointer; - typedef IIty reference; + typedef std::bidirectional_iterator_tag iterator_category; + typedef IIty value_type; + typedef unsigned difference_type; + typedef BIty pointer; + typedef IIty reference; template<class M> InstIterator(M &m) : BBs(m.getBasicBlocks()), BB(BBs.begin()) { // begin ctor diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index d6a977b..1527940 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -17,7 +17,7 @@ class GlobalValue : public User { GlobalValue(const GlobalValue &); // do not implement protected: GlobalValue(const Type *Ty, ValueTy vty, bool hasInternalLinkage, - const string &name = "") + const std::string &name = "") : User(Ty, vty, name), HasInternalLinkage(hasInternalLinkage), Parent(0) {} bool HasInternalLinkage; // Is this value accessable externally? diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h index f46fa35..9f10f71 100644 --- a/include/llvm/GlobalVariable.h +++ b/include/llvm/GlobalVariable.h @@ -25,11 +25,11 @@ class GlobalVariable : public GlobalValue { bool isConstantGlobal; // Is this a global constant? public: GlobalVariable(const Type *Ty, bool isConstant, bool isInternal, - Constant *Initializer = 0, const string &Name = ""); + Constant *Initializer = 0, const std::string &Name = ""); ~GlobalVariable() {} // Specialize setName to handle symbol table majik... - virtual void setName(const string &name, SymbolTable *ST = 0); + virtual void setName(const std::string &name, SymbolTable *ST = 0); // The initializer for the global variable/constant is held by Operands[0] if // an initializer is specified. diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 3d834e9..4aa612a 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -25,7 +25,7 @@ class TerminatorInst : public Instruction { public: TerminatorInst(Instruction::TermOps iType); TerminatorInst(const Type *Ty, Instruction::TermOps iType, - const string &Name = ""); + const std::string &Name = ""); inline ~TerminatorInst() {} // Terminators must implement the methods required by Instruction... @@ -66,7 +66,7 @@ public: // static UnaryOperator *create(UnaryOps Op, Value *Source); - UnaryOperator(Value *S, UnaryOps iType, const string &Name = "") + UnaryOperator(Value *S, UnaryOps iType, const std::string &Name = "") : Instruction(S->getType(), iType, Name) { Operands.reserve(1); Operands.push_back(Use(S, this)); @@ -105,10 +105,10 @@ public: // and the two operands. // static BinaryOperator *create(BinaryOps Op, Value *S1, Value *S2, - const string &Name = ""); + const std::string &Name = ""); BinaryOperator(BinaryOps iType, Value *S1, Value *S2, - const string &Name = "") + const std::string &Name = "") : Instruction(S1->getType(), iType, Name) { Operands.reserve(2); Operands.push_back(Use(S1, this)); diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index a7407ab..efcecc9 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -25,11 +25,11 @@ class Instruction : public User { protected: unsigned iType; // InstructionType public: - Instruction(const Type *Ty, unsigned iType, const string &Name = ""); + Instruction(const Type *Ty, unsigned iType, const std::string &Name = ""); virtual ~Instruction(); // Virtual dtor == good. // Specialize setName to handle symbol table majik... - virtual void setName(const string &name, SymbolTable *ST = 0); + virtual void setName(const std::string &name, SymbolTable *ST = 0); // clone() - Create a copy of 'this' instruction that is identical in all ways // except the following: diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h index 3650ccb..e74c5d4 100644 --- a/include/llvm/Linker.h +++ b/include/llvm/Linker.h @@ -16,7 +16,7 @@ class Module; // error occurs, true is returned and ErrorMsg (if not null) is set to indicate // the problem. // -bool LinkModules(Module *Dest, const Module *Src, string *ErrorMsg = 0); +bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg = 0); #endif diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 92f137e..617840c 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -26,16 +26,16 @@ public: typedef ValueHolder<Method, Module, Module> MethodListType; // Global Variable iterators... - typedef GlobalListType::iterator giterator; - typedef GlobalListType::const_iterator const_giterator; - typedef reverse_iterator<giterator> reverse_giterator; - typedef reverse_iterator<const_giterator> const_reverse_giterator; + typedef GlobalListType::iterator giterator; + typedef GlobalListType::const_iterator const_giterator; + typedef std::reverse_iterator<giterator> reverse_giterator; + typedef std::reverse_iterator<const_giterator> const_reverse_giterator; // Method iterators... - typedef MethodListType::iterator iterator; - typedef MethodListType::const_iterator const_iterator; - typedef reverse_iterator<const_iterator> const_reverse_iterator; - typedef reverse_iterator<iterator> reverse_iterator; + typedef MethodListType::iterator iterator; + typedef MethodListType::const_iterator const_iterator; + typedef std::reverse_iterator<iterator> reverse_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; private: GlobalListType GlobalList; // The Global Variables diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index e357df0..c000927 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -45,7 +45,7 @@ struct Pass { // // runAllPasses - Run a bunch of passes on the specified module, efficiently. - static bool runAllPasses(Module *M, vector<Pass*> &Passes) { + static bool runAllPasses(Module *M, std::vector<Pass*> &Passes) { bool MadeChanges = false; // Run all of the pass initializers for (unsigned i = 0; i < Passes.size(); ++i) @@ -65,7 +65,7 @@ struct Pass { // runAllPassesAndFree - Run a bunch of passes on the specified module, // efficiently. When done, delete all of the passes. // - static bool runAllPassesAndFree(Module *M, vector<Pass*> &Passes) { + static bool runAllPassesAndFree(Module *M, std::vector<Pass*> &Passes) { // First run all of the passes bool MadeChanges = runAllPasses(M, Passes); diff --git a/include/llvm/SlotCalculator.h b/include/llvm/SlotCalculator.h index c7b3149..9528244 100644 --- a/include/llvm/SlotCalculator.h +++ b/include/llvm/SlotCalculator.h @@ -23,14 +23,14 @@ class SlotCalculator { const Module *TheModule; bool IgnoreNamedNodes; // Shall we not count named nodes? - typedef vector<const Value*> TypePlane; - vector<TypePlane> Table; - map<const Value *, unsigned> NodeMap; + typedef std::vector<const Value*> TypePlane; + std::vector<TypePlane> Table; + std::map<const Value *, unsigned> NodeMap; // ModuleLevel - Used to keep track of which values belong to the module, // and which values belong to the currently incorporated method. // - vector<unsigned> ModuleLevel; + std::vector<unsigned> ModuleLevel; public: SlotCalculator(const Module *M, bool IgnoreNamed); diff --git a/include/llvm/Support/Annotation.h b/include/llvm/Support/Annotation.h index 9919732..c0642e1 100644 --- a/include/llvm/Support/Annotation.h +++ b/include/llvm/Support/Annotation.h @@ -166,12 +166,13 @@ struct AnnotationManager { //===--------------------------------------------------------------------===// // Basic ID <-> Name map functionality - static AnnotationID getID (const string &Name); // Name -> ID - static const string &getName(AnnotationID ID); // ID -> Name + static AnnotationID getID(const std::string &Name); // Name -> ID + static const std::string &getName(AnnotationID ID); // ID -> Name // getID - Name -> ID + registration of a factory function for demand driven // annotation support. - static AnnotationID getID (const string &Name, Factory Fact, void *Data=0); + static AnnotationID getID(const std::string &Name, Factory Fact, + void *Data = 0); //===--------------------------------------------------------------------===// // Annotation creation on demand support... diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 84a3bc9..3c0ac1a 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -100,7 +100,7 @@ class Option { // an argument. Should return true if there was an error processing the // argument and the program should exit. // - virtual bool handleOccurance(const char *ArgName, const string &Arg) = 0; + virtual bool handleOccurance(const char *ArgName, const std::string &Arg) = 0; virtual enum NumOccurances getNumOccurancesFlagDefault() const { return Optional; @@ -146,10 +146,10 @@ public: // addOccurance - Wrapper around handleOccurance that enforces Flags // - bool addOccurance(const char *ArgName, const string &Value); + bool addOccurance(const char *ArgName, const std::string &Value); // Prints option name followed by message. Always returns true. - bool error(string Message, const char *ArgName = 0); + bool error(std::string Message, const char *ArgName = 0); public: inline int getNumOccurances() const { return NumOccurances; } @@ -162,7 +162,7 @@ public: // class Alias : public Option { Option &AliasFor; - virtual bool handleOccurance(const char *ArgName, const string &Arg) { + virtual bool handleOccurance(const char *ArgName, const std::string &Arg) { return AliasFor.handleOccurance(AliasFor.ArgStr, Arg); } virtual enum OptionHidden getOptionHiddenFlagDefault() const {return Hidden;} @@ -177,7 +177,7 @@ public: // class Flag : public Option { bool Value; - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); public: inline Flag(const char *ArgStr, const char *Message, int Flags = 0, bool DefaultVal = 0) : Option(ArgStr, Message, Flags), @@ -193,7 +193,7 @@ public: // class Int : public Option { int Value; - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); virtual enum ValueExpected getValueExpectedFlagDefault() const { return ValueRequired; } @@ -209,18 +209,18 @@ public: //===----------------------------------------------------------------------===// // String valued command line option // -class String : public Option, public string { - virtual bool handleOccurance(const char *ArgName, const string &Arg); +class String : public Option, public std::string { + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); virtual enum ValueExpected getValueExpectedFlagDefault() const { return ValueRequired; } public: inline String(const char *ArgStr, const char *Help, int Flags = 0, const char *DefaultVal = "") - : Option(ArgStr, Help, Flags), string(DefaultVal) {} + : Option(ArgStr, Help, Flags), std::string(DefaultVal) {} - inline const string &operator=(const string &Val) { - return string::operator=(Val); + inline const std::string &operator=(const std::string &Val) { + return std::string::operator=(Val); } }; @@ -228,7 +228,7 @@ public: //===----------------------------------------------------------------------===// // String list command line option // -class StringList : public Option, public vector<string> { +class StringList : public Option, public std::vector<std::string> { virtual enum NumOccurances getNumOccurancesFlagDefault() const { return ZeroOrMore; @@ -236,7 +236,7 @@ class StringList : public Option, public vector<string> { virtual enum ValueExpected getValueExpectedFlagDefault() const { return ValueRequired; } - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); public: inline StringList(const char *ArgStr, const char *Help, int Flags = 0) @@ -256,7 +256,7 @@ protected: // Use a vector instead of a map, because the lists should be short, // the overhead is less, and most importantly, it keeps them in the order // inserted so we can print our option out nicely. - vector<pair<const char *, pair<int, const char *> > > ValueMap; + std::vector<std::pair<const char *, std::pair<int, const char *> > > ValueMap; inline EnumBase(const char *ArgStr, const char *Help, int Flags) : Option(ArgStr, Help, Flags) {} @@ -284,7 +284,7 @@ protected: inline EnumValueBase(int Flags) : EnumBase(Flags) {} // handleOccurance - Set Value to the enum value specified by Arg - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); // Return the width of the option tag for printing... virtual unsigned getOptionWidth() const; @@ -323,7 +323,7 @@ class EnumFlagsBase : public EnumValueBase { return ValueDisallowed; } protected: - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); inline EnumFlagsBase(int Flags) : EnumValueBase(Flags) {} // Return the width of the option tag for printing... @@ -363,11 +363,11 @@ class EnumListBase : public EnumBase { return ValueDisallowed; } protected: - vector<int> Values; // The options specified so far. + std::vector<int> Values; // The options specified so far. inline EnumListBase(int Flags) : EnumBase(Flags) {} - virtual bool handleOccurance(const char *ArgName, const string &Arg); + virtual bool handleOccurance(const char *ArgName, const std::string &Arg); // Return the width of the option tag for printing... virtual unsigned getOptionWidth() const; diff --git a/include/llvm/Support/Linker.h b/include/llvm/Support/Linker.h index 3650ccb..e74c5d4 100644 --- a/include/llvm/Support/Linker.h +++ b/include/llvm/Support/Linker.h @@ -16,7 +16,7 @@ class Module; // error occurs, true is returned and ErrorMsg (if not null) is set to indicate // the problem. // -bool LinkModules(Module *Dest, const Module *Src, string *ErrorMsg = 0); +bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg = 0); #endif diff --git a/include/llvm/Support/NameMangling.h b/include/llvm/Support/NameMangling.h index 67e68c7..8d33dcc 100644 --- a/include/llvm/Support/NameMangling.h +++ b/include/llvm/Support/NameMangling.h @@ -14,14 +14,14 @@ class Value; // MangleTypeName - Implement a consistent name-mangling scheme for // a given type. // -string MangleTypeName(const Type *type); +std::string MangleTypeName(const Type *type); // MangleName - implement a consistent name-mangling scheme for all // externally visible (i.e., global) objects. // // privateName should be unique within the module. // -string MangleName(const string &privateName, const Value *V); +std::string MangleName(const std::string &privateName, const Value *V); #endif diff --git a/include/llvm/SymbolTable.h b/include/llvm/SymbolTable.h index 2436311..e425e88 100644 --- a/include/llvm/SymbolTable.h +++ b/include/llvm/SymbolTable.h @@ -27,10 +27,11 @@ class Type; class SymbolTable : public AbstractTypeUser, - public map<const Type *, map<const string, Value *> > { + public std::map<const Type *, + std::map<const std::string, Value *> > { public: - typedef map<const string, Value *> VarMap; - typedef map<const Type *, VarMap> super; + typedef std::map<const std::string, Value *> VarMap; + typedef std::map<const Type *, VarMap> super; private: SymbolTable *ParentSymTab; @@ -51,7 +52,7 @@ public: SymbolTable *getParentSymTab() { return ParentSymTab; } // lookup - Returns null on failure... - Value *lookup(const Type *Ty, const string &name); + Value *lookup(const Type *Ty, const std::string &name); // insert - Add named definition to the symbol table... inline void insert(Value *N) { @@ -63,7 +64,7 @@ public: // name... There can be a many to one mapping between names and // (constant/type)s. // - inline void insert(const string &Name, Value *V) { + inline void insert(const std::string &Name, Value *V) { assert((isa<Type>(V) || isa<Constant>(V)) && "Can only insert types and constants here!"); insertEntry(Name, V->getType(), V); @@ -78,7 +79,7 @@ public: // it (or derived from it) that does not already occur in the symbol table for // the specified type. // - string getUniqueName(const Type *Ty, const string &BaseName); + std::string getUniqueName(const Type *Ty, const std::string &BaseName); inline unsigned type_size(const Type *TypeID) const { return find(TypeID)->second.size(); @@ -121,7 +122,7 @@ private: // insertEntry - Insert a value into the symbol table with the specified // name... // - void insertEntry(const string &Name, const Type *Ty, Value *V); + void insertEntry(const std::string &Name, const Type *Ty, Value *V); // removeEntry - Remove a value from the symbol table... // diff --git a/include/llvm/Target/MachineInstrInfo.h b/include/llvm/Target/MachineInstrInfo.h index 6b1804f..e2489f4 100644 --- a/include/llvm/Target/MachineInstrInfo.h +++ b/include/llvm/Target/MachineInstrInfo.h @@ -59,11 +59,11 @@ const unsigned int M_PSEUDO_FLAG = 1 << 14; struct MachineInstrDescriptor { - string opCodeString; // Assembly language mnemonic for the opcode. - int numOperands; // Number of args; -1 if variable #args - int resultPos; // Position of the result; -1 if no result + std::string opCodeString; // Assembly language mnemonic for the opcode. + int numOperands; // Number of args; -1 if variable #args + int resultPos; // Position of the result; -1 if no result unsigned int maxImmedConst; // Largest +ve constant in IMMMED field or 0. - bool immedIsSignExtended; // Is IMMED field sign-extended? If so, + bool immedIsSignExtended; // Is IMMED field sign-extended? If so, // smallest -ve value is -(maxImmedConst+1). unsigned int numDelaySlots; // Number of delay slots after instruction unsigned int latency; // Latency in machine cycles @@ -246,8 +246,8 @@ public: // virtual void CreateCodeToLoadConst(Value* val, Instruction* dest, - vector<MachineInstr*>& minstrVec, - vector<TmpInstruction*>& temps) const =0; + std::vector<MachineInstr*>& minstrVec, + std::vector<TmpInstruction*> &) const = 0; // Create an instruction sequence to copy an integer value `val' // to a floating point value `dest' by copying to memory and back. @@ -258,8 +258,8 @@ public: virtual void CreateCodeToCopyIntToFloat(Method* method, Value* val, Instruction* dest, - vector<MachineInstr*>& minstrVec, - vector<TmpInstruction*>& tempVec, + std::vector<MachineInstr*>& minstVec, + std::vector<TmpInstruction*>& tmpVec, TargetMachine& target) const = 0; // Similarly, create an instruction sequence to copy an FP value @@ -269,8 +269,8 @@ public: virtual void CreateCodeToCopyFloatToInt(Method* method, Value* val, Instruction* dest, - vector<MachineInstr*>& minstrVec, - vector<TmpInstruction*>& tempVec, + std::vector<MachineInstr*>& minstVec, + std::vector<TmpInstruction*>& tmpVec, TargetMachine& target) const = 0; @@ -279,10 +279,7 @@ public: CreateCopyInstructionsByType(const TargetMachine& target, Value* src, Instruction* dest, - vector<MachineInstr*>& minstrVec) const = 0; - - - + std::vector<MachineInstr*>& minstrVec) const = 0; }; #endif diff --git a/include/llvm/Target/TargetCacheInfo.h b/include/llvm/Target/TargetCacheInfo.h index 21436d0..34194ec 100644 --- a/include/llvm/Target/TargetCacheInfo.h +++ b/include/llvm/Target/TargetCacheInfo.h @@ -28,9 +28,9 @@ public: protected: unsigned int numLevels; - vector<unsigned short> cacheLineSizes; - vector<unsigned int> cacheSizes; - vector<unsigned short> cacheAssoc; + std::vector<unsigned short> cacheLineSizes; + std::vector<unsigned int> cacheSizes; + std::vector<unsigned short> cacheAssoc; public: /*ctor*/ MachineCacheInfo (const TargetMachine& tgt); diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index edd6b26..2bce5f40 100644 --- a/include/llvm/Target/TargetData.h +++ b/include/llvm/Target/TargetData.h @@ -31,7 +31,7 @@ class TargetData { static Annotation *TypeAnFactory(AnnotationID, const Annotable *, void *); public: - TargetData(const string &TargetName, unsigned char PtrSize = 8, + TargetData(const std::string &TargetName, unsigned char PtrSize = 8, unsigned char PtrAl = 8, unsigned char DoubleAl = 8, unsigned char FloatAl = 4, unsigned char LongAl = 8, unsigned char IntAl = 4, unsigned char ShortAl = 2, @@ -61,7 +61,7 @@ public: // stores that include the implicit form of getelementptr. // unsigned getIndexedOffset(const Type *Ty, - const vector<Value*> &Indices) const; + const std::vector<Value*> &Indices) const; inline const StructLayout *getStructLayout(const StructType *Ty) const { return (const StructLayout*)((const Type*)Ty)->getOrCreateAnnotation(AID); @@ -73,7 +73,7 @@ public: // TargetData structure. // struct StructLayout : public Annotation { - vector<unsigned> MemberOffsets; + std::vector<unsigned> MemberOffsets; unsigned StructSize; unsigned StructAlignment; private: diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h index 6b1804f..e2489f4 100644 --- a/include/llvm/Target/TargetInstrInfo.h +++ b/include/llvm/Target/TargetInstrInfo.h @@ -59,11 +59,11 @@ const unsigned int M_PSEUDO_FLAG = 1 << 14; struct MachineInstrDescriptor { - string opCodeString; // Assembly language mnemonic for the opcode. - int numOperands; // Number of args; -1 if variable #args - int resultPos; // Position of the result; -1 if no result + std::string opCodeString; // Assembly language mnemonic for the opcode. + int numOperands; // Number of args; -1 if variable #args + int resultPos; // Position of the result; -1 if no result unsigned int maxImmedConst; // Largest +ve constant in IMMMED field or 0. - bool immedIsSignExtended; // Is IMMED field sign-extended? If so, + bool immedIsSignExtended; // Is IMMED field sign-extended? If so, // smallest -ve value is -(maxImmedConst+1). unsigned int numDelaySlots; // Number of delay slots after instruction unsigned int latency; // Latency in machine cycles @@ -246,8 +246,8 @@ public: // virtual void CreateCodeToLoadConst(Value* val, Instruction* dest, - vector<MachineInstr*>& minstrVec, - vector<TmpInstruction*>& temps) const =0; + std::vector<MachineInstr*>& minstrVec, + std::vector<TmpInstruction*> &) const = 0; // Create an instruction sequence to copy an integer value `val' // to a floating point value `dest' by copying to memory and back. @@ -258,8 +258,8 @@ public: virtual void CreateCodeToCopyIntToFloat(Method* method, Value* val, Instruction* dest, - vector<MachineInstr*>& minstrVec, - vector<TmpInstruction*>& tempVec, + std::vector<MachineInstr*>& minstVec, + std::vector<TmpInstruction*>& tmpVec, TargetMachine& target) const = 0; // Similarly, create an instruction sequence to copy an FP value @@ -269,8 +269,8 @@ public: virtual void CreateCodeToCopyFloatToInt(Method* method, Value* val, Instruction* dest, - vector<MachineInstr*>& minstrVec, - vector<TmpInstruction*>& tempVec, + std::vector<MachineInstr*>& minstVec, + std::vector<TmpInstruction*>& tmpVec, TargetMachine& target) const = 0; @@ -279,10 +279,7 @@ public: CreateCopyInstructionsByType(const TargetMachine& target, Value* src, Instruction* dest, - vector<MachineInstr*>& minstrVec) const = 0; - - - + std::vector<MachineInstr*>& minstrVec) const = 0; }; #endif diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index ad1f105..6effeed 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -38,14 +38,14 @@ typedef int OpCodeMask; class TargetMachine : public NonCopyableV { public: - const string TargetName; + const std::string TargetName; const TargetData DataLayout; // Calculates type size & alignment int optSizeForSubWordData; int minMemOpWordSize; int maxAtomicMemOpWordSize; protected: - TargetMachine(const string &targetname, // Can only create subclasses... + TargetMachine(const std::string &targetname, // Can only create subclasses... unsigned char PtrSize = 8, unsigned char PtrAl = 8, unsigned char DoubleAl = 8, unsigned char FloatAl = 4, unsigned char LongAl = 8, unsigned char IntAl = 4, @@ -86,7 +86,7 @@ public: // method. The specified method must have been compiled before this may be // used. // - virtual void emitAssembly(const Module *M, ostream &OutStr) const = 0; + virtual void emitAssembly(const Module *M, std::ostream &OutStr) const = 0; }; #endif diff --git a/include/llvm/Target/TargetRegInfo.h b/include/llvm/Target/TargetRegInfo.h index ae083c9..b2fa048 100644 --- a/include/llvm/Target/TargetRegInfo.h +++ b/include/llvm/Target/TargetRegInfo.h @@ -9,7 +9,7 @@ #define LLVM_TARGET_MACHINEREGINFO_H #include "Support/NonCopyable.h" -#include <hash_map> +#include <ext/hash_map> #include <string> class TargetMachine; @@ -76,11 +76,11 @@ public: -typedef hash_map<const MachineInstr *, AddedInstrns *> AddedInstrMapType; +typedef std::hash_map<const MachineInstr *, AddedInstrns *> AddedInstrMapType; // A vector of all machine register classes // -typedef vector<const MachineRegClassInfo *> MachineRegClassArrayType; +typedef std::vector<const MachineRegClassInfo *> MachineRegClassArrayType; class MachineRegInfo : public NonCopyableV { @@ -128,7 +128,7 @@ public: LiveRangeInfo & LRI) const = 0; virtual void suggestRegs4CallArgs(const MachineInstr *const CallI, - LiveRangeInfo& LRI, vector<RegClass *> RCL) const = 0; + LiveRangeInfo& LRI, std::vector<RegClass *> RCL) const = 0; virtual void suggestReg4RetValue(const MachineInstr *const RetI, LiveRangeInfo& LRI) const = 0; @@ -186,7 +186,7 @@ public: // virtual int getUnifiedRegNum(int RegClassID, int reg) const = 0; - virtual const string getUnifiedRegName(int UnifiedRegNum) const = 0; + virtual const std::string getUnifiedRegName(int UnifiedRegNum) const = 0; // Gives the type of a register based on the type of the LR diff --git a/include/llvm/Target/TargetSchedInfo.h b/include/llvm/Target/TargetSchedInfo.h index 356c785..e8908c5 100644 --- a/include/llvm/Target/TargetSchedInfo.h +++ b/include/llvm/Target/TargetSchedInfo.h @@ -8,10 +8,10 @@ #define LLVM_TARGET_MACHINESCHEDINFO_H #include "llvm/Target/MachineInstrInfo.h" -#include <hash_map> +#include <ext/hash_map> typedef long long cycles_t; -const cycles_t HUGE_LATENCY = ~((unsigned long long) 1 << sizeof(cycles_t)-1); +const cycles_t HUGE_LATENCY = ~((unsigned long long) 1 << sizeof(cycles_t)-2); const cycles_t INVALID_LATENCY = -HUGE_LATENCY; static const unsigned MAX_OPCODE_SIZE = 16; @@ -28,13 +28,13 @@ private: OpCodePair(); // disable for now }; - +namespace std { template <> struct hash<OpCodePair> { size_t operator()(const OpCodePair& pair) const { return hash<long>()(pair.val); } }; - +} //--------------------------------------------------------------------------- // class MachineResource @@ -50,10 +50,10 @@ typedef unsigned int resourceId_t; class MachineResource { public: - const string rname; + const std::string rname; resourceId_t rid; - /*ctor*/ MachineResource(const string& resourceName) + /*ctor*/ MachineResource(const std::string& resourceName) : rname(resourceName), rid(nextId++) {} private: @@ -66,7 +66,7 @@ class CPUResource : public MachineResource { public: int maxNumUsers; // MAXINT if no restriction - /*ctor*/ CPUResource(const string& rname, int maxUsers) + /*ctor*/ CPUResource(const std::string& rname, int maxUsers) : MachineResource(rname), maxNumUsers(maxUsers) {} }; @@ -147,11 +147,11 @@ struct InstrRUsage { cycles_t numBubbles; // Feasible slots to use for this instruction. - vector<bool> feasibleSlots; + std::vector<bool> feasibleSlots; // Resource usages for this instruction, with one resource vector per cycle. cycles_t numCycles; - vector<vector<resourceId_t> > resourcesByCycle; + std::vector<std::vector<resourceId_t> > resourcesByCycle; private: // Conveniences for initializing this structure @@ -243,7 +243,7 @@ InstrRUsage::addUsageDelta(const InstrRUsageDelta& delta) // resize the resources vector if more cycles are specified unsigned maxCycles = this->numCycles; - maxCycles = max(maxCycles, delta.startCycle + abs(NC) - 1); + maxCycles = std::max(maxCycles, delta.startCycle + abs(NC) - 1); if (maxCycles > this->numCycles) { this->resourcesByCycle.resize(maxCycles); @@ -259,7 +259,7 @@ InstrRUsage::addUsageDelta(const InstrRUsageDelta& delta) { // Look for the resource backwards so we remove the last entry // for that resource in each cycle. - vector<resourceId_t>& rvec = this->resourcesByCycle[c]; + std::vector<resourceId_t>& rvec = this->resourcesByCycle[c]; int r; for (r = (int) rvec.size(); r >= 0; r--) if (rvec[r] == delta.resourceId) @@ -349,14 +349,14 @@ public: inline int getMinIssueGap (MachineOpCode fromOp, MachineOpCode toOp) const { - hash_map<OpCodePair,int>::const_iterator + std::hash_map<OpCodePair,int>::const_iterator I = issueGaps.find(OpCodePair(fromOp, toOp)); return (I == issueGaps.end())? 0 : (*I).second; } - inline const vector<MachineOpCode>* + inline const std::vector<MachineOpCode>* getConflictList(MachineOpCode opCode) const { - hash_map<MachineOpCode,vector<MachineOpCode> >::const_iterator + std::hash_map<MachineOpCode, std::vector<MachineOpCode> >::const_iterator I = conflictLists.find(opCode); return (I == conflictLists.end())? NULL : & (*I).second; } @@ -377,22 +377,22 @@ protected: virtual void initializeResources (); private: - void computeInstrResources(const vector<InstrRUsage>& instrRUForClasses); - void computeIssueGaps(const vector<InstrRUsage>& instrRUForClasses); + void computeInstrResources(const std::vector<InstrRUsage>& instrRUForClasses); + void computeIssueGaps(const std::vector<InstrRUsage>& instrRUForClasses); protected: int numSchedClasses; const MachineInstrInfo* mii; - const InstrClassRUsage* classRUsages; // raw array by sclass - const InstrRUsageDelta* usageDeltas; // raw array [1:numUsageDeltas] - const InstrIssueDelta* issueDeltas; // raw array [1:numIssueDeltas] + const InstrClassRUsage* classRUsages; // raw array by sclass + const InstrRUsageDelta* usageDeltas; // raw array [1:numUsageDeltas] + const InstrIssueDelta* issueDeltas; // raw array [1:numIssueDeltas] unsigned int numUsageDeltas; unsigned int numIssueDeltas; - vector<InstrRUsage> instrRUsages; // indexed by opcode - hash_map<OpCodePair,int> issueGaps; // indexed by opcode pair - hash_map<MachineOpCode,vector<MachineOpCode> > - conflictLists; // indexed by opcode + std::vector<InstrRUsage> instrRUsages; // indexed by opcode + std::hash_map<OpCodePair,int> issueGaps; // indexed by opcode pair + std::hash_map<MachineOpCode, std::vector<MachineOpCode> > + conflictLists; // indexed by opcode }; #endif diff --git a/include/llvm/Transforms/IPO/ConstantMerge.h b/include/llvm/Transforms/IPO/ConstantMerge.h index 6eed771..37d830c 100644 --- a/include/llvm/Transforms/IPO/ConstantMerge.h +++ b/include/llvm/Transforms/IPO/ConstantMerge.h @@ -24,7 +24,7 @@ class GlobalVariable; class ConstantMerge : public Pass { protected: - map<Constant*, GlobalVariable*> Constants; + std::map<Constant*, GlobalVariable*> Constants; unsigned LastConstantSeen; public: inline ConstantMerge() : LastConstantSeen(0) {} diff --git a/include/llvm/Transforms/MutateStructTypes.h b/include/llvm/Transforms/MutateStructTypes.h index b2d4b30..23bf71c 100644 --- a/include/llvm/Transforms/MutateStructTypes.h +++ b/include/llvm/Transforms/MutateStructTypes.h @@ -28,19 +28,19 @@ class MutateStructTypes : public Pass { // incoming slot [or negative if the specified incoming slot should be // removed]. // - typedef pair<const StructType*, vector<int> > TransformType; + typedef std::pair<const StructType*, std::vector<int> > TransformType; // Transforms to do for each structure type... - map<const StructType*, TransformType> Transforms; + std::map<const StructType*, TransformType> Transforms; // Mapping of old type to new types... - map<const Type *, PATypeHolder<Type> > TypeMap; + std::map<const Type *, PATypeHolder<Type> > TypeMap; // Mapping from global value of old type, to a global value of the new type... - map<const GlobalValue*, GlobalValue*> GlobalMap; + std::map<const GlobalValue*, GlobalValue*> GlobalMap; // Mapping from intra method value to intra method value - map<const Value*, Value*> LocalValueMap; + std::map<const Value*, Value*> LocalValueMap; public: // Ctor - Take a map that specifies what transformation to do for each field @@ -49,7 +49,7 @@ public: // the destination structure the field should end up in. A negative value // indicates that the field should be deleted entirely. // - typedef map<const StructType*, vector<int> > TransformsType; + typedef std::map<const StructType*, std::vector<int> > TransformsType; MutateStructTypes(const TransformsType &Transforms); @@ -83,7 +83,7 @@ private: // AdjustIndices - Convert the indexes specifed by Idx to the new changed form // using the specified OldTy as the base type being indexed into. // - void AdjustIndices(const CompositeType *OldTy, vector<Value*> &Idx, + void AdjustIndices(const CompositeType *OldTy, std::vector<Value*> &Idx, unsigned idx = 0); }; diff --git a/include/llvm/Transforms/Utils/Linker.h b/include/llvm/Transforms/Utils/Linker.h index 3650ccb..e74c5d4 100644 --- a/include/llvm/Transforms/Utils/Linker.h +++ b/include/llvm/Transforms/Utils/Linker.h @@ -16,7 +16,7 @@ class Module; // error occurs, true is returned and ErrorMsg (if not null) is set to indicate // the problem. // -bool LinkModules(Module *Dest, const Module *Src, string *ErrorMsg = 0); +bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg = 0); #endif diff --git a/include/llvm/Type.h b/include/llvm/Type.h index 3617aae..1bbe023 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -71,23 +71,23 @@ public: private: PrimitiveID ID; // The current base type of this type... unsigned UID; // The unique ID number for this class - string Desc; // The printed name of the string... + std::string Desc; // The printed name of the string... bool Abstract; // True if type contains an OpaqueType bool Recursive; // True if the type is recursive protected: // ctor is protected, so only subclasses can create Type objects... - Type(const string &Name, PrimitiveID id); + Type(const std::string &Name, PrimitiveID id); virtual ~Type() {} // When types are refined, they update their description to be more concrete. // - inline void setDescription(const string &D) { Desc = D; } + inline void setDescription(const std::string &D) { Desc = D; } // setName - Associate the name with this type in the symbol table, but don't // set the local name to be equal specified name. // - virtual void setName(const string &Name, SymbolTable *ST = 0); + virtual void setName(const std::string &Name, SymbolTable *ST = 0); // Types can become nonabstract later, if they are refined. // @@ -116,7 +116,7 @@ public: inline unsigned getUniqueID() const { return UID; } // getDescription - Return the string representation of the type... - inline const string &getDescription() const { return Desc; } + inline const std::string &getDescription() const { return Desc; } // isSigned - Return whether a numeric type is signed. virtual bool isSigned() const { return 0; } diff --git a/include/llvm/User.h b/include/llvm/User.h index 2ea3a43..007db5f 100644 --- a/include/llvm/User.h +++ b/include/llvm/User.h @@ -17,9 +17,9 @@ class User : public Value { User(const User &); // Do not implement protected: - vector<Use> Operands; + std::vector<Use> Operands; public: - User(const Type *Ty, ValueTy vty, const string &name = ""); + User(const Type *Ty, ValueTy vty, const std::string &name = ""); virtual ~User() { dropAllReferences(); } inline Value *getOperand(unsigned i) { @@ -39,8 +39,8 @@ public: // --------------------------------------------------------------------------- // Operand Iterator interface... // - typedef vector<Use>::iterator op_iterator; - typedef vector<Use>::const_iterator const_op_iterator; + typedef std::vector<Use>::iterator op_iterator; + typedef std::vector<Use>::const_iterator const_op_iterator; inline op_iterator op_begin() { return Operands.begin(); } inline const_op_iterator op_begin() const { return Operands.begin(); } diff --git a/include/llvm/Value.h b/include/llvm/Value.h index 8a0014c..1983970 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -49,8 +49,8 @@ public: }; private: - vector<User *> Uses; - string Name; + std::vector<User *> Uses; + std::string Name; PATypeHandle<Type> Ty; ValueTy VTy; @@ -58,7 +58,7 @@ private: protected: inline void setType(const Type *ty) { Ty = ty; } public: - Value(const Type *Ty, ValueTy vty, const string &name = ""); + Value(const Type *Ty, ValueTy vty, const std::string &name = ""); virtual ~Value(); // Support for debugging @@ -68,10 +68,10 @@ public: inline const Type *getType() const { return Ty; } // All values can potentially be named... - inline bool hasName() const { return Name != ""; } - inline const string &getName() const { return Name; } + inline bool hasName() const { return Name != ""; } + inline const std::string &getName() const { return Name; } - virtual void setName(const string &name, SymbolTable * = 0) { + virtual void setName(const std::string &name, SymbolTable * = 0) { Name = name; } @@ -101,8 +101,8 @@ public: //---------------------------------------------------------------------- // Methods for handling the vector of uses of this Value. // - typedef vector<User*>::iterator use_iterator; - typedef vector<User*>::const_iterator use_const_iterator; + typedef std::vector<User*>::iterator use_iterator; + typedef std::vector<User*>::const_iterator use_const_iterator; inline unsigned use_size() const { return Uses.size(); } inline bool use_empty() const { return Uses.empty(); } diff --git a/include/llvm/ValueHolder.h b/include/llvm/ValueHolder.h index ef4ed19..b75d243 100644 --- a/include/llvm/ValueHolder.h +++ b/include/llvm/ValueHolder.h @@ -25,7 +25,7 @@ // template<class ValueSubclass, class ItemParentType, class SymTabType> class ValueHolder { - vector<ValueSubclass*> ValueList; + std::vector<ValueSubclass*> ValueList; ItemParentType *ItemParent; SymTabType *Parent; @@ -66,10 +66,10 @@ public: // sub-Definition iterator code //===--------------------------------------------------------------------===// // - typedef vector<ValueSubclass*>::iterator iterator; - typedef vector<ValueSubclass*>::const_iterator const_iterator; - typedef reverse_iterator<const_iterator> const_reverse_iterator; - typedef reverse_iterator<iterator> reverse_iterator; + typedef std::vector<ValueSubclass*>::iterator iterator; + typedef std::vector<ValueSubclass*>::const_iterator const_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + typedef std::reverse_iterator<iterator> reverse_iterator; inline iterator begin() { return ValueList.begin(); } inline const_iterator begin() const { return ValueList.begin(); } diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h index bf384a6..13b1400 100644 --- a/include/llvm/iMemory.h +++ b/include/llvm/iMemory.h @@ -21,7 +21,7 @@ class AllocationInst : public Instruction { public: AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, - const string &Name = "") + const std::string &Name = "") : Instruction(Ty, iTy, Name) { assert(Ty->isPointerType() && "Can't allocate a non pointer type!"); @@ -67,7 +67,7 @@ public: class MallocInst : public AllocationInst { public: - MallocInst(const Type *Ty, Value *ArraySize = 0, const string &Name = "") + MallocInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "") : AllocationInst(Ty, ArraySize, Malloc, Name) {} virtual Instruction *clone() const { @@ -94,7 +94,7 @@ public: class AllocaInst : public AllocationInst { public: - AllocaInst(const Type *Ty, Value *ArraySize = 0, const string &Name = "") + AllocaInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "") : AllocationInst(Ty, ArraySize, Alloca, Name) {} virtual Instruction *clone() const { @@ -154,7 +154,7 @@ public: class MemAccessInst : public Instruction { protected: inline MemAccessInst(const Type *Ty, unsigned Opcode, - const string &Nam = "") + const std::string &Nam = "") : Instruction(Ty, Opcode, Nam) {} public: // getIndexedType - Returns the type of the element that would be loaded with @@ -164,7 +164,7 @@ public: // pointer type. // static const Type *getIndexedType(const Type *Ptr, - const vector<Value*> &Indices, + const std::vector<Value*> &Indices, bool AllowStructLeaf = false); inline op_iterator idx_begin() { @@ -177,8 +177,8 @@ public: inline const_op_iterator idx_end() const { return op_end(); } - vector<Value*> copyIndices() const { - return vector<Value*>(idx_begin(), idx_end()); + std::vector<Value*> copyIndices() const { + return std::vector<Value*>(idx_begin(), idx_end()); } Value *getPointerOperand() { @@ -217,8 +217,8 @@ class LoadInst : public MemAccessInst { Operands.push_back(Use(LI.Operands[i], this)); } public: - LoadInst(Value *Ptr, const vector<Value*> &Idx, const string &Name = ""); - LoadInst(Value *Ptr, const string &Name = ""); + LoadInst(Value *Ptr, const std::vector<Value*> &Ix, const std::string & = ""); + LoadInst(Value *Ptr, const std::string &Name = ""); virtual Instruction *clone() const { return new LoadInst(*this); } virtual const char *getOpcodeName() const { return "load"; } @@ -247,9 +247,9 @@ class StoreInst : public MemAccessInst { Operands.push_back(Use(SI.Operands[i], this)); } public: - StoreInst(Value *Val, Value *Ptr, const vector<Value*> &Idx, - const string &Name = ""); - StoreInst(Value *Val, Value *Ptr, const string &Name = ""); + StoreInst(Value *Val, Value *Ptr, const std::vector<Value*> &Idx, + const std::string &Name = ""); + StoreInst(Value *Val, Value *Ptr, const std::string &Name = ""); virtual Instruction *clone() const { return new StoreInst(*this); } virtual const char *getOpcodeName() const { return "store"; } @@ -280,8 +280,8 @@ class GetElementPtrInst : public MemAccessInst { Operands.push_back(Use(EPI.Operands[i], this)); } public: - GetElementPtrInst(Value *Ptr, const vector<Value*> &Idx, - const string &Name = ""); + GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx, + const std::string &Name = ""); virtual Instruction *clone() const { return new GetElementPtrInst(*this); } virtual const char *getOpcodeName() const { return "getelementptr"; } virtual unsigned getFirstIndexOperandNumber() const { return 1; } diff --git a/include/llvm/iOperators.h b/include/llvm/iOperators.h index 7cbaecf..f9cba9f 100644 --- a/include/llvm/iOperators.h +++ b/include/llvm/iOperators.h @@ -15,7 +15,7 @@ // class GenericUnaryInst : public UnaryOperator { public: - GenericUnaryInst(UnaryOps Opcode, Value *S1, const string &Name = "") + GenericUnaryInst(UnaryOps Opcode, Value *S1, const std::string &Name = "") : UnaryOperator(S1, Opcode, Name) { } @@ -32,7 +32,7 @@ public: class GenericBinaryInst : public BinaryOperator { public: GenericBinaryInst(BinaryOps Opcode, Value *S1, Value *S2, - const string &Name = "") + const std::string &Name = "") : BinaryOperator(Opcode, S1, S2, Name) { } @@ -43,7 +43,7 @@ class SetCondInst : public BinaryOperator { BinaryOps OpType; public: SetCondInst(BinaryOps opType, Value *S1, Value *S2, - const string &Name = ""); + const std::string &Name = ""); virtual const char *getOpcodeName() const; }; diff --git a/include/llvm/iOther.h b/include/llvm/iOther.h index de1532d..85698da 100644 --- a/include/llvm/iOther.h +++ b/include/llvm/iOther.h @@ -24,7 +24,7 @@ class CastInst : public Instruction { Operands.push_back(Use(CI.Operands[0], this)); } public: - CastInst(Value *S, const Type *Ty, const string &Name = "") + CastInst(Value *S, const Type *Ty, const std::string &Name = "") : Instruction(Ty, Cast, Name) { Operands.reserve(1); Operands.push_back(Use(S, this)); @@ -55,13 +55,13 @@ class MethodArgument : public Value { // Defined in the InstrType.cpp file inline void setParent(Method *parent) { Parent = parent; } public: - MethodArgument(const Type *Ty, const string &Name = "") + MethodArgument(const Type *Ty, const std::string &Name = "") : Value(Ty, Value::MethodArgumentVal, Name) { Parent = 0; } // Specialize setName to handle symbol table majik... - virtual void setName(const string &name, SymbolTable *ST = 0); + virtual void setName(const std::string &name, SymbolTable *ST = 0); inline const Method *getParent() const { return Parent; } inline Method *getParent() { return Parent; } @@ -81,7 +81,7 @@ public: class CallInst : public Instruction { CallInst(const CallInst &CI); public: - CallInst(Value *Meth, const vector<Value*> ¶ms, const string &Name = ""); + CallInst(Value *M, const std::vector<Value*> &Par, const std::string & = ""); virtual const char *getOpcodeName() const { return "call"; } @@ -123,7 +123,7 @@ class ShiftInst : public Instruction { Operands.push_back(Use(SI.Operands[1], this)); } public: - ShiftInst(OtherOps Opcode, Value *S, Value *SA, const string &Name = "") + ShiftInst(OtherOps Opcode, Value *S, Value *SA, const std::string &Name = "") : Instruction(S->getType(), Opcode, Name) { assert((Opcode == Shl || Opcode == Shr) && "ShiftInst Opcode invalid!"); Operands.reserve(2); diff --git a/include/llvm/iPHINode.h b/include/llvm/iPHINode.h index 66afac6..0ac0d44 100644 --- a/include/llvm/iPHINode.h +++ b/include/llvm/iPHINode.h @@ -21,7 +21,7 @@ class BasicBlock; class PHINode : public Instruction { PHINode(const PHINode &PN); public: - PHINode(const Type *Ty, const string &Name = ""); + PHINode(const Type *Ty, const std::string &Name = ""); virtual Instruction *clone() const { return new PHINode(*this); } virtual const char *getOpcodeName() const { return "phi"; } diff --git a/include/llvm/iTerminators.h b/include/llvm/iTerminators.h index ebd8b87..6ed75fa 100644 --- a/include/llvm/iTerminators.h +++ b/include/llvm/iTerminators.h @@ -198,7 +198,7 @@ class InvokeInst : public TerminatorInst { InvokeInst(const InvokeInst &BI); public: InvokeInst(Value *Meth, BasicBlock *IfNormal, BasicBlock *IfException, - const vector<Value*> &Params, const string &Name = ""); + const std::vector<Value*> &Params, const std::string &Name = ""); virtual Instruction *clone() const { return new InvokeInst(*this); } |