aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Instrumentation')
-rw-r--r--lib/Transforms/Instrumentation/BlockProfiling.cpp4
-rw-r--r--lib/Transforms/Instrumentation/EmitFunctions.cpp4
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp6
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp3
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp4
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/Graph.h12
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp4
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp4
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp4
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp4
-rw-r--r--lib/Transforms/Instrumentation/TraceValues.cpp4
11 files changed, 50 insertions, 3 deletions
diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp
index c371a9fa69..90ef14df7e 100644
--- a/lib/Transforms/Instrumentation/BlockProfiling.cpp
+++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp
@@ -25,6 +25,8 @@
#include "llvm/Module.h"
#include "llvm/Pass.h"
+namespace llvm {
+
static void insertInitializationCall(Function *MainFn, const char *FnName,
GlobalValue *Array) {
const Type *ArgVTy = PointerType::get(PointerType::get(Type::SByteTy));
@@ -181,3 +183,5 @@ bool BlockProfiler::run(Module &M) {
insertInitializationCall(Main, "llvm_start_block_profiling", Counters);
return true;
}
+
+} // End llvm namespace
diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp
index 9c395a9c1f..57254b9080 100644
--- a/lib/Transforms/Instrumentation/EmitFunctions.cpp
+++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp
@@ -17,6 +17,8 @@
#include "llvm/Pass.h"
#include "llvm/Support/CFG.h"
+namespace llvm {
+
enum Color{
WHITE,
GREY,
@@ -104,3 +106,5 @@ bool EmitFunctionTable::run(Module &M){
M.getGlobalList().push_back(fnCount);
return true; // Always modifies program
}
+
+} // End llvm namespace
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp b/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
index 6c7bb5f360..04207820a5 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
@@ -27,6 +27,8 @@
#include "llvm/Function.h"
#include "llvm/Pass.h"
+namespace llvm {
+
//this is used to color vertices
//during DFS
@@ -36,7 +38,7 @@ enum Color{
BLACK
};
-namespace{
+namespace {
struct CombineBranches : public FunctionPass {
private:
//DominatorSet *DS;
@@ -225,3 +227,5 @@ bool CombineBranches::runOnFunction(Function &F){
return true;
}
+
+} // End llvm namespace
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
index 6a7f50e333..3cb5698a11 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
@@ -27,8 +27,10 @@
#define INSERT_LOAD_COUNT
#define INSERT_STORE
+
using std::vector;
+namespace llvm {
static void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo,
Value *cnt, Instruction *rInst){
@@ -369,3 +371,4 @@ void insertBB(Edge ed,
}
}
+} // End llvm namespace
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp
index cae699a8d6..d69c4c3b4c 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp
@@ -19,6 +19,8 @@
using std::vector;
+namespace llvm {
+
const graphListElement *findNodeInList(const Graph::nodeList &NL,
Node *N) {
for(Graph::nodeList::const_iterator NI = NL.begin(), NE=NL.end(); NI != NE;
@@ -564,4 +566,4 @@ void Graph::getBackEdgesVisit(Node *u, vector<Edge > &be,
color[u]=BLACK;//done with visiting the node and its neighbors
}
-
+} // End llvm namespace
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.h b/lib/Transforms/Instrumentation/ProfilePaths/Graph.h
index 5597b599e0..44b63a91ea 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.h
+++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.h
@@ -19,6 +19,8 @@
#include <map>
#include <cstdlib>
+namespace llvm {
+
class Module;
class Function;
@@ -112,8 +114,13 @@ struct graphListElement{
}
};
+} // End llvm namespace
+
namespace std {
+
+using namespace llvm;
+
template<>
struct less<Node *> : public binary_function<Node *, Node *,bool> {
bool operator()(Node *n1, Node *n2) const {
@@ -135,6 +142,8 @@ namespace std {
};
}
+namespace llvm {
+
struct BBSort{
bool operator()(BasicBlock *BB1, BasicBlock *BB2) const{
std::string name1=BB1->getName();
@@ -465,6 +474,7 @@ int valueAssignmentToEdges(Graph& g, std::map<Node *, int> nodePriority,
std::vector<Edge> &be);
void getBBtrace(std::vector<BasicBlock *> &vBB, int pathNo, Function *M);
-#endif
+} // End llvm namespace
+#endif
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp b/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp
index 66b8ccd6c4..d9dc011cd5 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp
@@ -24,6 +24,8 @@ using std::map;
using std::vector;
using std::cerr;
+namespace llvm {
+
//check if 2 edges are equal (same endpoints and same weight)
static bool edgesEqual(Edge ed1, Edge ed2){
return ((ed1==ed2) && ed1.getWeight()==ed2.getWeight());
@@ -673,3 +675,5 @@ void printGraph(Graph &g){
}
cerr<<"--------------------Graph\n";
}
+
+} // End llvm namespace
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
index b5e9d8c30c..9d6107cd2d 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
@@ -27,6 +27,8 @@
#include "llvm/Function.h"
#include "llvm/Pass.h"
+namespace llvm {
+
//this is used to color vertices
//during DFS
@@ -181,3 +183,5 @@ bool InstLoops::runOnFunction(Function &F){
findAndInstrumentBackEdges(F);
return true; // Function was modified.
}
+
+} // End llvm namespace
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
index d4973be25e..5728265f42 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
@@ -43,6 +43,8 @@
#include <fstream>
#include <cstdio>
+namespace llvm {
+
struct ProfilePaths : public FunctionPass {
bool runOnFunction(Function &F);
@@ -245,3 +247,5 @@ bool ProfilePaths::runOnFunction(Function &F){
return true; // Always modifies function
}
+
+} // End llvm namespace
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp
index 58b3840587..cbb2ae6aee 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp
@@ -21,6 +21,8 @@ using std::vector;
using std::map;
using std::cerr;
+namespace llvm {
+
//Routines to get the path trace!
void getPathFrmNode(Node *n, vector<BasicBlock*> &vBB, int pathNo, Graph &g,
@@ -303,3 +305,5 @@ void getBBtrace(vector<BasicBlock *> &vBB, int pathNo, Function *M){//,
}
*/
}
+
+} // End llvm namespace
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index f19ba74000..c802f73604 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -26,6 +26,8 @@
#include <algorithm>
#include <sstream>
+namespace llvm {
+
static cl::opt<bool>
DisablePtrHashing("tracedisablehashdisable", cl::Hidden,
cl::desc("Disable pointer hashing in the -trace or -tracem "
@@ -433,3 +435,5 @@ bool InsertTraceCode::runOnFunction(Function &F) {
return true;
}
+
+} // End llvm namespace