summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorEugene Zelenko <eugene.zelenko@gmail.com>2017-10-10 22:49:55 +0000
committerEugene Zelenko <eugene.zelenko@gmail.com>2017-10-10 22:49:55 +0000
commite9ea08a0974a429c47e060f8ac7e18a80ed1c543 (patch)
tree3d9a4d368a20a17512f563627f05f29fb5fe1438 /llvm/include
parentbb0e316dc749d0cfc62504d46d4fb4ee6936c8bc (diff)
downloadbcm5719-llvm-e9ea08a0974a429c47e060f8ac7e18a80ed1c543.tar.gz
bcm5719-llvm-e9ea08a0974a429c47e060f8ac7e18a80ed1c543.zip
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 315383
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Transforms/IPO/ConstantMerge.h6
-rw-r--r--llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h39
-rw-r--r--llvm/include/llvm/Transforms/IPO/ElimAvailExtern.h6
-rw-r--r--llvm/include/llvm/Transforms/IPO/FunctionImport.h28
-rw-r--r--llvm/include/llvm/Transforms/IPO/GlobalOpt.h5
-rw-r--r--llvm/include/llvm/Transforms/IPO/GlobalSplit.h8
-rw-r--r--llvm/include/llvm/Transforms/IPO/PartialInlining.h9
7 files changed, 64 insertions, 37 deletions
diff --git a/llvm/include/llvm/Transforms/IPO/ConstantMerge.h b/llvm/include/llvm/Transforms/IPO/ConstantMerge.h
index 1d4da43f6a7..e04d3ae1a40 100644
--- a/llvm/include/llvm/Transforms/IPO/ConstantMerge.h
+++ b/llvm/include/llvm/Transforms/IPO/ConstantMerge.h
@@ -20,16 +20,18 @@
#ifndef LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
#define LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
-#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
namespace llvm {
+class Module;
+
/// A pass that merges duplicate global constants into a single constant.
class ConstantMergePass : public PassInfoMixin<ConstantMergePass> {
public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
};
-}
+
+} // end namespace llvm
#endif // LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
diff --git a/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h b/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
index e179afa956f..ba5666f20a9 100644
--- a/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
+++ b/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
@@ -20,15 +20,21 @@
#ifndef LLVM_TRANSFORMS_IPO_DEADARGUMENTELIMINATION_H
#define LLVM_TRANSFORMS_IPO_DEADARGUMENTELIMINATION_H
-#include "llvm/IR/Module.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/IR/Function.h"
#include "llvm/IR/PassManager.h"
-
#include <map>
#include <set>
#include <string>
+#include <tuple>
namespace llvm {
+class Module;
+class Use;
+class Value;
+
/// Eliminate dead arguments (and return values) from functions.
class DeadArgumentEliminationPass
: public PassInfoMixin<DeadArgumentEliminationPass> {
@@ -37,12 +43,13 @@ public:
/// argument. Used so that arguments and return values can be used
/// interchangeably.
struct RetOrArg {
- RetOrArg(const Function *F, unsigned Idx, bool IsArg)
- : F(F), Idx(Idx), IsArg(IsArg) {}
const Function *F;
unsigned Idx;
bool IsArg;
+ RetOrArg(const Function *F, unsigned Idx, bool IsArg)
+ : F(F), Idx(Idx), IsArg(IsArg) {}
+
/// Make RetOrArg comparable, so we can put it into a map.
bool operator<(const RetOrArg &O) const {
return std::tie(F, Idx, IsArg) < std::tie(O.F, O.Idx, O.IsArg);
@@ -67,16 +74,23 @@ public:
/// thus become dead in the end.
enum Liveness { Live, MaybeLive };
+ DeadArgumentEliminationPass(bool ShouldHackArguments_ = false)
+ : ShouldHackArguments(ShouldHackArguments_) {}
+
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+
/// Convenience wrapper
RetOrArg CreateRet(const Function *F, unsigned Idx) {
return RetOrArg(F, Idx, false);
}
+
/// Convenience wrapper
RetOrArg CreateArg(const Function *F, unsigned Idx) {
return RetOrArg(F, Idx, true);
}
- typedef std::multimap<RetOrArg, RetOrArg> UseMap;
+ using UseMap = std::multimap<RetOrArg, RetOrArg>;
+
/// This maps a return value or argument to any MaybeLive return values or
/// arguments it uses. This allows the MaybeLive values to be marked live
/// when any of its users is marked live.
@@ -93,25 +107,21 @@ public:
/// directly to F.
UseMap Uses;
- typedef std::set<RetOrArg> LiveSet;
- typedef std::set<const Function *> LiveFuncSet;
+ using LiveSet = std::set<RetOrArg>;
+ using LiveFuncSet = std::set<const Function *>;
/// This set contains all values that have been determined to be live.
LiveSet LiveValues;
+
/// This set contains all values that are cannot be changed in any way.
LiveFuncSet LiveFunctions;
- typedef SmallVector<RetOrArg, 5> UseVector;
+ using UseVector = SmallVector<RetOrArg, 5>;
/// This allows this pass to do double-duty as the dead arg hacking pass
/// (used only by bugpoint).
bool ShouldHackArguments = false;
-public:
- DeadArgumentEliminationPass(bool ShouldHackArguments_ = false)
- : ShouldHackArguments(ShouldHackArguments_) {}
- PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
-
private:
Liveness MarkIfNotLive(RetOrArg Use, UseVector &MaybeLiveUses);
Liveness SurveyUse(const Use *U, UseVector &MaybeLiveUses,
@@ -128,6 +138,7 @@ private:
bool DeleteDeadVarargs(Function &Fn);
bool RemoveDeadArgumentsFromCallers(Function &Fn);
};
-}
+
+} // end namespace llvm
#endif // LLVM_TRANSFORMS_IPO_DEADARGUMENTELIMINATION_H
diff --git a/llvm/include/llvm/Transforms/IPO/ElimAvailExtern.h b/llvm/include/llvm/Transforms/IPO/ElimAvailExtern.h
index 88a0e9bd8ce..94cb954fd2d 100644
--- a/llvm/include/llvm/Transforms/IPO/ElimAvailExtern.h
+++ b/llvm/include/llvm/Transforms/IPO/ElimAvailExtern.h
@@ -15,17 +15,19 @@
#ifndef LLVM_TRANSFORMS_IPO_ELIMAVAILEXTERN_H
#define LLVM_TRANSFORMS_IPO_ELIMAVAILEXTERN_H
-#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
namespace llvm {
+class Module;
+
/// A pass that transforms external global definitions into declarations.
class EliminateAvailableExternallyPass
: public PassInfoMixin<EliminateAvailableExternallyPass> {
public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
};
-}
+
+} // end namespace llvm
#endif // LLVM_TRANSFORMS_IPO_ELIMAVAILEXTERN_H
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
index de35cdf052e..63c73af44e8 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
@@ -7,23 +7,26 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_FUNCTIONIMPORT_H
-#define LLVM_FUNCTIONIMPORT_H
+#ifndef LLVM_TRANSFORMS_IPO_FUNCTIONIMPORT_H
+#define LLVM_TRANSFORMS_IPO_FUNCTIONIMPORT_H
+#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/Error.h"
-
#include <functional>
#include <map>
+#include <memory>
+#include <string>
+#include <system_error>
#include <unordered_set>
#include <utility>
namespace llvm {
-class LLVMContext;
-class GlobalValueSummary;
+
class Module;
/// The function importer is automatically importing function from other modules
@@ -34,19 +37,19 @@ public:
/// containing all the functions to import for a source module.
/// The keys is the GUID identifying a function to import, and the value
/// is the threshold applied when deciding to import it.
- typedef std::map<GlobalValue::GUID, unsigned> FunctionsToImportTy;
+ using FunctionsToImportTy = std::map<GlobalValue::GUID, unsigned>;
/// The map contains an entry for every module to import from, the key being
/// the module identifier to pass to the ModuleLoader. The value is the set of
/// functions to import.
- typedef StringMap<FunctionsToImportTy> ImportMapTy;
+ using ImportMapTy = StringMap<FunctionsToImportTy>;
/// The set contains an entry for every global value the module exports.
- typedef std::unordered_set<GlobalValue::GUID> ExportSetTy;
+ using ExportSetTy = std::unordered_set<GlobalValue::GUID>;
/// A function of this type is used to load modules referenced by the index.
- typedef std::function<Expected<std::unique_ptr<Module>>(StringRef Identifier)>
- ModuleLoaderTy;
+ using ModuleLoaderTy =
+ std::function<Expected<std::unique_ptr<Module>>(StringRef Identifier)>;
/// Create a Function Importer.
FunctionImporter(const ModuleSummaryIndex &Index, ModuleLoaderTy ModuleLoader)
@@ -132,6 +135,7 @@ void thinLTOResolveWeakForLinkerModule(Module &TheModule,
/// during global summary-based analysis.
void thinLTOInternalizeModule(Module &TheModule,
const GVSummaryMapTy &DefinedGlobals);
-}
-#endif // LLVM_FUNCTIONIMPORT_H
+} // end namespace llvm
+
+#endif // LLVM_TRANSFORMS_IPO_FUNCTIONIMPORT_H
diff --git a/llvm/include/llvm/Transforms/IPO/GlobalOpt.h b/llvm/include/llvm/Transforms/IPO/GlobalOpt.h
index ab9116810be..5b4878604ea 100644
--- a/llvm/include/llvm/Transforms/IPO/GlobalOpt.h
+++ b/llvm/include/llvm/Transforms/IPO/GlobalOpt.h
@@ -16,17 +16,18 @@
#ifndef LLVM_TRANSFORMS_IPO_GLOBALOPT_H
#define LLVM_TRANSFORMS_IPO_GLOBALOPT_H
-#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
namespace llvm {
+class Module;
+
/// Optimize globals that never have their address taken.
class GlobalOptPass : public PassInfoMixin<GlobalOptPass> {
public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
-}
+} // end namespace llvm
#endif // LLVM_TRANSFORMS_IPO_GLOBALOPT_H
diff --git a/llvm/include/llvm/Transforms/IPO/GlobalSplit.h b/llvm/include/llvm/Transforms/IPO/GlobalSplit.h
index fb2c2d27338..56cefb7886f 100644
--- a/llvm/include/llvm/Transforms/IPO/GlobalSplit.h
+++ b/llvm/include/llvm/Transforms/IPO/GlobalSplit.h
@@ -17,14 +17,18 @@
#ifndef LLVM_TRANSFORMS_IPO_GLOBALSPLIT_H
#define LLVM_TRANSFORMS_IPO_GLOBALSPLIT_H
-#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
namespace llvm {
+
+class Module;
+
/// Pass to perform split of global variables.
class GlobalSplitPass : public PassInfoMixin<GlobalSplitPass> {
public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
-}
+
+} // end namespace llvm
+
#endif // LLVM_TRANSFORMS_IPO_GLOBALSPLIT_H
diff --git a/llvm/include/llvm/Transforms/IPO/PartialInlining.h b/llvm/include/llvm/Transforms/IPO/PartialInlining.h
index 15407fc36a2..ec6dd36dae0 100644
--- a/llvm/include/llvm/Transforms/IPO/PartialInlining.h
+++ b/llvm/include/llvm/Transforms/IPO/PartialInlining.h
@@ -1,4 +1,4 @@
-//===- PartialInlining.h - Inline parts of functions --------------------===//
+//===- PartialInlining.h - Inline parts of functions ------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -15,15 +15,18 @@
#ifndef LLVM_TRANSFORMS_IPO_PARTIALINLINING_H
#define LLVM_TRANSFORMS_IPO_PARTIALINLINING_H
-#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
namespace llvm {
+class Module;
+
/// Pass to remove unused function declarations.
class PartialInlinerPass : public PassInfoMixin<PartialInlinerPass> {
public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
};
-}
+
+} // end namespace llvm
+
#endif // LLVM_TRANSFORMS_IPO_PARTIALINLINING_H
OpenPOWER on IntegriCloud