summaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-01-01 10:31:22 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-01-01 10:31:22 +0000
commita16c51cee9225a354c999dd1076d5dba2aa79807 (patch)
treedba00119388b84f9f44e6ec5e9129f807fd79ca3 /include/llvm/Analysis
parent40a6fcdb85efd93fe0e36c9552cfb0b18b5eacd6 (diff)
downloadFreeBSD-src-a16c51cee9225a354c999dd1076d5dba2aa79807.zip
FreeBSD-src-a16c51cee9225a354c999dd1076d5dba2aa79807.tar.gz
Update LLVM to 92395.
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r--include/llvm/Analysis/DebugInfo.h90
-rw-r--r--include/llvm/Analysis/LoopInfo.h22
-rw-r--r--include/llvm/Analysis/MemoryDependenceAnalysis.h44
-rw-r--r--include/llvm/Analysis/ProfileInfo.h30
-rw-r--r--include/llvm/Analysis/ScalarEvolution.h2
-rw-r--r--include/llvm/Analysis/SparsePropagation.h7
-rw-r--r--include/llvm/Analysis/ValueTracking.h1
7 files changed, 102 insertions, 94 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index 232804e..fdbd9c1 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -17,14 +17,10 @@
#ifndef LLVM_ANALYSIS_DEBUGINFO_H
#define LLVM_ANALYSIS_DEBUGINFO_H
-#include "llvm/Metadata.h"
-#include "llvm/Target/TargetMachine.h"
-#include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Dwarf.h"
-#include "llvm/Support/ValueHandle.h"
namespace llvm {
class BasicBlock;
@@ -42,13 +38,15 @@ namespace llvm {
class DebugLoc;
struct DebugLocTracker;
class Instruction;
+ class MDNode;
class LLVMContext;
- /// DIDescriptor - A thin wraper around MDNode to access encoded debug info. This should not
- /// be stored in a container, because underly MDNode may change in certain situations.
+ /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
+ /// This should not be stored in a container, because underly MDNode may
+ /// change in certain situations.
class DIDescriptor {
protected:
- MDNode *DbgNode;
+ MDNode *DbgNode;
/// DIDescriptor constructor. If the specified node is non-null, check
/// to make sure that the tag in the descriptor matches 'RequiredTag'. If
@@ -86,7 +84,7 @@ namespace llvm {
}
/// ValidDebugInfo - Return true if N represents valid debug info value.
- static bool ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel);
+ static bool ValidDebugInfo(MDNode *N, unsigned OptLevel);
/// dump - print descriptor.
void dump() const;
@@ -99,6 +97,7 @@ namespace llvm {
bool isGlobalVariable() const;
bool isScope() const;
bool isCompileUnit() const;
+ bool isNameSpace() const;
bool isLexicalBlock() const;
bool isSubrange() const;
bool isEnumerator() const;
@@ -218,7 +217,7 @@ namespace llvm {
virtual ~DIType() {}
DIDescriptor getContext() const { return getDescriptorField(1); }
- StringRef getName() const { return getStringField(2); }
+ StringRef getName() const { return getStringField(2); }
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
unsigned getLineNumber() const { return getUnsignedField(4); }
uint64_t getSizeInBits() const { return getUInt64Field(5); }
@@ -371,20 +370,10 @@ namespace llvm {
unsigned isLocalToUnit() const { return getUnsignedField(9); }
unsigned isDefinition() const { return getUnsignedField(10); }
- unsigned getVirtuality() const {
- if (DbgNode->getNumElements() < 14)
- return 0;
- return getUnsignedField(11);
- }
-
- unsigned getVirtualIndex() const {
- if (DbgNode->getNumElements() < 14)
- return 0;
- return getUnsignedField(12);
- }
+ unsigned getVirtuality() const { return getUnsignedField(11); }
+ unsigned getVirtualIndex() const { return getUnsignedField(12); }
DICompositeType getContainingType() const {
- assert (DbgNode->getNumElements() >= 14 && "Invalid type!");
return getFieldAs<DICompositeType>(13);
}
@@ -442,8 +431,8 @@ namespace llvm {
return getNumAddrElements() > 0;
}
- unsigned getNumAddrElements() const { return DbgNode->getNumElements()-6; }
-
+ unsigned getNumAddrElements() const;
+
uint64_t getAddrElement(unsigned Idx) const {
return getUInt64Field(Idx+6);
}
@@ -470,6 +459,22 @@ namespace llvm {
StringRef getFilename() const { return getContext().getFilename(); }
};
+ /// DINameSpace - A wrapper for a C++ style name space.
+ class DINameSpace : public DIScope {
+ public:
+ explicit DINameSpace(MDNode *N = 0) : DIScope(N) {
+ if (DbgNode && !isNameSpace())
+ DbgNode = 0;
+ }
+
+ DIScope getContext() const { return getFieldAs<DIScope>(1); }
+ StringRef getName() const { return getStringField(2); }
+ StringRef getDirectory() const { return getContext().getDirectory(); }
+ StringRef getFilename() const { return getContext().getFilename(); }
+ DICompileUnit getCompileUnit() const { return getFieldAs<DICompileUnit>(3);}
+ unsigned getLineNumber() const { return getUnsignedField(4); }
+ };
+
/// DILocation - This object holds location information. This object
/// is not associated with any DWARF tag.
class DILocation : public DIDescriptor {
@@ -624,6 +629,11 @@ namespace llvm {
/// with the specified parent context.
DILexicalBlock CreateLexicalBlock(DIDescriptor Context);
+ /// CreateNameSpace - This creates new descriptor for a namespace
+ /// with the specified parent context.
+ DINameSpace CreateNameSpace(DIDescriptor Context, StringRef Name,
+ DICompileUnit CU, unsigned LineNo);
+
/// CreateLocation - Creates a debug info location.
DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
DIScope S, DILocation OrigLoc);
@@ -666,34 +676,9 @@ namespace llvm {
/// Find the debug info descriptor corresponding to this global variable.
Value *findDbgGlobalDeclare(GlobalVariable *V);
-bool getLocationInfo(const Value *V, std::string &DisplayName,
- std::string &Type, unsigned &LineNo, std::string &File,
- std::string &Dir);
-
- /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
- /// info intrinsic.
- bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI,
- CodeGenOpt::Level OptLev);
-
- /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug
- /// info intrinsic.
- bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI,
- CodeGenOpt::Level OptLev);
-
- /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug
- /// info intrinsic.
- bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI,
- CodeGenOpt::Level OptLev);
-
- /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug
- /// info intrinsic.
- bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI,
- CodeGenOpt::Level OptLev);
-
- /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug
- /// info intrinsic.
- bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI,
- CodeGenOpt::Level OptLev);
+ bool getLocationInfo(const Value *V, std::string &DisplayName,
+ std::string &Type, unsigned &LineNo, std::string &File,
+ std::string &Dir);
/// ExtractDebugLocation - Extract debug location information
/// from llvm.dbg.stoppoint intrinsic.
@@ -717,7 +702,6 @@ bool getLocationInfo(const Value *V, std::string &DisplayName,
DICompositeType getDICompositeType(DIType T);
class DebugInfoFinder {
-
public:
/// processModule - Process entire module and collect debug info
/// anchors.
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 2294e53..060286f 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -93,12 +93,28 @@ public:
BlockT *getHeader() const { return Blocks.front(); }
LoopT *getParentLoop() const { return ParentLoop; }
- /// contains - Return true if the specified basic block is in this loop
+ /// contains - Return true if the specified loop is contained within in
+ /// this loop.
+ ///
+ bool contains(const LoopT *L) const {
+ if (L == this) return true;
+ if (L == 0) return false;
+ return contains(L->getParentLoop());
+ }
+
+ /// contains - Return true if the specified basic block is in this loop.
///
bool contains(const BlockT *BB) const {
return std::find(block_begin(), block_end(), BB) != block_end();
}
+ /// contains - Return true if the specified instruction is in this loop.
+ ///
+ template<class InstT>
+ bool contains(const InstT *Inst) const {
+ return contains(Inst->getParent());
+ }
+
/// iterator/begin/end - Return the loops contained entirely within this loop.
///
const std::vector<LoopT *> &getSubLoops() const { return SubLoops; }
@@ -463,10 +479,6 @@ public:
(*I)->print(OS, Depth+2);
}
- void dump() const {
- print(errs());
- }
-
protected:
friend class LoopInfoBase<BlockT, LoopT>;
explicit LoopBase(BlockT *BB) : ParentLoop(0) {
diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h
index c04631b..f83cc4f 100644
--- a/include/llvm/Analysis/MemoryDependenceAnalysis.h
+++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h
@@ -132,21 +132,17 @@ namespace llvm {
}
};
- /// NonLocalDepEntry - This is an entry in the NonLocalDepInfo cache, and an
- /// entry in the results set for a non-local query. For each BasicBlock (the
- /// BB entry) it keeps a MemDepResult and the (potentially phi translated)
- /// address that was live in the block.
- class NonLocalDepEntry {
+ /// NonLocalDepResult - This is a result from a NonLocal dependence query.
+ /// For each BasicBlock (the BB entry) it keeps a MemDepResult and the
+ /// (potentially phi translated) address that was live in the block.
+ class NonLocalDepResult {
BasicBlock *BB;
MemDepResult Result;
- WeakVH Address;
+ Value *Address;
public:
- NonLocalDepEntry(BasicBlock *bb, MemDepResult result, Value *address)
+ NonLocalDepResult(BasicBlock *bb, MemDepResult result, Value *address)
: BB(bb), Result(result), Address(address) {}
-
- // This is used for searches.
- NonLocalDepEntry(BasicBlock *bb) : BB(bb) {}
-
+
// BB is the sort key, it can't be changed.
BasicBlock *getBB() const { return BB; }
@@ -154,7 +150,7 @@ namespace llvm {
Result = R;
Address = Addr;
}
-
+
const MemDepResult &getResult() const { return Result; }
/// getAddress - Return the address of this pointer in this block. This can
@@ -165,7 +161,27 @@ namespace llvm {
///
/// The address is always null for a non-local 'call' dependence.
Value *getAddress() const { return Address; }
+ };
+
+ /// NonLocalDepEntry - This is an entry in the NonLocalDepInfo cache. For
+ /// each BasicBlock (the BB entry) it keeps a MemDepResult.
+ class NonLocalDepEntry {
+ BasicBlock *BB;
+ MemDepResult Result;
+ public:
+ NonLocalDepEntry(BasicBlock *bb, MemDepResult result)
+ : BB(bb), Result(result) {}
+
+ // This is used for searches.
+ NonLocalDepEntry(BasicBlock *bb) : BB(bb) {}
+ // BB is the sort key, it can't be changed.
+ BasicBlock *getBB() const { return BB; }
+
+ void setResult(const MemDepResult &R) { Result = R; }
+
+ const MemDepResult &getResult() const { return Result; }
+
bool operator<(const NonLocalDepEntry &RHS) const {
return BB < RHS.BB;
}
@@ -283,7 +299,7 @@ namespace llvm {
/// This method assumes the pointer has a "NonLocal" dependency within BB.
void getNonLocalPointerDependency(Value *Pointer, bool isLoad,
BasicBlock *BB,
- SmallVectorImpl<NonLocalDepEntry> &Result);
+ SmallVectorImpl<NonLocalDepResult> &Result);
/// removeInstruction - Remove an instruction from the dependence analysis,
/// updating the dependence of instructions that previously depended on it.
@@ -307,7 +323,7 @@ namespace llvm {
BasicBlock *BB);
bool getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t Size,
bool isLoad, BasicBlock *BB,
- SmallVectorImpl<NonLocalDepEntry> &Result,
+ SmallVectorImpl<NonLocalDepResult> &Result,
DenseMap<BasicBlock*, Value*> &Visited,
bool SkipFirstBlock = false);
MemDepResult GetNonLocalInfoForBlock(Value *Pointer, uint64_t PointeeSize,
diff --git a/include/llvm/Analysis/ProfileInfo.h b/include/llvm/Analysis/ProfileInfo.h
index 80ba6d8..300a027 100644
--- a/include/llvm/Analysis/ProfileInfo.h
+++ b/include/llvm/Analysis/ProfileInfo.h
@@ -38,7 +38,7 @@ namespace llvm {
class MachineBasicBlock;
class MachineFunction;
- // Helper for dumping edges to errs().
+ // Helper for dumping edges to dbgs().
raw_ostream& operator<<(raw_ostream &O, std::pair<const BasicBlock *, const BasicBlock *> E);
raw_ostream& operator<<(raw_ostream &O, std::pair<const MachineBasicBlock *, const MachineBasicBlock *> E);
@@ -123,7 +123,7 @@ namespace llvm {
void setEdgeWeight(Edge e, double w) {
DEBUG_WITH_TYPE("profile-info",
- errs() << "Creating Edge " << e
+ dbgs() << "Creating Edge " << e
<< " (weight: " << format("%.20g",w) << ")\n");
EdgeInformation[getFunction(e)][e] = w;
}
@@ -170,18 +170,18 @@ namespace llvm {
void repair(const FType *F);
void dump(FType *F = 0, bool real = true) {
- errs() << "**** This is ProfileInfo " << this << " speaking:\n";
+ dbgs() << "**** This is ProfileInfo " << this << " speaking:\n";
if (!real) {
typename std::set<const FType*> Functions;
- errs() << "Functions: \n";
+ dbgs() << "Functions: \n";
if (F) {
- errs() << F << "@" << format("%p", F) << ": " << format("%.20g",getExecutionCount(F)) << "\n";
+ dbgs() << F << "@" << format("%p", F) << ": " << format("%.20g",getExecutionCount(F)) << "\n";
Functions.insert(F);
} else {
for (typename std::map<const FType*, double>::iterator fi = FunctionInformation.begin(),
fe = FunctionInformation.end(); fi != fe; ++fi) {
- errs() << fi->first << "@" << format("%p",fi->first) << ": " << format("%.20g",fi->second) << "\n";
+ dbgs() << fi->first << "@" << format("%p",fi->first) << ": " << format("%.20g",fi->second) << "\n";
Functions.insert(fi->first);
}
}
@@ -190,34 +190,34 @@ namespace llvm {
FI != FE; ++FI) {
const FType *F = *FI;
typename std::map<const FType*, BlockCounts>::iterator bwi = BlockInformation.find(F);
- errs() << "BasicBlocks for Function " << F << ":\n";
+ dbgs() << "BasicBlocks for Function " << F << ":\n";
for (typename BlockCounts::const_iterator bi = bwi->second.begin(), be = bwi->second.end(); bi != be; ++bi) {
- errs() << bi->first << "@" << format("%p", bi->first) << ": " << format("%.20g",bi->second) << "\n";
+ dbgs() << bi->first << "@" << format("%p", bi->first) << ": " << format("%.20g",bi->second) << "\n";
}
}
for (typename std::set<const FType*>::iterator FI = Functions.begin(), FE = Functions.end();
FI != FE; ++FI) {
typename std::map<const FType*, EdgeWeights>::iterator ei = EdgeInformation.find(*FI);
- errs() << "Edges for Function " << ei->first << ":\n";
+ dbgs() << "Edges for Function " << ei->first << ":\n";
for (typename EdgeWeights::iterator ewi = ei->second.begin(), ewe = ei->second.end();
ewi != ewe; ++ewi) {
- errs() << ewi->first << ": " << format("%.20g",ewi->second) << "\n";
+ dbgs() << ewi->first << ": " << format("%.20g",ewi->second) << "\n";
}
}
} else {
assert(F && "No function given, this is not supported!");
- errs() << "Functions: \n";
- errs() << F << "@" << format("%p", F) << ": " << format("%.20g",getExecutionCount(F)) << "\n";
+ dbgs() << "Functions: \n";
+ dbgs() << F << "@" << format("%p", F) << ": " << format("%.20g",getExecutionCount(F)) << "\n";
- errs() << "BasicBlocks for Function " << F << ":\n";
+ dbgs() << "BasicBlocks for Function " << F << ":\n";
for (typename FType::const_iterator BI = F->begin(), BE = F->end();
BI != BE; ++BI) {
const BType *BB = &(*BI);
- errs() << BB << "@" << format("%p", BB) << ": " << format("%.20g",getExecutionCount(BB)) << "\n";
+ dbgs() << BB << "@" << format("%p", BB) << ": " << format("%.20g",getExecutionCount(BB)) << "\n";
}
}
- errs() << "**** ProfileInfo " << this << ", over and out.\n";
+ dbgs() << "**** ProfileInfo " << this << ", over and out.\n";
}
bool CalculateMissingEdge(const BType *BB, Edge &removed, bool assumeEmptyExit = false);
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h
index 4aa3dfa..6f57c74 100644
--- a/include/llvm/Analysis/ScalarEvolution.h
+++ b/include/llvm/Analysis/ScalarEvolution.h
@@ -243,7 +243,7 @@ namespace llvm {
/// createNodeForGEP - Provide the special handling we need to analyze GEP
/// SCEVs.
- const SCEV *createNodeForGEP(Operator *GEP);
+ const SCEV *createNodeForGEP(GEPOperator *GEP);
/// computeSCEVAtScope - Implementation code for getSCEVAtScope; called
/// at most once for each SCEV+Loop pair.
diff --git a/include/llvm/Analysis/SparsePropagation.h b/include/llvm/Analysis/SparsePropagation.h
index 677d41d..c3c2f4b 100644
--- a/include/llvm/Analysis/SparsePropagation.h
+++ b/include/llvm/Analysis/SparsePropagation.h
@@ -30,7 +30,6 @@ namespace llvm {
class BasicBlock;
class Function;
class SparseSolver;
- class LLVMContext;
class raw_ostream;
template<typename T> class SmallVectorImpl;
@@ -120,8 +119,6 @@ class SparseSolver {
/// compute transfer functions.
AbstractLatticeFunction *LatticeFunc;
- LLVMContext *Context;
-
DenseMap<Value*, LatticeVal> ValueState; // The state each value is in.
SmallPtrSet<BasicBlock*, 16> BBExecutable; // The bbs that are executable.
@@ -137,8 +134,8 @@ class SparseSolver {
SparseSolver(const SparseSolver&); // DO NOT IMPLEMENT
void operator=(const SparseSolver&); // DO NOT IMPLEMENT
public:
- explicit SparseSolver(AbstractLatticeFunction *Lattice, LLVMContext *C)
- : LatticeFunc(Lattice), Context(C) {}
+ explicit SparseSolver(AbstractLatticeFunction *Lattice)
+ : LatticeFunc(Lattice) {}
~SparseSolver() {
delete LatticeFunc;
}
diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h
index 5f3c671..7c673c3 100644
--- a/include/llvm/Analysis/ValueTracking.h
+++ b/include/llvm/Analysis/ValueTracking.h
@@ -24,7 +24,6 @@ namespace llvm {
class Instruction;
class APInt;
class TargetData;
- class LLVMContext;
/// ComputeMaskedBits - Determine which of the bits specified in Mask are
/// known to be either zero or one and return them in the KnownZero/KnownOne
OpenPOWER on IntegriCloud