mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
[PM] Cleanup formatting and namespace commenting. Mostly done with
clang-format, but with some modifications by me where it got things wrong or got confused. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203432 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -143,9 +143,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
// Note that this must not be -1 or -2 as those are already used by the
|
// Note that this must not be -1 or -2 as those are already used by the
|
||||||
// SmallPtrSet.
|
// SmallPtrSet.
|
||||||
static const uintptr_t AllPassesID = (intptr_t)-3;
|
static const uintptr_t AllPassesID = (intptr_t)(-3);
|
||||||
|
|
||||||
bool areAllPreserved() const { return PreservedPassIDs.count((void *)AllPassesID); }
|
bool areAllPreserved() const {
|
||||||
|
return PreservedPassIDs.count((void *)AllPassesID);
|
||||||
|
}
|
||||||
|
|
||||||
SmallPtrSet<void *, 2> PreservedPassIDs;
|
SmallPtrSet<void *, 2> PreservedPassIDs;
|
||||||
};
|
};
|
||||||
@@ -176,7 +178,9 @@ template <typename IRUnitT, typename AnalysisManagerT, typename PassT,
|
|||||||
typename ResultT>
|
typename ResultT>
|
||||||
class PassRunAcceptsAnalysisManager {
|
class PassRunAcceptsAnalysisManager {
|
||||||
typedef char SmallType;
|
typedef char SmallType;
|
||||||
struct BigType { char a, b; };
|
struct BigType {
|
||||||
|
char a, b;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T, ResultT (T::*)(IRUnitT, AnalysisManagerT *)>
|
template <typename T, ResultT (T::*)(IRUnitT, AnalysisManagerT *)>
|
||||||
struct Checker;
|
struct Checker;
|
||||||
@@ -201,8 +205,8 @@ struct PassModel;
|
|||||||
/// \brief Specialization of \c PassModel for passes that accept an analyis
|
/// \brief Specialization of \c PassModel for passes that accept an analyis
|
||||||
/// manager.
|
/// manager.
|
||||||
template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
|
template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
|
||||||
struct PassModel<IRUnitT, AnalysisManagerT, PassT,
|
struct PassModel<IRUnitT, AnalysisManagerT, PassT, true>
|
||||||
true> : PassConcept<IRUnitT, AnalysisManagerT> {
|
: PassConcept<IRUnitT, AnalysisManagerT> {
|
||||||
explicit PassModel(PassT Pass) : Pass(std::move(Pass)) {}
|
explicit PassModel(PassT Pass) : Pass(std::move(Pass)) {}
|
||||||
// We have to explicitly define all the special member functions because MSVC
|
// We have to explicitly define all the special member functions because MSVC
|
||||||
// refuses to generate them.
|
// refuses to generate them.
|
||||||
@@ -223,8 +227,8 @@ struct PassModel<IRUnitT, AnalysisManagerT, PassT,
|
|||||||
/// \brief Specialization of \c PassModel for passes that accept an analyis
|
/// \brief Specialization of \c PassModel for passes that accept an analyis
|
||||||
/// manager.
|
/// manager.
|
||||||
template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
|
template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
|
||||||
struct PassModel<IRUnitT, AnalysisManagerT, PassT,
|
struct PassModel<IRUnitT, AnalysisManagerT, PassT, false>
|
||||||
false> : PassConcept<IRUnitT, AnalysisManagerT> {
|
: PassConcept<IRUnitT, AnalysisManagerT> {
|
||||||
explicit PassModel(PassT Pass) : Pass(std::move(Pass)) {}
|
explicit PassModel(PassT Pass) : Pass(std::move(Pass)) {}
|
||||||
// We have to explicitly define all the special member functions because MSVC
|
// We have to explicitly define all the special member functions because MSVC
|
||||||
// refuses to generate them.
|
// refuses to generate them.
|
||||||
@@ -266,7 +270,9 @@ template <typename IRUnitT> struct AnalysisResultConcept {
|
|||||||
/// \c invalidate member function.
|
/// \c invalidate member function.
|
||||||
template <typename IRUnitT, typename ResultT> class ResultHasInvalidateMethod {
|
template <typename IRUnitT, typename ResultT> class ResultHasInvalidateMethod {
|
||||||
typedef char SmallType;
|
typedef char SmallType;
|
||||||
struct BigType { char a, b; };
|
struct BigType {
|
||||||
|
char a, b;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T, bool (T::*)(IRUnitT, const PreservedAnalyses &)>
|
template <typename T, bool (T::*)(IRUnitT, const PreservedAnalyses &)>
|
||||||
struct Checker;
|
struct Checker;
|
||||||
@@ -292,8 +298,8 @@ struct AnalysisResultModel;
|
|||||||
/// \brief Specialization of \c AnalysisResultModel which provides the default
|
/// \brief Specialization of \c AnalysisResultModel which provides the default
|
||||||
/// invalidate functionality.
|
/// invalidate functionality.
|
||||||
template <typename IRUnitT, typename PassT, typename ResultT>
|
template <typename IRUnitT, typename PassT, typename ResultT>
|
||||||
struct AnalysisResultModel<IRUnitT, PassT, ResultT,
|
struct AnalysisResultModel<IRUnitT, PassT, ResultT, false>
|
||||||
false> : AnalysisResultConcept<IRUnitT> {
|
: AnalysisResultConcept<IRUnitT> {
|
||||||
explicit AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
|
explicit AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
|
||||||
// We have to explicitly define all the special member functions because MSVC
|
// We have to explicitly define all the special member functions because MSVC
|
||||||
// refuses to generate them.
|
// refuses to generate them.
|
||||||
@@ -320,8 +326,8 @@ struct AnalysisResultModel<IRUnitT, PassT, ResultT,
|
|||||||
/// \brief Specialization of \c AnalysisResultModel which delegates invalidate
|
/// \brief Specialization of \c AnalysisResultModel which delegates invalidate
|
||||||
/// handling to \c ResultT.
|
/// handling to \c ResultT.
|
||||||
template <typename IRUnitT, typename PassT, typename ResultT>
|
template <typename IRUnitT, typename PassT, typename ResultT>
|
||||||
struct AnalysisResultModel<IRUnitT, PassT, ResultT,
|
struct AnalysisResultModel<IRUnitT, PassT, ResultT, true>
|
||||||
true> : AnalysisResultConcept<IRUnitT> {
|
: AnalysisResultConcept<IRUnitT> {
|
||||||
explicit AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
|
explicit AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
|
||||||
// We have to explicitly define all the special member functions because MSVC
|
// We have to explicitly define all the special member functions because MSVC
|
||||||
// refuses to generate them.
|
// refuses to generate them.
|
||||||
@@ -353,7 +359,7 @@ struct AnalysisPassConcept {
|
|||||||
/// \returns A unique_ptr to the analysis result object to be queried by
|
/// \returns A unique_ptr to the analysis result object to be queried by
|
||||||
/// users.
|
/// users.
|
||||||
virtual std::unique_ptr<AnalysisResultConcept<IRUnitT>>
|
virtual std::unique_ptr<AnalysisResultConcept<IRUnitT>>
|
||||||
run(IRUnitT IR, AnalysisManagerT *AM) = 0;
|
run(IRUnitT IR, AnalysisManagerT *AM) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Wrapper to model the analysis pass concept.
|
/// \brief Wrapper to model the analysis pass concept.
|
||||||
@@ -363,15 +369,14 @@ struct AnalysisPassConcept {
|
|||||||
/// wrapped in a \c AnalysisResultModel.
|
/// wrapped in a \c AnalysisResultModel.
|
||||||
template <typename IRUnitT, typename AnalysisManagerT, typename PassT,
|
template <typename IRUnitT, typename AnalysisManagerT, typename PassT,
|
||||||
bool AcceptsAnalysisManager = PassRunAcceptsAnalysisManager<
|
bool AcceptsAnalysisManager = PassRunAcceptsAnalysisManager<
|
||||||
IRUnitT, AnalysisManagerT, PassT,
|
IRUnitT, AnalysisManagerT, PassT, typename PassT::Result>::Value>
|
||||||
typename PassT::Result>::Value> struct AnalysisPassModel;
|
struct AnalysisPassModel;
|
||||||
|
|
||||||
/// \brief Specialization of \c AnalysisPassModel which passes an
|
/// \brief Specialization of \c AnalysisPassModel which passes an
|
||||||
/// \c AnalysisManager to PassT's run method.
|
/// \c AnalysisManager to PassT's run method.
|
||||||
template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
|
template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
|
||||||
struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT,
|
struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT, true>
|
||||||
true> : AnalysisPassConcept<IRUnitT,
|
: AnalysisPassConcept<IRUnitT, AnalysisManagerT> {
|
||||||
AnalysisManagerT> {
|
|
||||||
explicit AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
|
explicit AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
|
||||||
// We have to explicitly define all the special member functions because MSVC
|
// We have to explicitly define all the special member functions because MSVC
|
||||||
// refuses to generate them.
|
// refuses to generate them.
|
||||||
@@ -400,9 +405,8 @@ struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT,
|
|||||||
/// \brief Specialization of \c AnalysisPassModel which does not pass an
|
/// \brief Specialization of \c AnalysisPassModel which does not pass an
|
||||||
/// \c AnalysisManager to PassT's run method.
|
/// \c AnalysisManager to PassT's run method.
|
||||||
template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
|
template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
|
||||||
struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT,
|
struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT, false>
|
||||||
false> : AnalysisPassConcept<IRUnitT,
|
: AnalysisPassConcept<IRUnitT, AnalysisManagerT> {
|
||||||
AnalysisManagerT> {
|
|
||||||
explicit AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
|
explicit AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
|
||||||
// We have to explicitly define all the special member functions because MSVC
|
// We have to explicitly define all the special member functions because MSVC
|
||||||
// refuses to generate them.
|
// refuses to generate them.
|
||||||
@@ -428,7 +432,7 @@ struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT,
|
|||||||
PassT Pass;
|
PassT Pass;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // End namespace detail
|
||||||
|
|
||||||
class ModuleAnalysisManager;
|
class ModuleAnalysisManager;
|
||||||
|
|
||||||
@@ -458,7 +462,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Pull in the concept type and model template specialized for modules.
|
// Pull in the concept type and model template specialized for modules.
|
||||||
typedef detail::PassConcept<Module *, ModuleAnalysisManager> ModulePassConcept;
|
typedef detail::PassConcept<Module *, ModuleAnalysisManager>
|
||||||
|
ModulePassConcept;
|
||||||
template <typename PassT>
|
template <typename PassT>
|
||||||
struct ModulePassModel
|
struct ModulePassModel
|
||||||
: detail::PassModel<Module *, ModuleAnalysisManager, PassT> {
|
: detail::PassModel<Module *, ModuleAnalysisManager, PassT> {
|
||||||
@@ -480,7 +485,8 @@ public:
|
|||||||
// We have to explicitly define all the special member functions because MSVC
|
// We have to explicitly define all the special member functions because MSVC
|
||||||
// refuses to generate them.
|
// refuses to generate them.
|
||||||
FunctionPassManager() {}
|
FunctionPassManager() {}
|
||||||
FunctionPassManager(FunctionPassManager &&Arg) : Passes(std::move(Arg.Passes)) {}
|
FunctionPassManager(FunctionPassManager &&Arg)
|
||||||
|
: Passes(std::move(Arg.Passes)) {}
|
||||||
FunctionPassManager &operator=(FunctionPassManager &&RHS) {
|
FunctionPassManager &operator=(FunctionPassManager &&RHS) {
|
||||||
Passes = std::move(RHS.Passes);
|
Passes = std::move(RHS.Passes);
|
||||||
return *this;
|
return *this;
|
||||||
@@ -497,7 +503,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
// Pull in the concept type and model template specialized for functions.
|
// Pull in the concept type and model template specialized for functions.
|
||||||
typedef detail::PassConcept<Function *, FunctionAnalysisManager>
|
typedef detail::PassConcept<Function *, FunctionAnalysisManager>
|
||||||
FunctionPassConcept;
|
FunctionPassConcept;
|
||||||
template <typename PassT>
|
template <typename PassT>
|
||||||
struct FunctionPassModel
|
struct FunctionPassModel
|
||||||
: detail::PassModel<Function *, FunctionAnalysisManager, PassT> {
|
: detail::PassModel<Function *, FunctionAnalysisManager, PassT> {
|
||||||
@@ -526,10 +532,11 @@ namespace detail {
|
|||||||
/// - invalidateImpl
|
/// - invalidateImpl
|
||||||
///
|
///
|
||||||
/// The details of the call pattern are within.
|
/// The details of the call pattern are within.
|
||||||
template <typename DerivedT, typename IRUnitT>
|
template <typename DerivedT, typename IRUnitT> class AnalysisManagerBase {
|
||||||
class AnalysisManagerBase {
|
|
||||||
DerivedT *derived_this() { return static_cast<DerivedT *>(this); }
|
DerivedT *derived_this() { return static_cast<DerivedT *>(this); }
|
||||||
const DerivedT *derived_this() const { return static_cast<const DerivedT *>(this); }
|
const DerivedT *derived_this() const {
|
||||||
|
return static_cast<const DerivedT *>(this);
|
||||||
|
}
|
||||||
|
|
||||||
AnalysisManagerBase(const AnalysisManagerBase &) LLVM_DELETED_FUNCTION;
|
AnalysisManagerBase(const AnalysisManagerBase &) LLVM_DELETED_FUNCTION;
|
||||||
AnalysisManagerBase &
|
AnalysisManagerBase &
|
||||||
@@ -642,7 +649,7 @@ private:
|
|||||||
AnalysisPassMapT AnalysisPasses;
|
AnalysisPassMapT AnalysisPasses;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // End namespace detail
|
||||||
|
|
||||||
/// \brief A module analysis pass manager with lazy running and caching of
|
/// \brief A module analysis pass manager with lazy running and caching of
|
||||||
/// results.
|
/// results.
|
||||||
@@ -683,7 +690,8 @@ private:
|
|||||||
/// \brief Invalidate results across a module.
|
/// \brief Invalidate results across a module.
|
||||||
void invalidateImpl(Module *M, const PreservedAnalyses &PA);
|
void invalidateImpl(Module *M, const PreservedAnalyses &PA);
|
||||||
|
|
||||||
/// \brief Map type from module analysis pass ID to pass result concept pointer.
|
/// \brief Map type from module analysis pass ID to pass result concept
|
||||||
|
/// pointer.
|
||||||
typedef DenseMap<void *,
|
typedef DenseMap<void *,
|
||||||
std::unique_ptr<detail::AnalysisResultConcept<Module *>>>
|
std::unique_ptr<detail::AnalysisResultConcept<Module *>>>
|
||||||
ModuleAnalysisResultMapT;
|
ModuleAnalysisResultMapT;
|
||||||
@@ -697,7 +705,8 @@ private:
|
|||||||
class FunctionAnalysisManager
|
class FunctionAnalysisManager
|
||||||
: public detail::AnalysisManagerBase<FunctionAnalysisManager, Function *> {
|
: public detail::AnalysisManagerBase<FunctionAnalysisManager, Function *> {
|
||||||
friend class detail::AnalysisManagerBase<FunctionAnalysisManager, Function *>;
|
friend class detail::AnalysisManagerBase<FunctionAnalysisManager, Function *>;
|
||||||
typedef detail::AnalysisManagerBase<FunctionAnalysisManager, Function *> BaseT;
|
typedef detail::AnalysisManagerBase<FunctionAnalysisManager, Function *>
|
||||||
|
BaseT;
|
||||||
typedef BaseT::ResultConceptT ResultConceptT;
|
typedef BaseT::ResultConceptT ResultConceptT;
|
||||||
typedef BaseT::PassConceptT PassConceptT;
|
typedef BaseT::PassConceptT PassConceptT;
|
||||||
|
|
||||||
@@ -728,7 +737,8 @@ public:
|
|||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FunctionAnalysisManager(const FunctionAnalysisManager &) LLVM_DELETED_FUNCTION;
|
FunctionAnalysisManager(const FunctionAnalysisManager &)
|
||||||
|
LLVM_DELETED_FUNCTION;
|
||||||
FunctionAnalysisManager &
|
FunctionAnalysisManager &
|
||||||
operator=(const FunctionAnalysisManager &) LLVM_DELETED_FUNCTION;
|
operator=(const FunctionAnalysisManager &) LLVM_DELETED_FUNCTION;
|
||||||
|
|
||||||
@@ -751,11 +761,11 @@ private:
|
|||||||
/// half of a bijection and provides storage for the actual result concept.
|
/// half of a bijection and provides storage for the actual result concept.
|
||||||
typedef std::list<std::pair<
|
typedef std::list<std::pair<
|
||||||
void *, std::unique_ptr<detail::AnalysisResultConcept<Function *>>>>
|
void *, std::unique_ptr<detail::AnalysisResultConcept<Function *>>>>
|
||||||
FunctionAnalysisResultListT;
|
FunctionAnalysisResultListT;
|
||||||
|
|
||||||
/// \brief Map type from function pointer to our custom list type.
|
/// \brief Map type from function pointer to our custom list type.
|
||||||
typedef DenseMap<Function *, FunctionAnalysisResultListT>
|
typedef DenseMap<Function *, FunctionAnalysisResultListT>
|
||||||
FunctionAnalysisResultListMapT;
|
FunctionAnalysisResultListMapT;
|
||||||
|
|
||||||
/// \brief Map from function to a list of function analysis results.
|
/// \brief Map from function to a list of function analysis results.
|
||||||
///
|
///
|
||||||
@@ -928,8 +938,7 @@ private:
|
|||||||
/// \c FunctionAnalysisManagerModuleProxy analysis prior to running the function
|
/// \c FunctionAnalysisManagerModuleProxy analysis prior to running the function
|
||||||
/// pass over the module to enable a \c FunctionAnalysisManager to be used
|
/// pass over the module to enable a \c FunctionAnalysisManager to be used
|
||||||
/// within this run safely.
|
/// within this run safely.
|
||||||
template <typename FunctionPassT>
|
template <typename FunctionPassT> class ModuleToFunctionPassAdaptor {
|
||||||
class ModuleToFunctionPassAdaptor {
|
|
||||||
public:
|
public:
|
||||||
explicit ModuleToFunctionPassAdaptor(FunctionPassT Pass)
|
explicit ModuleToFunctionPassAdaptor(FunctionPassT Pass)
|
||||||
: Pass(std::move(Pass)) {}
|
: Pass(std::move(Pass)) {}
|
||||||
|
Reference in New Issue
Block a user