mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Changes to build successfully with GCC 3.02
llvm-svn: 1503
This commit is contained in:
parent
a68be9b03d
commit
3dc9a2a61f
@ -52,7 +52,7 @@ RunBurg = $(BURG) $(BURG_OPTS)
|
||||
#Prof = -pg
|
||||
|
||||
# TODO: Get rid of exceptions! : -fno-exceptions -fno-rtti
|
||||
CompileCommonOpts = $(Prof) -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include
|
||||
CompileCommonOpts = $(Prof) -Wall -W -Wwrite-strings -Wno-unused-parameter -Wno-missing-braces -I$(LEVEL)/include
|
||||
|
||||
# Compile a file, don't link...
|
||||
Compile = $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
|
||||
|
@ -52,7 +52,7 @@ RunBurg = $(BURG) $(BURG_OPTS)
|
||||
#Prof = -pg
|
||||
|
||||
# TODO: Get rid of exceptions! : -fno-exceptions -fno-rtti
|
||||
CompileCommonOpts = $(Prof) -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include
|
||||
CompileCommonOpts = $(Prof) -Wall -W -Wwrite-strings -Wno-unused-parameter -Wno-missing-braces -I$(LEVEL)/include
|
||||
|
||||
# Compile a file, don't link...
|
||||
Compile = $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
|
||||
|
@ -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...
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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...
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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(); }
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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; }
|
||||
|
@ -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
|
||||
|
@ -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?
|
||||
|
@ -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.
|
||||
|
@ -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));
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
|
@ -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...
|
||||
//
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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) {}
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -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(); }
|
||||
|
@ -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(); }
|
||||
|
@ -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(); }
|
||||
|
@ -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; }
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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"; }
|
||||
|
@ -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); }
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "llvm/Optimizations/ConstantHandling.h"
|
||||
#include "llvm/Method.h"
|
||||
#include "llvm/BasicBlock.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace opt; // Get all the constant handling stuff
|
||||
using namespace analysis;
|
||||
@ -178,7 +179,7 @@ inline const ConstantInt *operator*(const DefZero &L, const DefOne &R) {
|
||||
static ExprType handleAddition(ExprType Left, ExprType Right, Value *V) {
|
||||
const Type *Ty = V->getType();
|
||||
if (Left.ExprTy > Right.ExprTy)
|
||||
swap(Left, Right); // Make left be simpler than right
|
||||
std::swap(Left, Right); // Make left be simpler than right
|
||||
|
||||
switch (Left.ExprTy) {
|
||||
case ExprType::Constant:
|
||||
@ -229,7 +230,7 @@ ExprType analysis::ClassifyExpression(Value *Expr) {
|
||||
case Value::TypeVal: case Value::BasicBlockVal:
|
||||
case Value::MethodVal: case Value::ModuleVal: default:
|
||||
//assert(0 && "Unexpected expression type to classify!");
|
||||
cerr << "Bizarre thing to expr classify: " << Expr << endl;
|
||||
std::cerr << "Bizarre thing to expr classify: " << Expr << "\n";
|
||||
return Expr;
|
||||
case Value::GlobalVariableVal: // Global Variable & Method argument:
|
||||
case Value::MethodArgumentVal: // nothing known, return variable itself
|
||||
@ -280,7 +281,7 @@ ExprType analysis::ClassifyExpression(Value *Expr) {
|
||||
ExprType Left (ClassifyExpression(I->getOperand(0)));
|
||||
ExprType Right(ClassifyExpression(I->getOperand(1)));
|
||||
if (Left.ExprTy > Right.ExprTy)
|
||||
swap(Left, Right); // Make left be simpler than right
|
||||
std::swap(Left, Right); // Make left be simpler than right
|
||||
|
||||
if (Left.ExprTy != ExprType::Constant) // RHS must be > constant
|
||||
return I; // Quadratic eqn! :(
|
||||
|
@ -29,7 +29,7 @@ cfg::CallGraphNode *cfg::CallGraph::getNodeFor(Method *M) {
|
||||
assert(M->getParent() == Mod && "Method not in current module!");
|
||||
CallGraphNode *New = new CallGraphNode(M);
|
||||
|
||||
MethodMap.insert(pair<const Method*, CallGraphNode*>(M, New));
|
||||
MethodMap.insert(std::make_pair(M, New));
|
||||
return New;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ cfg::CallGraph::~CallGraph() {
|
||||
}
|
||||
|
||||
|
||||
void cfg::WriteToOutput(const CallGraphNode *CGN, ostream &o) {
|
||||
void cfg::WriteToOutput(const CallGraphNode *CGN, std::ostream &o) {
|
||||
if (CGN->getMethod())
|
||||
o << "Call graph node for method: '" << CGN->getMethod()->getName() <<"'\n";
|
||||
else
|
||||
@ -79,10 +79,10 @@ void cfg::WriteToOutput(const CallGraphNode *CGN, ostream &o) {
|
||||
|
||||
for (unsigned i = 0; i < CGN->size(); ++i)
|
||||
o << " Calls method '" << (*CGN)[i]->getMethod()->getName() << "'\n";
|
||||
o << endl;
|
||||
o << "\n";
|
||||
}
|
||||
|
||||
void cfg::WriteToOutput(const CallGraph &CG, ostream &o) {
|
||||
void cfg::WriteToOutput(const CallGraph &CG, std::ostream &o) {
|
||||
WriteToOutput(CG.getRoot(), o);
|
||||
for (CallGraph::const_iterator I = CG.begin(), E = CG.end(); I != E; ++I)
|
||||
o << I->second;
|
||||
|
@ -60,7 +60,7 @@ bool FindUnsafePointerTypes::doPerMethodWork(Method *Meth) {
|
||||
UnsafeTypes.insert((PointerType*)ITy);
|
||||
|
||||
if (PrintFailures) {
|
||||
CachedWriter CW(M->getParent(), cerr);
|
||||
CachedWriter CW(M->getParent(), std::cerr);
|
||||
CW << "FindUnsafePointerTypes: Type '" << ITy
|
||||
<< "' marked unsafe in '" << Meth->getName() << "' by:\n" << Inst;
|
||||
}
|
||||
@ -74,7 +74,7 @@ bool FindUnsafePointerTypes::doPerMethodWork(Method *Meth) {
|
||||
// printResults - Loop over the results of the analysis, printing out unsafe
|
||||
// types.
|
||||
//
|
||||
void FindUnsafePointerTypes::printResults(const Module *M, ostream &o) {
|
||||
void FindUnsafePointerTypes::printResults(const Module *M, std::ostream &o) {
|
||||
if (UnsafeTypes.empty()) {
|
||||
o << "SafePointerAccess Analysis: No unsafe types found!\n";
|
||||
return;
|
||||
@ -84,9 +84,9 @@ void FindUnsafePointerTypes::printResults(const Module *M, ostream &o) {
|
||||
|
||||
CW << "SafePointerAccess Analysis: Found these unsafe types:\n";
|
||||
unsigned Counter = 1;
|
||||
for (set<PointerType*>::const_iterator I = getUnsafeTypes().begin(),
|
||||
for (std::set<PointerType*>::const_iterator I = getUnsafeTypes().begin(),
|
||||
E = getUnsafeTypes().end(); I != E; ++I, ++Counter) {
|
||||
|
||||
CW << " #" << Counter << ". " << (Value*)*I << endl;
|
||||
CW << " #" << Counter << ". " << (Value*)*I << "\n";
|
||||
}
|
||||
}
|
||||
|
@ -78,15 +78,15 @@ bool FindUsedTypes::doPerMethodWork(Method *m) {
|
||||
// passed in, then the types are printed symbolically if possible, using the
|
||||
// symbol table from the module.
|
||||
//
|
||||
void FindUsedTypes::printTypes(ostream &o, const Module *M = 0) const {
|
||||
void FindUsedTypes::printTypes(std::ostream &o, const Module *M = 0) const {
|
||||
o << "Types in use by this module:\n";
|
||||
if (M) {
|
||||
CachedWriter CW(M, o);
|
||||
for (set<const Type *>::const_iterator I = UsedTypes.begin(),
|
||||
for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
|
||||
E = UsedTypes.end(); I != E; ++I)
|
||||
CW << " " << *I << endl;
|
||||
CW << " " << *I << "\n";
|
||||
} else
|
||||
for (set<const Type *>::const_iterator I = UsedTypes.begin(),
|
||||
for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
|
||||
E = UsedTypes.end(); I != E; ++I)
|
||||
o << " " << *I << endl;
|
||||
o << " " << *I << "\n";
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ InductionVariable::InductionVariable(PHINode *P, cfg::LoopInfo *LoopInfo) {
|
||||
ExprType E2 = analysis::ClassifyExpression(V2);
|
||||
|
||||
if (E1.ExprTy > E2.ExprTy) // Make E1 be the simpler expression
|
||||
swap(E1, E2);
|
||||
std::swap(E1, E2);
|
||||
|
||||
// E1 must be a constant incoming value, and E2 must be a linear expression
|
||||
// with respect to the PHI node.
|
||||
@ -109,7 +109,7 @@ InductionVariable::InductionVariable(PHINode *P, cfg::LoopInfo *LoopInfo) {
|
||||
// Make sure that V1 is the incoming value, and V2 is from the backedge of
|
||||
// the loop.
|
||||
if (L->contains(Phi->getIncomingBlock(0))) // Wrong order. Swap now.
|
||||
swap(V1, V2);
|
||||
std::swap(V1, V2);
|
||||
|
||||
Start = V1; // We know that Start has to be loop invariant...
|
||||
Step = 0;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "Support/STLExtras.h"
|
||||
|
||||
using namespace cfg;
|
||||
using std::make_pair;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// IntervalPartition Implementation
|
||||
|
@ -1,8 +1,13 @@
|
||||
#include "llvm/Analysis/LiveVar/BBLiveVar.h"
|
||||
#include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
|
||||
/// BROKEN: Should not include sparc stuff directly into here
|
||||
#include "../../Target/Sparc/SparcInternals.h" // Only for PHI defn
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::pair;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Constructor
|
||||
@ -39,7 +44,7 @@ void BBLiveVar::calcDefUseSets()
|
||||
if( DEBUG_LV > 1) { // debug msg
|
||||
cerr << " *Iterating over machine instr ";
|
||||
MInst->dump();
|
||||
cerr << endl;
|
||||
cerr << "\n";
|
||||
}
|
||||
|
||||
// iterate over MI operands to find defs
|
||||
@ -85,9 +90,9 @@ void BBLiveVar::calcDefUseSets()
|
||||
if( DEBUG_LV > 1) { // debug msg of level 2
|
||||
cerr << " - phi operand ";
|
||||
printValue( ArgVal );
|
||||
cerr << " came from BB ";
|
||||
cerr << " came from BB ";
|
||||
printValue( PhiArgMap[ ArgVal ]);
|
||||
cerr<<endl;
|
||||
cerr << "\n";
|
||||
}
|
||||
|
||||
} // if( IsPhi )
|
||||
@ -123,7 +128,7 @@ void BBLiveVar::addDef(const Value *Op)
|
||||
InSetChanged = true;
|
||||
|
||||
if( DEBUG_LV > 1) {
|
||||
cerr << " +Def: "; printValue( Op ); cerr << endl;
|
||||
cerr << " +Def: "; printValue( Op ); cerr << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ class BBLiveVar
|
||||
|
||||
// map that contains phi args->BB they came
|
||||
// set by calcDefUseSets & used by setPropagate
|
||||
hash_map<const Value *, const BasicBlock *, hashFuncValue> PhiArgMap;
|
||||
std::hash_map<const Value *, const BasicBlock *> PhiArgMap;
|
||||
|
||||
// method to propogate an InSet to OutSet of a predecessor
|
||||
bool setPropagate( LiveVarSet *const OutSetOfPred,
|
||||
|
@ -12,15 +12,15 @@
|
||||
#include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "Support/PostOrderIterator.h"
|
||||
|
||||
#include <iostream>
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
//************************** Constructor/Destructor ***************************
|
||||
|
||||
|
||||
MethodLiveVarInfo::MethodLiveVarInfo(const Method *const M) : Meth(M),
|
||||
BB2BBLVMap()
|
||||
{
|
||||
assert(! M->isExternal() ); // cannot be a prototype decleration
|
||||
MethodLiveVarInfo::MethodLiveVarInfo(const Method *const M) : Meth(M) {
|
||||
assert(!M->isExternal() && "Cannot be a prototype declaration");
|
||||
HasAnalyzed = false; // still we haven't called analyze()
|
||||
}
|
||||
|
||||
@ -55,8 +55,6 @@ MethodLiveVarInfo:: ~MethodLiveVarInfo()
|
||||
if( (*MI).first ) // delete all LiveVarSets in MInst2LVSetBI
|
||||
delete (*MI).second;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,11 +1,14 @@
|
||||
|
||||
#include "llvm/Analysis/LiveVar/ValueSet.h"
|
||||
#include "llvm/ConstantVals.h"
|
||||
|
||||
#include <iostream>
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::pair;
|
||||
using std::hash_set;
|
||||
|
||||
void printValue( const Value *const v) // func to print a Value
|
||||
{
|
||||
|
||||
if (v->hasName())
|
||||
cerr << v << "(" << ((*v).getName()) << ") ";
|
||||
else if (Constant *C = dyn_cast<Constant>(v))
|
||||
@ -16,17 +19,13 @@ void printValue( const Value *const v) // func to print a Value
|
||||
|
||||
|
||||
//---------------- Method implementations --------------------------
|
||||
|
||||
|
||||
ValueSet:: ValueSet() : hash_set<const Value *, hashFuncValue> () { }
|
||||
|
||||
// for performing two set unions
|
||||
bool ValueSet::setUnion( const ValueSet *const set1) {
|
||||
const_iterator set1it;
|
||||
pair<iterator, bool> result;
|
||||
bool changed = false;
|
||||
|
||||
for( set1it = set1->begin() ; set1it != set1->end(); set1it++) {
|
||||
for( set1it = set1->begin() ; set1it != set1->end(); ++set1it) {
|
||||
// for all all elements in set1
|
||||
result = insert( *set1it ); // insert to this set
|
||||
if( result.second == true) changed = true;
|
||||
@ -41,7 +40,7 @@ void ValueSet::setDifference( const ValueSet *const set1,
|
||||
const ValueSet *const set2) {
|
||||
|
||||
const_iterator set1it, set2it;
|
||||
for( set1it = set1->begin() ; set1it != set1->end(); set1it++) {
|
||||
for( set1it = set1->begin() ; set1it != set1->end(); ++set1it) {
|
||||
// for all elements in set1
|
||||
iterator set2it = set2->find( *set1it ); // find wether the elem is in set2
|
||||
if( set2it == set2->end() ) // if the element is not in set2
|
||||
@ -53,7 +52,7 @@ void ValueSet::setDifference( const ValueSet *const set1,
|
||||
// for performing set subtraction
|
||||
void ValueSet::setSubtract( const ValueSet *const set1) {
|
||||
const_iterator set1it;
|
||||
for( set1it = set1->begin() ; set1it != set1->end(); set1it++)
|
||||
for( set1it = set1->begin() ; set1it != set1->end(); ++set1it)
|
||||
// for all elements in set1
|
||||
erase( *set1it ); // erase that element from this set
|
||||
}
|
||||
@ -62,7 +61,5 @@ void ValueSet::setSubtract( const ValueSet *const set1) {
|
||||
|
||||
|
||||
void ValueSet::printSet() const { // for printing a live variable set
|
||||
const_iterator it;
|
||||
for( it = begin() ; it != end(); it++)
|
||||
printValue( *it );
|
||||
for_each(begin(), end(), printValue);
|
||||
}
|
||||
|
@ -22,8 +22,6 @@ inline void LoopDepthCalculator::ProcessInterval(cfg::Interval *I) {
|
||||
}
|
||||
|
||||
LoopDepthCalculator::LoopDepthCalculator(Method *M) {
|
||||
//map<const BasicBlock*, unsigned> LoopDepth;
|
||||
|
||||
cfg::IntervalPartition *IP = new cfg::IntervalPartition(M);
|
||||
while (!IP->isDegeneratePartition()) {
|
||||
for_each(IP->begin(), IP->end(),
|
||||
@ -34,7 +32,7 @@ LoopDepthCalculator::LoopDepthCalculator(Method *M) {
|
||||
//
|
||||
cfg::IntervalPartition *NewIP = new cfg::IntervalPartition(*IP, true);
|
||||
if (NewIP->size() == IP->size()) {
|
||||
cerr << "IRREDUCIBLE GRAPH FOUND!!!\n";
|
||||
assert(0 && "IRREDUCIBLE GRAPH FOUND!!!\n");
|
||||
// TODO: fix irreducible graph
|
||||
return;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ cfg::Loop *cfg::LoopInfo::ConsiderForLoop(const BasicBlock *BB,
|
||||
const DominatorSet &DS) {
|
||||
if (BBMap.find(BB) != BBMap.end()) return 0; // Havn't processed this node?
|
||||
|
||||
vector<const BasicBlock *> TodoStack;
|
||||
std::vector<const BasicBlock *> TodoStack;
|
||||
|
||||
// Scan the predecessors of BB, checking to see if BB dominates any of
|
||||
// them.
|
||||
@ -64,7 +64,7 @@ cfg::Loop *cfg::LoopInfo::ConsiderForLoop(const BasicBlock *BB,
|
||||
// loop can be found for them. Also check subsidary basic blocks to see if
|
||||
// they start subloops of their own.
|
||||
//
|
||||
for (vector<const BasicBlock*>::reverse_iterator I = L->Blocks.rbegin(),
|
||||
for (std::vector<const BasicBlock*>::reverse_iterator I = L->Blocks.rbegin(),
|
||||
E = L->Blocks.rend(); I != E; ++I) {
|
||||
|
||||
// Check to see if this block starts a new loop
|
||||
@ -74,7 +74,7 @@ cfg::Loop *cfg::LoopInfo::ConsiderForLoop(const BasicBlock *BB,
|
||||
}
|
||||
|
||||
if (BBMap.find(*I) == BBMap.end())
|
||||
BBMap.insert(make_pair(*I, L));
|
||||
BBMap.insert(std::make_pair(*I, L));
|
||||
}
|
||||
|
||||
return L;
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "Support/STLExtras.h"
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
using std::set;
|
||||
|
||||
// processModule - Driver function to call all of my subclasses virtual methods.
|
||||
//
|
||||
@ -59,8 +61,8 @@ inline bool ModuleAnalyzer::handleType(set<const Type *> &TypeSet,
|
||||
break;
|
||||
|
||||
default:
|
||||
cerr << "ModuleAnalyzer::handleType, type unknown: '"
|
||||
<< T->getName() << "'\n";
|
||||
std::cerr << "ModuleAnalyzer::handleType, type unknown: '"
|
||||
<< T->getName() << "'\n";
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "Support/DepthFirstIterator.h"
|
||||
#include "Support/STLExtras.h"
|
||||
#include <algorithm>
|
||||
using std::set;
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Helper Template
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include "llvm/Analysis/InductionVariable.h"
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
using std::ostream;
|
||||
using std::set;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Interval Printing Routines
|
||||
@ -23,19 +27,19 @@ void cfg::WriteToOutput(const Interval *I, ostream &o) {
|
||||
|
||||
// Print out all of the basic blocks in the interval...
|
||||
copy(I->Nodes.begin(), I->Nodes.end(),
|
||||
ostream_iterator<BasicBlock*>(o, "\n"));
|
||||
std::ostream_iterator<BasicBlock*>(o, "\n"));
|
||||
|
||||
o << "Interval Predecessors:\n";
|
||||
copy(I->Predecessors.begin(), I->Predecessors.end(),
|
||||
ostream_iterator<BasicBlock*>(o, "\n"));
|
||||
std::ostream_iterator<BasicBlock*>(o, "\n"));
|
||||
|
||||
o << "Interval Successors:\n";
|
||||
copy(I->Successors.begin(), I->Successors.end(),
|
||||
ostream_iterator<BasicBlock*>(o, "\n"));
|
||||
std::ostream_iterator<BasicBlock*>(o, "\n"));
|
||||
}
|
||||
|
||||
void cfg::WriteToOutput(const IntervalPartition &IP, ostream &o) {
|
||||
copy(IP.begin(), IP.end(), ostream_iterator<const Interval *>(o, "\n"));
|
||||
copy(IP.begin(), IP.end(), std::ostream_iterator<const Interval *>(o, "\n"));
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +49,7 @@ void cfg::WriteToOutput(const IntervalPartition &IP, ostream &o) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ostream &operator<<(ostream &o, const set<const BasicBlock*> &BBs) {
|
||||
copy(BBs.begin(), BBs.end(), ostream_iterator<const BasicBlock*>(o, "\n"));
|
||||
copy(BBs.begin(),BBs.end(), std::ostream_iterator<const BasicBlock*>(o,"\n"));
|
||||
return o;
|
||||
}
|
||||
|
||||
@ -53,7 +57,7 @@ void cfg::WriteToOutput(const DominatorSet &DS, ostream &o) {
|
||||
for (DominatorSet::const_iterator I = DS.begin(), E = DS.end(); I != E; ++I) {
|
||||
o << "=============================--------------------------------\n"
|
||||
<< "\nDominator Set For Basic Block\n" << I->first
|
||||
<< "-------------------------------\n" << I->second << endl;
|
||||
<< "-------------------------------\n" << I->second << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +67,7 @@ void cfg::WriteToOutput(const ImmediateDominators &ID, ostream &o) {
|
||||
I != E; ++I) {
|
||||
o << "=============================--------------------------------\n"
|
||||
<< "\nImmediate Dominator For Basic Block\n" << I->first
|
||||
<< "is: \n" << I->second << endl;
|
||||
<< "is: \n" << I->second << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +97,7 @@ void cfg::WriteToOutput(const DominanceFrontier &DF, ostream &o) {
|
||||
I != E; ++I) {
|
||||
o << "=============================--------------------------------\n"
|
||||
<< "\nDominance Frontier For Basic Block\n" << I->first
|
||||
<< "is: \n" << I->second << endl;
|
||||
<< "is: \n" << I->second << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,15 +113,15 @@ void cfg::WriteToOutput(const Loop *L, ostream &o) {
|
||||
if (i) o << ",";
|
||||
WriteAsOperand(o, (const Value*)L->getBlocks()[i]);
|
||||
}
|
||||
o << endl;
|
||||
o << "\n";
|
||||
|
||||
copy(L->getSubLoops().begin(), L->getSubLoops().end(),
|
||||
ostream_iterator<const Loop*>(o, "\n"));
|
||||
std::ostream_iterator<const Loop*>(o, "\n"));
|
||||
}
|
||||
|
||||
void cfg::WriteToOutput(const LoopInfo &LI, ostream &o) {
|
||||
copy(LI.getTopLevelLoops().begin(), LI.getTopLevelLoops().end(),
|
||||
ostream_iterator<const Loop*>(o, "\n"));
|
||||
std::ostream_iterator<const Loop*>(o, "\n"));
|
||||
}
|
||||
|
||||
|
||||
@ -138,11 +142,11 @@ void WriteToOutput(const InductionVariable &IV, ostream &o) {
|
||||
WriteAsOperand(o, (const Value*)IV.Phi);
|
||||
o << ":\n" << (const Value*)IV.Phi;
|
||||
} else {
|
||||
o << endl;
|
||||
o << "\n";
|
||||
}
|
||||
if (IV.InductionType == InductionVariable::Unknown) return;
|
||||
|
||||
o << " Start ="; WriteAsOperand(o, IV.Start);
|
||||
o << " Step =" ; WriteAsOperand(o, IV.Step);
|
||||
o << endl;
|
||||
o << "\n";
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "llvm/Module.h"
|
||||
#include "ParserInternals.h"
|
||||
#include <stdio.h> // for sprintf
|
||||
using std::string;
|
||||
|
||||
// The useful interface defined by this file... Parse an ascii file, and return
|
||||
// the internal representation in a nice slice'n'dice'able representation.
|
||||
@ -30,7 +31,7 @@ Module *ParseAssemblyFile(const string &Filename) { // throw (ParseException)
|
||||
fclose(F);
|
||||
|
||||
if (Result) { // Check to see that it is valid...
|
||||
vector<string> Errors;
|
||||
std::vector<string> Errors;
|
||||
if (verify(Result, Errors)) {
|
||||
delete Result; Result = 0;
|
||||
string Message;
|
||||
|
@ -23,12 +23,12 @@
|
||||
class Module;
|
||||
|
||||
// Global variables exported from the lexer...
|
||||
extern FILE *llvmAsmin;
|
||||
extern std::FILE *llvmAsmin;
|
||||
extern int llvmAsmlineno;
|
||||
|
||||
// Globals exported by the parser...
|
||||
extern string CurFilename;
|
||||
Module *RunVMAsmParser(const string &Filename, FILE *F);
|
||||
extern std::string CurFilename;
|
||||
Module *RunVMAsmParser(const std::string &Filename, FILE *F);
|
||||
|
||||
|
||||
// UnEscapeLexed - Run through the specified buffer and change \xx codes to the
|
||||
@ -47,7 +47,7 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull = false);
|
||||
// This also helps me because I keep typing 'throw new ParseException' instead
|
||||
// of just 'throw ParseException'... sigh...
|
||||
//
|
||||
static inline void ThrowException(const string &message,
|
||||
static inline void ThrowException(const std::string &message,
|
||||
int LineNo = -1) {
|
||||
if (LineNo == -1) LineNo = llvmAsmlineno;
|
||||
// TODO: column number in exception
|
||||
@ -116,18 +116,19 @@ struct ValID {
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline string getName() const {
|
||||
inline std::string getName() const {
|
||||
switch (Type) {
|
||||
case NumberVal : return string("#") + itostr(Num);
|
||||
case NumberVal : return std::string("#") + itostr(Num);
|
||||
case NameVal : return Name;
|
||||
case ConstStringVal: return string("\"") + Name + string("\"");
|
||||
case ConstStringVal: return std::string("\"") + Name + std::string("\"");
|
||||
case ConstFPVal : return ftostr(ConstPoolFP);
|
||||
case ConstNullVal : return "null";
|
||||
case ConstUIntVal :
|
||||
case ConstSIntVal : return string("%") + itostr(ConstPool64);
|
||||
case ConstSIntVal : return std::string("%") + itostr(ConstPool64);
|
||||
default:
|
||||
assert(0 && "Unknown value!");
|
||||
abort();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +164,7 @@ public:
|
||||
struct InstPlaceHolderHelper : public Instruction {
|
||||
InstPlaceHolderHelper(const Type *Ty) : Instruction(Ty, UserOp1, "") {}
|
||||
|
||||
virtual Instruction *clone() const { abort(); }
|
||||
virtual Instruction *clone() const { abort(); return 0; }
|
||||
virtual const char *getOpcodeName() const { return "placeholder"; }
|
||||
};
|
||||
|
||||
|
@ -22,6 +22,15 @@
|
||||
#include <utility> // Get definition of pair class
|
||||
#include <algorithm>
|
||||
#include <stdio.h> // This embarasment is due to our flex lexer...
|
||||
#include <iostream>
|
||||
using std::list;
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
using std::map;
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
using std::cerr;
|
||||
using std::string;
|
||||
|
||||
int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
|
||||
int yylex(); // declaration" of xxx warnings.
|
||||
@ -46,7 +55,6 @@ string CurFilename;
|
||||
typedef vector<Value *> ValueList; // Numbered defs
|
||||
static void ResolveDefinitions(vector<ValueList> &LateResolvers,
|
||||
vector<ValueList> *FutureLateResolvers = 0);
|
||||
static void ResolveTypes (vector<PATypeHolder<Type> > &LateResolveTypes);
|
||||
|
||||
static struct PerModuleInfo {
|
||||
Module *CurrentModule;
|
||||
@ -425,22 +433,6 @@ static void ResolveDefinitions(vector<ValueList> &LateResolvers,
|
||||
LateResolvers.clear();
|
||||
}
|
||||
|
||||
// ResolveType - Take a specified unresolved type and resolve it. If there is
|
||||
// nothing to resolve it to yet, return true. Otherwise resolve it and return
|
||||
// false.
|
||||
//
|
||||
static bool ResolveType(PATypeHolder<Type> &T) {
|
||||
const Type *Ty = T;
|
||||
ValID &DID = getValIDFromPlaceHolder(Ty);
|
||||
|
||||
const Type *TheRealType = getTypeVal(DID, true);
|
||||
if (TheRealType == 0 || TheRealType == Ty) return true;
|
||||
|
||||
// Refine the opaque type we had to the new type we are getting.
|
||||
cast<DerivedType>(Ty)->refineAbstractTypeTo(TheRealType);
|
||||
return false;
|
||||
}
|
||||
|
||||
// ResolveTypeTo - A brand new type was just declared. This means that (if
|
||||
// name is not null) things referencing Name can be resolved. Otherwise, things
|
||||
// refering to the number can be resolved. Do this now.
|
||||
@ -641,12 +633,13 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) {
|
||||
PATypeHolder<Type> *TypeVal;
|
||||
Value *ValueVal;
|
||||
|
||||
list<MethodArgument*> *MethodArgList;
|
||||
vector<Value*> *ValueList;
|
||||
list<PATypeHolder<Type> > *TypeList;
|
||||
list<pair<Value*, BasicBlock*> > *PHIList; // Represent the RHS of PHI node
|
||||
list<pair<Constant*, BasicBlock*> > *JumpTable;
|
||||
vector<Constant*> *ConstVector;
|
||||
std::list<MethodArgument*> *MethodArgList;
|
||||
std::vector<Value*> *ValueList;
|
||||
std::list<PATypeHolder<Type> > *TypeList;
|
||||
std::list<std::pair<Value*,
|
||||
BasicBlock*> > *PHIList; // Represent the RHS of PHI node
|
||||
std::list<std::pair<Constant*, BasicBlock*> > *JumpTable;
|
||||
std::vector<Constant*> *ConstVector;
|
||||
|
||||
int64_t SInt64Val;
|
||||
uint64_t UInt64Val;
|
||||
@ -812,8 +805,8 @@ UpRTypes : '\\' EUINT64VAL { // Type UpReference
|
||||
}
|
||||
| UpRTypesV '(' ArgTypeListI ')' { // Method derived type?
|
||||
vector<const Type*> Params;
|
||||
mapto($3->begin(), $3->end(), back_inserter(Params),
|
||||
mem_fun_ref(&PATypeHandle<Type>::get));
|
||||
mapto($3->begin(), $3->end(), std::back_inserter(Params),
|
||||
std::mem_fun_ref(&PATypeHandle<Type>::get));
|
||||
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
|
||||
if (isVarArg) Params.pop_back();
|
||||
|
||||
@ -827,8 +820,8 @@ UpRTypes : '\\' EUINT64VAL { // Type UpReference
|
||||
}
|
||||
| '{' TypeListI '}' { // Structure type?
|
||||
vector<const Type*> Elements;
|
||||
mapto($2->begin(), $2->end(), back_inserter(Elements),
|
||||
mem_fun_ref(&PATypeHandle<Type>::get));
|
||||
mapto($2->begin(), $2->end(), std::back_inserter(Elements),
|
||||
std::mem_fun_ref(&PATypeHandle<Type>::get));
|
||||
|
||||
$$ = newTH<Type>(HandleUpRefs(StructType::get(Elements)));
|
||||
delete $2;
|
||||
|
@ -14,8 +14,9 @@
|
||||
#include "llvm/ConstantVals.h"
|
||||
#include "llvm/GlobalVariable.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#include <iostream>
|
||||
using std::make_pair;
|
||||
using std::cerr;
|
||||
|
||||
const Type *BytecodeParser::parseTypeConstant(const uchar *&Buf,
|
||||
const uchar *EndBuf) {
|
||||
@ -36,7 +37,7 @@ const Type *BytecodeParser::parseTypeConstant(const uchar *&Buf,
|
||||
unsigned NumParams;
|
||||
if (read_vbr(Buf, EndBuf, NumParams)) return failure(Val);
|
||||
|
||||
vector<const Type*> Params;
|
||||
std::vector<const Type*> Params;
|
||||
while (NumParams--) {
|
||||
if (read_vbr(Buf, EndBuf, Typ)) return failure(Val);
|
||||
const Type *Ty = getType(Typ);
|
||||
@ -59,12 +60,12 @@ const Type *BytecodeParser::parseTypeConstant(const uchar *&Buf,
|
||||
if (read_vbr(Buf, EndBuf, NumElements)) return failure(Val);
|
||||
|
||||
BCR_TRACE(5, "Array Type Constant #" << ElTyp << " size="
|
||||
<< NumElements << endl);
|
||||
<< NumElements << "\n");
|
||||
return ArrayType::get(ElementType, NumElements);
|
||||
}
|
||||
case Type::StructTyID: {
|
||||
unsigned Typ;
|
||||
vector<const Type*> Elements;
|
||||
std::vector<const Type*> Elements;
|
||||
|
||||
if (read_vbr(Buf, EndBuf, Typ)) return failure(Val);
|
||||
while (Typ) { // List is terminated by void/0 typeid
|
||||
@ -80,7 +81,7 @@ const Type *BytecodeParser::parseTypeConstant(const uchar *&Buf,
|
||||
case Type::PointerTyID: {
|
||||
unsigned ElTyp;
|
||||
if (read_vbr(Buf, EndBuf, ElTyp)) return failure(Val);
|
||||
BCR_TRACE(5, "Pointer Type Constant #" << (ElTyp-14) << endl);
|
||||
BCR_TRACE(5, "Pointer Type Constant #" << (ElTyp-14) << "\n");
|
||||
const Type *ElementType = getType(ElTyp);
|
||||
if (ElementType == 0) return failure(Val);
|
||||
return PointerType::get(ElementType);
|
||||
@ -241,7 +242,7 @@ bool BytecodeParser::parseConstantValue(const uchar *&Buf, const uchar *EndBuf,
|
||||
const ArrayType *AT = cast<const ArrayType>(Ty);
|
||||
unsigned NumElements = AT->getNumElements();
|
||||
|
||||
vector<Constant*> Elements;
|
||||
std::vector<Constant*> Elements;
|
||||
while (NumElements--) { // Read all of the elements of the constant.
|
||||
unsigned Slot;
|
||||
if (read_vbr(Buf, EndBuf, Slot)) return failure(true);
|
||||
@ -257,7 +258,7 @@ bool BytecodeParser::parseConstantValue(const uchar *&Buf, const uchar *EndBuf,
|
||||
const StructType *ST = cast<StructType>(Ty);
|
||||
const StructType::ElementTypes &ET = ST->getElementTypes();
|
||||
|
||||
vector<Constant *> Elements;
|
||||
std::vector<Constant *> Elements;
|
||||
for (unsigned i = 0; i < ET.size(); ++i) {
|
||||
unsigned Slot;
|
||||
if (read_vbr(Buf, EndBuf, Slot)) return failure(true);
|
||||
|
@ -16,6 +16,9 @@
|
||||
#include "llvm/iMemory.h"
|
||||
#include "llvm/iPHINode.h"
|
||||
#include "llvm/iOther.h"
|
||||
#include <iostream>
|
||||
using std::vector;
|
||||
using std::cerr;
|
||||
|
||||
bool BytecodeParser::ParseRawInst(const uchar *&Buf, const uchar *EndBuf,
|
||||
RawInst &Result) {
|
||||
@ -107,7 +110,7 @@ bool BytecodeParser::ParseRawInst(const uchar *&Buf, const uchar *EndBuf,
|
||||
#if 0
|
||||
cerr << "NO: " << Result.NumOperands << " opcode: " << Result.Opcode
|
||||
<< " Ty: " << Result.Ty->getDescription() << " arg1: " << Result.Arg1
|
||||
<< " arg2: " << Result.Arg2 << " arg3: " << Result.Arg3 << endl;
|
||||
<< " arg2: " << Result.Arg2 << " arg3: " << Result.Arg3 << "\n";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -441,6 +444,6 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
|
||||
} // end switch(Raw.Opcode)
|
||||
|
||||
cerr << "Unrecognized instruction! " << Raw.Opcode
|
||||
<< " ADDR = 0x" << (void*)Buf << endl;
|
||||
<< " ADDR = 0x" << (void*)Buf << "\n";
|
||||
return failure(true);
|
||||
}
|
||||
|
@ -20,11 +20,15 @@
|
||||
#include "llvm/iPHINode.h"
|
||||
#include "llvm/iOther.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
typedef int blksize_t;
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
using std::cerr;
|
||||
using std::make_pair;
|
||||
|
||||
bool BytecodeParser::getTypeSlot(const Type *Ty, unsigned &Slot) {
|
||||
if (Ty->isPrimitiveType()) {
|
||||
@ -42,7 +46,7 @@ bool BytecodeParser::getTypeSlot(const Type *Ty, unsigned &Slot) {
|
||||
Slot = FirstDerivedTyID + (&*I - &ModuleTypeValues[0]);
|
||||
}
|
||||
}
|
||||
//cerr << "getTypeSlot '" << Ty->getName() << "' = " << Slot << endl;
|
||||
//cerr << "getTypeSlot '" << Ty->getName() << "' = " << Slot << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -50,7 +54,7 @@ const Type *BytecodeParser::getType(unsigned ID) {
|
||||
const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID);
|
||||
if (T) return T;
|
||||
|
||||
//cerr << "Looking up Type ID: " << ID << endl;
|
||||
//cerr << "Looking up Type ID: " << ID << "\n";
|
||||
|
||||
const Value *D = getValue(Type::TypeTy, ID, false);
|
||||
if (D == 0) return failure<const Type*>(0);
|
||||
@ -58,7 +62,7 @@ const Type *BytecodeParser::getType(unsigned ID) {
|
||||
return cast<Type>(D);
|
||||
}
|
||||
|
||||
int BytecodeParser::insertValue(Value *Val, vector<ValueList> &ValueTab) {
|
||||
int BytecodeParser::insertValue(Value *Val, std::vector<ValueList> &ValueTab) {
|
||||
unsigned type;
|
||||
if (getTypeSlot(Val->getType(), type)) return failure<int>(-1);
|
||||
assert(type != Type::TypeTyID && "Types should never be insertValue'd!");
|
||||
@ -67,7 +71,7 @@ int BytecodeParser::insertValue(Value *Val, vector<ValueList> &ValueTab) {
|
||||
ValueTab.resize(type+1, ValueList());
|
||||
|
||||
//cerr << "insertValue Values[" << type << "][" << ValueTab[type].size()
|
||||
// << "] = " << Val << endl;
|
||||
// << "] = " << Val << "\n";
|
||||
ValueTab[type].push_back(Val);
|
||||
|
||||
return ValueTab[type].size()-1;
|
||||
@ -115,7 +119,7 @@ Value *BytecodeParser::getValue(const Type *Ty, unsigned oNum, bool Create) {
|
||||
case Type::LabelTyID: d = new BBPHolder(Ty, oNum); break;
|
||||
case Type::MethodTyID:
|
||||
cerr << "Creating method pholder! : " << type << ":" << oNum << " "
|
||||
<< Ty->getName() << endl;
|
||||
<< Ty->getName() << "\n";
|
||||
d = new MethPHolder(Ty, oNum);
|
||||
if (insertValue(d, LateResolveModuleValues) ==-1) return failure<Value*>(0);
|
||||
return d;
|
||||
@ -196,17 +200,17 @@ bool BytecodeParser::ParseSymbolTable(const uchar *&Buf, const uchar *EndBuf,
|
||||
// Symtab entry: [def slot #][name]
|
||||
unsigned slot;
|
||||
if (read_vbr(Buf, EndBuf, slot)) return failure(true);
|
||||
string Name;
|
||||
std::string Name;
|
||||
if (read(Buf, EndBuf, Name, false)) // Not aligned...
|
||||
return failure(true);
|
||||
|
||||
Value *D = getValue(Ty, slot, false); // Find mapping...
|
||||
if (D == 0) {
|
||||
BCR_TRACE(3, "FAILED LOOKUP: Slot #" << slot << endl);
|
||||
BCR_TRACE(3, "FAILED LOOKUP: Slot #" << slot << "\n");
|
||||
return failure(true);
|
||||
}
|
||||
BCR_TRACE(4, "Map: '" << Name << "' to #" << slot << ":" << D;
|
||||
if (!isa<Instruction>(D)) cerr << endl);
|
||||
if (!isa<Instruction>(D)) cerr << "\n");
|
||||
|
||||
D->setName(Name, ST);
|
||||
}
|
||||
@ -272,7 +276,7 @@ bool BytecodeParser::ParseMethod(const uchar *&Buf, const uchar *EndBuf,
|
||||
MethodSignatureList.pop_front();
|
||||
Method *M = new Method(MTy, isInternal != 0);
|
||||
|
||||
BCR_TRACE(2, "METHOD TYPE: " << MTy << endl);
|
||||
BCR_TRACE(2, "METHOD TYPE: " << MTy << "\n");
|
||||
|
||||
const MethodType::ParamTypes &Params = MTy->getParamTypes();
|
||||
for (MethodType::ParamTypes::const_iterator It = Params.begin();
|
||||
@ -418,7 +422,7 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End,
|
||||
DeclareNewGlobalValue(GV, unsigned(DestSlot));
|
||||
|
||||
BCR_TRACE(2, "Global Variable of type: " << PTy->getDescription()
|
||||
<< " into slot #" << DestSlot << endl);
|
||||
<< " into slot #" << DestSlot << "\n");
|
||||
|
||||
if (read_vbr(Buf, End, VarType)) return failure(true);
|
||||
}
|
||||
@ -459,7 +463,7 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End,
|
||||
MethodSignatureList.push_back(
|
||||
make_pair(cast<const PointerType>(Val->getType()), SlotNo));
|
||||
if (read_vbr(Buf, End, MethSignature)) return failure(true);
|
||||
BCR_TRACE(2, "Method of type: " << Ty << endl);
|
||||
BCR_TRACE(2, "Method of type: " << Ty << "\n");
|
||||
}
|
||||
|
||||
if (align32(Buf, End)) return failure(true);
|
||||
@ -566,11 +570,11 @@ Module *ParseBytecodeBuffer(const uchar *Buffer, unsigned Length) {
|
||||
|
||||
// Parse and return a class file...
|
||||
//
|
||||
Module *ParseBytecodeFile(const string &Filename, string *ErrorStr) {
|
||||
Module *ParseBytecodeFile(const std::string &Filename, std::string *ErrorStr) {
|
||||
struct stat StatBuf;
|
||||
Module *Result = 0;
|
||||
|
||||
if (Filename != string("-")) { // Read from a file...
|
||||
if (Filename != std::string("-")) { // Read from a file...
|
||||
int FD = open(Filename.c_str(), O_RDONLY);
|
||||
if (FD == -1) {
|
||||
if (ErrorStr) *ErrorStr = "Error opening file!";
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#if TRACE_LEVEL // ByteCodeReading_TRACEer
|
||||
#include "llvm/Assembly/Writer.h"
|
||||
#define BCR_TRACE(n, X) if (n < TRACE_LEVEL) cerr << string(n*2, ' ') << X
|
||||
#define BCR_TRACE(n, X) if (n < TRACE_LEVEL) cerr << std::string(n*2, ' ') << X
|
||||
#else
|
||||
#define BCR_TRACE(n, X)
|
||||
#endif
|
||||
@ -41,12 +41,12 @@ struct RawInst { // The raw fields out of the bytecode stream...
|
||||
unsigned Arg1, Arg2;
|
||||
union {
|
||||
unsigned Arg3;
|
||||
vector<unsigned> *VarArgs; // Contains arg #3,4,5... if NumOperands > 3
|
||||
std::vector<unsigned> *VarArgs; // Contains arg #3,4,5... if NumOperands > 3
|
||||
};
|
||||
};
|
||||
|
||||
class BytecodeParser : public AbstractTypeUser {
|
||||
string Error; // Error message string goes here...
|
||||
std::string Error; // Error message string goes here...
|
||||
public:
|
||||
BytecodeParser() {
|
||||
// Define this in case we don't see a ModuleGlobalInfo block.
|
||||
@ -55,13 +55,13 @@ public:
|
||||
|
||||
Module *ParseBytecode(const uchar *Buf, const uchar *EndBuf);
|
||||
|
||||
string getError() const { return Error; }
|
||||
std::string getError() const { return Error; }
|
||||
|
||||
private: // All of this data is transient across calls to ParseBytecode
|
||||
Module *TheModule; // Current Module being read into...
|
||||
|
||||
typedef vector<Value *> ValueList;
|
||||
typedef vector<ValueList> ValueTable;
|
||||
typedef std::vector<Value *> ValueList;
|
||||
typedef std::vector<ValueList> ValueTable;
|
||||
ValueTable Values, LateResolveValues;
|
||||
ValueTable ModuleValues, LateResolveModuleValues;
|
||||
|
||||
@ -70,14 +70,14 @@ private: // All of this data is transient across calls to ParseBytecode
|
||||
// are defined, and if so, the temporary object that they represent is held
|
||||
// here.
|
||||
//
|
||||
typedef map<pair<const PointerType *, unsigned>, GlobalVariable*>
|
||||
GlobalRefsType;
|
||||
typedef std::map<std::pair<const PointerType *, unsigned>,
|
||||
GlobalVariable*> GlobalRefsType;
|
||||
GlobalRefsType GlobalRefs;
|
||||
|
||||
// TypesLoaded - This vector mirrors the Values[TypeTyID] plane. It is used
|
||||
// to deal with forward references to types.
|
||||
//
|
||||
typedef vector<PATypeHandle<Type> > TypeValuesListTy;
|
||||
typedef std::vector<PATypeHandle<Type> > TypeValuesListTy;
|
||||
TypeValuesListTy ModuleTypeValues;
|
||||
TypeValuesListTy MethodTypeValues;
|
||||
|
||||
@ -89,11 +89,11 @@ private: // All of this data is transient across calls to ParseBytecode
|
||||
// into its slot to reserve it. When the method is loaded, this placeholder
|
||||
// is replaced.
|
||||
//
|
||||
list<pair<const PointerType *, unsigned> > MethodSignatureList;
|
||||
std::list<std::pair<const PointerType *, unsigned> > MethodSignatureList;
|
||||
|
||||
private:
|
||||
bool ParseModule (const uchar * Buf, const uchar *End, Module *&);
|
||||
bool ParseModuleGlobalInfo (const uchar *&Buf, const uchar *End, Module *);
|
||||
bool ParseModule (const uchar * Buf, const uchar *End, Module *&);
|
||||
bool ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End, Module *);
|
||||
bool ParseSymbolTable (const uchar *&Buf, const uchar *End, SymbolTable *);
|
||||
bool ParseMethod (const uchar *&Buf, const uchar *End, Module *);
|
||||
bool ParseBasicBlock (const uchar *&Buf, const uchar *End, BasicBlock *&);
|
||||
@ -111,7 +111,7 @@ private:
|
||||
Value *getValue(const Type *Ty, unsigned num, bool Create = true);
|
||||
const Type *getType(unsigned ID);
|
||||
|
||||
int insertValue(Value *D, vector<ValueList> &D); // -1 = Failure
|
||||
int insertValue(Value *D, std::vector<ValueList> &D); // -1 = Failure
|
||||
bool postResolveValues(ValueTable &ValTab);
|
||||
|
||||
bool getTypeSlot(const Type *Ty, unsigned &Slot);
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "llvm/ConstantVals.h"
|
||||
#include "llvm/SymbolTable.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include <iostream>
|
||||
using std::cerr;
|
||||
|
||||
void BytecodeWriter::outputType(const Type *T) {
|
||||
output_vbr((unsigned)T->getPrimitiveID(), Out);
|
||||
@ -134,7 +136,7 @@ bool BytecodeWriter::outputConstant(const Constant *CPV) {
|
||||
|
||||
case Type::StructTyID: {
|
||||
const ConstantStruct *CPS = cast<const ConstantStruct>(CPV);
|
||||
const vector<Use> &Vals = CPS->getValues();
|
||||
const std::vector<Use> &Vals = CPS->getValues();
|
||||
|
||||
for (unsigned i = 0; i < Vals.size(); ++i) {
|
||||
int Slot = Table.getValSlot(Vals[i]);
|
||||
|
@ -28,7 +28,7 @@ typedef unsigned char uchar;
|
||||
//
|
||||
static void outputInstructionFormat0(const Instruction *I,
|
||||
const SlotCalculator &Table,
|
||||
unsigned Type, deque<uchar> &Out) {
|
||||
unsigned Type, std::deque<uchar> &Out) {
|
||||
// Opcode must have top two bits clear...
|
||||
output_vbr(I->getOpcode() << 2, Out); // Instruction Opcode ID
|
||||
output_vbr(Type, Out); // Result type
|
||||
@ -63,7 +63,7 @@ static void outputInstructionFormat0(const Instruction *I,
|
||||
//
|
||||
static void outputInstrVarArgsCall(const Instruction *I,
|
||||
const SlotCalculator &Table, unsigned Type,
|
||||
deque<uchar> &Out) {
|
||||
std::deque<uchar> &Out) {
|
||||
assert(isa<CallInst>(I) || isa<InvokeInst>(I));
|
||||
// Opcode must have top two bits clear...
|
||||
output_vbr(I->getOpcode() << 2, Out); // Instruction Opcode ID
|
||||
@ -106,7 +106,7 @@ static void outputInstrVarArgsCall(const Instruction *I,
|
||||
//
|
||||
static void outputInstructionFormat1(const Instruction *I,
|
||||
const SlotCalculator &Table, int *Slots,
|
||||
unsigned Type, deque<uchar> &Out) {
|
||||
unsigned Type, std::deque<uchar> &Out) {
|
||||
unsigned Opcode = I->getOpcode(); // Instruction Opcode ID
|
||||
|
||||
// bits Instruction format:
|
||||
@ -127,7 +127,7 @@ static void outputInstructionFormat1(const Instruction *I,
|
||||
//
|
||||
static void outputInstructionFormat2(const Instruction *I,
|
||||
const SlotCalculator &Table, int *Slots,
|
||||
unsigned Type, deque<uchar> &Out) {
|
||||
unsigned Type, std::deque<uchar> &Out) {
|
||||
unsigned Opcode = I->getOpcode(); // Instruction Opcode ID
|
||||
|
||||
// bits Instruction format:
|
||||
@ -151,7 +151,7 @@ static void outputInstructionFormat2(const Instruction *I,
|
||||
//
|
||||
static void outputInstructionFormat3(const Instruction *I,
|
||||
const SlotCalculator &Table, int *Slots,
|
||||
unsigned Type, deque<uchar> &Out) {
|
||||
unsigned Type, std::deque<uchar> &Out) {
|
||||
unsigned Opcode = I->getOpcode(); // Instruction Opcode ID
|
||||
|
||||
// bits Instruction format:
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
|
||||
BytecodeWriter::BytecodeWriter(deque<unsigned char> &o, const Module *M)
|
||||
BytecodeWriter::BytecodeWriter(std::deque<unsigned char> &o, const Module *M)
|
||||
: Out(o), Table(M, false) {
|
||||
|
||||
outputSignature();
|
||||
@ -66,7 +66,7 @@ void BytecodeWriter::outputConstants(bool isMethod) {
|
||||
|
||||
unsigned NumPlanes = Table.getNumPlanes();
|
||||
for (unsigned pno = 0; pno < NumPlanes; pno++) {
|
||||
const vector<const Value*> &Plane = Table.getPlane(pno);
|
||||
const std::vector<const Value*> &Plane = Table.getPlane(pno);
|
||||
if (Plane.empty()) continue; // Skip empty type planes...
|
||||
|
||||
unsigned ValNo = 0;
|
||||
@ -95,8 +95,8 @@ void BytecodeWriter::outputConstants(bool isMethod) {
|
||||
assert (Slot != -1 && "Type in constant pool but not in method!!");
|
||||
output_vbr((unsigned)Slot, Out);
|
||||
|
||||
//cout << "Emitting " << NC << " constants of type '"
|
||||
// << Plane.front()->getType()->getName() << "' = Slot #" << Slot << endl;
|
||||
//cerr << "Emitting " << NC << " constants of type '"
|
||||
// << Plane.front()->getType()->getName() << "' = Slot #" << Slot << "\n";
|
||||
|
||||
for (unsigned i = ValNo; i < ValNo+NC; ++i) {
|
||||
const Value *V = Plane[i];
|
||||
@ -211,7 +211,7 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
|
||||
void WriteBytecodeToFile(const Module *C, ostream &Out) {
|
||||
assert(C && "You can't write a null module!!");
|
||||
|
||||
deque<unsigned char> Buffer;
|
||||
std::deque<unsigned char> Buffer;
|
||||
|
||||
// This object populates buffer for us...
|
||||
BytecodeWriter BCW(Buffer, C);
|
||||
@ -220,7 +220,7 @@ void WriteBytecodeToFile(const Module *C, ostream &Out) {
|
||||
// sequential in memory, however, so write out as much as possible in big
|
||||
// chunks, until we're done.
|
||||
//
|
||||
deque<unsigned char>::const_iterator I = Buffer.begin(), E = Buffer.end();
|
||||
std::deque<unsigned char>::const_iterator I = Buffer.begin(),E = Buffer.end();
|
||||
while (I != E) { // Loop until it's all written
|
||||
// Scan to see how big this chunk is...
|
||||
const unsigned char *ChunkPtr = &*I;
|
||||
@ -235,7 +235,7 @@ void WriteBytecodeToFile(const Module *C, ostream &Out) {
|
||||
}
|
||||
|
||||
// Write out the chunk...
|
||||
Out.write(ChunkPtr, LastPtr-ChunkPtr);
|
||||
Out.write((char*)ChunkPtr, LastPtr-ChunkPtr);
|
||||
}
|
||||
|
||||
Out.flush();
|
||||
|
@ -20,10 +20,10 @@
|
||||
#include <deque>
|
||||
|
||||
class BytecodeWriter {
|
||||
deque<unsigned char> &Out;
|
||||
std::deque<unsigned char> &Out;
|
||||
SlotCalculator Table;
|
||||
public:
|
||||
BytecodeWriter(deque<unsigned char> &o, const Module *M);
|
||||
BytecodeWriter(std::deque<unsigned char> &o, const Module *M);
|
||||
|
||||
protected:
|
||||
void outputConstants(bool isMethod);
|
||||
@ -51,12 +51,12 @@ private :
|
||||
//
|
||||
class BytecodeBlock {
|
||||
unsigned Loc;
|
||||
deque<unsigned char> &Out;
|
||||
std::deque<unsigned char> &Out;
|
||||
|
||||
BytecodeBlock(const BytecodeBlock &); // do not implement
|
||||
void operator=(const BytecodeBlock &); // do not implement
|
||||
public:
|
||||
inline BytecodeBlock(unsigned ID, deque<unsigned char> &o) : Out(o) {
|
||||
inline BytecodeBlock(unsigned ID, std::deque<unsigned char> &o) : Out(o) {
|
||||
output(ID, Out);
|
||||
output((unsigned)0, Out); // Reserve the space for the block size...
|
||||
Loc = Out.size();
|
||||
|
@ -18,10 +18,12 @@
|
||||
#include "llvm/Instruction.h"
|
||||
#include "Support/CommandLine.h"
|
||||
#include "SchedPriorities.h"
|
||||
#include <hash_set>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include <ext/hash_set>
|
||||
#include <iostream>
|
||||
using std::cerr;
|
||||
using std::vector;
|
||||
|
||||
//************************* External Data Types *****************************/
|
||||
|
||||
@ -353,11 +355,11 @@ private:
|
||||
unsigned int totalInstrCount;
|
||||
cycles_t curTime;
|
||||
cycles_t nextEarliestIssueTime; // next cycle we can issue
|
||||
vector<hash_set<const SchedGraphNode*> > choicesForSlot; // indexed by slot#
|
||||
vector<std::hash_set<const SchedGraphNode*> > choicesForSlot; // indexed by slot#
|
||||
vector<const SchedGraphNode*> choiceVec; // indexed by node ptr
|
||||
vector<int> numInClass; // indexed by sched class
|
||||
vector<cycles_t> nextEarliestStartTime; // indexed by opCode
|
||||
hash_map<const SchedGraphNode*, DelaySlotInfo*> delaySlotInfoForBranches;
|
||||
std::hash_map<const SchedGraphNode*, DelaySlotInfo*> delaySlotInfoForBranches;
|
||||
// indexed by branch node ptr
|
||||
|
||||
public:
|
||||
@ -419,7 +421,7 @@ public:
|
||||
return choiceVec[i];
|
||||
}
|
||||
|
||||
inline hash_set<const SchedGraphNode*>& getChoicesForSlot(unsigned slotNum) {
|
||||
inline std::hash_set<const SchedGraphNode*>& getChoicesForSlot(unsigned slotNum) {
|
||||
assert(slotNum < nslots);
|
||||
return choicesForSlot[slotNum];
|
||||
}
|
||||
@ -495,7 +497,7 @@ public:
|
||||
bool createIfMissing=false)
|
||||
{
|
||||
DelaySlotInfo* dinfo;
|
||||
hash_map<const SchedGraphNode*, DelaySlotInfo* >::const_iterator
|
||||
std::hash_map<const SchedGraphNode*, DelaySlotInfo* >::const_iterator
|
||||
I = delaySlotInfoForBranches.find(bn);
|
||||
if (I == delaySlotInfoForBranches.end())
|
||||
{
|
||||
@ -552,7 +554,7 @@ SchedulingManager::updateEarliestStartTimes(const SchedGraphNode* node,
|
||||
{
|
||||
if (schedInfo.numBubblesAfter(node->getOpCode()) > 0)
|
||||
{ // Update next earliest time before which *nothing* can issue.
|
||||
nextEarliestIssueTime = max(nextEarliestIssueTime,
|
||||
nextEarliestIssueTime = std::max(nextEarliestIssueTime,
|
||||
curTime + 1 + schedInfo.numBubblesAfter(node->getOpCode()));
|
||||
}
|
||||
|
||||
@ -603,7 +605,7 @@ AssignInstructionsToSlots(class SchedulingManager& S, unsigned maxIssue)
|
||||
unsigned numIssued;
|
||||
for (numIssued = 0; numIssued < maxIssue; numIssued++)
|
||||
{
|
||||
int chosenSlot = -1, chosenNodeIndex = -1;
|
||||
int chosenSlot = -1;
|
||||
for (unsigned s=startSlot; s < S.nslots; s++)
|
||||
if ((*igroup)[s] == NULL && S.getChoicesForSlot(s).size() == 1)
|
||||
{
|
||||
@ -877,7 +879,7 @@ FindSlotChoices(SchedulingManager& S,
|
||||
|
||||
assert(s < S.nslots && "No feasible slot for instruction?");
|
||||
|
||||
highestSlotUsed = max(highestSlotUsed, (int) s);
|
||||
highestSlotUsed = std::max(highestSlotUsed, (int) s);
|
||||
}
|
||||
|
||||
assert(highestSlotUsed <= (int) S.nslots-1 && "Invalid slot used?");
|
||||
@ -961,7 +963,6 @@ FindSlotChoices(SchedulingManager& S,
|
||||
// Otherwise, just ignore the instruction.
|
||||
for (unsigned i=indexForBreakingNode+1; i < S.getNumChoices(); i++)
|
||||
{
|
||||
bool foundLowerSlot = false;
|
||||
MachineOpCode opCode = S.getChoice(i)->getOpCode();
|
||||
for (unsigned int s=startSlot; s < nslotsToUse; s++)
|
||||
if (S.schedInfo.instrCanUseSlot(opCode, s))
|
||||
@ -1001,15 +1002,15 @@ ChooseOneGroup(SchedulingManager& S)
|
||||
{
|
||||
for (cycles_t c = firstCycle; c <= S.getTime(); c++)
|
||||
{
|
||||
cout << " Cycle " << c << " : Scheduled instructions:\n";
|
||||
cerr << " Cycle " << (long)c << " : Scheduled instructions:\n";
|
||||
const InstrGroup* igroup = S.isched.getIGroup(c);
|
||||
for (unsigned int s=0; s < S.nslots; s++)
|
||||
{
|
||||
cout << " ";
|
||||
cerr << " ";
|
||||
if ((*igroup)[s] != NULL)
|
||||
cout << * ((*igroup)[s])->getMachineInstr() << endl;
|
||||
cerr << * ((*igroup)[s])->getMachineInstr() << "\n";
|
||||
else
|
||||
cout << "<none>" << endl;
|
||||
cerr << "<none>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1056,9 +1057,9 @@ ForwardListSchedule(SchedulingManager& S)
|
||||
// an instruction can be issued, or the next earliest in which
|
||||
// one will be ready, or to the next cycle, whichever is latest.
|
||||
//
|
||||
S.updateTime(max(S.getTime() + 1,
|
||||
max(S.getEarliestIssueTime(),
|
||||
S.schedPrio.getEarliestReadyTime())));
|
||||
S.updateTime(std::max(S.getTime() + 1,
|
||||
std::max(S.getEarliestIssueTime(),
|
||||
S.schedPrio.getEarliestReadyTime())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1499,8 +1500,7 @@ ScheduleInstructionsWithSSA(Method* method,
|
||||
|
||||
if (SchedDebugLevel >= Sched_PrintSchedGraphs)
|
||||
{
|
||||
cout << endl << "*** SCHEDULING GRAPHS FOR INSTRUCTION SCHEDULING"
|
||||
<< endl;
|
||||
cerr << "\n*** SCHEDULING GRAPHS FOR INSTRUCTION SCHEDULING\n";
|
||||
graphSet.dump();
|
||||
}
|
||||
|
||||
@ -1513,7 +1513,7 @@ ScheduleInstructionsWithSSA(Method* method,
|
||||
const BasicBlock* bb = bbvec[0];
|
||||
|
||||
if (SchedDebugLevel >= Sched_PrintSchedTrace)
|
||||
cout << endl << "*** TRACE OF INSTRUCTION SCHEDULING OPERATIONS\n\n";
|
||||
cerr << "\n*** TRACE OF INSTRUCTION SCHEDULING OPERATIONS\n\n";
|
||||
|
||||
SchedPriorities schedPrio(method, graph); // expensive!
|
||||
SchedulingManager S(target, graph, schedPrio);
|
||||
@ -1527,8 +1527,7 @@ ScheduleInstructionsWithSSA(Method* method,
|
||||
|
||||
if (SchedDebugLevel >= Sched_PrintMachineCode)
|
||||
{
|
||||
cout << endl
|
||||
<< "*** Machine instructions after INSTRUCTION SCHEDULING" << endl;
|
||||
cerr << "\n*** Machine instructions after INSTRUCTION SCHEDULING\n";
|
||||
MachineCodeForMethod::get(method).dump();
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,16 @@
|
||||
#include "llvm/Target/MachineRegInfo.h"
|
||||
#include "llvm/iOther.h"
|
||||
#include "Support/StringExtras.h"
|
||||
#include "Support/STLExtras.h"
|
||||
#include <algorithm>
|
||||
#include <hash_map>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <ext/hash_map>
|
||||
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
using std::hash_map;
|
||||
using std::cerr;
|
||||
|
||||
//*********************** Internal Data Structures *************************/
|
||||
|
||||
@ -132,7 +138,7 @@ SchedGraphEdge::~SchedGraphEdge()
|
||||
}
|
||||
|
||||
void SchedGraphEdge::dump(int indent=0) const {
|
||||
cout << string(indent*2, ' ') << *this;
|
||||
cerr << std::string(indent*2, ' ') << *this;
|
||||
}
|
||||
|
||||
|
||||
@ -168,7 +174,7 @@ SchedGraphNode::~SchedGraphNode()
|
||||
}
|
||||
|
||||
void SchedGraphNode::dump(int indent=0) const {
|
||||
cout << string(indent*2, ' ') << *this;
|
||||
cerr << std::string(indent*2, ' ') << *this;
|
||||
}
|
||||
|
||||
|
||||
@ -222,21 +228,20 @@ SchedGraph::SchedGraph(const BasicBlock* bb,
|
||||
const TargetMachine& target)
|
||||
{
|
||||
bbVec.push_back(bb);
|
||||
this->buildGraph(target);
|
||||
buildGraph(target);
|
||||
}
|
||||
|
||||
|
||||
/*dtor*/
|
||||
SchedGraph::~SchedGraph()
|
||||
{
|
||||
for (iterator I=begin(); I != end(); ++I)
|
||||
for (const_iterator I = begin(); I != end(); ++I)
|
||||
{
|
||||
SchedGraphNode* node = (*I).second;
|
||||
SchedGraphNode *node = I->second;
|
||||
|
||||
// for each node, delete its out-edges
|
||||
for (SchedGraphNode::iterator I = node->beginOutEdges();
|
||||
I != node->endOutEdges(); ++I)
|
||||
delete *I;
|
||||
std::for_each(node->beginOutEdges(), node->endOutEdges(),
|
||||
deleter<SchedGraphEdge>);
|
||||
|
||||
// then delete the node itself.
|
||||
delete node;
|
||||
@ -247,24 +252,24 @@ SchedGraph::~SchedGraph()
|
||||
void
|
||||
SchedGraph::dump() const
|
||||
{
|
||||
cout << " Sched Graph for Basic Blocks: ";
|
||||
cerr << " Sched Graph for Basic Blocks: ";
|
||||
for (unsigned i=0, N=bbVec.size(); i < N; i++)
|
||||
{
|
||||
cout << (bbVec[i]->hasName()? bbVec[i]->getName() : "block")
|
||||
cerr << (bbVec[i]->hasName()? bbVec[i]->getName() : "block")
|
||||
<< " (" << bbVec[i] << ")"
|
||||
<< ((i == N-1)? "" : ", ");
|
||||
}
|
||||
|
||||
cout << endl << endl << " Actual Root nodes : ";
|
||||
cerr << "\n\n Actual Root nodes : ";
|
||||
for (unsigned i=0, N=graphRoot->outEdges.size(); i < N; i++)
|
||||
cout << graphRoot->outEdges[i]->getSink()->getNodeId()
|
||||
cerr << graphRoot->outEdges[i]->getSink()->getNodeId()
|
||||
<< ((i == N-1)? "" : ", ");
|
||||
|
||||
cout << endl << " Graph Nodes:" << endl;
|
||||
cerr << "\n Graph Nodes:\n";
|
||||
for (const_iterator I=begin(); I != end(); ++I)
|
||||
cout << endl << * (*I).second;
|
||||
cerr << "\n" << *I->second;
|
||||
|
||||
cout << endl;
|
||||
cerr << "\n";
|
||||
}
|
||||
|
||||
|
||||
@ -690,7 +695,7 @@ SchedGraph::addNonSSAEdgesForValue(const Instruction* instr,
|
||||
// this operand is a definition or use of value `instr'
|
||||
SchedGraphNode* node = this->getGraphNodeForInstr(mvec[i]);
|
||||
assert(node && "No node for machine instruction in this BB?");
|
||||
refVec.push_back(make_pair(node, o));
|
||||
refVec.push_back(std::make_pair(node, o));
|
||||
}
|
||||
}
|
||||
|
||||
@ -747,8 +752,8 @@ SchedGraph::findDefUseInfoAtInstr(const TargetMachine& target,
|
||||
{
|
||||
int regNum = mop.getMachineRegNum();
|
||||
if (regNum != target.getRegInfo().getZeroRegNum())
|
||||
regToRefVecMap[mop.getMachineRegNum()].push_back(make_pair(node,
|
||||
i));
|
||||
regToRefVecMap[mop.getMachineRegNum()].push_back(
|
||||
std::make_pair(node, i));
|
||||
continue; // nothing more to do
|
||||
}
|
||||
|
||||
@ -762,7 +767,7 @@ SchedGraph::findDefUseInfoAtInstr(const TargetMachine& target,
|
||||
&& "Do not expect any other kind of operand to be defined!");
|
||||
|
||||
const Instruction* defInstr = cast<Instruction>(mop.getVRegValue());
|
||||
valueToDefVecMap[defInstr].push_back(make_pair(node, i));
|
||||
valueToDefVecMap[defInstr].push_back(std::make_pair(node, i));
|
||||
}
|
||||
|
||||
//
|
||||
@ -774,7 +779,7 @@ SchedGraph::findDefUseInfoAtInstr(const TargetMachine& target,
|
||||
if (const Instruction* defInstr =
|
||||
dyn_cast_or_null<Instruction>(minstr.getImplicitRef(i)))
|
||||
{
|
||||
valueToDefVecMap[defInstr].push_back(make_pair(node, -i));
|
||||
valueToDefVecMap[defInstr].push_back(std::make_pair(node, -i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -860,7 +865,6 @@ SchedGraph::buildNodesforBB(const TargetMachine& target,
|
||||
void
|
||||
SchedGraph::buildGraph(const TargetMachine& target)
|
||||
{
|
||||
const MachineInstrInfo& mii = target.getInstrInfo();
|
||||
const BasicBlock* bb = bbVec[0];
|
||||
|
||||
assert(bbVec.size() == 1 && "Only handling a single basic block here");
|
||||
@ -966,24 +970,22 @@ SchedGraphSet::SchedGraphSet(const Method* _method,
|
||||
SchedGraphSet::~SchedGraphSet()
|
||||
{
|
||||
// delete all the graphs
|
||||
for (iterator I=begin(); I != end(); ++I)
|
||||
delete (*I).second;
|
||||
for (const_iterator I = begin(); I != end(); ++I)
|
||||
delete I->second;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SchedGraphSet::dump() const
|
||||
{
|
||||
cout << "======== Sched graphs for method `"
|
||||
<< (method->hasName()? method->getName() : "???")
|
||||
<< "' ========" << endl << endl;
|
||||
cerr << "======== Sched graphs for method `" << method->getName()
|
||||
<< "' ========\n\n";
|
||||
|
||||
for (const_iterator I=begin(); I != end(); ++I)
|
||||
(*I).second->dump();
|
||||
I->second->dump();
|
||||
|
||||
cout << endl << "====== End graphs for method `"
|
||||
<< (method->hasName()? method->getName() : "")
|
||||
<< "' ========" << endl << endl;
|
||||
cerr << "\n====== End graphs for method `" << method->getName()
|
||||
<< "' ========\n\n";
|
||||
}
|
||||
|
||||
|
||||
@ -1000,8 +1002,7 @@ SchedGraphSet::buildGraphsForMethod(const Method *method,
|
||||
|
||||
|
||||
|
||||
ostream&
|
||||
operator<<(ostream& os, const SchedGraphEdge& edge)
|
||||
std::ostream &operator<<(std::ostream &os, const SchedGraphEdge& edge)
|
||||
{
|
||||
os << "edge [" << edge.src->getNodeId() << "] -> ["
|
||||
<< edge.sink->getNodeId() << "] : ";
|
||||
@ -1015,33 +1016,30 @@ operator<<(ostream& os, const SchedGraphEdge& edge)
|
||||
default: assert(0); break;
|
||||
}
|
||||
|
||||
os << " : delay = " << edge.minDelay << endl;
|
||||
os << " : delay = " << edge.minDelay << "\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
ostream&
|
||||
operator<<(ostream& os, const SchedGraphNode& node)
|
||||
std::ostream &operator<<(std::ostream &os, const SchedGraphNode& node)
|
||||
{
|
||||
os << string(8, ' ')
|
||||
os << std::string(8, ' ')
|
||||
<< "Node " << node.nodeId << " : "
|
||||
<< "latency = " << node.latency << endl << string(12, ' ');
|
||||
<< "latency = " << node.latency << "\n" << std::string(12, ' ');
|
||||
|
||||
if (node.getMachineInstr() == NULL)
|
||||
os << "(Dummy node)" << endl;
|
||||
os << "(Dummy node)\n";
|
||||
else
|
||||
{
|
||||
os << *node.getMachineInstr() << endl << string(12, ' ');
|
||||
os << node.inEdges.size() << " Incoming Edges:" << endl;
|
||||
os << *node.getMachineInstr() << "\n" << std::string(12, ' ');
|
||||
os << node.inEdges.size() << " Incoming Edges:\n";
|
||||
for (unsigned i=0, N=node.inEdges.size(); i < N; i++)
|
||||
os << string(16, ' ') << *node.inEdges[i];
|
||||
os << std::string(16, ' ') << *node.inEdges[i];
|
||||
|
||||
os << string(12, ' ') << node.outEdges.size()
|
||||
<< " Outgoing Edges:" << endl;
|
||||
os << std::string(12, ' ') << node.outEdges.size()
|
||||
<< " Outgoing Edges:\n";
|
||||
for (unsigned i=0, N=node.outEdges.size(); i < N; i++)
|
||||
{
|
||||
os << string(16, ' ') << * node.outEdges[i];
|
||||
}
|
||||
os << std::string(16, ' ') << *node.outEdges[i];
|
||||
}
|
||||
|
||||
return os;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user