mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[Coroutines] Rename "legacy" passes (NFC)
A series of patches beginning with https://reviews.llvm.org/D71898 propose to add an implementation of the coroutine passes to the new pass manager. As part of these changes, the coroutine passes that implement the legacy pass manager interface are renamed, to `<PassName>Legacy`. This mirrors similar changes that have been made to many other passes in LLVM as they've been transitioned to support both old and new pass managers. This commit splits out the renaming portion of that patch and commits it in advance as an NFC (no functional change intended) commit. It renames: * `CoroEarly` => `CoroEarlyLegacy` * `CoroSplit` => `CoroSplitLegacy` * `CoroElide` => `CoroElideLegacy` * `CoroCleanup` => `CoroCleanupLegacy`
This commit is contained in:
parent
d45a63d8ad
commit
bc3d8a44a7
@ -31,16 +31,16 @@ LLVM_C_EXTERN_C_BEGIN
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** See llvm::createCoroEarlyPass function. */
|
/** See llvm::createCoroEarlyLegacyPass function. */
|
||||||
void LLVMAddCoroEarlyPass(LLVMPassManagerRef PM);
|
void LLVMAddCoroEarlyPass(LLVMPassManagerRef PM);
|
||||||
|
|
||||||
/** See llvm::createCoroSplitPass function. */
|
/** See llvm::createCoroSplitLegacyPass function. */
|
||||||
void LLVMAddCoroSplitPass(LLVMPassManagerRef PM);
|
void LLVMAddCoroSplitPass(LLVMPassManagerRef PM);
|
||||||
|
|
||||||
/** See llvm::createCoroElidePass function. */
|
/** See llvm::createCoroElideLegacyPass function. */
|
||||||
void LLVMAddCoroElidePass(LLVMPassManagerRef PM);
|
void LLVMAddCoroElidePass(LLVMPassManagerRef PM);
|
||||||
|
|
||||||
/** See llvm::createCoroCleanupPass function. */
|
/** See llvm::createCoroCleanupLegacyPass function. */
|
||||||
void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM);
|
void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,17 +20,17 @@ class PassManagerBuilder;
|
|||||||
void addCoroutinePassesToExtensionPoints(PassManagerBuilder &Builder);
|
void addCoroutinePassesToExtensionPoints(PassManagerBuilder &Builder);
|
||||||
|
|
||||||
/// Lower coroutine intrinsics that are not needed by later passes.
|
/// Lower coroutine intrinsics that are not needed by later passes.
|
||||||
Pass *createCoroEarlyPass();
|
Pass *createCoroEarlyLegacyPass();
|
||||||
|
|
||||||
/// Split up coroutines into multiple functions driving their state machines.
|
/// Split up coroutines into multiple functions driving their state machines.
|
||||||
Pass *createCoroSplitPass();
|
Pass *createCoroSplitLegacyPass();
|
||||||
|
|
||||||
/// Analyze coroutines use sites, devirtualize resume/destroy calls and elide
|
/// Analyze coroutines use sites, devirtualize resume/destroy calls and elide
|
||||||
/// heap allocation for coroutine frame where possible.
|
/// heap allocation for coroutine frame where possible.
|
||||||
Pass *createCoroElidePass();
|
Pass *createCoroElideLegacyPass();
|
||||||
|
|
||||||
/// Lower all remaining coroutine intrinsics.
|
/// Lower all remaining coroutine intrinsics.
|
||||||
Pass *createCoroCleanupPass();
|
Pass *createCoroCleanupLegacyPass();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,11 +99,11 @@ bool Lowerer::lowerRemainingCoroIntrinsics(Function &F) {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct CoroCleanup : FunctionPass {
|
struct CoroCleanupLegacy : FunctionPass {
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
|
|
||||||
CoroCleanup() : FunctionPass(ID) {
|
CoroCleanupLegacy() : FunctionPass(ID) {
|
||||||
initializeCoroCleanupPass(*PassRegistry::getPassRegistry());
|
initializeCoroCleanupLegacyPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Lowerer> L;
|
std::unique_ptr<Lowerer> L;
|
||||||
@ -132,8 +132,8 @@ struct CoroCleanup : FunctionPass {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
char CoroCleanup::ID = 0;
|
char CoroCleanupLegacy::ID = 0;
|
||||||
INITIALIZE_PASS(CoroCleanup, "coro-cleanup",
|
INITIALIZE_PASS(CoroCleanupLegacy, "coro-cleanup",
|
||||||
"Lower all coroutine related intrinsics", false, false)
|
"Lower all coroutine related intrinsics", false, false)
|
||||||
|
|
||||||
Pass *llvm::createCoroCleanupPass() { return new CoroCleanup(); }
|
Pass *llvm::createCoroCleanupLegacyPass() { return new CoroCleanupLegacy(); }
|
||||||
|
@ -22,7 +22,7 @@ using namespace llvm;
|
|||||||
#define DEBUG_TYPE "coro-early"
|
#define DEBUG_TYPE "coro-early"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// Created on demand if CoroEarly pass has work to do.
|
// Created on demand if the coro-early pass has work to do.
|
||||||
class Lowerer : public coro::LowererBase {
|
class Lowerer : public coro::LowererBase {
|
||||||
IRBuilder<> Builder;
|
IRBuilder<> Builder;
|
||||||
PointerType *const AnyResumeFnPtrTy;
|
PointerType *const AnyResumeFnPtrTy;
|
||||||
@ -225,10 +225,10 @@ bool Lowerer::lowerEarlyIntrinsics(Function &F) {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct CoroEarly : public FunctionPass {
|
struct CoroEarlyLegacy : public FunctionPass {
|
||||||
static char ID; // Pass identification, replacement for typeid.
|
static char ID; // Pass identification, replacement for typeid.
|
||||||
CoroEarly() : FunctionPass(ID) {
|
CoroEarlyLegacy() : FunctionPass(ID) {
|
||||||
initializeCoroEarlyPass(*PassRegistry::getPassRegistry());
|
initializeCoroEarlyLegacyPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Lowerer> L;
|
std::unique_ptr<Lowerer> L;
|
||||||
@ -267,8 +267,8 @@ struct CoroEarly : public FunctionPass {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
char CoroEarly::ID = 0;
|
char CoroEarlyLegacy::ID = 0;
|
||||||
INITIALIZE_PASS(CoroEarly, "coro-early", "Lower early coroutine intrinsics",
|
INITIALIZE_PASS(CoroEarlyLegacy, "coro-early",
|
||||||
false, false)
|
"Lower early coroutine intrinsics", false, false)
|
||||||
|
|
||||||
Pass *llvm::createCoroEarlyPass() { return new CoroEarly(); }
|
Pass *llvm::createCoroEarlyLegacyPass() { return new CoroEarlyLegacy(); }
|
||||||
|
@ -24,7 +24,7 @@ using namespace llvm;
|
|||||||
#define DEBUG_TYPE "coro-elide"
|
#define DEBUG_TYPE "coro-elide"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// Created on demand if CoroElide pass has work to do.
|
// Created on demand if the coro-elide pass has work to do.
|
||||||
struct Lowerer : coro::LowererBase {
|
struct Lowerer : coro::LowererBase {
|
||||||
SmallVector<CoroIdInst *, 4> CoroIds;
|
SmallVector<CoroIdInst *, 4> CoroIds;
|
||||||
SmallVector<CoroBeginInst *, 1> CoroBegins;
|
SmallVector<CoroBeginInst *, 1> CoroBegins;
|
||||||
@ -277,10 +277,10 @@ static bool replaceDevirtTrigger(Function &F) {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct CoroElide : FunctionPass {
|
struct CoroElideLegacy : FunctionPass {
|
||||||
static char ID;
|
static char ID;
|
||||||
CoroElide() : FunctionPass(ID) {
|
CoroElideLegacy() : FunctionPass(ID) {
|
||||||
initializeCoroElidePass(*PassRegistry::getPassRegistry());
|
initializeCoroElideLegacyPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Lowerer> L;
|
std::unique_ptr<Lowerer> L;
|
||||||
@ -330,15 +330,15 @@ struct CoroElide : FunctionPass {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
char CoroElide::ID = 0;
|
char CoroElideLegacy::ID = 0;
|
||||||
INITIALIZE_PASS_BEGIN(
|
INITIALIZE_PASS_BEGIN(
|
||||||
CoroElide, "coro-elide",
|
CoroElideLegacy, "coro-elide",
|
||||||
"Coroutine frame allocation elision and indirect calls replacement", false,
|
"Coroutine frame allocation elision and indirect calls replacement", false,
|
||||||
false)
|
false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
|
||||||
INITIALIZE_PASS_END(
|
INITIALIZE_PASS_END(
|
||||||
CoroElide, "coro-elide",
|
CoroElideLegacy, "coro-elide",
|
||||||
"Coroutine frame allocation elision and indirect calls replacement", false,
|
"Coroutine frame allocation elision and indirect calls replacement", false,
|
||||||
false)
|
false)
|
||||||
|
|
||||||
Pass *llvm::createCoroElidePass() { return new CoroElide(); }
|
Pass *llvm::createCoroElideLegacyPass() { return new CoroElideLegacy(); }
|
||||||
|
@ -21,10 +21,10 @@ class CallGraph;
|
|||||||
class CallGraphSCC;
|
class CallGraphSCC;
|
||||||
class PassRegistry;
|
class PassRegistry;
|
||||||
|
|
||||||
void initializeCoroEarlyPass(PassRegistry &);
|
void initializeCoroEarlyLegacyPass(PassRegistry &);
|
||||||
void initializeCoroSplitPass(PassRegistry &);
|
void initializeCoroSplitLegacyPass(PassRegistry &);
|
||||||
void initializeCoroElidePass(PassRegistry &);
|
void initializeCoroElideLegacyPass(PassRegistry &);
|
||||||
void initializeCoroCleanupPass(PassRegistry &);
|
void initializeCoroCleanupLegacyPass(PassRegistry &);
|
||||||
|
|
||||||
// CoroEarly pass marks every function that has coro.begin with a string
|
// CoroEarly pass marks every function that has coro.begin with a string
|
||||||
// attribute "coroutine.presplit"="0". CoroSplit pass processes the coroutine
|
// attribute "coroutine.presplit"="0". CoroSplit pass processes the coroutine
|
||||||
|
@ -1408,9 +1408,10 @@ static void prepareForSplit(Function &F, CallGraph &CG) {
|
|||||||
CG[&F]->addCalledFunction(IndirectCall, CG.getCallsExternalNode());
|
CG[&F]->addCalledFunction(IndirectCall, CG.getCallsExternalNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that there is a devirtualization trigger function that CoroSplit
|
// Make sure that there is a devirtualization trigger function that the
|
||||||
// pass uses the force restart CGSCC pipeline. If devirt trigger function is not
|
// coro-split pass uses to force a restart of the CGSCC pipeline. If the devirt
|
||||||
// found, we will create one and add it to the current SCC.
|
// trigger function is not found, we will create one and add it to the current
|
||||||
|
// SCC.
|
||||||
static void createDevirtTriggerFunc(CallGraph &CG, CallGraphSCC &SCC) {
|
static void createDevirtTriggerFunc(CallGraph &CG, CallGraphSCC &SCC) {
|
||||||
Module &M = CG.getModule();
|
Module &M = CG.getModule();
|
||||||
if (M.getFunction(CORO_DEVIRT_TRIGGER_FN))
|
if (M.getFunction(CORO_DEVIRT_TRIGGER_FN))
|
||||||
@ -1513,11 +1514,11 @@ static bool replaceAllPrepares(Function *PrepareFn, CallGraph &CG) {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct CoroSplit : public CallGraphSCCPass {
|
struct CoroSplitLegacy : public CallGraphSCCPass {
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
|
|
||||||
CoroSplit() : CallGraphSCCPass(ID) {
|
CoroSplitLegacy() : CallGraphSCCPass(ID) {
|
||||||
initializeCoroSplitPass(*PassRegistry::getPassRegistry());
|
initializeCoroSplitLegacyPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Run = false;
|
bool Run = false;
|
||||||
@ -1587,16 +1588,16 @@ struct CoroSplit : public CallGraphSCCPass {
|
|||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
char CoroSplit::ID = 0;
|
char CoroSplitLegacy::ID = 0;
|
||||||
|
|
||||||
INITIALIZE_PASS_BEGIN(
|
INITIALIZE_PASS_BEGIN(
|
||||||
CoroSplit, "coro-split",
|
CoroSplitLegacy, "coro-split",
|
||||||
"Split coroutine into a set of functions driving its state machine", false,
|
"Split coroutine into a set of functions driving its state machine", false,
|
||||||
false)
|
false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
|
||||||
INITIALIZE_PASS_END(
|
INITIALIZE_PASS_END(
|
||||||
CoroSplit, "coro-split",
|
CoroSplitLegacy, "coro-split",
|
||||||
"Split coroutine into a set of functions driving its state machine", false,
|
"Split coroutine into a set of functions driving its state machine", false,
|
||||||
false)
|
false)
|
||||||
|
|
||||||
Pass *llvm::createCoroSplitPass() { return new CoroSplit(); }
|
Pass *llvm::createCoroSplitLegacyPass() { return new CoroSplitLegacy(); }
|
||||||
|
@ -43,39 +43,39 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
void llvm::initializeCoroutines(PassRegistry &Registry) {
|
void llvm::initializeCoroutines(PassRegistry &Registry) {
|
||||||
initializeCoroEarlyPass(Registry);
|
initializeCoroEarlyLegacyPass(Registry);
|
||||||
initializeCoroSplitPass(Registry);
|
initializeCoroSplitLegacyPass(Registry);
|
||||||
initializeCoroElidePass(Registry);
|
initializeCoroElideLegacyPass(Registry);
|
||||||
initializeCoroCleanupPass(Registry);
|
initializeCoroCleanupLegacyPass(Registry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addCoroutineOpt0Passes(const PassManagerBuilder &Builder,
|
static void addCoroutineOpt0Passes(const PassManagerBuilder &Builder,
|
||||||
legacy::PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
PM.add(createCoroSplitPass());
|
PM.add(createCoroSplitLegacyPass());
|
||||||
PM.add(createCoroElidePass());
|
PM.add(createCoroElideLegacyPass());
|
||||||
|
|
||||||
PM.add(createBarrierNoopPass());
|
PM.add(createBarrierNoopPass());
|
||||||
PM.add(createCoroCleanupPass());
|
PM.add(createCoroCleanupLegacyPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addCoroutineEarlyPasses(const PassManagerBuilder &Builder,
|
static void addCoroutineEarlyPasses(const PassManagerBuilder &Builder,
|
||||||
legacy::PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
PM.add(createCoroEarlyPass());
|
PM.add(createCoroEarlyLegacyPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addCoroutineScalarOptimizerPasses(const PassManagerBuilder &Builder,
|
static void addCoroutineScalarOptimizerPasses(const PassManagerBuilder &Builder,
|
||||||
legacy::PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
PM.add(createCoroElidePass());
|
PM.add(createCoroElideLegacyPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addCoroutineSCCPasses(const PassManagerBuilder &Builder,
|
static void addCoroutineSCCPasses(const PassManagerBuilder &Builder,
|
||||||
legacy::PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
PM.add(createCoroSplitPass());
|
PM.add(createCoroSplitLegacyPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addCoroutineOptimizerLastPasses(const PassManagerBuilder &Builder,
|
static void addCoroutineOptimizerLastPasses(const PassManagerBuilder &Builder,
|
||||||
legacy::PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
PM.add(createCoroCleanupPass());
|
PM.add(createCoroCleanupLegacyPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void llvm::addCoroutinePassesToExtensionPoints(PassManagerBuilder &Builder) {
|
void llvm::addCoroutinePassesToExtensionPoints(PassManagerBuilder &Builder) {
|
||||||
@ -635,17 +635,17 @@ void AnyCoroIdRetconInst::checkWellFormed() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LLVMAddCoroEarlyPass(LLVMPassManagerRef PM) {
|
void LLVMAddCoroEarlyPass(LLVMPassManagerRef PM) {
|
||||||
unwrap(PM)->add(createCoroEarlyPass());
|
unwrap(PM)->add(createCoroEarlyLegacyPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVMAddCoroSplitPass(LLVMPassManagerRef PM) {
|
void LLVMAddCoroSplitPass(LLVMPassManagerRef PM) {
|
||||||
unwrap(PM)->add(createCoroSplitPass());
|
unwrap(PM)->add(createCoroSplitLegacyPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVMAddCoroElidePass(LLVMPassManagerRef PM) {
|
void LLVMAddCoroElidePass(LLVMPassManagerRef PM) {
|
||||||
unwrap(PM)->add(createCoroElidePass());
|
unwrap(PM)->add(createCoroElideLegacyPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM) {
|
void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM) {
|
||||||
unwrap(PM)->add(createCoroCleanupPass());
|
unwrap(PM)->add(createCoroCleanupLegacyPass());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user