summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/AliasSetTracker.cpp26
-rw-r--r--llvm/lib/Analysis/CallGraph.cpp21
-rw-r--r--llvm/lib/Analysis/DominanceFrontier.cpp12
-rw-r--r--llvm/lib/Analysis/Interval.cpp3
-rw-r--r--llvm/lib/Analysis/IntervalPartition.cpp13
5 files changed, 53 insertions, 22 deletions
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp
index 4dfa25490d0..025e8119deb 100644
--- a/llvm/lib/Analysis/AliasSetTracker.cpp
+++ b/llvm/lib/Analysis/AliasSetTracker.cpp
@@ -13,17 +13,29 @@
#include "llvm/Analysis/AliasSetTracker.h"
#include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Analysis/MemoryLocation.h"
+#include "llvm/IR/CallSite.h"
+#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/Function.h"
#include "llvm/IR/InstIterator.h"
+#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
-#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
-#include "llvm/IR/Type.h"
+#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
+#include "llvm/Support/AtomicOrdering.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
+#include <cassert>
+#include <cstdint>
+#include <vector>
+
using namespace llvm;
static cl::opt<unsigned>
@@ -106,7 +118,6 @@ void AliasSetTracker::removeAliasSet(AliasSet *AS) {
TotalMayAliasSetSize -= AS->size();
AliasSets.erase(AS);
-
}
void AliasSet::removeFromTracker(AliasSetTracker &AST) {
@@ -580,7 +591,6 @@ AliasSet &AliasSetTracker::mergeAllAliasSets() {
AliasSet &AliasSetTracker::addPointer(Value *P, uint64_t Size,
const AAMDNodes &AAInfo,
AliasSet::AccessLattice E) {
-
AliasSet &AS = getAliasSetForPointer(P, Size, AAInfo);
AS.Access |= E;
@@ -611,7 +621,6 @@ void AliasSet::print(raw_ostream &OS) const {
if (Forward)
OS << " forwarding to " << (void*)Forward;
-
if (!empty()) {
OS << "Pointers: ";
for (iterator I = begin(), E = end(); I != E; ++I) {
@@ -671,10 +680,13 @@ AliasSetTracker::ASTCallbackVH::operator=(Value *V) {
//===----------------------------------------------------------------------===//
namespace {
+
class AliasSetPrinter : public FunctionPass {
AliasSetTracker *Tracker;
+
public:
static char ID; // Pass identification, replacement for typeid
+
AliasSetPrinter() : FunctionPass(ID) {
initializeAliasSetPrinterPass(*PassRegistry::getPassRegistry());
}
@@ -695,9 +707,11 @@ namespace {
return false;
}
};
-}
+
+} // end anonymous namespace
char AliasSetPrinter::ID = 0;
+
INITIALIZE_PASS_BEGIN(AliasSetPrinter, "print-alias-sets",
"Alias Set Printer", false, true)
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
diff --git a/llvm/lib/Analysis/CallGraph.cpp b/llvm/lib/Analysis/CallGraph.cpp
index ff5242f69a1..ac3ea2b73fe 100644
--- a/llvm/lib/Analysis/CallGraph.cpp
+++ b/llvm/lib/Analysis/CallGraph.cpp
@@ -8,12 +8,20 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/CallGraph.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/CallSite.h"
-#include "llvm/IR/Instructions.h"
-#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/PassManager.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
+
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -125,7 +133,6 @@ Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN) {
/// This does not rescan the body of the function, so it is suitable when
/// splicing the body of the old function to the new while also updating all
/// callers from old to new.
-///
void CallGraph::spliceFunction(const Function *From, const Function *To) {
assert(FunctionMap.count(From) && "No CallGraphNode for function!");
assert(!FunctionMap.count(To) &&
@@ -256,7 +263,7 @@ CallGraphWrapperPass::CallGraphWrapperPass() : ModulePass(ID) {
initializeCallGraphWrapperPassPass(*PassRegistry::getPassRegistry());
}
-CallGraphWrapperPass::~CallGraphWrapperPass() {}
+CallGraphWrapperPass::~CallGraphWrapperPass() = default;
void CallGraphWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
@@ -291,8 +298,10 @@ void CallGraphWrapperPass::dump() const { print(dbgs(), nullptr); }
#endif
namespace {
+
struct CallGraphPrinterLegacyPass : public ModulePass {
static char ID; // Pass ID, replacement for typeid
+
CallGraphPrinterLegacyPass() : ModulePass(ID) {
initializeCallGraphPrinterLegacyPassPass(*PassRegistry::getPassRegistry());
}
@@ -301,12 +310,14 @@ struct CallGraphPrinterLegacyPass : public ModulePass {
AU.setPreservesAll();
AU.addRequiredTransitive<CallGraphWrapperPass>();
}
+
bool runOnModule(Module &M) override {
getAnalysis<CallGraphWrapperPass>().print(errs(), &M);
return false;
}
};
-}
+
+} // end anonymous namespace
char CallGraphPrinterLegacyPass::ID = 0;
diff --git a/llvm/lib/Analysis/DominanceFrontier.cpp b/llvm/lib/Analysis/DominanceFrontier.cpp
index c08c6cfe0c3..bb8caf4a517 100644
--- a/llvm/lib/Analysis/DominanceFrontier.cpp
+++ b/llvm/lib/Analysis/DominanceFrontier.cpp
@@ -9,15 +9,23 @@
#include "llvm/Analysis/DominanceFrontier.h"
#include "llvm/Analysis/DominanceFrontierImpl.h"
+#include "llvm/IR/Dominators.h"
+#include "llvm/IR/Function.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
namespace llvm {
+
template class DominanceFrontierBase<BasicBlock, false>;
template class DominanceFrontierBase<BasicBlock, true>;
template class ForwardDominanceFrontierBase<BasicBlock>;
-}
+
+} // end namespace llvm
char DominanceFrontierWrapperPass::ID = 0;
@@ -27,7 +35,7 @@ INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_END(DominanceFrontierWrapperPass, "domfrontier",
"Dominance Frontier Construction", true, true)
- DominanceFrontierWrapperPass::DominanceFrontierWrapperPass()
+DominanceFrontierWrapperPass::DominanceFrontierWrapperPass()
: FunctionPass(ID), DF() {
initializeDominanceFrontierWrapperPassPass(*PassRegistry::getPassRegistry());
}
diff --git a/llvm/lib/Analysis/Interval.cpp b/llvm/lib/Analysis/Interval.cpp
index 6c10d73bcb4..6d5de22cb93 100644
--- a/llvm/lib/Analysis/Interval.cpp
+++ b/llvm/lib/Analysis/Interval.cpp
@@ -16,7 +16,6 @@
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/Support/raw_ostream.h"
-#include <algorithm>
using namespace llvm;
@@ -25,7 +24,6 @@ using namespace llvm;
//===----------------------------------------------------------------------===//
// isLoop - Find out if there is a back edge in this interval...
-//
bool Interval::isLoop() const {
// There is a loop in this interval iff one of the predecessors of the header
// node lives in the interval.
@@ -36,7 +34,6 @@ bool Interval::isLoop() const {
return false;
}
-
void Interval::print(raw_ostream &OS) const {
OS << "-------------------------------------------------------------\n"
<< "Interval Contents:\n";
diff --git a/llvm/lib/Analysis/IntervalPartition.cpp b/llvm/lib/Analysis/IntervalPartition.cpp
index a4e56e0694b..c777d91b67c 100644
--- a/llvm/lib/Analysis/IntervalPartition.cpp
+++ b/llvm/lib/Analysis/IntervalPartition.cpp
@@ -12,10 +12,17 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Analysis/IntervalPartition.h"
+#include "llvm/Analysis/Interval.h"
#include "llvm/Analysis/IntervalIterator.h"
+#include "llvm/Pass.h"
+#include <cassert>
+#include <utility>
+
using namespace llvm;
char IntervalPartition::ID = 0;
+
INITIALIZE_PASS(IntervalPartition, "intervals",
"Interval Partition Construction", true, true)
@@ -40,7 +47,6 @@ void IntervalPartition::print(raw_ostream &O, const Module*) const {
// addIntervalToPartition - Add an interval to the internal list of intervals,
// and then add mappings from all of the basic blocks in the interval to the
// interval itself (in the IntervalMap).
-//
void IntervalPartition::addIntervalToPartition(Interval *I) {
Intervals.push_back(I);
@@ -54,7 +60,6 @@ void IntervalPartition::addIntervalToPartition(Interval *I) {
// the interval data structures. After interval generation is complete,
// run through all of the intervals and propagate successor info as
// predecessor info.
-//
void IntervalPartition::updatePredecessors(Interval *Int) {
BasicBlock *Header = Int->getHeaderNode();
for (BasicBlock *Successor : Int->Successors)
@@ -63,7 +68,6 @@ void IntervalPartition::updatePredecessors(Interval *Int) {
// IntervalPartition ctor - Build the first level interval partition for the
// specified function...
-//
bool IntervalPartition::runOnFunction(Function &F) {
// Pass false to intervals_begin because we take ownership of it's memory
function_interval_iterator I = intervals_begin(&F, false);
@@ -84,11 +88,9 @@ bool IntervalPartition::runOnFunction(Function &F) {
return false;
}
-
// IntervalPartition ctor - Build a reduced interval partition from an
// existing interval graph. This takes an additional boolean parameter to
// distinguish it from a copy constructor. Always pass in false for now.
-//
IntervalPartition::IntervalPartition(IntervalPartition &IP, bool)
: FunctionPass(ID) {
assert(IP.getRootInterval() && "Cannot operate on empty IntervalPartitions!");
@@ -110,4 +112,3 @@ IntervalPartition::IntervalPartition(IntervalPartition &IP, bool)
for (unsigned i = 0, e = Intervals.size(); i != e; ++i)
updatePredecessors(Intervals[i]);
}
-
OpenPOWER on IntegriCloud