mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
[PM] Stop playing fast and loose with rebinding of references. However
convenient it is to imagine a world where this works, that is not C++ as was pointed out in review. The standard even goes to some lengths to preclude any attempt at this, for better or worse. Maybe better. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203775 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -799,14 +799,14 @@ public:
|
|||||||
static void *ID() { return (void *)&PassID; }
|
static void *ID() { return (void *)&PassID; }
|
||||||
|
|
||||||
explicit FunctionAnalysisManagerModuleProxy(FunctionAnalysisManager &FAM)
|
explicit FunctionAnalysisManagerModuleProxy(FunctionAnalysisManager &FAM)
|
||||||
: FAM(FAM) {}
|
: FAM(&FAM) {}
|
||||||
// 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.
|
||||||
FunctionAnalysisManagerModuleProxy(
|
FunctionAnalysisManagerModuleProxy(
|
||||||
const FunctionAnalysisManagerModuleProxy &Arg)
|
const FunctionAnalysisManagerModuleProxy &Arg)
|
||||||
: FAM(Arg.FAM) {}
|
: FAM(Arg.FAM) {}
|
||||||
FunctionAnalysisManagerModuleProxy(FunctionAnalysisManagerModuleProxy &&Arg)
|
FunctionAnalysisManagerModuleProxy(FunctionAnalysisManagerModuleProxy &&Arg)
|
||||||
: FAM(Arg.FAM) {}
|
: FAM(std::move(Arg.FAM)) {}
|
||||||
FunctionAnalysisManagerModuleProxy &
|
FunctionAnalysisManagerModuleProxy &
|
||||||
operator=(FunctionAnalysisManagerModuleProxy RHS) {
|
operator=(FunctionAnalysisManagerModuleProxy RHS) {
|
||||||
std::swap(*this, RHS);
|
std::swap(*this, RHS);
|
||||||
@ -827,7 +827,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
static char PassID;
|
static char PassID;
|
||||||
|
|
||||||
FunctionAnalysisManager &FAM;
|
FunctionAnalysisManager *FAM;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief The result proxy object for the
|
/// \brief The result proxy object for the
|
||||||
@ -836,11 +836,11 @@ private:
|
|||||||
/// See its documentation for more information.
|
/// See its documentation for more information.
|
||||||
class FunctionAnalysisManagerModuleProxy::Result {
|
class FunctionAnalysisManagerModuleProxy::Result {
|
||||||
public:
|
public:
|
||||||
explicit Result(FunctionAnalysisManager &FAM) : FAM(FAM) {}
|
explicit Result(FunctionAnalysisManager &FAM) : FAM(&FAM) {}
|
||||||
// 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.
|
||||||
Result(const Result &Arg) : FAM(Arg.FAM) {}
|
Result(const Result &Arg) : FAM(Arg.FAM) {}
|
||||||
Result(Result &&Arg) : FAM(Arg.FAM) {}
|
Result(Result &&Arg) : FAM(std::move(Arg.FAM)) {}
|
||||||
Result &operator=(Result RHS) {
|
Result &operator=(Result RHS) {
|
||||||
std::swap(*this, RHS);
|
std::swap(*this, RHS);
|
||||||
return *this;
|
return *this;
|
||||||
@ -848,7 +848,7 @@ public:
|
|||||||
~Result();
|
~Result();
|
||||||
|
|
||||||
/// \brief Accessor for the \c FunctionAnalysisManager.
|
/// \brief Accessor for the \c FunctionAnalysisManager.
|
||||||
FunctionAnalysisManager &getManager() { return FAM; }
|
FunctionAnalysisManager &getManager() { return *FAM; }
|
||||||
|
|
||||||
/// \brief Handler for invalidation of the module.
|
/// \brief Handler for invalidation of the module.
|
||||||
///
|
///
|
||||||
@ -863,7 +863,7 @@ public:
|
|||||||
bool invalidate(Module *M, const PreservedAnalyses &PA);
|
bool invalidate(Module *M, const PreservedAnalyses &PA);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FunctionAnalysisManager &FAM;
|
FunctionAnalysisManager *FAM;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief A function analysis which acts as a proxy for a module analysis
|
/// \brief A function analysis which acts as a proxy for a module analysis
|
||||||
@ -883,36 +883,36 @@ public:
|
|||||||
/// \brief Result proxy object for \c ModuleAnalysisManagerFunctionProxy.
|
/// \brief Result proxy object for \c ModuleAnalysisManagerFunctionProxy.
|
||||||
class Result {
|
class Result {
|
||||||
public:
|
public:
|
||||||
explicit Result(const ModuleAnalysisManager &MAM) : MAM(MAM) {}
|
explicit Result(const ModuleAnalysisManager &MAM) : MAM(&MAM) {}
|
||||||
// We have to explicitly define all the special member functions because
|
// We have to explicitly define all the special member functions because
|
||||||
// MSVC refuses to generate them.
|
// MSVC refuses to generate them.
|
||||||
Result(const Result &Arg) : MAM(Arg.MAM) {}
|
Result(const Result &Arg) : MAM(Arg.MAM) {}
|
||||||
Result(Result &&Arg) : MAM(Arg.MAM) {}
|
Result(Result &&Arg) : MAM(std::move(Arg.MAM)) {}
|
||||||
Result &operator=(Result RHS) {
|
Result &operator=(Result RHS) {
|
||||||
std::swap(*this, RHS);
|
std::swap(*this, RHS);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ModuleAnalysisManager &getManager() const { return MAM; }
|
const ModuleAnalysisManager &getManager() const { return *MAM; }
|
||||||
|
|
||||||
/// \brief Handle invalidation by ignoring it, this pass is immutable.
|
/// \brief Handle invalidation by ignoring it, this pass is immutable.
|
||||||
bool invalidate(Function *) { return false; }
|
bool invalidate(Function *) { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ModuleAnalysisManager &MAM;
|
const ModuleAnalysisManager *MAM;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *ID() { return (void *)&PassID; }
|
static void *ID() { return (void *)&PassID; }
|
||||||
|
|
||||||
ModuleAnalysisManagerFunctionProxy(const ModuleAnalysisManager &MAM)
|
ModuleAnalysisManagerFunctionProxy(const ModuleAnalysisManager &MAM)
|
||||||
: MAM(MAM) {}
|
: MAM(&MAM) {}
|
||||||
// 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.
|
||||||
ModuleAnalysisManagerFunctionProxy(
|
ModuleAnalysisManagerFunctionProxy(
|
||||||
const ModuleAnalysisManagerFunctionProxy &Arg)
|
const ModuleAnalysisManagerFunctionProxy &Arg)
|
||||||
: MAM(Arg.MAM) {}
|
: MAM(Arg.MAM) {}
|
||||||
ModuleAnalysisManagerFunctionProxy(ModuleAnalysisManagerFunctionProxy &&Arg)
|
ModuleAnalysisManagerFunctionProxy(ModuleAnalysisManagerFunctionProxy &&Arg)
|
||||||
: MAM(Arg.MAM) {}
|
: MAM(std::move(Arg.MAM)) {}
|
||||||
ModuleAnalysisManagerFunctionProxy &
|
ModuleAnalysisManagerFunctionProxy &
|
||||||
operator=(ModuleAnalysisManagerFunctionProxy RHS) {
|
operator=(ModuleAnalysisManagerFunctionProxy RHS) {
|
||||||
std::swap(*this, RHS);
|
std::swap(*this, RHS);
|
||||||
@ -922,12 +922,12 @@ public:
|
|||||||
/// \brief Run the analysis pass and create our proxy result object.
|
/// \brief Run the analysis pass and create our proxy result object.
|
||||||
/// Nothing to see here, it just forwards the \c MAM reference into the
|
/// Nothing to see here, it just forwards the \c MAM reference into the
|
||||||
/// result.
|
/// result.
|
||||||
Result run(Function *) { return Result(MAM); }
|
Result run(Function *) { return Result(*MAM); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static char PassID;
|
static char PassID;
|
||||||
|
|
||||||
const ModuleAnalysisManager &MAM;
|
const ModuleAnalysisManager *MAM;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Trivial adaptor that maps from a module to its functions.
|
/// \brief Trivial adaptor that maps from a module to its functions.
|
||||||
|
@ -171,14 +171,14 @@ char FunctionAnalysisManagerModuleProxy::PassID;
|
|||||||
|
|
||||||
FunctionAnalysisManagerModuleProxy::Result
|
FunctionAnalysisManagerModuleProxy::Result
|
||||||
FunctionAnalysisManagerModuleProxy::run(Module *M) {
|
FunctionAnalysisManagerModuleProxy::run(Module *M) {
|
||||||
assert(FAM.empty() && "Function analyses ran prior to the module proxy!");
|
assert(FAM->empty() && "Function analyses ran prior to the module proxy!");
|
||||||
return Result(FAM);
|
return Result(*FAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionAnalysisManagerModuleProxy::Result::~Result() {
|
FunctionAnalysisManagerModuleProxy::Result::~Result() {
|
||||||
// Clear out the analysis manager if we're being destroyed -- it means we
|
// Clear out the analysis manager if we're being destroyed -- it means we
|
||||||
// didn't even see an invalidate call when we got invalidated.
|
// didn't even see an invalidate call when we got invalidated.
|
||||||
FAM.clear();
|
FAM->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
|
bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
|
||||||
@ -188,7 +188,7 @@ bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
|
|||||||
// objects in the cache making it impossible to incrementally preserve them.
|
// objects in the cache making it impossible to incrementally preserve them.
|
||||||
// Just clear the entire manager.
|
// Just clear the entire manager.
|
||||||
if (!PA.preserved(ID()))
|
if (!PA.preserved(ID()))
|
||||||
FAM.clear();
|
FAM->clear();
|
||||||
|
|
||||||
// Return false to indicate that this result is still a valid proxy.
|
// Return false to indicate that this result is still a valid proxy.
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user