mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Remove trailing whitespace
llvm-svn: 21408
This commit is contained in:
parent
8d813a7d51
commit
3f0aa3dbf8
@ -1,10 +1,10 @@
|
||||
//===-- llvm/ADT/BitVectorSet.h - A bit-vector rep. of sets -----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This is an implementation of the bit-vector representation of sets. Unlike
|
||||
@ -15,11 +15,11 @@
|
||||
// universal set) can be chosen at creation time.
|
||||
//
|
||||
// External functions:
|
||||
//
|
||||
//
|
||||
// bool Disjoint(const BitSetVector& set1, const BitSetVector& set2):
|
||||
// Tests if two sets have an empty intersection.
|
||||
// This is more efficient than !(set1 & set2).any().
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ADT_BITSETVECTOR_H
|
||||
@ -47,7 +47,7 @@ private:
|
||||
// Utility functions for the representation
|
||||
static unsigned NumWords(unsigned Size) {
|
||||
return (Size+BITSET_WORDSIZE-1)/BITSET_WORDSIZE;
|
||||
}
|
||||
}
|
||||
static unsigned LastWordSize(unsigned Size) { return Size % BITSET_WORDSIZE; }
|
||||
|
||||
// Clear the unused bits in the last word.
|
||||
@ -67,7 +67,7 @@ private:
|
||||
|
||||
public:
|
||||
class iterator;
|
||||
///
|
||||
///
|
||||
/// Constructor: create a set of the maximum size maxSetSize.
|
||||
/// The set is initialized to empty.
|
||||
///
|
||||
@ -77,9 +77,9 @@ public:
|
||||
/// size - Return the number of bits tracked by this bit vector...
|
||||
unsigned size() const { return maxSize; }
|
||||
|
||||
///
|
||||
///
|
||||
/// Modifier methods: reset, set for entire set, operator[] for one element.
|
||||
///
|
||||
///
|
||||
void reset() {
|
||||
for (unsigned i=0, N = bitsetVec.size(); i < N; ++i)
|
||||
bitsetVec[i].reset();
|
||||
@ -95,11 +95,11 @@ public:
|
||||
return bitsetVec[ndiv][nmod];
|
||||
}
|
||||
iterator begin() { return iterator::begin(*this); }
|
||||
iterator end() { return iterator::end(*this); }
|
||||
iterator end() { return iterator::end(*this); }
|
||||
|
||||
///
|
||||
///
|
||||
/// Comparison operations: equal, not equal
|
||||
///
|
||||
///
|
||||
bool operator == (const BitSetVector& set2) const {
|
||||
assert(maxSize == set2.maxSize && "Illegal == comparison");
|
||||
for (unsigned i = 0; i < bitsetVec.size(); ++i)
|
||||
@ -111,9 +111,9 @@ public:
|
||||
return ! (*this == set2);
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// Set membership operations: single element, any, none, count
|
||||
///
|
||||
///
|
||||
bool test(unsigned n) const {
|
||||
assert(n < size() && "BitSetVector: Bit number out of range");
|
||||
unsigned ndiv = n / BITSET_WORDSIZE, nmod = n % BITSET_WORDSIZE;
|
||||
@ -138,9 +138,9 @@ public:
|
||||
return (count() == size());
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// Set operations: intersection, union, disjoint union, complement.
|
||||
///
|
||||
///
|
||||
BitSetVector operator& (const BitSetVector& set2) const {
|
||||
assert(maxSize == set2.maxSize && "Illegal intersection");
|
||||
BitSetVector result(maxSize);
|
||||
@ -170,19 +170,19 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// Printing and debugging support
|
||||
///
|
||||
///
|
||||
void print(std::ostream &O) const;
|
||||
void dump() const { print(std::cerr); }
|
||||
|
||||
public:
|
||||
//
|
||||
//
|
||||
// An iterator to enumerate the bits in a BitSetVector.
|
||||
// Eventually, this needs to inherit from bidirectional_iterator.
|
||||
// But this iterator may not be as useful as I once thought and
|
||||
// may just go away.
|
||||
//
|
||||
//
|
||||
class iterator {
|
||||
unsigned currentBit;
|
||||
unsigned currentWord;
|
||||
@ -257,7 +257,7 @@ inline std::ostream& operator<< (std::ostream& O, const BitSetVector& bset)
|
||||
|
||||
///
|
||||
/// Optimized versions of fundamental comparison operations
|
||||
///
|
||||
///
|
||||
inline bool Disjoint(const BitSetVector& set1,
|
||||
const BitSetVector& set2)
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/ADT/DepthFirstIterator.h - Depth First iterator -----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file builds on the ADT/GraphTraits.h file to build generic depth
|
||||
@ -58,7 +58,7 @@ public:
|
||||
|
||||
|
||||
// Generic Depth First Iterator
|
||||
template<class GraphT, class SetType =
|
||||
template<class GraphT, class SetType =
|
||||
std::set<typename GraphTraits<GraphT>::NodeType*>,
|
||||
bool ExtStorage = false, class GT = GraphTraits<GraphT> >
|
||||
class df_iterator : public forward_iterator<typename GT::NodeType, ptrdiff_t>,
|
||||
@ -85,7 +85,7 @@ private:
|
||||
VisitStack.push_back(std::make_pair(Node, GT::child_begin(Node)));
|
||||
}
|
||||
}
|
||||
inline df_iterator(SetType &S)
|
||||
inline df_iterator(SetType &S)
|
||||
: df_iterator_storage<SetType, ExtStorage>(S) {
|
||||
// End is when stack is empty
|
||||
}
|
||||
@ -106,13 +106,13 @@ public:
|
||||
}
|
||||
static inline _Self end(GraphT G, SetType &S) { return _Self(S); }
|
||||
|
||||
inline bool operator==(const _Self& x) const {
|
||||
inline bool operator==(const _Self& x) const {
|
||||
return VisitStack.size() == x.VisitStack.size() &&
|
||||
VisitStack == x.VisitStack;
|
||||
}
|
||||
inline bool operator!=(const _Self& x) const { return !operator==(x); }
|
||||
|
||||
inline pointer operator*() const {
|
||||
inline pointer operator*() const {
|
||||
return VisitStack.back().first;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ public:
|
||||
std::pair<NodeType *, ChildItTy> &Top = VisitStack.back();
|
||||
NodeType *Node = Top.first;
|
||||
ChildItTy &It = Top.second;
|
||||
|
||||
|
||||
while (It != GT::child_end(Node)) {
|
||||
NodeType *Next = *It++;
|
||||
if (!this->Visited.count(Next)) { // Has our next sibling been visited?
|
||||
@ -137,22 +137,22 @@ public:
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Oops, ran out of successors... go up a level on the stack.
|
||||
VisitStack.pop_back();
|
||||
} while (!VisitStack.empty());
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline _Self operator++(int) { // Postincrement
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
|
||||
// nodeVisited - return true if this iterator has already visited the
|
||||
// specified node. This is public, and will probably be used to iterate over
|
||||
// nodes that a depth first iteration did not find: ie unreachable nodes.
|
||||
//
|
||||
inline bool nodeVisited(NodeType *Node) const {
|
||||
inline bool nodeVisited(NodeType *Node) const {
|
||||
return this->Visited.count(Node) != 0;
|
||||
}
|
||||
};
|
||||
|
@ -1,15 +1,15 @@
|
||||
//===-- llvm/ADT/EquivalenceClasses.h - Generic Equiv. Classes --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
//
|
||||
// Generic implementation of equivalence classes through the use Tarjan's
|
||||
// efficient union-find algorithm.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ADT_EQUIVALENCECLASSES_H
|
||||
@ -128,7 +128,7 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Inspection methods
|
||||
//
|
||||
@ -220,7 +220,7 @@ public:
|
||||
// point to the L2 leader node.
|
||||
const ECValue &L1LV = *L1.Node, &L2LV = *L2.Node;
|
||||
L1LV.getEndOfList()->setNext(&L2LV);
|
||||
|
||||
|
||||
// Update L1LV's end of list pointer.
|
||||
L1LV.Leader = L2LV.getEndOfList();
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
//===-- llvm/ADT/GraphTraits.h - Graph traits template ----------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the little GraphTraits<X> template class that should be
|
||||
// This file defines the little GraphTraits<X> template class that should be
|
||||
// specialized by classes that want to be iteratable by generic graph iterators.
|
||||
//
|
||||
// This file also defines the marker class Inverse that is used to iterate over
|
||||
@ -35,9 +35,9 @@ struct GraphTraits {
|
||||
|
||||
// static ChildIteratorType child_begin(NodeType *)
|
||||
// static ChildIteratorType child_end (NodeType *)
|
||||
// Return iterators that point to the beginning and ending of the child
|
||||
// Return iterators that point to the beginning and ending of the child
|
||||
// node list for the specified node.
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
// typedef ...iterator nodes_iterator;
|
||||
@ -50,7 +50,7 @@ struct GraphTraits {
|
||||
// If anyone tries to use this class without having an appropriate
|
||||
// specialization, make an error. If you get this error, it's because you
|
||||
// need to include the appropriate specialization of GraphTraits<> for your
|
||||
// graph, or you need to define it for a new graph type. Either that or
|
||||
// graph, or you need to define it for a new graph type. Either that or
|
||||
// your argument to XXX_begin(...) is unknown or needs to have the proper .h
|
||||
// file #include'd.
|
||||
//
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/ADT/HashExtras.h - Useful functions for STL hash ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains some templates that are useful if you are working with the
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/ADT/PostOrderIterator.h - PostOrder iterator --------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file builds on the ADT/GraphTraits.h file to build a generic graph
|
||||
@ -58,12 +58,12 @@ public:
|
||||
static inline _Self begin(GraphT G) { return _Self(GT::getEntryNode(G)); }
|
||||
static inline _Self end (GraphT G) { return _Self(); }
|
||||
|
||||
inline bool operator==(const _Self& x) const {
|
||||
inline bool operator==(const _Self& x) const {
|
||||
return VisitStack == x.VisitStack;
|
||||
}
|
||||
inline bool operator!=(const _Self& x) const { return !operator==(x); }
|
||||
|
||||
inline pointer operator*() const {
|
||||
inline pointer operator*() const {
|
||||
return VisitStack.top().first;
|
||||
}
|
||||
|
||||
@ -77,11 +77,11 @@ public:
|
||||
VisitStack.pop();
|
||||
if (!VisitStack.empty())
|
||||
traverseChild();
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline _Self operator++(int) { // Postincrement
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
@ -112,10 +112,10 @@ ipo_iterator<T> ipo_end(T G){
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Reverse Post Order CFG iterator code
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
//
|
||||
// This is used to visit basic blocks in a method in reverse post order. This
|
||||
// class is awkward to use because I don't know a good incremental algorithm to
|
||||
// computer RPO from a graph. Because of this, the construction of the
|
||||
// computer RPO from a graph. Because of this, the construction of the
|
||||
// ReversePostOrderTraversal object is expensive (it must walk the entire graph
|
||||
// with a postorder iterator to build the data structures). The moral of this
|
||||
// story is: Don't create more ReversePostOrderTraversal classes than necessary.
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- Support/SCCIterator.h - Strongly Connected Comp. Iter. --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This builds on the llvm/ADT/GraphTraits.h file to find the strongly connected
|
||||
@ -12,7 +12,7 @@
|
||||
//
|
||||
// The SCC iterator has the important property that if a node in SCC S1 has an
|
||||
// edge to a node in SCC S2, then it visits S1 *after* S2.
|
||||
//
|
||||
//
|
||||
// To visit S1 *before* S2, use the scc_iterator on the Inverse graph.
|
||||
// (NOTE: This requires some simple wrappers and is not supported yet.)
|
||||
//
|
||||
@ -118,7 +118,7 @@ class scc_iterator
|
||||
do {
|
||||
CurrentSCC.push_back(SCCNodeStack.back());
|
||||
SCCNodeStack.pop_back();
|
||||
nodeVisitNumbers[CurrentSCC.back()] = ~0UL;
|
||||
nodeVisitNumbers[CurrentSCC.back()] = ~0UL;
|
||||
} while (CurrentSCC.back() != visitingN);
|
||||
return;
|
||||
}
|
||||
@ -144,7 +144,7 @@ public:
|
||||
return CurrentSCC.empty();
|
||||
}
|
||||
|
||||
inline bool operator==(const _Self& x) const {
|
||||
inline bool operator==(const _Self& x) const {
|
||||
return VisitStack == x.VisitStack && CurrentSCC == x.CurrentSCC;
|
||||
}
|
||||
inline bool operator!=(const _Self& x) const { return !operator==(x); }
|
||||
@ -152,18 +152,18 @@ public:
|
||||
// Iterator traversal: forward iteration only
|
||||
inline _Self& operator++() { // Preincrement
|
||||
GetNextSCC();
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
inline _Self operator++(int) { // Postincrement
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
|
||||
// Retrieve a reference to the current SCC
|
||||
inline const SccTy &operator*() const {
|
||||
inline const SccTy &operator*() const {
|
||||
assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!");
|
||||
return CurrentSCC;
|
||||
}
|
||||
inline SccTy &operator*() {
|
||||
inline SccTy &operator*() {
|
||||
assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!");
|
||||
return CurrentSCC;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/ADT/STLExtras.h - Useful STL related functions ------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains some templates that are useful if you are working with the
|
||||
@ -35,13 +35,13 @@ struct greater_ptr : public std::binary_function<Ty, Ty, bool> {
|
||||
};
|
||||
|
||||
// deleter - Very very very simple method that is used to invoke operator
|
||||
// delete on something. It is used like this:
|
||||
// delete on something. It is used like this:
|
||||
//
|
||||
// for_each(V.begin(), B.end(), deleter<Interval>);
|
||||
//
|
||||
template <class T>
|
||||
static inline void deleter(T *Ptr) {
|
||||
delete Ptr;
|
||||
template <class T>
|
||||
static inline void deleter(T *Ptr) {
|
||||
delete Ptr;
|
||||
}
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ public:
|
||||
inline mapped_iterator(const mapped_iterator &It)
|
||||
: current(It.current), Fn(It.Fn) {}
|
||||
|
||||
inline value_type operator*() const { // All this work to do this
|
||||
inline value_type operator*() const { // All this work to do this
|
||||
return Fn(*current); // little change
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public:
|
||||
_Self& operator+= (difference_type n) { current += n; return *this; }
|
||||
_Self operator- (difference_type n) const { return _Self(current - n); }
|
||||
_Self& operator-= (difference_type n) { current -= n; return *this; }
|
||||
reference operator[](difference_type n) const { return *(*this + n); }
|
||||
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; }
|
||||
@ -102,7 +102,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _Iterator, class Func>
|
||||
inline mapped_iterator<_Iterator, Func>
|
||||
inline mapped_iterator<_Iterator, Func>
|
||||
operator+(typename mapped_iterator<_Iterator, Func>::difference_type N,
|
||||
const mapped_iterator<_Iterator, Func>& X) {
|
||||
return mapped_iterator<_Iterator, Func>(X.getCurrent() - N);
|
||||
@ -164,7 +164,7 @@ inline ItTy prior(ItTy it)
|
||||
// a std::pair. Since an example is worth 1000 words:
|
||||
//
|
||||
// typedef std::map<int, int> Int2IntMap;
|
||||
//
|
||||
//
|
||||
// Int2IntMap myMap;
|
||||
// Int2IntMap::iterator where;
|
||||
// bool inserted;
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/ADT/SetOperations.h - Generic Set Operations -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines generic set operations that may be used on set's of
|
||||
@ -20,7 +20,7 @@ namespace llvm {
|
||||
/// set_union(A, B) - Compute A := A u B, return whether A changed.
|
||||
///
|
||||
template <class S1Ty, class S2Ty>
|
||||
bool set_union(S1Ty &S1, const S2Ty &S2) {
|
||||
bool set_union(S1Ty &S1, const S2Ty &S2) {
|
||||
bool Changed = false;
|
||||
|
||||
for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
|
||||
@ -60,9 +60,9 @@ S1Ty set_difference(const S1Ty &S1, const S2Ty &S2) {
|
||||
/// set_subtract(A, B) - Compute A := A - B
|
||||
///
|
||||
template <class S1Ty, class S2Ty>
|
||||
void set_subtract(S1Ty &S1, const S2Ty &S2) {
|
||||
void set_subtract(S1Ty &S1, const S2Ty &S2) {
|
||||
for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
|
||||
SI != SE; ++SI)
|
||||
SI != SE; ++SI)
|
||||
S1.erase(*SI);
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
//===- llvm/ADT/SetVector.h - Set with insert order iteration ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements a set that has insertion order iteration
|
||||
// This file implements a set that has insertion order iteration
|
||||
// characteristics. This is useful for keeping a set of things that need to be
|
||||
// visited later but in a deterministic order (insertion order). The interface
|
||||
// is purposefully minimal.
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
/// This class provides a way to keep a set of things that also has the
|
||||
/// This class provides a way to keep a set of things that also has the
|
||||
/// property of a deterministic iteration order. The order of iteration is the
|
||||
/// order of insertion.
|
||||
/// @brief A vector that has set insertion semantics.
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/ADT/Statistic.h - Easy way to expose stats ---------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the 'Statistic' class, which is designed to be an easy way
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/ADT/StringExtras.h - Useful string functions -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains some functions that are useful when dealing with strings.
|
||||
@ -77,21 +77,21 @@ static inline std::string utostr(unsigned X, bool isNeg = false) {
|
||||
}
|
||||
|
||||
static inline std::string itostr(long long X) {
|
||||
if (X < 0)
|
||||
if (X < 0)
|
||||
return utostr(static_cast<uint64_t>(-X), true);
|
||||
else
|
||||
return utostr(static_cast<uint64_t>(X));
|
||||
}
|
||||
|
||||
|
||||
static inline std::string itostr(long X) {
|
||||
if (X < 0)
|
||||
if (X < 0)
|
||||
return utostr(static_cast<uint64_t>(-X), true);
|
||||
else
|
||||
return utostr(static_cast<uint64_t>(X));
|
||||
}
|
||||
|
||||
static inline std::string itostr(int X) {
|
||||
if (X < 0)
|
||||
if (X < 0)
|
||||
return utostr(static_cast<unsigned>(-X), true);
|
||||
else
|
||||
return utostr(static_cast<unsigned>(X));
|
||||
@ -105,7 +105,7 @@ static inline std::string ftostr(double V) {
|
||||
return B;
|
||||
}
|
||||
|
||||
static inline std::string LowercaseString(const std::string &S) {
|
||||
static inline std::string LowercaseString(const std::string &S) {
|
||||
std::string result(S);
|
||||
for (unsigned i = 0; i < S.length(); ++i)
|
||||
if (isupper(result[i]))
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/ADT/Tree.h - Generic n-way tree structure -----------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This class defines a generic N way tree node structure. The tree structure
|
||||
@ -35,7 +35,7 @@ public:
|
||||
ConcreteTreeNode *par) : Children(children), Parent(par) {}
|
||||
|
||||
inline Tree(const std::vector<ConcreteTreeNode*> &children,
|
||||
ConcreteTreeNode *par, const Payload &data)
|
||||
ConcreteTreeNode *par, const Payload &data)
|
||||
: Children(children), Parent(par), Data(data) {}
|
||||
|
||||
// Tree dtor - Free all children
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/ADT/VectorExtras.h - Helpers for std::vector -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains helper functions which are useful for working with the
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/AbstractTypeUser.h - AbstractTypeUser Interface ----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The AbstractTypeUser class is an interface to be implemented by classes who
|
||||
@ -79,7 +79,7 @@ class PATypeHandle {
|
||||
void removeUser();
|
||||
public:
|
||||
// ctor - Add use to type if abstract. Note that Ty must not be null
|
||||
inline PATypeHandle(const Type *ty, AbstractTypeUser *user)
|
||||
inline PATypeHandle(const Type *ty, AbstractTypeUser *user)
|
||||
: Ty(ty), User(user) {
|
||||
addUser();
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Analysis/AliasAnalysis.h - Alias Analysis Interface -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the generic AliasAnalysis interface, which is used as the
|
||||
@ -50,7 +50,7 @@ protected:
|
||||
/// called multiple times.
|
||||
///
|
||||
void InitializeAliasAnalysis(Pass *P);
|
||||
|
||||
|
||||
// getAnalysisUsage - All alias analysis implementations should invoke this
|
||||
// directly (using AliasAnalysis::getAnalysisUsage(AU)) to make sure that
|
||||
// TargetData is required by the pass.
|
||||
@ -108,8 +108,8 @@ public:
|
||||
/// bits which may be or'd together.
|
||||
///
|
||||
enum ModRefResult { NoModRef = 0, Ref = 1, Mod = 2, ModRef = 3 };
|
||||
|
||||
|
||||
|
||||
|
||||
/// ModRefBehavior - Summary of how a function affects memory in the program.
|
||||
/// Loads from constant globals are not considered memory accesses for this
|
||||
/// interface. Also, functions may freely modify stack space local to their
|
||||
@ -120,14 +120,14 @@ public:
|
||||
//
|
||||
// This property corresponds to the GCC 'const' attribute.
|
||||
DoesNotAccessMemory,
|
||||
|
||||
|
||||
// AccessesArguments - This function accesses function arguments in
|
||||
// non-volatile and well known ways, but does not access any other memory.
|
||||
//
|
||||
// Clients may call getArgumentAccesses to get specific information about
|
||||
// how pointer arguments are used.
|
||||
AccessesArguments,
|
||||
|
||||
|
||||
// AccessesArgumentsAndGlobals - This function has accesses function
|
||||
// arguments and global variables in non-volatile and well-known ways, but
|
||||
// does not access any other memory.
|
||||
@ -135,18 +135,18 @@ public:
|
||||
// Clients may call getArgumentAccesses to get specific information about
|
||||
// how pointer arguments and globals are used.
|
||||
AccessesArgumentsAndGlobals,
|
||||
|
||||
|
||||
// OnlyReadsMemory - This function does not perform any non-local stores or
|
||||
// volatile loads, but may read from any memory location.
|
||||
//
|
||||
// This property corresponds to the GCC 'pure' attribute.
|
||||
OnlyReadsMemory,
|
||||
|
||||
|
||||
// UnknownModRefBehavior - This indicates that the function could not be
|
||||
// classified into one of the behaviors above.
|
||||
UnknownModRefBehavior
|
||||
};
|
||||
|
||||
|
||||
/// PointerAccessInfo - This struct is used to return results for pointers,
|
||||
/// globals, and the return value of a function.
|
||||
struct PointerAccessInfo {
|
||||
@ -154,11 +154,11 @@ public:
|
||||
/// the function, a GlobalVariable, or null, corresponding to the return
|
||||
/// value for the function.
|
||||
Value *V;
|
||||
|
||||
|
||||
/// ModRefInfo - Whether the pointer is loaded or stored to/from.
|
||||
///
|
||||
ModRefResult ModRefInfo;
|
||||
|
||||
|
||||
/// AccessType - Specific fine-grained access information for the argument.
|
||||
/// If none of these classifications is general enough, the
|
||||
/// getModRefBehavior method should not return AccessesArguments*. If a
|
||||
@ -168,25 +168,25 @@ public:
|
||||
/// ScalarAccess - The pointer is dereferenced.
|
||||
///
|
||||
ScalarAccess,
|
||||
|
||||
|
||||
/// ArrayAccess - The pointer is indexed through as an array of elements.
|
||||
///
|
||||
ArrayAccess,
|
||||
|
||||
|
||||
/// ElementAccess ?? P->F only?
|
||||
|
||||
|
||||
/// CallsThrough - Indirect calls are made through the specified function
|
||||
/// pointer.
|
||||
CallsThrough,
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
/// getModRefBehavior - Return the behavior of the specified function if
|
||||
/// called from the specified call site. The call site may be null in which
|
||||
/// case the most generic behavior of this function should be returned.
|
||||
virtual ModRefBehavior getModRefBehavior(Function *F, CallSite CS,
|
||||
std::vector<PointerAccessInfo> *Info = 0);
|
||||
|
||||
|
||||
/// doesNotAccessMemory - If the specified function is known to never read or
|
||||
/// write memory, return true. If the function only reads from known-constant
|
||||
/// memory, it is also legal to return true. Functions that unwind the stack
|
||||
|
@ -1,17 +1,17 @@
|
||||
//===- llvm/Analysis/AliasSetTracker.h - Build Alias Sets -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines two classes: AliasSetTracker and AliasSet. These interface
|
||||
// are used to classify a collection of pointer references into a maximal number
|
||||
// of disjoint sets. Each AliasSet object constructed by the AliasSetTracker
|
||||
// object refers to memory disjoint from the other sets.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ANALYSIS_ALIASSETTRACKER_H
|
||||
@ -58,7 +58,7 @@ class AliasSet {
|
||||
|
||||
unsigned getSize() const { return Size; }
|
||||
|
||||
AliasSet *getAliasSet(AliasSetTracker &AST) {
|
||||
AliasSet *getAliasSet(AliasSetTracker &AST) {
|
||||
assert(AS && "No AliasSet yet!");
|
||||
if (AS->Forward) {
|
||||
AliasSet *OldAS = AS;
|
||||
@ -163,7 +163,7 @@ public:
|
||||
HashNodePair *CurNode;
|
||||
public:
|
||||
iterator(HashNodePair *CN = 0) : CurNode(CN) {}
|
||||
|
||||
|
||||
bool operator==(const iterator& x) const {
|
||||
return CurNode == x.CurNode;
|
||||
}
|
||||
@ -173,7 +173,7 @@ public:
|
||||
CurNode = I.CurNode;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
value_type &operator*() const {
|
||||
assert(CurNode && "Dereferencing AliasSet.end()!");
|
||||
return *CurNode;
|
||||
@ -182,14 +182,14 @@ public:
|
||||
|
||||
Value *getPointer() const { return CurNode->first; }
|
||||
unsigned getSize() const { return CurNode->second.getSize(); }
|
||||
|
||||
|
||||
iterator& operator++() { // Preincrement
|
||||
assert(CurNode && "Advancing past AliasSet.end()!");
|
||||
CurNode = CurNode->second.getNext();
|
||||
return *this;
|
||||
}
|
||||
iterator operator++(int) { // Postincrement
|
||||
iterator tmp = *this; ++*this; return tmp;
|
||||
iterator tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
@ -306,7 +306,7 @@ public:
|
||||
AliasSet *getAliasSetForPointerIfExists(Value *P, unsigned Size) {
|
||||
return findAliasSetForPointer(P, Size);
|
||||
}
|
||||
|
||||
|
||||
/// containsPointer - Return true if the specified location is represented by
|
||||
/// this alias set, false otherwise. This does not modify the AST object or
|
||||
/// alias sets.
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- CFGPrinter.h - CFG printer external interface ------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines external functions that can be called to explicitly
|
||||
|
@ -1,13 +1,13 @@
|
||||
//===- CallGraph.h - Build a Module's call graph ----------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This interface is used to build and manipulate a call graph, which is a very
|
||||
// This interface is used to build and manipulate a call graph, which is a very
|
||||
// useful tool for interprocedural optimization.
|
||||
//
|
||||
// Every function in a module is represented as a node in the call graph. The
|
||||
|
@ -1,10 +1,10 @@
|
||||
//==- llvm/Analysis/ConstantsScanner.h - Iterate over constants -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This class implements an iterator to walk through the constants referenced by
|
||||
@ -48,7 +48,7 @@ public:
|
||||
: InstI(inst_end(F)), OpIdx(0) {
|
||||
}
|
||||
|
||||
inline bool operator==(const _Self& x) const { return OpIdx == x.OpIdx &&
|
||||
inline bool operator==(const _Self& x) const { return OpIdx == x.OpIdx &&
|
||||
InstI == x.InstI; }
|
||||
inline bool operator!=(const _Self& x) const { return !operator==(x); }
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
|
||||
inline _Self operator++(int) { // Postincrement
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
|
||||
inline bool atEnd() const { return InstI.atEnd(); }
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- DSGraph.h - Represent a collection of data structures ----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header defines the data structure graph (DSGraph) and the
|
||||
@ -25,14 +25,14 @@ namespace llvm {
|
||||
class GlobalValue;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// DSScalarMap - An instance of this class is used to keep track of all of
|
||||
/// DSScalarMap - An instance of this class is used to keep track of all of
|
||||
/// which DSNode each scalar in a function points to. This is specialized to
|
||||
/// keep track of globals with nodes in the function, and to keep track of the
|
||||
/// keep track of globals with nodes in the function, and to keep track of the
|
||||
/// unique DSNodeHandle being used by the scalar map.
|
||||
///
|
||||
/// This class is crucial to the efficiency of DSA with some large SCC's. In
|
||||
/// This class is crucial to the efficiency of DSA with some large SCC's. In
|
||||
/// these cases, the cost of iterating over the scalar map dominates the cost
|
||||
/// of DSA. In all of these cases, the DSA phase is really trying to identify
|
||||
/// of DSA. In all of these cases, the DSA phase is really trying to identify
|
||||
/// globals or unique node handles active in the function.
|
||||
///
|
||||
class DSScalarMap {
|
||||
@ -48,7 +48,7 @@ public:
|
||||
|
||||
EquivalenceClasses<GlobalValue*> &getGlobalECs() const { return GlobalECs; }
|
||||
|
||||
// Compatibility methods: provide an interface compatible with a map of
|
||||
// Compatibility methods: provide an interface compatible with a map of
|
||||
// Value* to DSNodeHandle's.
|
||||
typedef ValueMapTy::const_iterator const_iterator;
|
||||
typedef ValueMapTy::iterator iterator;
|
||||
@ -142,11 +142,11 @@ public:
|
||||
return ValueMap.insert(std::make_pair(V, DSNodeHandle())).first->second;
|
||||
}
|
||||
|
||||
void erase(iterator I) {
|
||||
void erase(iterator I) {
|
||||
assert(I != ValueMap.end() && "Cannot erase end!");
|
||||
if (GlobalValue *GV = dyn_cast<GlobalValue>(I->first))
|
||||
GlobalSet.erase(GV);
|
||||
ValueMap.erase(I);
|
||||
ValueMap.erase(I);
|
||||
}
|
||||
|
||||
void clear() {
|
||||
@ -555,7 +555,7 @@ public:
|
||||
if (CloneFlags & DSGraph::StripIncompleteBit)
|
||||
BitsToKeep &= ~DSNode::Incomplete;
|
||||
}
|
||||
|
||||
|
||||
DSNodeHandle getClonedNH(const DSNodeHandle &SrcNH);
|
||||
|
||||
void merge(const DSNodeHandle &NH, const DSNodeHandle &SrcNH);
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- DSGraphTraits.h - Provide generic graph interface --------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file provides GraphTraits specializations for the DataStructure graph
|
||||
@ -28,7 +28,7 @@ class DSNodeIterator : public forward_iterator<const DSNode, ptrdiff_t> {
|
||||
friend class DSNode;
|
||||
NodeTy * const Node;
|
||||
unsigned Offset;
|
||||
|
||||
|
||||
typedef DSNodeIterator<NodeTy> _Self;
|
||||
|
||||
DSNodeIterator(NodeTy *N) : Node(N), Offset(0) {} // begin iterator
|
||||
@ -56,7 +56,7 @@ public:
|
||||
Offset = I.Offset;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
pointer operator*() const {
|
||||
if (Node->isDeadNode())
|
||||
return Node->getForwardNode();
|
||||
@ -64,13 +64,13 @@ public:
|
||||
return Node->getLink(Offset).getNode();
|
||||
}
|
||||
pointer operator->() const { return operator*(); }
|
||||
|
||||
|
||||
_Self& operator++() { // Preincrement
|
||||
Offset += (1 << DS::PointerShift);
|
||||
return *this;
|
||||
}
|
||||
_Self operator++(int) { // Postincrement
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
|
||||
unsigned getOffset() const { return Offset; }
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- DSNode.h - Node definition for datastructure graphs ------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Data structure graph nodes and some implementation of DSNodeHandle.
|
||||
@ -84,7 +84,7 @@ public:
|
||||
AllocaNode = 1 << 0, // This node was allocated with alloca
|
||||
HeapNode = 1 << 1, // This node was allocated with malloc
|
||||
GlobalNode = 1 << 2, // This node was allocated by a global var decl
|
||||
UnknownNode = 1 << 3, // This node points to unknown allocated memory
|
||||
UnknownNode = 1 << 3, // This node points to unknown allocated memory
|
||||
Incomplete = 1 << 4, // This node may not be complete
|
||||
|
||||
Modified = 1 << 5, // This node is modified in this context
|
||||
@ -97,7 +97,7 @@ public:
|
||||
|
||||
Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode,
|
||||
};
|
||||
|
||||
|
||||
/// NodeType - A union of the above bits. "Shadow" nodes do not add any flags
|
||||
/// to the nodes in the data structure graph, so it is possible to have nodes
|
||||
/// with a value of 0 for their NodeType.
|
||||
@ -105,7 +105,7 @@ public:
|
||||
private:
|
||||
unsigned short NodeType;
|
||||
public:
|
||||
|
||||
|
||||
/// DSNode ctor - Create a node of the specified type, inserting it into the
|
||||
/// specified graph.
|
||||
///
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- DSSupport.h - Support for datastructure graphs -----------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Support for graph nodes, call sites, and types.
|
||||
@ -161,7 +161,7 @@ namespace llvm {
|
||||
/// DSCallSite - Representation of a call site via its call instruction,
|
||||
/// the DSNode handle for the callee function (or function pointer), and
|
||||
/// the DSNode handles for the function arguments.
|
||||
///
|
||||
///
|
||||
class DSCallSite {
|
||||
CallSite Site; // Actual call site
|
||||
Function *CalleeF; // The function called (direct call)
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- DataStructure.h - Build data structure graphs ------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Implement the LLVM data structure analysis library.
|
||||
@ -82,7 +82,7 @@ public:
|
||||
|
||||
/// releaseMemory - if the pass pipeline is done with this pass, we can
|
||||
/// release our memory...
|
||||
///
|
||||
///
|
||||
virtual void releaseMemory();
|
||||
|
||||
/// getAnalysisUsage - This obviously provides a data structure graph.
|
||||
@ -177,7 +177,7 @@ private:
|
||||
DSGraph &getOrCreateGraph(Function *F);
|
||||
|
||||
unsigned calculateGraphs(Function *F, std::vector<Function*> &Stack,
|
||||
unsigned &NextID,
|
||||
unsigned &NextID,
|
||||
hash_map<Function*, unsigned> &ValMap);
|
||||
};
|
||||
|
||||
@ -313,7 +313,7 @@ struct CompleteBUDataStructures : public BUDataStructures {
|
||||
|
||||
private:
|
||||
unsigned calculateSCCGraphs(DSGraph &FG, std::vector<DSGraph*> &Stack,
|
||||
unsigned &NextID,
|
||||
unsigned &NextID,
|
||||
hash_map<DSGraph*, unsigned> &ValMap);
|
||||
DSGraph &getOrCreateGraph(Function &F);
|
||||
void processGraph(DSGraph &G);
|
||||
@ -327,99 +327,99 @@ private:
|
||||
///
|
||||
struct EquivClassGraphs : public ModulePass {
|
||||
CompleteBUDataStructures *CBU;
|
||||
|
||||
|
||||
DSGraph *GlobalsGraph;
|
||||
|
||||
|
||||
// DSInfo - one graph for each function.
|
||||
hash_map<const Function*, DSGraph*> DSInfo;
|
||||
|
||||
|
||||
/// ActualCallees - The actual functions callable from indirect call sites.
|
||||
///
|
||||
std::set<std::pair<Instruction*, Function*> > ActualCallees;
|
||||
|
||||
|
||||
// Equivalence class where functions that can potentially be called via the
|
||||
// same function pointer are in the same class.
|
||||
EquivalenceClasses<Function*> FuncECs;
|
||||
|
||||
|
||||
/// OneCalledFunction - For each indirect call, we keep track of one
|
||||
/// target of the call. This is used to find equivalence class called by
|
||||
/// a call site.
|
||||
std::map<DSNode*, Function *> OneCalledFunction;
|
||||
|
||||
|
||||
/// GlobalECs - The equivalence classes for each global value that is merged
|
||||
/// with other global values in the DSGraphs.
|
||||
EquivalenceClasses<GlobalValue*> GlobalECs;
|
||||
|
||||
|
||||
public:
|
||||
/// EquivClassGraphs - Computes the equivalence classes and then the
|
||||
/// folded DS graphs for each class.
|
||||
///
|
||||
///
|
||||
virtual bool runOnModule(Module &M);
|
||||
|
||||
|
||||
/// print - Print out the analysis results...
|
||||
///
|
||||
void print(std::ostream &O, const Module *M) const;
|
||||
|
||||
|
||||
EquivalenceClasses<GlobalValue*> &getGlobalECs() { return GlobalECs; }
|
||||
|
||||
|
||||
/// getDSGraph - Return the data structure graph for the specified function.
|
||||
/// This returns the folded graph. The folded graph is the same as the CBU
|
||||
/// graph iff the function is in a singleton equivalence class AND all its
|
||||
/// graph iff the function is in a singleton equivalence class AND all its
|
||||
/// callees also have the same folded graph as the CBU graph.
|
||||
///
|
||||
///
|
||||
DSGraph &getDSGraph(const Function &F) const {
|
||||
hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F);
|
||||
assert(I != DSInfo.end() && "No graph computed for that function!");
|
||||
return *I->second;
|
||||
}
|
||||
|
||||
|
||||
bool hasGraph(const Function &F) const {
|
||||
return DSInfo.find(&F) != DSInfo.end();
|
||||
}
|
||||
|
||||
|
||||
/// ContainsDSGraphFor - Return true if we have a graph for the specified
|
||||
/// function.
|
||||
bool ContainsDSGraphFor(const Function &F) const {
|
||||
return DSInfo.find(&F) != DSInfo.end();
|
||||
}
|
||||
|
||||
|
||||
/// getSomeCalleeForCallSite - Return any one callee function at
|
||||
/// a call site.
|
||||
///
|
||||
///
|
||||
Function *getSomeCalleeForCallSite(const CallSite &CS) const;
|
||||
|
||||
|
||||
DSGraph &getGlobalsGraph() const {
|
||||
return *GlobalsGraph;
|
||||
}
|
||||
|
||||
|
||||
typedef std::set<std::pair<Instruction*, Function*> > ActualCalleesTy;
|
||||
const ActualCalleesTy &getActualCallees() const {
|
||||
return ActualCallees;
|
||||
}
|
||||
|
||||
|
||||
typedef ActualCalleesTy::const_iterator callee_iterator;
|
||||
callee_iterator callee_begin(Instruction *I) const {
|
||||
return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0));
|
||||
}
|
||||
|
||||
|
||||
callee_iterator callee_end(Instruction *I) const {
|
||||
I = (Instruction*)((char*)I + 1);
|
||||
return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<CompleteBUDataStructures>();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void buildIndirectFunctionSets(Module &M);
|
||||
|
||||
|
||||
unsigned processSCC(DSGraph &FG, std::vector<DSGraph*> &Stack,
|
||||
unsigned &NextID,
|
||||
unsigned &NextID,
|
||||
std::map<DSGraph*, unsigned> &ValMap);
|
||||
void processGraph(DSGraph &FG);
|
||||
|
||||
|
||||
DSGraph &getOrCreateGraph(Function &F);
|
||||
};
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Analysis/Dominators.h - Dominator Info Calculation --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the following classes:
|
||||
@ -13,13 +13,13 @@
|
||||
// 2. DominatorSet: Calculates the [reverse] dominator set for a function
|
||||
// 3. DominatorTree: Represent the ImmediateDominator as an explicit tree
|
||||
// structure.
|
||||
// 4. DominanceFrontier: Calculate and hold the dominance frontier for a
|
||||
// 4. DominanceFrontier: Calculate and hold the dominance frontier for a
|
||||
// function.
|
||||
//
|
||||
// These data structures are listed in increasing order of complexity. It
|
||||
// takes longer to calculate the dominator frontier, for example, than the
|
||||
// takes longer to calculate the dominator frontier, for example, than the
|
||||
// ImmediateDominator mapping.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ANALYSIS_DOMINATORS_H
|
||||
@ -140,9 +140,9 @@ private:
|
||||
unsigned Semi;
|
||||
unsigned Size;
|
||||
BasicBlock *Label, *Parent, *Child, *Ancestor;
|
||||
|
||||
|
||||
std::vector<BasicBlock*> Bucket;
|
||||
|
||||
|
||||
InfoRec() : Semi(0), Size(0), Label(0), Parent(0), Child(0), Ancestor(0){}
|
||||
};
|
||||
|
||||
@ -306,7 +306,7 @@ public:
|
||||
inline Node *getIDom() const { return IDom; }
|
||||
inline const std::vector<Node*> &getChildren() const { return Children; }
|
||||
|
||||
/// dominates - Returns true iff this dominates N. Note that this is not a
|
||||
/// dominates - Returns true iff this dominates N. Note that this is not a
|
||||
/// constant time operation!
|
||||
///
|
||||
inline bool dominates(const Node *N) const {
|
||||
|
@ -1,17 +1,17 @@
|
||||
//===- llvm/Analysis/Expressions.h - Expression Analysis Utils --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a package of expression analysis utilties:
|
||||
//
|
||||
// ClassifyExpr: Analyze an expression to determine the complexity of the
|
||||
// expression, and which other variables it depends on.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ANALYSIS_EXPRESSIONS_H
|
||||
|
@ -1,13 +1,13 @@
|
||||
//===- llvm/Analysis/FindUnsafePointerTypes.h - Unsafe pointers -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a pass that can be used to determine, interprocedurally,
|
||||
// This file defines a pass that can be used to determine, interprocedurally,
|
||||
// which pointer types are accessed unsafely in a program. If there is an
|
||||
// "unsafe" access to a specific pointer type, transformations that depend on
|
||||
// type safety cannot be permitted.
|
||||
@ -18,7 +18,7 @@
|
||||
// Additionally, this analysis exports a hidden command line argument that (when
|
||||
// enabled) prints out the reasons a type was determined to be unsafe. Just add
|
||||
// -printunsafeptrinst to the command line of the tool you want to get it.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ANALYSIS_UNSAFEPOINTERTYPES_H
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Analysis/FindUsedTypes.h - Find all Types in use ----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This pass is used to seek out all of the types in use by the program.
|
||||
|
@ -1,15 +1,15 @@
|
||||
//===- llvm/Analysis/Interval.h - Interval Class Declaration ----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declaration of the Interval class, which
|
||||
// represents a set of CFG nodes and is a portion of an interval partition.
|
||||
//
|
||||
//
|
||||
// Intervals have some interesting and useful properties, including the
|
||||
// following:
|
||||
// 1. The header node of an interval dominates all of the elements of the
|
||||
@ -86,9 +86,9 @@ public:
|
||||
//return find(Successors.begin(), Successors.end(), BB) != Successors.end();
|
||||
}
|
||||
|
||||
/// Equality operator. It is only valid to compare two intervals from the same
|
||||
/// partition, because of this, all we have to check is the header node for
|
||||
/// equality.
|
||||
/// Equality operator. It is only valid to compare two intervals from the
|
||||
/// same partition, because of this, all we have to check is the header node
|
||||
/// for equality.
|
||||
///
|
||||
inline bool operator==(const Interval &I) const {
|
||||
return HeaderNode == I.HeaderNode;
|
||||
@ -131,7 +131,7 @@ template <> struct GraphTraits<Interval*> {
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return succ_begin(N);
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return succ_end(N);
|
||||
}
|
||||
};
|
||||
@ -140,10 +140,10 @@ template <> struct GraphTraits<Inverse<Interval*> > {
|
||||
typedef Interval NodeType;
|
||||
typedef Interval::pred_iterator ChildIteratorType;
|
||||
static NodeType *getEntryNode(Inverse<Interval *> G) { return G.Graph; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return pred_begin(N);
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return pred_end(N);
|
||||
}
|
||||
};
|
||||
|
@ -1,16 +1,16 @@
|
||||
//===- IntervalIterator.h - Interval Iterator Declaration -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines an iterator that enumerates the intervals in a control flow
|
||||
// graph of some sort. This iterator is parametric, allowing iterator over the
|
||||
// following types of graphs:
|
||||
//
|
||||
//
|
||||
// 1. A Function* object, composed of BasicBlock nodes.
|
||||
// 2. An IntervalPartition& object, composed of Interval nodes.
|
||||
//
|
||||
@ -18,9 +18,9 @@
|
||||
// in depth first order. These intervals are completely filled in except for
|
||||
// the predecessor fields (the successor information is filled in however).
|
||||
//
|
||||
// By default, the intervals created by this iterator are deleted after they
|
||||
// By default, the intervals created by this iterator are deleted after they
|
||||
// are no longer any use to the iterator. This behavior can be changed by
|
||||
// passing a false value into the intervals_begin() function. This causes the
|
||||
// passing a false value into the intervals_begin() function. This causes the
|
||||
// IOwnMem member to be set, and the intervals to not be deleted.
|
||||
//
|
||||
// It is only safe to use this if all of the intervals are deleted by the caller
|
||||
@ -42,27 +42,27 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
// getNodeHeader - Given a source graph node and the source graph, return the
|
||||
// getNodeHeader - Given a source graph node and the source graph, return the
|
||||
// BasicBlock that is the header node. This is the opposite of
|
||||
// getSourceGraphNode.
|
||||
//
|
||||
inline BasicBlock *getNodeHeader(BasicBlock *BB) { return BB; }
|
||||
inline BasicBlock *getNodeHeader(Interval *I) { return I->getHeaderNode(); }
|
||||
|
||||
// getSourceGraphNode - Given a BasicBlock and the source graph, return the
|
||||
// getSourceGraphNode - Given a BasicBlock and the source graph, return the
|
||||
// source graph node that corresponds to the BasicBlock. This is the opposite
|
||||
// of getNodeHeader.
|
||||
//
|
||||
inline BasicBlock *getSourceGraphNode(Function *, BasicBlock *BB) {
|
||||
return BB;
|
||||
return BB;
|
||||
}
|
||||
inline Interval *getSourceGraphNode(IntervalPartition *IP, BasicBlock *BB) {
|
||||
inline Interval *getSourceGraphNode(IntervalPartition *IP, BasicBlock *BB) {
|
||||
return IP->getBlockInterval(BB);
|
||||
}
|
||||
|
||||
// addNodeToInterval - This method exists to assist the generic ProcessNode
|
||||
// with the task of adding a node to the new interval, depending on the
|
||||
// type of the source node. In the case of a CFG source graph (BasicBlock
|
||||
// with the task of adding a node to the new interval, depending on the
|
||||
// type of the source node. In the case of a CFG source graph (BasicBlock
|
||||
// case), the BasicBlock itself is added to the interval.
|
||||
//
|
||||
inline void addNodeToInterval(Interval *Int, BasicBlock *BB) {
|
||||
@ -70,8 +70,8 @@ inline void addNodeToInterval(Interval *Int, BasicBlock *BB) {
|
||||
}
|
||||
|
||||
// addNodeToInterval - This method exists to assist the generic ProcessNode
|
||||
// with the task of adding a node to the new interval, depending on the
|
||||
// type of the source node. In the case of a CFG source graph (BasicBlock
|
||||
// with the task of adding a node to the new interval, depending on the
|
||||
// type of the source node. In the case of a CFG source graph (BasicBlock
|
||||
// case), the BasicBlock itself is added to the interval. In the case of
|
||||
// an IntervalPartition source graph (Interval case), all of the member
|
||||
// BasicBlocks are added to the interval.
|
||||
@ -96,7 +96,7 @@ class IntervalIterator {
|
||||
public:
|
||||
typedef IntervalIterator<NodeTy, OrigContainer_t> _Self;
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
|
||||
|
||||
IntervalIterator() {} // End iterator, empty stack
|
||||
IntervalIterator(Function *M, bool OwnMemory) : IOwnMem(OwnMemory) {
|
||||
OrigContainer = M;
|
||||
@ -148,14 +148,14 @@ public:
|
||||
IntStack.pop();
|
||||
} while (!IntStack.empty());
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
inline _Self operator++(int) { // Postincrement
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
|
||||
private:
|
||||
// ProcessInterval - This method is used during the construction of the
|
||||
// ProcessInterval - This method is used during the construction of the
|
||||
// interval graph. It walks through the source graph, recursively creating
|
||||
// an interval per invokation until the entire graph is covered. This uses
|
||||
// the ProcessNode method to add all of the nodes to the interval.
|
||||
@ -178,7 +178,7 @@ private:
|
||||
IntStack.push(std::make_pair(Int, succ_begin(Int)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ProcessNode - This method is called by ProcessInterval to add nodes to the
|
||||
// interval being constructed, and it is also called recursively as it walks
|
||||
// the source graph. A node is added to the current interval only if all of
|
||||
@ -191,7 +191,7 @@ private:
|
||||
void ProcessNode(Interval *Int, NodeTy *Node) {
|
||||
assert(Int && "Null interval == bad!");
|
||||
assert(Node && "Null Node == bad!");
|
||||
|
||||
|
||||
BasicBlock *NodeHeader = getNodeHeader(Node);
|
||||
|
||||
if (Visited.count(NodeHeader)) { // Node already been visited?
|
||||
@ -202,7 +202,7 @@ private:
|
||||
Int->Successors.push_back(NodeHeader);
|
||||
}
|
||||
} else { // Otherwise, not in interval yet
|
||||
for (typename IGT::ChildIteratorType I = IGT::child_begin(Node),
|
||||
for (typename IGT::ChildIteratorType I = IGT::child_begin(Node),
|
||||
E = IGT::child_end(Node); I != E; ++I) {
|
||||
if (!Int->contains(*I)) { // If pred not in interval, we can't be
|
||||
if (!Int->isSuccessor(NodeHeader)) // Add only if not already in set
|
||||
@ -215,14 +215,14 @@ private:
|
||||
// already. In this case, we must add BB to the interval!
|
||||
addNodeToInterval(Int, Node);
|
||||
Visited.insert(NodeHeader); // The node has now been visited!
|
||||
|
||||
|
||||
if (Int->isSuccessor(NodeHeader)) {
|
||||
// If we were in the successor list from before... remove from succ list
|
||||
Int->Successors.erase(std::remove(Int->Successors.begin(),
|
||||
Int->Successors.end(), NodeHeader),
|
||||
Int->Successors.end(), NodeHeader),
|
||||
Int->Successors.end());
|
||||
}
|
||||
|
||||
|
||||
// Now that we have discovered that Node is in the interval, perhaps some
|
||||
// of its successors are as well?
|
||||
for (typename GT::ChildIteratorType It = GT::child_begin(Node),
|
||||
@ -236,7 +236,7 @@ typedef IntervalIterator<BasicBlock, Function> function_interval_iterator;
|
||||
typedef IntervalIterator<Interval, IntervalPartition> interval_part_interval_iterator;
|
||||
|
||||
|
||||
inline function_interval_iterator intervals_begin(Function *F,
|
||||
inline function_interval_iterator intervals_begin(Function *F,
|
||||
bool DeleteInts = true) {
|
||||
return function_interval_iterator(F, DeleteInts);
|
||||
}
|
||||
@ -244,7 +244,7 @@ inline function_interval_iterator intervals_end(Function *) {
|
||||
return function_interval_iterator();
|
||||
}
|
||||
|
||||
inline interval_part_interval_iterator
|
||||
inline interval_part_interval_iterator
|
||||
intervals_begin(IntervalPartition &IP, bool DeleteIntervals = true) {
|
||||
return interval_part_interval_iterator(IP, DeleteIntervals);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- IntervalPartition.h - Interval partition Calculation -----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declaration of the IntervalPartition class, which
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Analysis/LoadValueNumbering.h - Value # Load Insts --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a value numbering pass that value #'s load instructions.
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Analysis/LoopInfo.h - Natural Loop Calculator -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the LoopInfo class that is used to identify natural loops
|
||||
@ -41,8 +41,8 @@ class PHINode;
|
||||
class Instruction;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// Loop class - Instances of this class are used to represent loops that are
|
||||
/// detected in the flow graph
|
||||
/// Loop class - Instances of this class are used to represent loops that are
|
||||
/// detected in the flow graph
|
||||
///
|
||||
class Loop {
|
||||
Loop *ParentLoop;
|
||||
@ -307,10 +307,10 @@ template <> struct GraphTraits<const Loop*> {
|
||||
typedef std::vector<Loop*>::const_iterator ChildIteratorType;
|
||||
|
||||
static NodeType *getEntryNode(const Loop *L) { return L; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->begin();
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return N->end();
|
||||
}
|
||||
};
|
||||
@ -320,10 +320,10 @@ template <> struct GraphTraits<Loop*> {
|
||||
typedef std::vector<Loop*>::const_iterator ChildIteratorType;
|
||||
|
||||
static NodeType *getEntryNode(Loop *L) { return L; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->begin();
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return N->end();
|
||||
}
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Analysis/Passes.h - Constructors for analyses ------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header file defines prototypes for accessor functions that expose passes
|
||||
@ -47,55 +47,55 @@ namespace llvm {
|
||||
// createNoAAPass - This pass implements a "I don't know" alias analysis.
|
||||
//
|
||||
ImmutablePass *createNoAAPass();
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createBasicAliasAnalysisPass - This pass implements the default alias
|
||||
// analysis.
|
||||
//
|
||||
ImmutablePass *createBasicAliasAnalysisPass();
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createAndersensPass - This pass implements Andersen's interprocedural alias
|
||||
// analysis.
|
||||
//
|
||||
ModulePass *createAndersensPass();
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createBasicVNPass - This pass walks SSA def-use chains to trivially
|
||||
// identify lexically identical expressions.
|
||||
//
|
||||
ImmutablePass *createBasicVNPass();
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createProfileLoaderPass - This pass loads information from a profile dump
|
||||
// file.
|
||||
//
|
||||
ModulePass *createProfileLoaderPass();
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createNoProfileInfoPass - This pass implements the default "no profile".
|
||||
//
|
||||
ImmutablePass *createNoProfileInfoPass();
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createDSAAPass - This pass implements simple context sensitive alias
|
||||
// analysis.
|
||||
//
|
||||
ModulePass *createDSAAPass();
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createDSOptPass - This pass uses DSA to do a series of simple
|
||||
// optimizations.
|
||||
//
|
||||
ModulePass *createDSOptPass();
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createSteensgaardPass - This pass uses the data structure graphs to do a
|
||||
|
@ -1,10 +1,10 @@
|
||||
//=- llvm/Analysis/PostDominators.h - Post Dominator Calculation-*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file exposes interfaces to post dominance information.
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Analysis/ProfileInfo.h - Profile Info Interface -----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the generic ProfileInfo interface, which is used as the
|
||||
@ -39,7 +39,7 @@ namespace llvm {
|
||||
std::map<std::pair<BasicBlock*, BasicBlock*>, unsigned> EdgeCounts;
|
||||
public:
|
||||
virtual ~ProfileInfo(); // We want to be subclassed
|
||||
|
||||
|
||||
//===------------------------------------------------------------------===//
|
||||
/// Profile Information Queries
|
||||
///
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- ProfileInfoLoader.h - Load & convert profile information -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The ProfileInfoLoader class is used to load and represent profiling
|
||||
|
@ -4,9 +4,9 @@
|
||||
|*
|
||||
|* This file was developed by the LLVM research group and is distributed under
|
||||
|* the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
|*
|
||||
|*
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|*
|
||||
|*
|
||||
|* This file defines constants shared by the various different profiling
|
||||
|* runtime libraries and the LLVM C++ profile info loader. It must be a
|
||||
|* C header because, at present, the profiling runtimes are written in C.
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Analysis/ScalarEvolution.h - Scalar Evolution -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The ScalarEvolution class is an LLVM pass which can be used to analyze and
|
||||
@ -15,7 +15,7 @@
|
||||
//
|
||||
// This analysis is primarily useful for induction variable substitution and
|
||||
// strength reduction.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ANALYSIS_SCALAREVOLUTION_H
|
||||
@ -89,7 +89,7 @@ namespace llvm {
|
||||
/// the same value, but which uses the concrete value Conc instead of the
|
||||
/// symbolic value. If this SCEV does not use the symbolic value, it
|
||||
/// returns itself.
|
||||
virtual SCEVHandle
|
||||
virtual SCEVHandle
|
||||
replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
|
||||
const SCEVHandle &Conc) const = 0;
|
||||
|
||||
@ -102,7 +102,7 @@ namespace llvm {
|
||||
///
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &OS, const SCEV &S) {
|
||||
S.print(OS);
|
||||
return OS;
|
||||
@ -121,7 +121,7 @@ namespace llvm {
|
||||
virtual const Type *getType() const;
|
||||
virtual bool hasComputableLoopEvolution(const Loop *L) const;
|
||||
virtual void print(std::ostream &OS) const;
|
||||
virtual SCEVHandle
|
||||
virtual SCEVHandle
|
||||
replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
|
||||
const SCEVHandle &Conc) const;
|
||||
|
||||
@ -141,7 +141,7 @@ namespace llvm {
|
||||
S->addRef();
|
||||
}
|
||||
SCEVHandle(const SCEVHandle &RHS) : S(RHS.S) {
|
||||
S->addRef();
|
||||
S->addRef();
|
||||
}
|
||||
~SCEVHandle() { S->dropRef(); }
|
||||
|
||||
@ -190,7 +190,7 @@ namespace llvm {
|
||||
void *Impl; // ScalarEvolution uses the pimpl pattern
|
||||
public:
|
||||
ScalarEvolution() : Impl(0) {}
|
||||
|
||||
|
||||
/// getSCEV - Return a SCEV expression handle for the full generality of the
|
||||
/// specified expression.
|
||||
SCEVHandle getSCEV(Value *V) const;
|
||||
|
@ -1,14 +1,14 @@
|
||||
//===- llvm/Analysis/ScalarEvolutionExpressions.h - SCEV Exprs --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the classes used to represent and build scalar expressions.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ANALYSIS_SCALAREVOLUTION_EXPRESSIONS_H
|
||||
@ -33,7 +33,7 @@ namespace llvm {
|
||||
class SCEVConstant : public SCEV {
|
||||
ConstantInt *V;
|
||||
SCEVConstant(ConstantInt *v) : SCEV(scConstant), V(v) {}
|
||||
|
||||
|
||||
virtual ~SCEVConstant();
|
||||
public:
|
||||
/// get method - This just gets and returns a new SCEVConstant object.
|
||||
@ -86,7 +86,7 @@ namespace llvm {
|
||||
|
||||
const SCEVHandle &getOperand() const { return Op; }
|
||||
virtual const Type *getType() const { return Ty; }
|
||||
|
||||
|
||||
virtual bool isLoopInvariant(const Loop *L) const {
|
||||
return Op->isLoopInvariant(L);
|
||||
}
|
||||
@ -132,7 +132,7 @@ namespace llvm {
|
||||
|
||||
const SCEVHandle &getOperand() const { return Op; }
|
||||
virtual const Type *getType() const { return Ty; }
|
||||
|
||||
|
||||
virtual bool isLoopInvariant(const Loop *L) const {
|
||||
return Op->isLoopInvariant(L);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
namespace llvm {
|
||||
namespace llvm {
|
||||
class BasicBlock;
|
||||
class Function;
|
||||
class Module;
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Analysis/ValueNumbering.h - Value #'ing Interface ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the abstract ValueNumbering interface, which is used as the
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Analysis/Verifier.h - Module Verifier --------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the function verifier interface, that can be used for some
|
||||
@ -28,12 +28,12 @@ class Module;
|
||||
class Function;
|
||||
|
||||
/// @brief An enumeration to specify the action to be taken if errors found.
|
||||
///
|
||||
///
|
||||
/// This enumeration is used in the functions below to indicate what should
|
||||
/// happen if the verifier finds errors. Each of the functions that uses
|
||||
/// this enumeration as an argument provides a default value for it. The
|
||||
/// actions are listed below.
|
||||
enum VerifierFailureAction {
|
||||
enum VerifierFailureAction {
|
||||
AbortProcessAction, ///< verifyModule will print to stderr and abort()
|
||||
ThrowExceptionAction, ///< verifyModule will throw errors as std::string
|
||||
PrintMessageAction, ///< verifyModule will print to stderr and return true
|
||||
@ -45,15 +45,15 @@ enum VerifierFailureAction {
|
||||
/// Check a module or function for validity. When the pass is used, the
|
||||
/// action indicated by the \p action argument will be used if errors are
|
||||
/// found.
|
||||
FunctionPass *createVerifierPass(
|
||||
FunctionPass *createVerifierPass(
|
||||
VerifierFailureAction action = AbortProcessAction ///< Action to take
|
||||
);
|
||||
|
||||
/// @brief Check a module for errors.
|
||||
/// @brief Check a module for errors.
|
||||
///
|
||||
/// If there are no errors, the function returns false. If an error is found,
|
||||
/// If there are no errors, the function returns false. If an error is found,
|
||||
/// the action taken depends on the \p action parameter.
|
||||
/// This should only be used for debugging, because it plays games with
|
||||
/// This should only be used for debugging, because it plays games with
|
||||
/// PassManagers and stuff.
|
||||
|
||||
bool verifyModule(
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Argument.h - Definition of the Argument class ------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the Argument class, which represents an incoming formal
|
||||
@ -41,7 +41,7 @@ public:
|
||||
|
||||
inline const Function *getParent() const { return Parent; }
|
||||
inline Function *getParent() { return Parent; }
|
||||
|
||||
|
||||
// getNext/Prev - Return the next or previous argument in the list.
|
||||
Argument *getNext() { return Next; }
|
||||
const Argument *getNext() const { return Next; }
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- AsmAnnotationWriter.h - Itf for annotation .ll files - --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Clients of the assembly writer can use this interface to add their own
|
||||
@ -26,7 +26,7 @@ class BasicBlock;
|
||||
class Instruction;
|
||||
|
||||
struct AssemblyAnnotationWriter {
|
||||
|
||||
|
||||
// emitFunctionAnnot - This may be implemented to emit a string right before
|
||||
// the start of a function.
|
||||
virtual void emitFunctionAnnot(const Function *F, std::ostream &OS) {}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Assembly/CachedWriter.h - Printer Accellerator -----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a 'CachedWriter' class that is used to accelerate printing
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Assembly/Parser.h - Parser for VM assembly files ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// These classes are implemented by the lib/AsmParser library.
|
||||
@ -38,12 +38,12 @@ Module *ParseAssemblyFile(const std::string &Filename);// throw (ParseException)
|
||||
//
|
||||
class ParseException {
|
||||
public:
|
||||
ParseException(const std::string &filename, const std::string &message,
|
||||
ParseException(const std::string &filename, const std::string &message,
|
||||
int LineNo = -1, int ColNo = -1);
|
||||
|
||||
ParseException(const ParseException &E);
|
||||
|
||||
// getMessage - Return the message passed in at construction time plus extra
|
||||
// getMessage - Return the message passed in at construction time plus extra
|
||||
// information extracted from the options used to parse with...
|
||||
//
|
||||
const std::string getMessage() const;
|
||||
@ -57,8 +57,8 @@ public:
|
||||
}
|
||||
|
||||
// getErrorLocation - Return the line and column number of the error in the
|
||||
// input source file. The source filename can be derived from the
|
||||
// ParserOptions in effect. If positional information is not applicable,
|
||||
// input source file. The source filename can be derived from the
|
||||
// ParserOptions in effect. If positional information is not applicable,
|
||||
// these will return a value of -1.
|
||||
//
|
||||
inline const void getErrorLocation(int &Line, int &Column) const {
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Assembly/PrintModulePass.h - Printing Pass ----------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines two passes to print out a module. The PrintModulePass pass
|
||||
@ -36,7 +36,7 @@ public:
|
||||
~PrintModulePass() {
|
||||
if (DeleteStream) delete Out;
|
||||
}
|
||||
|
||||
|
||||
bool runOnModule(Module &M) {
|
||||
(*Out) << M << std::flush;
|
||||
return false;
|
||||
@ -61,7 +61,7 @@ public:
|
||||
inline ~PrintFunctionPass() {
|
||||
if (DeleteStream) delete Out;
|
||||
}
|
||||
|
||||
|
||||
// runOnFunction - This pass just prints a banner followed by the function as
|
||||
// it's processed.
|
||||
//
|
||||
@ -69,7 +69,7 @@ public:
|
||||
(*Out) << Banner << (Value&)F;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Assembly/Writer.h - Printer for LLVM assembly files --*- C++ -*-=//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This functionality is implemented by lib/VMCore/AsmWriter.cpp.
|
||||
@ -34,7 +34,7 @@ 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. If you specify a Module for context,
|
||||
// then even constants get pretty-printed; for example, the type of a null
|
||||
// then even constants get pretty-printed; for example, the type of a null
|
||||
// pointer is printed symbolically.
|
||||
//
|
||||
std::ostream &WriteAsOperand(std::ostream &, const Value *, bool PrintTy = true,
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/BasicBlock.h - Represent a basic block in the VM ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
//
|
||||
@ -16,7 +16,7 @@
|
||||
//
|
||||
///===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Note that well formed basic blocks are formed of a list of instructions
|
||||
// Note that well formed basic blocks are formed of a list of instructions
|
||||
// followed by a single TerminatorInst instruction. TerminatorInst's may not
|
||||
// occur in the middle of basic blocks, and must terminate the blocks.
|
||||
//
|
||||
@ -91,7 +91,7 @@ public:
|
||||
///
|
||||
TerminatorInst *getTerminator();
|
||||
const TerminatorInst *const getTerminator() const;
|
||||
|
||||
|
||||
/// removeFromParent - This method unlinks 'this' from the containing
|
||||
/// function, but does not delete it.
|
||||
///
|
||||
@ -144,14 +144,14 @@ public:
|
||||
/// 'delete' a whole class at a time, even though there may be circular
|
||||
/// references... first all references are dropped, and all use counts go to
|
||||
/// zero. Then everything is delete'd for real. Note that no operations are
|
||||
/// valid on an object that has "dropped all references", except operator
|
||||
/// valid on an object that has "dropped all references", except operator
|
||||
/// delete.
|
||||
///
|
||||
void dropAllReferences();
|
||||
|
||||
/// removePredecessor - This method is used to notify a BasicBlock that the
|
||||
/// specified Predecessor of the block is no longer able to reach it. This is
|
||||
/// actually not used to update the Predecessor list, but is actually used to
|
||||
/// actually not used to update the Predecessor list, but is actually used to
|
||||
/// update the PHI nodes that reside in the block. Note that this should be
|
||||
/// called while the predecessor still refers to this block.
|
||||
///
|
||||
@ -164,7 +164,7 @@ public:
|
||||
/// new BB, including the old terminator. The newly formed BasicBlock is
|
||||
/// returned. This function invalidates the specified iterator.
|
||||
///
|
||||
/// Note that this only works on well formed basic blocks (must have a
|
||||
/// Note that this only works on well formed basic blocks (must have a
|
||||
/// terminator), and 'I' must not be the end of instruction list (which would
|
||||
/// cause a degenerate basic block to be formed, having a terminator inside of
|
||||
/// the basic block).
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- CallGraphSCCPass.h - Pass that operates BU on call graph -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the CallGraphSCCPass class, which is used for passes which
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Constant.h - Constant class definition -------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declaration of the Constant class.
|
||||
@ -38,7 +38,7 @@ public:
|
||||
|
||||
// Specialize get/setOperand for Constant's as their operands are always
|
||||
// constants as well.
|
||||
Constant *getOperand(unsigned i) {
|
||||
Constant *getOperand(unsigned i) {
|
||||
return static_cast<Constant*>(User::getOperand(i));
|
||||
}
|
||||
const Constant *getOperand(unsigned i) const {
|
||||
@ -56,7 +56,7 @@ public:
|
||||
/// destroyConstantImpl as the last thing they do, to destroy all users and
|
||||
/// delete this.
|
||||
virtual void destroyConstant() { assert(0 && "Not reached!"); }
|
||||
|
||||
|
||||
//// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const Constant *) { return true; }
|
||||
static inline bool classof(const GlobalValue *) { return true; }
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Constants.h - Constant class subclass definitions --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declarations for the subclasses of Constant, which
|
||||
@ -356,7 +356,7 @@ public:
|
||||
/// get() - Static factory methods - Return objects of the specified value
|
||||
static Constant *get(const ArrayType *T, const std::vector<Constant*> &);
|
||||
static Constant *get(const std::string &Initializer);
|
||||
|
||||
|
||||
/// getType - Specialize the getType() method to always return an ArrayType,
|
||||
/// which reduces the amount of casting needed in parts of the compiler.
|
||||
///
|
||||
@ -423,7 +423,7 @@ public:
|
||||
virtual void destroyConstant();
|
||||
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To,
|
||||
bool DisableChecking = false);
|
||||
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const ConstantStruct *) { return true; }
|
||||
static bool classof(const Value *V) {
|
||||
@ -446,7 +446,7 @@ public:
|
||||
/// get() - Static factory methods - Return objects of the specified value
|
||||
static Constant *get(const PackedType *T, const std::vector<Constant*> &);
|
||||
static Constant *get(const std::vector<Constant*> &V);
|
||||
|
||||
|
||||
/// getType - Specialize the getType() method to always return an PackedType,
|
||||
/// which reduces the amount of casting needed in parts of the compiler.
|
||||
///
|
||||
@ -519,12 +519,12 @@ class ConstantExpr : public Constant {
|
||||
friend struct ConstantCreator<ConstantExpr,Type,
|
||||
std::pair<unsigned, std::vector<Constant*> > >;
|
||||
friend struct ConvertConstantType<ConstantExpr, Type>;
|
||||
|
||||
|
||||
protected:
|
||||
ConstantExpr(const Type *Ty, unsigned Opcode, Use *Ops, unsigned NumOps)
|
||||
: Constant(Ty, ConstantExprVal, Ops, NumOps) {
|
||||
// Operation type (an Instruction opcode) is stored as the SubclassData.
|
||||
SubclassData = Opcode;
|
||||
SubclassData = Opcode;
|
||||
}
|
||||
|
||||
// These private methods are used by the type resolution code to create
|
||||
@ -537,13 +537,13 @@ protected:
|
||||
Constant *C1, Constant *C2, Constant *C3);
|
||||
static Constant *getGetElementPtrTy(const Type *Ty, Constant *C,
|
||||
const std::vector<Value*> &IdxList);
|
||||
|
||||
|
||||
public:
|
||||
// Static methods to construct a ConstantExpr of different kinds. Note that
|
||||
// these methods may return a object that is not an instance of the
|
||||
// ConstantExpr class, because they will attempt to fold the constant
|
||||
// expression into something simpler if possible.
|
||||
|
||||
|
||||
/// Cast constant expr
|
||||
///
|
||||
static Constant *getCast(Constant *C, const Type *Ty);
|
||||
@ -603,29 +603,29 @@ public:
|
||||
const std::vector<Constant*> &IdxList);
|
||||
static Constant *getGetElementPtr(Constant *C,
|
||||
const std::vector<Value*> &IdxList);
|
||||
|
||||
|
||||
/// isNullValue - Return true if this is the value that would be returned by
|
||||
/// getNullValue.
|
||||
virtual bool isNullValue() const { return false; }
|
||||
|
||||
|
||||
/// getOpcode - Return the opcode at the root of this constant expression
|
||||
unsigned getOpcode() const { return SubclassData; }
|
||||
|
||||
/// getOpcodeName - Return a string representation for an opcode.
|
||||
const char *getOpcodeName() const;
|
||||
|
||||
|
||||
virtual void destroyConstant();
|
||||
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To,
|
||||
bool DisableChecking = false);
|
||||
|
||||
|
||||
/// Override methods to provide more type information...
|
||||
inline Constant *getOperand(unsigned i) {
|
||||
inline Constant *getOperand(unsigned i) {
|
||||
return cast<Constant>(User::getOperand(i));
|
||||
}
|
||||
inline Constant *getOperand(unsigned i) const {
|
||||
return const_cast<Constant*>(cast<Constant>(User::getOperand(i)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const ConstantExpr *) { return true; }
|
||||
|
@ -1,13 +1,13 @@
|
||||
//===-- llvm/DerivedTypes.h - Classes for handling data types ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declarations of classes that represent "derived
|
||||
// This file contains the declarations of classes that represent "derived
|
||||
// types". These are things like "arrays of x" or "structure of x, y, z" or
|
||||
// "method returning x taking (y,z) as parameters", etc...
|
||||
//
|
||||
@ -61,7 +61,7 @@ protected:
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
@ -112,12 +112,12 @@ class FunctionType : public DerivedType {
|
||||
const FunctionType &operator=(const FunctionType &); // Do not implement
|
||||
protected:
|
||||
/// This should really be private, but it squelches a bogus warning
|
||||
/// from GCC to make them protected: warning: `class FunctionType' only
|
||||
/// from GCC to make them protected: warning: `class FunctionType' only
|
||||
/// defines private constructors and has no friends
|
||||
///
|
||||
/// Private ctor - Only can be created by a static member...
|
||||
///
|
||||
FunctionType(const Type *Result, const std::vector<const Type*> &Params,
|
||||
FunctionType(const Type *Result, const std::vector<const Type*> &Params,
|
||||
bool IsVarArgs);
|
||||
|
||||
public:
|
||||
@ -146,7 +146,7 @@ public:
|
||||
// Implement the AbstractTypeUser interface.
|
||||
virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
|
||||
virtual void typeBecameConcrete(const DerivedType *AbsTy);
|
||||
|
||||
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const FunctionType *T) { return true; }
|
||||
static inline bool classof(const Type *T) {
|
||||
@ -171,7 +171,7 @@ public:
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const CompositeType *T) { return true; }
|
||||
static inline bool classof(const Type *T) {
|
||||
return T->getTypeID() == ArrayTyID ||
|
||||
return T->getTypeID() == ArrayTyID ||
|
||||
T->getTypeID() == StructTyID ||
|
||||
T->getTypeID() == PointerTyID ||
|
||||
T->getTypeID() == PackedTyID;
|
||||
@ -188,7 +188,7 @@ class StructType : public CompositeType {
|
||||
|
||||
protected:
|
||||
/// This should really be private, but it squelches a bogus warning
|
||||
/// from GCC to make them protected: warning: `class StructType' only
|
||||
/// from GCC to make them protected: warning: `class StructType' only
|
||||
/// defines private constructors and has no friends
|
||||
///
|
||||
/// Private ctor - Only can be created by a static member...
|
||||
@ -231,12 +231,12 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/// SequentialType - This is the superclass of the array, pointer and packed
|
||||
/// SequentialType - This is the superclass of the array, pointer and packed
|
||||
/// type classes. All of these represent "arrays" in memory. The array type
|
||||
/// represents a specifically sized array, pointer types are unsized/unknown
|
||||
/// size arrays, packed types represent specifically sized arrays that
|
||||
/// allow for use of SIMD instructions. SequentialType holds the common
|
||||
/// features of all, which stem from the fact that all three lay their
|
||||
/// size arrays, packed types represent specifically sized arrays that
|
||||
/// allow for use of SIMD instructions. SequentialType holds the common
|
||||
/// features of all, which stem from the fact that all three lay their
|
||||
/// components out in memory identically.
|
||||
///
|
||||
class SequentialType : public CompositeType {
|
||||
@ -280,7 +280,7 @@ class ArrayType : public SequentialType {
|
||||
const ArrayType &operator=(const ArrayType &); // Do not implement
|
||||
protected:
|
||||
/// This should really be private, but it squelches a bogus warning
|
||||
/// from GCC to make them protected: warning: `class ArrayType' only
|
||||
/// from GCC to make them protected: warning: `class ArrayType' only
|
||||
/// defines private constructors and has no friends
|
||||
///
|
||||
/// Private ctor - Only can be created by a static member...
|
||||
@ -316,7 +316,7 @@ class PackedType : public SequentialType {
|
||||
const PackedType &operator=(const PackedType &); // Do not implement
|
||||
protected:
|
||||
/// This should really be private, but it squelches a bogus warning
|
||||
/// from GCC to make them protected: warning: `class PackedType' only
|
||||
/// from GCC to make them protected: warning: `class PackedType' only
|
||||
/// defines private constructors and has no friends
|
||||
///
|
||||
/// Private ctor - Only can be created by a static member...
|
||||
@ -351,7 +351,7 @@ class PointerType : public SequentialType {
|
||||
const PointerType &operator=(const PointerType &); // Do not implement
|
||||
protected:
|
||||
// This should really be private, but it squelches a bogus warning
|
||||
// from GCC to make them protected: warning: `class PointerType' only
|
||||
// from GCC to make them protected: warning: `class PointerType' only
|
||||
// defines private constructors and has no friends
|
||||
|
||||
// Private ctor - Only can be created by a static member...
|
||||
@ -380,7 +380,7 @@ class OpaqueType : public DerivedType {
|
||||
const OpaqueType &operator=(const OpaqueType &); // DO NOT IMPLEMENT
|
||||
protected:
|
||||
/// This should really be private, but it squelches a bogus warning
|
||||
/// from GCC to make them protected: warning: `class OpaqueType' only
|
||||
/// from GCC to make them protected: warning: `class OpaqueType' only
|
||||
/// defines private constructors and has no friends
|
||||
///
|
||||
/// Private ctor - Only can be created by a static member...
|
||||
|
@ -1,13 +1,13 @@
|
||||
//===-- llvm/Function.h - Class to represent a single function --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declaration of the Function class, which represents a
|
||||
// This file contains the declaration of the Function class, which represents a
|
||||
// single function/procedure in LLVM.
|
||||
//
|
||||
// A function basically consists of a list of basic blocks, a list of arguments,
|
||||
@ -66,7 +66,7 @@ private:
|
||||
ArgumentListType ArgumentList; // The formal arguments
|
||||
|
||||
SymbolTable *SymTab;
|
||||
|
||||
|
||||
friend class SymbolTableListTraits<Function, Module, Module>;
|
||||
|
||||
void setParent(Module *parent);
|
||||
@ -161,7 +161,7 @@ public:
|
||||
inline SymbolTable &getSymbolTable() { return *SymTab; }
|
||||
inline const SymbolTable &getSymbolTable() const { return *SymTab; }
|
||||
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// BasicBlock iterator forwarding functions
|
||||
//
|
||||
@ -209,7 +209,7 @@ public:
|
||||
/// in your path.
|
||||
///
|
||||
void viewCFG() const;
|
||||
|
||||
|
||||
/// viewCFGOnly - This function is meant for use from the debugger. It works
|
||||
/// just like viewCFG, but it does not include the contents of basic blocks
|
||||
/// into the nodes, just the label. If you are only interested in the CFG
|
||||
@ -228,7 +228,7 @@ public:
|
||||
/// 'delete' a whole module at a time, even though there may be circular
|
||||
/// references... first all references are dropped, and all use counts go to
|
||||
/// zero. Then everything is deleted for real. Note that no operations are
|
||||
/// valid on an object that has "dropped all references", except operator
|
||||
/// valid on an object that has "dropped all references", except operator
|
||||
/// delete.
|
||||
///
|
||||
/// Since no other object in the module can have references into the body of a
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/GlobalValue.h - Class to represent a global value --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file is a common base class of all globally definable objects. As such,
|
||||
@ -48,9 +48,9 @@ public:
|
||||
}
|
||||
|
||||
/// If the usage is empty (except transitively dead constants), then this
|
||||
/// global value can can be safely deleted since the destructor will
|
||||
/// global value can can be safely deleted since the destructor will
|
||||
/// delete the dead constants as well.
|
||||
/// @brief Determine if the usage of this global value is empty except
|
||||
/// @brief Determine if the usage of this global value is empty except
|
||||
/// for transitively dead constants.
|
||||
bool use_empty_except_constants();
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const GlobalValue *T) { return true; }
|
||||
static inline bool classof(const Value *V) {
|
||||
return V->getValueType() == Value::FunctionVal ||
|
||||
return V->getValueType() == Value::FunctionVal ||
|
||||
V->getValueType() == Value::GlobalVariableVal;
|
||||
}
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/GlobalVariable.h - GlobalVariable class ------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declaration of the GlobalVariable class, which
|
||||
@ -110,12 +110,12 @@ public:
|
||||
/// and deletes it.
|
||||
///
|
||||
void eraseFromParent();
|
||||
|
||||
/// Override Constant's implementation of this method so we can
|
||||
|
||||
/// Override Constant's implementation of this method so we can
|
||||
/// replace constant initializers.
|
||||
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To,
|
||||
bool DisableChecking = false);
|
||||
|
||||
|
||||
virtual void print(std::ostream &OS) const;
|
||||
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
|
@ -1,14 +1,14 @@
|
||||
//===-- llvm/InstrTypes.h - Important Instruction subclasses ----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines various meta classes of instructions that exist in the VM
|
||||
// representation. Specific concrete subclasses of these may be found in the
|
||||
// representation. Specific concrete subclasses of these may be found in the
|
||||
// i*.h files...
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -24,7 +24,7 @@ namespace llvm {
|
||||
// TerminatorInst Class
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// TerminatorInst - Subclasses of this class are all able to terminate a basic
|
||||
/// TerminatorInst - Subclasses of this class are all able to terminate a basic
|
||||
/// block. Thus, these are all the flow control type of operations.
|
||||
///
|
||||
class TerminatorInst : public Instruction {
|
||||
@ -153,7 +153,7 @@ public:
|
||||
static BinaryOperator *create(BinaryOps Op, Value *S1, Value *S2,
|
||||
const std::string &Name = "",
|
||||
Instruction *InsertBefore = 0);
|
||||
|
||||
|
||||
/// create() - Construct a binary instruction, given the opcode and the two
|
||||
/// operands. Also automatically insert this instruction to the end of the
|
||||
/// BasicBlock specified.
|
||||
@ -183,11 +183,11 @@ public:
|
||||
return create(Instruction::OPC, V1, V2, Name, I);\
|
||||
}
|
||||
#include "llvm/Instruction.def"
|
||||
|
||||
|
||||
|
||||
/// Helper functions to construct and inspect unary operations (NEG and NOT)
|
||||
/// via binary operators SUB and XOR:
|
||||
///
|
||||
///
|
||||
/// createNeg, createNot - Create the NEG and NOT
|
||||
/// instructions out of SUB and XOR instructions.
|
||||
///
|
||||
@ -207,13 +207,13 @@ public:
|
||||
|
||||
/// getNegArgument, getNotArgument - Helper functions to extract the
|
||||
/// unary argument of a NEG or NOT operation implemented via Sub or Xor.
|
||||
///
|
||||
///
|
||||
static const Value* getNegArgument(const BinaryOperator* Bop);
|
||||
static Value* getNegArgument( BinaryOperator* Bop);
|
||||
static const Value* getNotArgument(const BinaryOperator* Bop);
|
||||
static Value* getNotArgument( BinaryOperator* Bop);
|
||||
|
||||
BinaryOps getOpcode() const {
|
||||
BinaryOps getOpcode() const {
|
||||
return static_cast<BinaryOps>(Instruction::getOpcode());
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ public:
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const BinaryOperator *) { return true; }
|
||||
static inline bool classof(const Instruction *I) {
|
||||
return I->getOpcode() >= BinaryOpsBegin && I->getOpcode() < BinaryOpsEnd;
|
||||
return I->getOpcode() >= BinaryOpsBegin && I->getOpcode() < BinaryOpsEnd;
|
||||
}
|
||||
static inline bool classof(const Value *V) {
|
||||
return isa<Instruction>(V) && classof(cast<Instruction>(V));
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Instruction.h - Instruction class definition -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declaration of the Instruction class, which is the
|
||||
@ -70,7 +70,7 @@ public:
|
||||
/// extra information (e.g. load is volatile) agree.
|
||||
bool isIdenticalTo(Instruction *I) const;
|
||||
|
||||
|
||||
|
||||
// Accessor methods...
|
||||
//
|
||||
inline const BasicBlock *getParent() const { return Parent; }
|
||||
@ -94,7 +94,7 @@ public:
|
||||
void eraseFromParent();
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/// Subclass classification... getOpcode() returns a member of
|
||||
/// Subclass classification... getOpcode() returns a member of
|
||||
/// one of the enums that is coming soon (down below)...
|
||||
///
|
||||
unsigned getOpcode() const { return getValueType() - InstructionVal; }
|
||||
@ -144,10 +144,10 @@ public:
|
||||
/// isTrappingInstruction - Return true if the instruction may trap.
|
||||
///
|
||||
bool isTrapping() const {
|
||||
return isTrapping(getOpcode());
|
||||
return isTrapping(getOpcode());
|
||||
}
|
||||
static bool isTrapping(unsigned op);
|
||||
|
||||
|
||||
virtual void print(std::ostream &OS) const { print(OS, 0); }
|
||||
void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
|
||||
|
||||
@ -156,7 +156,7 @@ public:
|
||||
static inline bool classof(const Value *V) {
|
||||
return V->getValueType() >= Value::InstructionVal;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Exported enumerations...
|
||||
//
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Instructions.h - Instruction subclass definitions --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file exposes the class definitions of all of the subclasses of the
|
||||
@ -34,9 +34,9 @@ class PointerType;
|
||||
///
|
||||
class AllocationInst : public UnaryInstruction {
|
||||
protected:
|
||||
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
||||
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
||||
const std::string &Name = "", Instruction *InsertBefore = 0);
|
||||
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
||||
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
||||
const std::string &Name, BasicBlock *InsertAtEnd);
|
||||
|
||||
public:
|
||||
@ -55,7 +55,7 @@ public:
|
||||
/// getType - Overload to return most specific pointer type
|
||||
///
|
||||
inline const PointerType *getType() const {
|
||||
return reinterpret_cast<const PointerType*>(Instruction::getType());
|
||||
return reinterpret_cast<const PointerType*>(Instruction::getType());
|
||||
}
|
||||
|
||||
/// getAllocatedType - Return the type that is being allocated by the
|
||||
@ -175,7 +175,7 @@ class LoadInst : public UnaryInstruction {
|
||||
LoadInst(const LoadInst &LI)
|
||||
: UnaryInstruction(LI.getType(), Load, LI.getOperand(0)) {
|
||||
setVolatile(LI.isVolatile());
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
AssertOK();
|
||||
#endif
|
||||
@ -221,7 +221,7 @@ public:
|
||||
// StoreInst Class
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// StoreInst - an instruction for storing to memory
|
||||
/// StoreInst - an instruction for storing to memory
|
||||
///
|
||||
class StoreInst : public Instruction {
|
||||
Use Ops[2];
|
||||
@ -252,7 +252,7 @@ public:
|
||||
void setVolatile(bool V) { SubclassData = V; }
|
||||
|
||||
/// Transparently provide more efficient getOperand methods.
|
||||
Value *getOperand(unsigned i) const {
|
||||
Value *getOperand(unsigned i) const {
|
||||
assert(i < 2 && "getOperand() out of range!");
|
||||
return Ops[i];
|
||||
}
|
||||
@ -319,7 +319,7 @@ public:
|
||||
~GetElementPtrInst();
|
||||
|
||||
virtual GetElementPtrInst *clone() const;
|
||||
|
||||
|
||||
// getType - Overload to return most specific pointer type...
|
||||
inline const PointerType *getType() const {
|
||||
return reinterpret_cast<const PointerType*>(Instruction::getType());
|
||||
@ -328,15 +328,15 @@ public:
|
||||
/// getIndexedType - Returns the type of the element that would be loaded with
|
||||
/// a load instruction with the specified parameters.
|
||||
///
|
||||
/// A null type is returned if the indices are invalid for the specified
|
||||
/// A null type is returned if the indices are invalid for the specified
|
||||
/// pointer type.
|
||||
///
|
||||
static const Type *getIndexedType(const Type *Ptr,
|
||||
static const Type *getIndexedType(const Type *Ptr,
|
||||
const std::vector<Value*> &Indices,
|
||||
bool AllowStructLeaf = false);
|
||||
static const Type *getIndexedType(const Type *Ptr, Value *Idx0, Value *Idx1,
|
||||
bool AllowStructLeaf = false);
|
||||
|
||||
|
||||
inline op_iterator idx_begin() { return op_begin()+1; }
|
||||
inline const_op_iterator idx_begin() const { return op_begin()+1; }
|
||||
inline op_iterator idx_end() { return op_end(); }
|
||||
@ -355,7 +355,7 @@ public:
|
||||
inline unsigned getNumIndices() const { // Note: always non-negative
|
||||
return getNumOperands() - 1;
|
||||
}
|
||||
|
||||
|
||||
inline bool hasIndices() const {
|
||||
return getNumOperands() > 1;
|
||||
}
|
||||
@ -430,7 +430,7 @@ public:
|
||||
/// the instruction (i->getType()).
|
||||
///
|
||||
class CastInst : public UnaryInstruction {
|
||||
CastInst(const CastInst &CI)
|
||||
CastInst(const CastInst &CI)
|
||||
: UnaryInstruction(CI.getType(), Cast, CI.getOperand(0)) {
|
||||
}
|
||||
public:
|
||||
@ -486,9 +486,9 @@ public:
|
||||
Instruction *InsertBefore = 0);
|
||||
CallInst(Value *F, Value *Actual, const std::string& Name,
|
||||
BasicBlock *InsertAtEnd);
|
||||
explicit CallInst(Value *F, const std::string &Name = "",
|
||||
explicit CallInst(Value *F, const std::string &Name = "",
|
||||
Instruction *InsertBefore = 0);
|
||||
explicit CallInst(Value *F, const std::string &Name,
|
||||
explicit CallInst(Value *F, const std::string &Name,
|
||||
BasicBlock *InsertAtEnd);
|
||||
~CallInst();
|
||||
|
||||
@ -509,7 +509,7 @@ public:
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const CallInst *) { return true; }
|
||||
static inline bool classof(const Instruction *I) {
|
||||
return I->getOpcode() == Instruction::Call;
|
||||
return I->getOpcode() == Instruction::Call;
|
||||
}
|
||||
static inline bool classof(const Value *V) {
|
||||
return isa<Instruction>(V) && classof(cast<Instruction>(V));
|
||||
@ -568,7 +568,7 @@ public:
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const ShiftInst *) { return true; }
|
||||
static inline bool classof(const Instruction *I) {
|
||||
return (I->getOpcode() == Instruction::Shr) |
|
||||
return (I->getOpcode() == Instruction::Shr) |
|
||||
(I->getOpcode() == Instruction::Shl);
|
||||
}
|
||||
static inline bool classof(const Value *V) {
|
||||
@ -772,7 +772,7 @@ public:
|
||||
|
||||
/// getIncomingBlock - Return incoming basic block #x
|
||||
///
|
||||
BasicBlock *getIncomingBlock(unsigned i) const {
|
||||
BasicBlock *getIncomingBlock(unsigned i) const {
|
||||
return reinterpret_cast<BasicBlock*>(getOperand(i*2+1));
|
||||
}
|
||||
void setIncomingBlock(unsigned i, BasicBlock *BB) {
|
||||
@ -795,7 +795,7 @@ public:
|
||||
OperandList[OpNo].init(V, this);
|
||||
OperandList[OpNo+1].init(reinterpret_cast<Value*>(BB), this);
|
||||
}
|
||||
|
||||
|
||||
/// removeIncomingValue - Remove an incoming value. This is useful if a
|
||||
/// predecessor basic block is deleted. The value removed is returned.
|
||||
///
|
||||
@ -812,12 +812,12 @@ public:
|
||||
return removeIncomingValue(Idx, DeletePHIIfEmpty);
|
||||
}
|
||||
|
||||
/// getBasicBlockIndex - Return the first index of the specified basic
|
||||
/// getBasicBlockIndex - Return the first index of the specified basic
|
||||
/// block in the value list for this PHI. Returns -1 if no instance.
|
||||
///
|
||||
int getBasicBlockIndex(const BasicBlock *BB) const {
|
||||
Use *OL = OperandList;
|
||||
for (unsigned i = 0, e = getNumOperands(); i != e; i += 2)
|
||||
for (unsigned i = 0, e = getNumOperands(); i != e; i += 2)
|
||||
if (OL[i+1] == reinterpret_cast<const Value*>(BB)) return i/2;
|
||||
return -1;
|
||||
}
|
||||
@ -829,7 +829,7 @@ public:
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const PHINode *) { return true; }
|
||||
static inline bool classof(const Instruction *I) {
|
||||
return I->getOpcode() == Instruction::PHI;
|
||||
return I->getOpcode() == Instruction::PHI;
|
||||
}
|
||||
static inline bool classof(const Value *V) {
|
||||
return isa<Instruction>(V) && classof(cast<Instruction>(V));
|
||||
@ -1007,7 +1007,7 @@ public:
|
||||
|
||||
BasicBlock *getSuccessor(unsigned i) const {
|
||||
assert(i < getNumSuccessors() && "Successor # out of range for Branch!");
|
||||
return (i == 0) ? cast<BasicBlock>(getOperand(0)) :
|
||||
return (i == 0) ? cast<BasicBlock>(getOperand(0)) :
|
||||
cast<BasicBlock>(getOperand(1));
|
||||
}
|
||||
|
||||
@ -1052,7 +1052,7 @@ public:
|
||||
/// be specified here to make memory allocation more efficient. This
|
||||
/// constructor can also autoinsert before another instruction.
|
||||
SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
|
||||
Instruction *InsertBefore = 0)
|
||||
Instruction *InsertBefore = 0)
|
||||
: TerminatorInst(Instruction::Switch, 0, 0, InsertBefore) {
|
||||
init(Value, Default, NumCases);
|
||||
}
|
||||
@ -1062,7 +1062,7 @@ public:
|
||||
/// be specified here to make memory allocation more efficient. This
|
||||
/// constructor also autoinserts at the end of the specified BasicBlock.
|
||||
SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
|
||||
BasicBlock *InsertAtEnd)
|
||||
BasicBlock *InsertAtEnd)
|
||||
: TerminatorInst(Instruction::Switch, 0, 0, InsertAtEnd) {
|
||||
init(Value, Default, NumCases);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/InstrinsicInst.h - Intrinsic Instruction Wrappers --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines classes that make it really easy to deal with intrinsic
|
||||
@ -53,11 +53,11 @@ namespace llvm {
|
||||
static inline bool classof(const CallInst *I) {
|
||||
if (const Function *CF = I->getCalledFunction())
|
||||
switch (CF->getIntrinsicID()) {
|
||||
case Intrinsic::dbg_stoppoint:
|
||||
case Intrinsic::dbg_region_start:
|
||||
case Intrinsic::dbg_region_end:
|
||||
case Intrinsic::dbg_func_start:
|
||||
case Intrinsic::dbg_declare:
|
||||
case Intrinsic::dbg_stoppoint:
|
||||
case Intrinsic::dbg_region_start:
|
||||
case Intrinsic::dbg_region_end:
|
||||
case Intrinsic::dbg_func_start:
|
||||
case Intrinsic::dbg_declare:
|
||||
return true;
|
||||
default: break;
|
||||
}
|
||||
@ -81,7 +81,7 @@ namespace llvm {
|
||||
}
|
||||
Value *getContext() const { return const_cast<Value*>(getOperand(4)); }
|
||||
|
||||
|
||||
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const DbgStopPointInst *) { return true; }
|
||||
static inline bool classof(const CallInst *I) {
|
||||
@ -159,7 +159,7 @@ namespace llvm {
|
||||
/// value is guaranteed to be a pointer.
|
||||
Value *getSource() const { return StripPointerCasts(getRawSource()); }
|
||||
|
||||
|
||||
|
||||
void setSource(Value *Ptr) {
|
||||
assert(getRawSource()->getType() == Ptr->getType() &&
|
||||
"setSource called with pointer of wrong type!");
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Instrinsics.h - LLVM Intrinsic Function Handling ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a set of enums which allow processing of intrinsic
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Linker.h - Module Linker Interface ------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the interface to the module/file/archive linker.
|
||||
@ -22,15 +22,15 @@ namespace llvm {
|
||||
class Module;
|
||||
|
||||
/// This class provides the core functionality of linking in LLVM. It retains a
|
||||
/// Module object which is the composite of the modules and libraries linked
|
||||
/// into it. The composite Module can be retrieved via the getModule() method.
|
||||
/// In this case the Linker still retains ownership of the Module. If the
|
||||
/// releaseModule() method is used, the ownership of the Module is transferred
|
||||
/// Module object which is the composite of the modules and libraries linked
|
||||
/// into it. The composite Module can be retrieved via the getModule() method.
|
||||
/// In this case the Linker still retains ownership of the Module. If the
|
||||
/// releaseModule() method is used, the ownership of the Module is transferred
|
||||
/// to the caller and the Linker object is only suitable for destruction.
|
||||
/// The Linker can link Modules from memory, bytecode files, or bytecode
|
||||
/// archives. It retains a set of search paths in which to find any libraries
|
||||
/// presented to it. By default, the linker will generate error and warning
|
||||
/// messages to std::cerr but this capability can be turned off with the
|
||||
/// The Linker can link Modules from memory, bytecode files, or bytecode
|
||||
/// archives. It retains a set of search paths in which to find any libraries
|
||||
/// presented to it. By default, the linker will generate error and warning
|
||||
/// messages to std::cerr but this capability can be turned off with the
|
||||
/// QuietWarnings and QuietErrors flags. It can also be instructed to verbosely
|
||||
/// print out the linking actions it is taking with the Verbose flag.
|
||||
/// @brief The LLVM Linker.
|
||||
@ -41,14 +41,14 @@ class Linker {
|
||||
public:
|
||||
/// This type is used to pass the linkage items (libraries and files) to
|
||||
/// the LinkItems function. It is composed of string/bool pairs. The string
|
||||
/// provides the name of the file or library (as with the -l option). The
|
||||
/// bool should be true for libraries and false for files, signifying
|
||||
/// provides the name of the file or library (as with the -l option). The
|
||||
/// bool should be true for libraries and false for files, signifying
|
||||
/// "isLibrary".
|
||||
/// @brief A list of linkage items
|
||||
typedef std::vector<std::pair<std::string,bool> > ItemList;
|
||||
|
||||
/// This enumeration is used to control various optional features of the
|
||||
/// linker.
|
||||
/// linker.
|
||||
enum ControlFlags {
|
||||
Verbose = 1, ///< Print to std::cerr what steps the linker is taking
|
||||
QuietWarnings = 2, ///< Don't print errors and warnings to std::cerr.
|
||||
@ -78,33 +78,33 @@ class Linker {
|
||||
/// @{
|
||||
public:
|
||||
/// This method gets the composite module into which linking is being
|
||||
/// done. The Composite module starts out empty and accumulates modules
|
||||
/// done. The Composite module starts out empty and accumulates modules
|
||||
/// linked into it via the various LinkIn* methods. This method does not
|
||||
/// release the Module to the caller. The Linker retains ownership and will
|
||||
/// destruct the Module when the Linker is destructed.
|
||||
/// destruct the Module when the Linker is destructed.
|
||||
/// @see releaseModule
|
||||
/// @brief Get the linked/composite module.
|
||||
Module* getModule() const { return Composite; }
|
||||
|
||||
/// This method releases the composite Module into which linking is being
|
||||
/// done. Ownership of the composite Module is transferred to the caller who
|
||||
/// must arrange for its destruct. After this method is called, the Linker
|
||||
/// terminates the linking session for the returned Module. It will no
|
||||
/// longer utilize the returned Module but instead resets itself for
|
||||
/// subsequent linking as if the constructor had been called. The Linker's
|
||||
/// LibPaths and flags to be reset, and memory will be released.
|
||||
/// @brief Release the linked/composite module.
|
||||
/// must arrange for its destruct. After this method is called, the Linker
|
||||
/// terminates the linking session for the returned Module. It will no
|
||||
/// longer utilize the returned Module but instead resets itself for
|
||||
/// subsequent linking as if the constructor had been called. The Linker's
|
||||
/// LibPaths and flags to be reset, and memory will be released.
|
||||
/// @brief Release the linked/composite module.
|
||||
Module* releaseModule();
|
||||
|
||||
/// This method gets the list of libraries that form the path that the
|
||||
/// Linker will search when it is presented with a library name.
|
||||
/// Linker will search when it is presented with a library name.
|
||||
/// @brief Get the Linkers library path
|
||||
const std::vector<sys::Path>& getLibPaths() const { return LibPaths; }
|
||||
|
||||
/// This method returns an error string suitable for printing to the user.
|
||||
/// The return value will be empty unless an error occurred in one of the
|
||||
/// LinkIn* methods. In those cases, the LinkIn* methods will have returned
|
||||
/// true, indicating an error occurred. At most one error is retained so
|
||||
/// true, indicating an error occurred. At most one error is retained so
|
||||
/// this function always returns the last error that occurred. Note that if
|
||||
/// the Quiet control flag is not set, the error string will have already
|
||||
/// been printed to std::cerr.
|
||||
@ -124,7 +124,7 @@ class Linker {
|
||||
void addPath(const sys::Path& path);
|
||||
|
||||
/// Add a set of paths to the list of paths that the linker will search. The
|
||||
/// Linker accumulates the set of libraries added. The \p paths will be
|
||||
/// Linker accumulates the set of libraries added. The \p paths will be
|
||||
/// added to the end of the Linker's list. Order will be retained.
|
||||
/// @brief Add a set of paths.
|
||||
void addPaths(const std::vector<std::string>& paths);
|
||||
@ -140,14 +140,14 @@ class Linker {
|
||||
/// @brief Set control flags.
|
||||
void setFlags(unsigned flags) { Flags = flags; }
|
||||
|
||||
/// This method is the main interface to the linker. It can be used to
|
||||
/// This method is the main interface to the linker. It can be used to
|
||||
/// link a set of linkage items into a module. A linkage item is either a
|
||||
/// file name with fully qualified path, or a library for which the Linker's
|
||||
/// LibraryPath will be utilized to locate the library. The bool value in
|
||||
/// the LinkItemKind should be set to true for libraries. This function
|
||||
/// allows linking to preserve the order of specification associated with
|
||||
/// the command line, or for other purposes. Each item will be linked in
|
||||
/// turn as it occurs in \p Items.
|
||||
/// the LinkItemKind should be set to true for libraries. This function
|
||||
/// allows linking to preserve the order of specification associated with
|
||||
/// the command line, or for other purposes. Each item will be linked in
|
||||
/// turn as it occurs in \p Items.
|
||||
/// @returns true if an error occurred, false otherwise
|
||||
/// @see LinkItemKind
|
||||
/// @see getLastError
|
||||
@ -156,11 +156,11 @@ class Linker {
|
||||
const ItemList& Items // Set of libraries/files to link in
|
||||
);
|
||||
|
||||
/// This function links the bytecode \p Files into the composite module.
|
||||
/// Note that this does not do any linking of unresolved symbols. The \p
|
||||
/// Files are all completely linked into \p HeadModule regardless of
|
||||
/// unresolved symbols. This function just loads each bytecode file and
|
||||
/// calls LinkInModule on them.
|
||||
/// This function links the bytecode \p Files into the composite module.
|
||||
/// Note that this does not do any linking of unresolved symbols. The \p
|
||||
/// Files are all completely linked into \p HeadModule regardless of
|
||||
/// unresolved symbols. This function just loads each bytecode file and
|
||||
/// calls LinkInModule on them.
|
||||
/// @returns true if an error occurs, false otherwise
|
||||
/// @see getLastError
|
||||
/// @brief Link in multiple files.
|
||||
@ -179,11 +179,11 @@ class Linker {
|
||||
const sys::Path& File ///< File to link in.
|
||||
);
|
||||
|
||||
/// This function provides a way to selectively link in a set of modules,
|
||||
/// found in libraries, based on the unresolved symbols in the composite
|
||||
/// This function provides a way to selectively link in a set of modules,
|
||||
/// found in libraries, based on the unresolved symbols in the composite
|
||||
/// module. Each item in \p Libraries should be the base name of a library,
|
||||
/// as if given with the -l option of a linker tool. The Linker's LibPaths
|
||||
/// are searched for the \p Libraries and any found will be linked in with
|
||||
/// are searched for the \p Libraries and any found will be linked in with
|
||||
/// LinkInArchive. If an error occurs, the Linker's error string is set.
|
||||
/// @see LinkInArchive
|
||||
/// @see getLastError
|
||||
@ -193,9 +193,9 @@ class Linker {
|
||||
const std::vector<std::string> & Libraries ///< Libraries to link in
|
||||
);
|
||||
|
||||
/// This function provides a way to selectively link in a set of modules,
|
||||
/// This function provides a way to selectively link in a set of modules,
|
||||
/// found in one library, based on the unresolved symbols in the composite
|
||||
/// module.The \p Library should be the base name of a library, as if given
|
||||
/// module.The \p Library should be the base name of a library, as if given
|
||||
/// with the -l option of a linker tool. The Linker's LibPaths are searched
|
||||
/// for the \P Library and if found, it will be linked in with via the
|
||||
/// LinkInArchive method. If an error occurs, the Linker's error string is
|
||||
@ -209,25 +209,25 @@ class Linker {
|
||||
);
|
||||
|
||||
/// This function links one bytecode archive, \p Filename, into the module.
|
||||
/// The archive is searched to resolve outstanding symbols. Any modules in
|
||||
/// the archive that resolve outstanding symbols will be linked in. The
|
||||
/// library is searched repeatedly until no more modules that resolve
|
||||
/// The archive is searched to resolve outstanding symbols. Any modules in
|
||||
/// the archive that resolve outstanding symbols will be linked in. The
|
||||
/// library is searched repeatedly until no more modules that resolve
|
||||
/// symbols can be found. If an error occurs, the error string is set.
|
||||
/// To speed up this function, ensure the the archive has been processed
|
||||
/// To speed up this function, ensure the the archive has been processed
|
||||
/// llvm-ranlib or the S option was given to llvm-ar when the archive was
|
||||
/// created. These tools add a symbol table to the archive which makes the
|
||||
/// search for undefined symbols much faster.
|
||||
/// @see getLastError
|
||||
/// @returns true if an error occurs, otherwise false.
|
||||
/// @returns true if an error occurs, otherwise false.
|
||||
/// @brief Link in one archive.
|
||||
bool LinkInArchive(
|
||||
bool LinkInArchive(
|
||||
const sys::Path& Filename ///< Filename of the archive to link
|
||||
);
|
||||
|
||||
/// This method links the \p Src module into the Linker's Composite module
|
||||
/// by calling LinkModules. All the other LinkIn* methods eventually
|
||||
/// result in calling this method to link a Module into the Linker's
|
||||
/// composite.
|
||||
/// by calling LinkModules. All the other LinkIn* methods eventually
|
||||
/// result in calling this method to link a Module into the Linker's
|
||||
/// composite.
|
||||
/// @see LinkModules
|
||||
/// @returns True if an error occurs, false otherwise.
|
||||
/// @brief Link in a module.
|
||||
@ -235,11 +235,11 @@ class Linker {
|
||||
Module* Src ///< Module linked into \p Dest
|
||||
) { return LinkModules(Composite, Src, &Error); }
|
||||
|
||||
/// This is the heart of the linker. This method will take unconditional
|
||||
/// This is the heart of the linker. This method will take unconditional
|
||||
/// control of the \p Src module and link it into the \p Dest module. The
|
||||
/// \p Src module will be destructed or subsumed by this method. In either
|
||||
/// case it is not usable by the caller after this method is invoked. Only
|
||||
/// the \p Dest module will remain. The \p Src module is linked into the
|
||||
/// the \p Dest module will remain. The \p Src module is linked into the
|
||||
/// Linker's composite module such that types, global variables, functions,
|
||||
/// and etc. are matched and resolved. If an error occurs, this function
|
||||
/// returns true and ErrorMsg is set to a descriptive message about the
|
||||
@ -277,7 +277,7 @@ class Linker {
|
||||
std::string Error; ///< Text of error that occurred.
|
||||
std::string ProgramName; ///< Name of the program being linked
|
||||
/// @}
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -1,13 +1,13 @@
|
||||
//===-- llvm/Module.h - C++ class to represent a VM module ------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declarations for the Module class that is used to
|
||||
// This file contains the declarations for the Module class that is used to
|
||||
// maintain all the information related to a VM module.
|
||||
//
|
||||
// A module also maintains a GlobalValRefMap object that is used to hold all
|
||||
@ -229,7 +229,7 @@ public:
|
||||
/// @brief Remove a library from the list of dependent libraries
|
||||
inline void removeLibrary(const std::string& Lib) { LibraryList.remove(Lib); }
|
||||
|
||||
/// @brief Get all the libraries
|
||||
/// @brief Get all the libraries
|
||||
inline const LibraryListType& getLibraries() const { return LibraryList; }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
@ -245,7 +245,7 @@ public:
|
||||
/// 'delete' a whole class at a time, even though there may be circular
|
||||
/// references... first all references are dropped, and all use counts go to
|
||||
/// zero. Then everything is delete'd for real. Note that no operations are
|
||||
/// valid on an object that has "dropped all references", except operator
|
||||
/// valid on an object that has "dropped all references", except operator
|
||||
/// delete.
|
||||
///
|
||||
void dropAllReferences();
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/ModuleProvider.h - Interface for module providers --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file provides an abstract interface for loading a module from some
|
||||
@ -48,12 +48,12 @@ public:
|
||||
/// releaseModule - no longer delete the Module* when provider is destroyed.
|
||||
/// Note that this can throw an exception if the module is corrupt!
|
||||
///
|
||||
virtual Module* releaseModule() {
|
||||
virtual Module* releaseModule() {
|
||||
// Since we're losing control of this Module, we must hand it back complete
|
||||
materializeModule();
|
||||
Module *tempM = TheModule;
|
||||
TheModule = 0;
|
||||
return tempM;
|
||||
Module *tempM = TheModule;
|
||||
TheModule = 0;
|
||||
return tempM;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/Pass.h - Base class for Passes ----------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a base class that indicates that a specified class is a
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/PassAnalysisSupport.h - Analysis Pass Support code --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines stuff that is used to define and "use" Analysis Passes.
|
||||
@ -25,10 +25,10 @@ namespace llvm {
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// AnalysisUsage - Represent the analysis usage information of a pass. This
|
||||
// tracks analyses that the pass REQUIRES (must be available when the pass
|
||||
// tracks analyses that the pass REQUIRES (must be available when the pass
|
||||
// runs), REQUIRES TRANSITIVE (must be available throughout the lifetime of the
|
||||
// pass), and analyses that the pass PRESERVES (the pass does not invalidate the
|
||||
// results of these analyses). This information is provided by a pass to the
|
||||
// results of these analyses). This information is provided by a pass to the
|
||||
// Pass infrastructure through the getAnalysisUsage virtual function.
|
||||
//
|
||||
class AnalysisUsage {
|
||||
@ -37,7 +37,7 @@ class AnalysisUsage {
|
||||
bool PreservesAll;
|
||||
public:
|
||||
AnalysisUsage() : PreservesAll(false) {}
|
||||
|
||||
|
||||
// addRequired - Add the specified ID to the required set of the usage info
|
||||
// for a pass.
|
||||
//
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/PassManager.h - Container for Passes ----------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the PassManager class. This class is used to hold,
|
||||
@ -63,7 +63,7 @@ public:
|
||||
///
|
||||
void add(FunctionPass *P);
|
||||
|
||||
/// add - ImmutablePasses are not FunctionPasses, so we have a
|
||||
/// add - ImmutablePasses are not FunctionPasses, so we have a
|
||||
/// special hack to get them into a FunctionPassManager.
|
||||
///
|
||||
void add(ImmutablePass *IP);
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/PassSupport.h - Pass Support code -------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines stuff that is used to define and "use" Passes. This file
|
||||
@ -55,7 +55,7 @@ public:
|
||||
|
||||
/// PassInfo ctor - Do not call this directly, this should only be invoked
|
||||
/// through RegisterPass.
|
||||
PassInfo(const char *name, const char *arg, const std::type_info &ti,
|
||||
PassInfo(const char *name, const char *arg, const std::type_info &ti,
|
||||
unsigned char pt, Pass *(*normal)() = 0,
|
||||
Pass *(*targetctor)(TargetMachine &) = 0)
|
||||
: PassName(name), PassArgument(arg), TypeInfo(ti), PassType(pt),
|
||||
@ -86,7 +86,7 @@ public:
|
||||
/// getNormalCtor - Return a pointer to a function, that when called, creates
|
||||
/// an instance of the pass and returns it. This pointer may be null if there
|
||||
/// is no default constructor for the pass.
|
||||
///
|
||||
///
|
||||
Pass *(*getNormalCtor() const)() {
|
||||
return NormalCtor;
|
||||
}
|
||||
@ -135,7 +135,7 @@ public:
|
||||
/// for example will not be able to see the pass and attempts to create the pass
|
||||
/// will fail. This template is used in the follow manner (at global scope, in
|
||||
/// your .cpp file):
|
||||
///
|
||||
///
|
||||
/// static RegisterPass<YourPassClassName> tmp("passopt", "My Pass Name");
|
||||
///
|
||||
/// This statement will cause your pass to be created by calling the default
|
||||
@ -145,7 +145,7 @@ public:
|
||||
///
|
||||
/// Pass *createMyPass(foo &opt) { return new MyPass(opt); }
|
||||
/// static RegisterPass<PassClassName> tmp("passopt", "My Name", createMyPass);
|
||||
///
|
||||
///
|
||||
struct RegisterPassBase {
|
||||
/// getPassInfo - Get the pass info for the registered class...
|
||||
///
|
||||
@ -172,7 +172,7 @@ Pass *callDefaultCtor() { return new PassName(); }
|
||||
|
||||
template<typename PassName>
|
||||
struct RegisterPass : public RegisterPassBase {
|
||||
|
||||
|
||||
// Register Pass using default constructor...
|
||||
RegisterPass(const char *PassArg, const char *Name, unsigned char PassTy = 0){
|
||||
registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassTy,
|
||||
@ -226,7 +226,7 @@ struct RegisterOpt : public RegisterPassBase {
|
||||
RegisterOpt(const char *PassArg, const char *Name, FunctionPass *(*ctor)(),
|
||||
bool CFGOnly = false) {
|
||||
registerPass(new PassInfo(Name, PassArg, typeid(PassName),
|
||||
PassInfo::Optimization,
|
||||
PassInfo::Optimization,
|
||||
static_cast<Pass*(*)()>(ctor)));
|
||||
if (CFGOnly) setOnlyUsesCFG();
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
//===-- llvm/SymbolTable.h - Implement a type plane'd symtab ----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and re-written by Reid
|
||||
// Spencer. It is distributed under the University of Illinois Open Source
|
||||
// Spencer. It is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the main symbol table for LLVM.
|
||||
@ -21,23 +21,23 @@
|
||||
namespace llvm {
|
||||
|
||||
/// This class provides a symbol table of name/value pairs that is broken
|
||||
/// up by type. For each Type* there is a "plane" of name/value pairs in
|
||||
/// the symbol table. Identical types may have overlapping symbol names as
|
||||
/// long as they are distinct. The SymbolTable also tracks, separately, a
|
||||
/// map of name/type pairs. This allows types to be named. Types are treated
|
||||
/// up by type. For each Type* there is a "plane" of name/value pairs in
|
||||
/// the symbol table. Identical types may have overlapping symbol names as
|
||||
/// long as they are distinct. The SymbolTable also tracks, separately, a
|
||||
/// map of name/type pairs. This allows types to be named. Types are treated
|
||||
/// distinctly from Values.
|
||||
///
|
||||
///
|
||||
/// The SymbolTable provides several utility functions for answering common
|
||||
/// questions about its contents as well as an iterator interface for
|
||||
/// directly iterating over the contents. To reduce confusion, the terms
|
||||
/// directly iterating over the contents. To reduce confusion, the terms
|
||||
/// "type", "value", and "plane" are used consistently. For example,
|
||||
/// There is a TypeMap typedef that is the mapping of names to Types.
|
||||
/// Similarly there is a ValueMap typedef that is the mapping of
|
||||
/// There is a TypeMap typedef that is the mapping of names to Types.
|
||||
/// Similarly there is a ValueMap typedef that is the mapping of
|
||||
/// names to Values. Finally, there is a PlaneMap typedef that is the
|
||||
/// mapping of types to planes of ValueMap. This is the basic structure
|
||||
/// of the symbol table. When you call type_begin() you're asking
|
||||
/// for an iterator at the start of the TypeMap. When you call
|
||||
/// plane_begin(), you're asking for an iterator at the start of
|
||||
/// plane_begin(), you're asking for an iterator at the start of
|
||||
/// the PlaneMap. Finally, when you call value_begin(), you're asking
|
||||
/// for an iterator at the start of a ValueMap for a specific type
|
||||
/// plane.
|
||||
@ -102,7 +102,7 @@ public:
|
||||
/// @brief Lookup a type by name.
|
||||
Type* lookupType(const std::string& name) const;
|
||||
|
||||
/// @returns true iff the type map and the type plane are both not
|
||||
/// @returns true iff the type map and the type plane are both not
|
||||
/// empty.
|
||||
/// @brief Determine if the symbol table is empty
|
||||
inline bool isEmpty() const { return pmap.empty() && tmap.empty(); }
|
||||
@ -110,17 +110,17 @@ public:
|
||||
/// @brief The number of name/type pairs is returned.
|
||||
inline unsigned num_types() const { return (unsigned)tmap.size(); }
|
||||
|
||||
/// Given a base name, return a string that is either equal to it or
|
||||
/// derived from it that does not already occur in the symbol table
|
||||
/// Given a base name, return a string that is either equal to it or
|
||||
/// derived from it that does not already occur in the symbol table
|
||||
/// for the specified type.
|
||||
/// @brief Get a name unique to this symbol table
|
||||
std::string getUniqueName(const Type *Ty,
|
||||
std::string getUniqueName(const Type *Ty,
|
||||
const std::string &BaseName) const;
|
||||
|
||||
/// This function can be used from the debugger to display the
|
||||
/// content of the symbol table while debugging.
|
||||
/// @brief Print out symbol table on stderr
|
||||
void dump() const;
|
||||
void dump() const;
|
||||
|
||||
/// @}
|
||||
/// @name Iteration
|
||||
@ -129,12 +129,12 @@ public:
|
||||
|
||||
/// Get an iterator that starts at the beginning of the type planes.
|
||||
/// The iterator will iterate over the Type/ValueMap pairs in the
|
||||
/// type planes.
|
||||
/// type planes.
|
||||
inline plane_iterator plane_begin() { return pmap.begin(); }
|
||||
|
||||
/// Get a const_iterator that starts at the beginning of the type
|
||||
/// planes. The iterator will iterate over the Type/ValueMap pairs
|
||||
/// in the type planes.
|
||||
/// Get a const_iterator that starts at the beginning of the type
|
||||
/// planes. The iterator will iterate over the Type/ValueMap pairs
|
||||
/// in the type planes.
|
||||
inline plane_const_iterator plane_begin() const { return pmap.begin(); }
|
||||
|
||||
/// Get an iterator at the end of the type planes. This serves as
|
||||
@ -148,9 +148,9 @@ public:
|
||||
/// Get an iterator that starts at the beginning of a type plane.
|
||||
/// The iterator will iterate over the name/value pairs in the type plane.
|
||||
/// @note The type plane must already exist before using this.
|
||||
inline value_iterator value_begin(const Type *Typ) {
|
||||
inline value_iterator value_begin(const Type *Typ) {
|
||||
assert(Typ && "Can't get value iterator with null type!");
|
||||
return pmap.find(Typ)->second.begin();
|
||||
return pmap.find(Typ)->second.begin();
|
||||
}
|
||||
|
||||
/// Get a const_iterator that starts at the beginning of a type plane.
|
||||
@ -158,23 +158,23 @@ public:
|
||||
/// @note The type plane must already exist before using this.
|
||||
inline value_const_iterator value_begin(const Type *Typ) const {
|
||||
assert(Typ && "Can't get value iterator with null type!");
|
||||
return pmap.find(Typ)->second.begin();
|
||||
return pmap.find(Typ)->second.begin();
|
||||
}
|
||||
|
||||
/// Get an iterator to the end of a type plane. This serves as the marker
|
||||
/// for end of iteration of the type plane.
|
||||
/// @note The type plane must already exist before using this.
|
||||
inline value_iterator value_end(const Type *Typ) {
|
||||
inline value_iterator value_end(const Type *Typ) {
|
||||
assert(Typ && "Can't get value iterator with null type!");
|
||||
return pmap.find(Typ)->second.end();
|
||||
return pmap.find(Typ)->second.end();
|
||||
}
|
||||
|
||||
/// Get a const_iterator to the end of a type plane. This serves as the
|
||||
/// marker for end of iteration of the type plane.
|
||||
/// @note The type plane must already exist before using this.
|
||||
inline value_const_iterator value_end(const Type *Typ) const {
|
||||
inline value_const_iterator value_end(const Type *Typ) const {
|
||||
assert(Typ && "Can't get value iterator with null type!");
|
||||
return pmap.find(Typ)->second.end();
|
||||
return pmap.find(Typ)->second.end();
|
||||
}
|
||||
|
||||
/// Get an iterator to the start of the name/Type map.
|
||||
@ -187,7 +187,7 @@ public:
|
||||
/// marker for end of iteration of the types.
|
||||
inline type_iterator type_end() { return tmap.end(); }
|
||||
|
||||
/// Get a const-iterator to the end of the name/Type map. This serves
|
||||
/// Get a const-iterator to the end of the name/Type map. This serves
|
||||
/// as the marker for end of iteration of the types.
|
||||
inline type_const_iterator type_end() const { return tmap.end(); }
|
||||
|
||||
@ -202,9 +202,9 @@ public:
|
||||
/// This method returns a plane_iterator for iteration over the
|
||||
/// type planes starting at a specific plane, given by \p Ty.
|
||||
/// @brief Find a type plane.
|
||||
inline plane_iterator find(const Type* Typ) {
|
||||
inline plane_iterator find(const Type* Typ) {
|
||||
assert(Typ && "Can't find type plane with null type!");
|
||||
return pmap.find(Typ);
|
||||
return pmap.find(Typ);
|
||||
}
|
||||
|
||||
|
||||
@ -265,7 +265,7 @@ private:
|
||||
/// @brief Insert a value into the symbol table with the specified name.
|
||||
void insertEntry(const std::string &Name, const Type *Ty, Value *V);
|
||||
|
||||
/// This function is called when one of the types in the type plane
|
||||
/// This function is called when one of the types in the type plane
|
||||
/// is refined.
|
||||
virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
|
||||
|
||||
@ -273,20 +273,20 @@ private:
|
||||
virtual void typeBecameConcrete(const DerivedType *AbsTy);
|
||||
|
||||
/// @}
|
||||
/// @name Internal Data
|
||||
/// @name Internal Data
|
||||
/// @{
|
||||
private:
|
||||
|
||||
/// This is the main content of the symbol table. It provides
|
||||
/// separate type planes for named values. That is, each named
|
||||
/// value is organized into a separate dictionary based on
|
||||
/// value is organized into a separate dictionary based on
|
||||
/// Type. This means that the same name can be used for different
|
||||
/// types without conflict.
|
||||
/// types without conflict.
|
||||
/// @brief The mapping of types to names to values.
|
||||
PlaneMap pmap;
|
||||
|
||||
/// This is the type plane. It is separated from the pmap
|
||||
/// because the elements of the map are name/Type pairs not
|
||||
/// because the elements of the map are name/Type pairs not
|
||||
/// name/Value pairs and Type is not a Value.
|
||||
TypeMap tmap;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/SymbolTableListTraits.h - Traits for iplist --------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a generic class that is used to implement the automatic
|
||||
@ -64,7 +64,7 @@ public:
|
||||
|
||||
void addNodeToList(ValueSubClass *V);
|
||||
void removeNodeFromList(ValueSubClass *V);
|
||||
void transferNodesFromList(iplist<ValueSubClass,
|
||||
void transferNodesFromList(iplist<ValueSubClass,
|
||||
ilist_traits<ValueSubClass> > &L2,
|
||||
ilist_iterator<ValueSubClass> first,
|
||||
ilist_iterator<ValueSubClass> last);
|
||||
|
@ -1,18 +1,18 @@
|
||||
//===-- llvm/Type.h - Classes for handling data types -----------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declaration of the Type class. For more "Type" type
|
||||
// stuff, look in DerivedTypes.h.
|
||||
//
|
||||
// Note that instances of the Type class are immutable: once they are created,
|
||||
// they are never changed. Also note that only one instance of a particular
|
||||
// type is ever created. Thus seeing if two types are equal is a matter of
|
||||
// they are never changed. Also note that only one instance of a particular
|
||||
// type is ever created. Thus seeing if two types are equal is a matter of
|
||||
// doing a trivial pointer comparison.
|
||||
//
|
||||
// Types, once allocated, are never free'd, unless they are an abstract type
|
||||
@ -20,7 +20,7 @@
|
||||
//
|
||||
// Opaque types are simple derived types with no state. There may be many
|
||||
// different Opaque type objects floating around, but two are only considered
|
||||
// identical if they are pointer equals of each other. This allows us to have
|
||||
// identical if they are pointer equals of each other. This allows us to have
|
||||
// two opaque types that end up resolving to different concrete types later.
|
||||
//
|
||||
// Opaque types are also kinda weird and scary and different because they have
|
||||
@ -55,7 +55,7 @@ public:
|
||||
///===-------------------------------------------------------------------===//
|
||||
/// Definitions of all of the base types for the Type system. Based on this
|
||||
/// value, you can cast to a "DerivedType" subclass (see DerivedTypes.h)
|
||||
/// Note: If you add an element to this, you need to add an element to the
|
||||
/// Note: If you add an element to this, you need to add an element to the
|
||||
/// Type::getPrimitiveType function, or else things will break!
|
||||
///
|
||||
enum TypeID {
|
||||
@ -66,14 +66,14 @@ public:
|
||||
UIntTyID , IntTyID, // 6, 7: 32 bit types...
|
||||
ULongTyID , LongTyID, // 8, 9: 64 bit types...
|
||||
FloatTyID , DoubleTyID, // 10,11: Floating point types...
|
||||
LabelTyID , // 12 : Labels...
|
||||
LabelTyID , // 12 : Labels...
|
||||
|
||||
// Derived types... see DerivedTypes.h file...
|
||||
// Make sure FirstDerivedTyID stays up to date!!!
|
||||
FunctionTyID , StructTyID, // Functions... Structs...
|
||||
ArrayTyID , PointerTyID, // Array... pointer...
|
||||
OpaqueTyID, // Opaque type instances...
|
||||
PackedTyID, // SIMD 'packed' format...
|
||||
PackedTyID, // SIMD 'packed' format...
|
||||
//...
|
||||
|
||||
NumTypeIDs, // Must remain as last defined ID
|
||||
@ -145,18 +145,18 @@ public:
|
||||
/// Float and Double.
|
||||
///
|
||||
bool isSigned() const {
|
||||
return ID == SByteTyID || ID == ShortTyID ||
|
||||
ID == IntTyID || ID == LongTyID;
|
||||
return ID == SByteTyID || ID == ShortTyID ||
|
||||
ID == IntTyID || ID == LongTyID;
|
||||
}
|
||||
|
||||
|
||||
/// isUnsigned - Return whether a numeric type is unsigned. This is not quite
|
||||
/// the complement of isSigned... nonnumeric types return false as they do
|
||||
/// with isSigned. This returns true for UByteTy, UShortTy, UIntTy, and
|
||||
/// ULongTy
|
||||
///
|
||||
///
|
||||
bool isUnsigned() const {
|
||||
return ID == UByteTyID || ID == UShortTyID ||
|
||||
ID == UIntTyID || ID == ULongTyID;
|
||||
return ID == UByteTyID || ID == UShortTyID ||
|
||||
ID == UIntTyID || ID == ULongTyID;
|
||||
}
|
||||
|
||||
/// isInteger - Equivalent to isSigned() || isUnsigned()
|
||||
@ -173,7 +173,7 @@ public:
|
||||
bool isFloatingPoint() const { return ID == FloatTyID || ID == DoubleTyID; }
|
||||
|
||||
/// isAbstract - True if the type is either an Opaque type, or is a derived
|
||||
/// type that includes an opaque type somewhere in it.
|
||||
/// type that includes an opaque type somewhere in it.
|
||||
///
|
||||
inline bool isAbstract() const { return Abstract; }
|
||||
|
||||
@ -192,7 +192,7 @@ public:
|
||||
/// isFirstClassType - Return true if the value is holdable in a register.
|
||||
///
|
||||
inline bool isFirstClassType() const {
|
||||
return (ID != VoidTyID && ID <= LastPrimitiveTyID) ||
|
||||
return (ID != VoidTyID && ID <= LastPrimitiveTyID) ||
|
||||
ID == PointerTyID || ID == PackedTyID;
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ public:
|
||||
static Type *VoidTy , *BoolTy;
|
||||
static Type *SByteTy, *UByteTy,
|
||||
*ShortTy, *UShortTy,
|
||||
*IntTy , *UIntTy,
|
||||
*IntTy , *UIntTy,
|
||||
*LongTy , *ULongTy;
|
||||
static Type *FloatTy, *DoubleTy;
|
||||
|
||||
@ -295,7 +295,7 @@ public:
|
||||
assert(isAbstract() && "Cannot add a reference to a non-abstract type!");
|
||||
++RefCount;
|
||||
}
|
||||
|
||||
|
||||
void dropRef() const {
|
||||
assert(isAbstract() && "Cannot drop a reference to a non-abstract type!");
|
||||
assert(RefCount && "No objects are currently referencing this object!");
|
||||
@ -325,7 +325,7 @@ private:
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Define some inline methods for the AbstractTypeUser.h:PATypeHandle class.
|
||||
// These are defined here because they MUST be inlined, yet are dependent on
|
||||
// These are defined here because they MUST be inlined, yet are dependent on
|
||||
// the definition of the Type class. Of course Type derives from Value, which
|
||||
// contains an AbstractTypeUser instance, so there is no good way to factor out
|
||||
// the code. Hence this bit of uglyness.
|
||||
@ -375,7 +375,7 @@ inline Type* PATypeHolder::get() const {
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Provide specializations of GraphTraits to be able to treat a type as a
|
||||
// Provide specializations of GraphTraits to be able to treat a type as a
|
||||
// graph of sub types...
|
||||
|
||||
template <> struct GraphTraits<Type*> {
|
||||
@ -383,10 +383,10 @@ template <> struct GraphTraits<Type*> {
|
||||
typedef Type::subtype_iterator ChildIteratorType;
|
||||
|
||||
static inline NodeType *getEntryNode(Type *T) { return T; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->subtype_begin();
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->subtype_begin();
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return N->subtype_end();
|
||||
}
|
||||
};
|
||||
@ -396,15 +396,15 @@ template <> struct GraphTraits<const Type*> {
|
||||
typedef Type::subtype_iterator ChildIteratorType;
|
||||
|
||||
static inline NodeType *getEntryNode(const Type *T) { return T; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->subtype_begin();
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->subtype_begin();
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return N->subtype_end();
|
||||
}
|
||||
};
|
||||
|
||||
template <> inline bool isa_impl<PointerType, Type>(const Type &Ty) {
|
||||
template <> inline bool isa_impl<PointerType, Type>(const Type &Ty) {
|
||||
return Ty.getTypeID() == Type::PointerTyID;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Use.h - Definition of the Use class ----------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This defines the Use class. The Use class represents the operand of an
|
||||
@ -114,7 +114,7 @@ public:
|
||||
value_use_iterator(const _Self &I) : U(I.U) {}
|
||||
value_use_iterator() {}
|
||||
|
||||
bool operator==(const _Self &x) const {
|
||||
bool operator==(const _Self &x) const {
|
||||
return U == x.U;
|
||||
}
|
||||
bool operator!=(const _Self &x) const {
|
||||
@ -125,14 +125,14 @@ public:
|
||||
_Self &operator++() { // Preincrement
|
||||
assert(U && "Cannot increment end iterator!");
|
||||
U = U->getNext();
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
_Self operator++(int) { // Postincrement
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
|
||||
// Retrieve a reference to the current SCC
|
||||
UserTy *operator*() const {
|
||||
UserTy *operator*() const {
|
||||
assert(U && "Cannot increment end iterator!");
|
||||
return U->getUser();
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/User.h - User class definition ---------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This class defines the interface that one who 'use's a Value must implement.
|
||||
@ -39,11 +39,11 @@ protected:
|
||||
unsigned NumOperands;
|
||||
|
||||
public:
|
||||
User(const Type *Ty, unsigned vty, Use *OpList, unsigned NumOps,
|
||||
User(const Type *Ty, unsigned vty, Use *OpList, unsigned NumOps,
|
||||
const std::string &name = "")
|
||||
: Value(Ty, vty, name), OperandList(OpList), NumOperands(NumOps) {}
|
||||
|
||||
Value *getOperand(unsigned i) const {
|
||||
Value *getOperand(unsigned i) const {
|
||||
assert(i < NumOperands && "getOperand() out of range!");
|
||||
return OperandList[i];
|
||||
}
|
||||
@ -69,7 +69,7 @@ public:
|
||||
// 'delete' a whole class at a time, even though there may be circular
|
||||
// references... first all references are dropped, and all use counts go to
|
||||
// zero. Then everything is delete'd for real. Note that no operations are
|
||||
// valid on an object that has "dropped all references", except operator
|
||||
// valid on an object that has "dropped all references", except operator
|
||||
// delete.
|
||||
//
|
||||
void dropAllReferences() {
|
||||
@ -92,7 +92,7 @@ public:
|
||||
|
||||
template<> struct simplify_type<User::op_iterator> {
|
||||
typedef Value* SimpleType;
|
||||
|
||||
|
||||
static SimpleType getSimplifiedValue(const User::op_iterator &Val) {
|
||||
return static_cast<SimpleType>(Val->get());
|
||||
}
|
||||
@ -103,7 +103,7 @@ template<> struct simplify_type<const User::op_iterator>
|
||||
|
||||
template<> struct simplify_type<User::const_op_iterator> {
|
||||
typedef Value* SimpleType;
|
||||
|
||||
|
||||
static SimpleType getSimplifiedValue(const User::const_op_iterator &Val) {
|
||||
return static_cast<SimpleType>(Val->get());
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- llvm/Value.h - Definition of the Value class ------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the very important Value class. This is subclassed by a
|
||||
@ -60,7 +60,7 @@ private:
|
||||
public:
|
||||
Value(const Type *Ty, unsigned scid, const std::string &name = "");
|
||||
virtual ~Value();
|
||||
|
||||
|
||||
/// dump - Support for debugging, callable in GDB: V->dump()
|
||||
//
|
||||
virtual void dump() const;
|
||||
@ -68,19 +68,19 @@ public:
|
||||
/// print - Implement operator<< on Value...
|
||||
///
|
||||
virtual void print(std::ostream &O) const = 0;
|
||||
|
||||
|
||||
/// All values are typed, get the type of this value.
|
||||
///
|
||||
inline const Type *getType() const { return Ty; }
|
||||
|
||||
|
||||
// All values can potentially be named...
|
||||
inline bool hasName() const { return !Name.empty(); }
|
||||
inline const std::string &getName() const { return Name; }
|
||||
|
||||
void setName(const std::string &name);
|
||||
|
||||
|
||||
/// replaceAllUsesWith - Go through the uses list for this definition and make
|
||||
/// each use point to "V" instead of "this". After this completes, 'this's
|
||||
/// each use point to "V" instead of "this". After this completes, 'this's
|
||||
/// use list is guaranteed to be empty.
|
||||
///
|
||||
void replaceAllUsesWith(Value *V);
|
||||
@ -184,7 +184,7 @@ Use::~Use() {
|
||||
if (Val) removeFromList();
|
||||
}
|
||||
|
||||
void Use::set(Value *V) {
|
||||
void Use::set(Value *V) {
|
||||
if (Val) removeFromList();
|
||||
Val = V;
|
||||
if (V) V->addUse(*this);
|
||||
@ -194,7 +194,7 @@ void Use::set(Value *V) {
|
||||
// isa - Provide some specializations of isa so that we don't have to include
|
||||
// the subtype header files to test to see if the value is a subclass...
|
||||
//
|
||||
template <> inline bool isa_impl<Constant, Value>(const Value &Val) {
|
||||
template <> inline bool isa_impl<Constant, Value>(const Value &Val) {
|
||||
return Val.getValueType() == Value::SimpleConstantVal ||
|
||||
Val.getValueType() == Value::FunctionVal ||
|
||||
Val.getValueType() == Value::GlobalVariableVal ||
|
||||
@ -202,22 +202,22 @@ template <> inline bool isa_impl<Constant, Value>(const Value &Val) {
|
||||
Val.getValueType() == Value::ConstantAggregateZeroVal ||
|
||||
Val.getValueType() == Value::UndefValueVal;
|
||||
}
|
||||
template <> inline bool isa_impl<Argument, Value>(const Value &Val) {
|
||||
template <> inline bool isa_impl<Argument, Value>(const Value &Val) {
|
||||
return Val.getValueType() == Value::ArgumentVal;
|
||||
}
|
||||
template <> inline bool isa_impl<Instruction, Value>(const Value &Val) {
|
||||
template <> inline bool isa_impl<Instruction, Value>(const Value &Val) {
|
||||
return Val.getValueType() >= Value::InstructionVal;
|
||||
}
|
||||
template <> inline bool isa_impl<BasicBlock, Value>(const Value &Val) {
|
||||
template <> inline bool isa_impl<BasicBlock, Value>(const Value &Val) {
|
||||
return Val.getValueType() == Value::BasicBlockVal;
|
||||
}
|
||||
template <> inline bool isa_impl<Function, Value>(const Value &Val) {
|
||||
template <> inline bool isa_impl<Function, Value>(const Value &Val) {
|
||||
return Val.getValueType() == Value::FunctionVal;
|
||||
}
|
||||
template <> inline bool isa_impl<GlobalVariable, Value>(const Value &Val) {
|
||||
template <> inline bool isa_impl<GlobalVariable, Value>(const Value &Val) {
|
||||
return Val.getValueType() == Value::GlobalVariableVal;
|
||||
}
|
||||
template <> inline bool isa_impl<GlobalValue, Value>(const Value &Val) {
|
||||
template <> inline bool isa_impl<GlobalValue, Value>(const Value &Val) {
|
||||
return isa<GlobalVariable>(Val) || isa<Function>(Val);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user