summaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-01-15 15:37:28 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-01-15 15:37:28 +0000
commit3fba7d16b41dfbefe3b1be6bc0ab94c017728f79 (patch)
treebe5a687969f682edded4aa6f13594ffd9aa9030e /include/llvm/Analysis
parenta16c51cee9225a354c999dd1076d5dba2aa79807 (diff)
downloadFreeBSD-src-3fba7d16b41dfbefe3b1be6bc0ab94c017728f79.zip
FreeBSD-src-3fba7d16b41dfbefe3b1be6bc0ab94c017728f79.tar.gz
Update LLVM to 93512.
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r--include/llvm/Analysis/AliasAnalysis.h4
-rw-r--r--include/llvm/Analysis/DebugInfo.h31
-rw-r--r--include/llvm/Analysis/DominatorInternals.h11
-rw-r--r--include/llvm/Analysis/Dominators.h73
-rw-r--r--include/llvm/Analysis/LoopInfo.h4
-rw-r--r--include/llvm/Analysis/PostDominators.h16
6 files changed, 63 insertions, 76 deletions
diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h
index 2d43bdd..9f41135 100644
--- a/include/llvm/Analysis/AliasAnalysis.h
+++ b/include/llvm/Analysis/AliasAnalysis.h
@@ -197,6 +197,10 @@ public:
virtual ModRefBehavior getModRefBehavior(Function *F,
std::vector<PointerAccessInfo> *Info = 0);
+ /// getModRefBehavior - Return the modref behavior of the intrinsic with the
+ /// given id.
+ static ModRefBehavior getModRefBehavior(unsigned iid);
+
/// doesNotAccessMemory - If the specified call is known to never read or
/// write memory, return true. If the call only reads from known-constant
/// memory, it is also legal to return true. Calls that unwind the stack
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index fdbd9c1..cc9514c 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -30,11 +30,7 @@ namespace llvm {
class Module;
class Type;
class Value;
- struct DbgStopPointInst;
- struct DbgDeclareInst;
- struct DbgFuncStartInst;
- struct DbgRegionStartInst;
- struct DbgRegionEndInst;
+ class DbgDeclareInst;
class DebugLoc;
struct DebugLocTracker;
class Instruction;
@@ -495,7 +491,6 @@ namespace llvm {
Module &M;
LLVMContext& VMContext;
- const Type *EmptyStructPtr; // "{}*".
Function *DeclareFn; // llvm.dbg.declare
Function *ValueFn; // llvm.dbg.value
@@ -651,27 +646,19 @@ namespace llvm {
Instruction *InsertBefore);
/// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
- Instruction *InsertDbgValueIntrinsic(llvm::Value *V, llvm::Value *Offset,
+ Instruction *InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset,
DIVariable D, BasicBlock *InsertAtEnd);
/// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
- Instruction *InsertDbgValueIntrinsic(llvm::Value *V, llvm::Value *Offset,
+ Instruction *InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset,
DIVariable D, Instruction *InsertBefore);
private:
Constant *GetTagConstant(unsigned TAG);
};
- /// Finds the stoppoint coressponding to this instruction, that is the
- /// stoppoint that dominates this instruction
- const DbgStopPointInst *findStopPoint(const Instruction *Inst);
-
- /// Finds the stoppoint corresponding to first real (non-debug intrinsic)
- /// instruction in this Basic Block, and returns the stoppoint for it.
- const DbgStopPointInst *findBBStopPoint(const BasicBlock *BB);
-
/// Finds the dbg.declare intrinsic corresponding to this value if any.
/// It looks through pointer casts too.
- const DbgDeclareInst *findDbgDeclare(const Value *V, bool stripCasts = true);
+ const DbgDeclareInst *findDbgDeclare(const Value *V);
/// Find the debug info descriptor corresponding to this global variable.
Value *findDbgGlobalDeclare(GlobalVariable *V);
@@ -681,20 +668,10 @@ namespace llvm {
std::string &Dir);
/// ExtractDebugLocation - Extract debug location information
- /// from llvm.dbg.stoppoint intrinsic.
- DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
- DebugLocTracker &DebugLocInfo);
-
- /// ExtractDebugLocation - Extract debug location information
/// from DILocation.
DebugLoc ExtractDebugLocation(DILocation &Loc,
DebugLocTracker &DebugLocInfo);
- /// ExtractDebugLocation - Extract debug location information
- /// from llvm.dbg.func_start intrinsic.
- DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
- DebugLocTracker &DebugLocInfo);
-
/// getDISubprogram - Find subprogram that is enclosing this scope.
DISubprogram getDISubprogram(MDNode *Scope);
diff --git a/include/llvm/Analysis/DominatorInternals.h b/include/llvm/Analysis/DominatorInternals.h
index cca0d50..5ecb348 100644
--- a/include/llvm/Analysis/DominatorInternals.h
+++ b/include/llvm/Analysis/DominatorInternals.h
@@ -347,15 +347,8 @@ void Calculate(DominatorTreeBase<typename GraphTraits<NodeT>::NodeType>& DT,
DT.IDoms.clear();
DT.Info.clear();
std::vector<typename GraphT::NodeType*>().swap(DT.Vertex);
-
- // FIXME: This does not work on PostDomTrees. It seems likely that this is
- // due to an error in the algorithm for post-dominators. This really should
- // be investigated and fixed at some point.
- // DT.updateDFSNumbers();
-
- // Start out with the DFS numbers being invalid. Let them be computed if
- // demanded.
- DT.DFSInfoValid = false;
+
+ DT.updateDFSNumbers();
}
}
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 2e149d5..31c19c4 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -390,6 +390,13 @@ public:
if (A == 0 || B == 0)
return false;
+ // Compare the result of the tree walk and the dfs numbers, if expensive
+ // checks are enabled.
+#ifdef XDEBUG
+ assert(!DFSInfoValid
+ || (dominatedBySlowTreeWalk(A, B) == B->DominatedBy(A)));
+#endif
+
if (DFSInfoValid)
return B->DominatedBy(A);
@@ -585,29 +592,35 @@ protected:
SmallVector<std::pair<DomTreeNodeBase<NodeT>*,
typename DomTreeNodeBase<NodeT>::iterator>, 32> WorkStack;
- for (unsigned i = 0, e = (unsigned)this->Roots.size(); i != e; ++i) {
- DomTreeNodeBase<NodeT> *ThisRoot = getNode(this->Roots[i]);
- WorkStack.push_back(std::make_pair(ThisRoot, ThisRoot->begin()));
- ThisRoot->DFSNumIn = DFSNum++;
-
- while (!WorkStack.empty()) {
- DomTreeNodeBase<NodeT> *Node = WorkStack.back().first;
- typename DomTreeNodeBase<NodeT>::iterator ChildIt =
- WorkStack.back().second;
-
- // If we visited all of the children of this node, "recurse" back up the
- // stack setting the DFOutNum.
- if (ChildIt == Node->end()) {
- Node->DFSNumOut = DFSNum++;
- WorkStack.pop_back();
- } else {
- // Otherwise, recursively visit this child.
- DomTreeNodeBase<NodeT> *Child = *ChildIt;
- ++WorkStack.back().second;
-
- WorkStack.push_back(std::make_pair(Child, Child->begin()));
- Child->DFSNumIn = DFSNum++;
- }
+ DomTreeNodeBase<NodeT> *ThisRoot = getRootNode();
+
+ if (!ThisRoot)
+ return;
+
+ // Even in the case of multiple exits that form the post dominator root
+ // nodes, do not iterate over all exits, but start from the virtual root
+ // node. Otherwise bbs, that are not post dominated by any exit but by the
+ // virtual root node, will never be assigned a DFS number.
+ WorkStack.push_back(std::make_pair(ThisRoot, ThisRoot->begin()));
+ ThisRoot->DFSNumIn = DFSNum++;
+
+ while (!WorkStack.empty()) {
+ DomTreeNodeBase<NodeT> *Node = WorkStack.back().first;
+ typename DomTreeNodeBase<NodeT>::iterator ChildIt =
+ WorkStack.back().second;
+
+ // If we visited all of the children of this node, "recurse" back up the
+ // stack setting the DFOutNum.
+ if (ChildIt == Node->end()) {
+ Node->DFSNumOut = DFSNum++;
+ WorkStack.pop_back();
+ } else {
+ // Otherwise, recursively visit this child.
+ DomTreeNodeBase<NodeT> *Child = *ChildIt;
+ ++WorkStack.back().second;
+
+ WorkStack.push_back(std::make_pair(Child, Child->begin()));
+ Child->DFSNumIn = DFSNum++;
}
}
@@ -646,21 +659,17 @@ public:
/// recalculate - compute a dominator tree for the given function
template<class FT>
void recalculate(FT& F) {
- if (!this->IsPostDominators) {
- reset();
+ reset();
+ this->Vertex.push_back(0);
- // Initialize roots
+ if (!this->IsPostDominators) {
+ // Initialize root
this->Roots.push_back(&F.front());
this->IDoms[&F.front()] = 0;
this->DomTreeNodes[&F.front()] = 0;
- this->Vertex.push_back(0);
Calculate<FT, NodeT*>(*this, F);
-
- updateDFSNumbers();
} else {
- reset(); // Reset from the last time we were run...
-
// Initialize the roots list
for (typename FT::iterator I = F.begin(), E = F.end(); I != E; ++I) {
if (std::distance(GraphTraits<FT*>::child_begin(I),
@@ -672,8 +681,6 @@ public:
this->DomTreeNodes[I] = 0;
}
- this->Vertex.push_back(0);
-
Calculate<FT, Inverse<NodeT*> >(*this, F);
}
}
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 060286f..33bf0b0 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -478,7 +478,7 @@ public:
for (iterator I = begin(), E = end(); I != E; ++I)
(*I)->print(OS, Depth+2);
}
-
+
protected:
friend class LoopInfoBase<BlockT, LoopT>;
explicit LoopBase(BlockT *BB) : ParentLoop(0) {
@@ -588,6 +588,8 @@ public:
/// block, return that block. Otherwise return null.
BasicBlock *getUniqueExitBlock() const;
+ void dump() const;
+
private:
friend class LoopInfoBase<BasicBlock, Loop>;
explicit Loop(BasicBlock *BB) : LoopBase<BasicBlock, Loop>(BB) {}
diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h
index ea14b2d..3681cc01 100644
--- a/include/llvm/Analysis/PostDominators.h
+++ b/include/llvm/Analysis/PostDominators.h
@@ -36,19 +36,23 @@ struct PostDominatorTree : public FunctionPass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}
-
+
inline const std::vector<BasicBlock*> &getRoots() const {
return DT->getRoots();
}
-
+
inline DomTreeNode *getRootNode() const {
return DT->getRootNode();
}
-
+
inline DomTreeNode *operator[](BasicBlock *BB) const {
return DT->getNode(BB);
}
-
+
+ inline DomTreeNode *getNode(BasicBlock *BB) const {
+ return DT->getNode(BB);
+ }
+
inline bool dominates(DomTreeNode* A, DomTreeNode* B) const {
return DT->dominates(A, B);
}
@@ -60,7 +64,7 @@ struct PostDominatorTree : public FunctionPass {
inline bool properlyDominates(const DomTreeNode* A, DomTreeNode* B) const {
return DT->properlyDominates(A, B);
}
-
+
inline bool properlyDominates(BasicBlock* A, BasicBlock* B) const {
return DT->properlyDominates(A, B);
}
@@ -97,7 +101,7 @@ template <> struct GraphTraits<PostDominatorTree*>
///
struct PostDominanceFrontier : public DominanceFrontierBase {
static char ID;
- PostDominanceFrontier()
+ PostDominanceFrontier()
: DominanceFrontierBase(&ID, true) {}
virtual bool runOnFunction(Function &) {
OpenPOWER on IntegriCloud