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