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);
|
||||
|
||||
/** See llvm::createCoroSplitPass function. */
|
||||
/** See llvm::createCoroSplitLegacyPass function. */
|
||||
void LLVMAddCoroSplitPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createCoroElidePass function. */
|
||||
/** See llvm::createCoroElideLegacyPass function. */
|
||||
void LLVMAddCoroElidePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createCoroCleanupPass function. */
|
||||
/** See llvm::createCoroCleanupLegacyPass function. */
|
||||
void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
|
@ -20,17 +20,17 @@ class PassManagerBuilder;
|
||||
void addCoroutinePassesToExtensionPoints(PassManagerBuilder &Builder);
|
||||
|
||||
/// Lower coroutine intrinsics that are not needed by later passes.
|
||||
Pass *createCoroEarlyPass();
|
||||
Pass *createCoroEarlyLegacyPass();
|
||||
|
||||
/// Split up coroutines into multiple functions driving their state machines.
|
||||
Pass *createCoroSplitPass();
|
||||
Pass *createCoroSplitLegacyPass();
|
||||
|
||||
/// Analyze coroutines use sites, devirtualize resume/destroy calls and elide
|
||||
/// heap allocation for coroutine frame where possible.
|
||||
Pass *createCoroElidePass();
|
||||
Pass *createCoroElideLegacyPass();
|
||||
|
||||
/// Lower all remaining coroutine intrinsics.
|
||||
Pass *createCoroCleanupPass();
|
||||
Pass *createCoroCleanupLegacyPass();
|
||||
|
||||
}
|
||||
|
||||
|
@ -99,11 +99,11 @@ bool Lowerer::lowerRemainingCoroIntrinsics(Function &F) {
|
||||
|
||||
namespace {
|
||||
|
||||
struct CoroCleanup : FunctionPass {
|
||||
struct CoroCleanupLegacy : FunctionPass {
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
|
||||
CoroCleanup() : FunctionPass(ID) {
|
||||
initializeCoroCleanupPass(*PassRegistry::getPassRegistry());
|
||||
CoroCleanupLegacy() : FunctionPass(ID) {
|
||||
initializeCoroCleanupLegacyPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
std::unique_ptr<Lowerer> L;
|
||||
@ -132,8 +132,8 @@ struct CoroCleanup : FunctionPass {
|
||||
};
|
||||
}
|
||||
|
||||
char CoroCleanup::ID = 0;
|
||||
INITIALIZE_PASS(CoroCleanup, "coro-cleanup",
|
||||
char CoroCleanupLegacy::ID = 0;
|
||||
INITIALIZE_PASS(CoroCleanupLegacy, "coro-cleanup",
|
||||
"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"
|
||||
|
||||
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 {
|
||||
IRBuilder<> Builder;
|
||||
PointerType *const AnyResumeFnPtrTy;
|
||||
@ -225,10 +225,10 @@ bool Lowerer::lowerEarlyIntrinsics(Function &F) {
|
||||
|
||||
namespace {
|
||||
|
||||
struct CoroEarly : public FunctionPass {
|
||||
struct CoroEarlyLegacy : public FunctionPass {
|
||||
static char ID; // Pass identification, replacement for typeid.
|
||||
CoroEarly() : FunctionPass(ID) {
|
||||
initializeCoroEarlyPass(*PassRegistry::getPassRegistry());
|
||||
CoroEarlyLegacy() : FunctionPass(ID) {
|
||||
initializeCoroEarlyLegacyPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
std::unique_ptr<Lowerer> L;
|
||||
@ -267,8 +267,8 @@ struct CoroEarly : public FunctionPass {
|
||||
};
|
||||
}
|
||||
|
||||
char CoroEarly::ID = 0;
|
||||
INITIALIZE_PASS(CoroEarly, "coro-early", "Lower early coroutine intrinsics",
|
||||
false, false)
|
||||
char CoroEarlyLegacy::ID = 0;
|
||||
INITIALIZE_PASS(CoroEarlyLegacy, "coro-early",
|
||||
"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"
|
||||
|
||||
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 {
|
||||
SmallVector<CoroIdInst *, 4> CoroIds;
|
||||
SmallVector<CoroBeginInst *, 1> CoroBegins;
|
||||
@ -277,10 +277,10 @@ static bool replaceDevirtTrigger(Function &F) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace {
|
||||
struct CoroElide : FunctionPass {
|
||||
struct CoroElideLegacy : FunctionPass {
|
||||
static char ID;
|
||||
CoroElide() : FunctionPass(ID) {
|
||||
initializeCoroElidePass(*PassRegistry::getPassRegistry());
|
||||
CoroElideLegacy() : FunctionPass(ID) {
|
||||
initializeCoroElideLegacyPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
std::unique_ptr<Lowerer> L;
|
||||
@ -330,15 +330,15 @@ struct CoroElide : FunctionPass {
|
||||
};
|
||||
}
|
||||
|
||||
char CoroElide::ID = 0;
|
||||
char CoroElideLegacy::ID = 0;
|
||||
INITIALIZE_PASS_BEGIN(
|
||||
CoroElide, "coro-elide",
|
||||
CoroElideLegacy, "coro-elide",
|
||||
"Coroutine frame allocation elision and indirect calls replacement", false,
|
||||
false)
|
||||
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
|
||||
INITIALIZE_PASS_END(
|
||||
CoroElide, "coro-elide",
|
||||
CoroElideLegacy, "coro-elide",
|
||||
"Coroutine frame allocation elision and indirect calls replacement", false,
|
||||
false)
|
||||
|
||||
Pass *llvm::createCoroElidePass() { return new CoroElide(); }
|
||||
Pass *llvm::createCoroElideLegacyPass() { return new CoroElideLegacy(); }
|
||||
|
@ -21,10 +21,10 @@ class CallGraph;
|
||||
class CallGraphSCC;
|
||||
class PassRegistry;
|
||||
|
||||
void initializeCoroEarlyPass(PassRegistry &);
|
||||
void initializeCoroSplitPass(PassRegistry &);
|
||||
void initializeCoroElidePass(PassRegistry &);
|
||||
void initializeCoroCleanupPass(PassRegistry &);
|
||||
void initializeCoroEarlyLegacyPass(PassRegistry &);
|
||||
void initializeCoroSplitLegacyPass(PassRegistry &);
|
||||
void initializeCoroElideLegacyPass(PassRegistry &);
|
||||
void initializeCoroCleanupLegacyPass(PassRegistry &);
|
||||
|
||||
// CoroEarly pass marks every function that has coro.begin with a string
|
||||
// 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());
|
||||
}
|
||||
|
||||
// Make sure that there is a devirtualization trigger function that CoroSplit
|
||||
// pass uses the force restart CGSCC pipeline. If devirt trigger function is not
|
||||
// found, we will create one and add it to the current SCC.
|
||||
// Make sure that there is a devirtualization trigger function that the
|
||||
// coro-split pass uses to force a restart of the CGSCC pipeline. If the devirt
|
||||
// trigger function is not found, we will create one and add it to the current
|
||||
// SCC.
|
||||
static void createDevirtTriggerFunc(CallGraph &CG, CallGraphSCC &SCC) {
|
||||
Module &M = CG.getModule();
|
||||
if (M.getFunction(CORO_DEVIRT_TRIGGER_FN))
|
||||
@ -1513,11 +1514,11 @@ static bool replaceAllPrepares(Function *PrepareFn, CallGraph &CG) {
|
||||
|
||||
namespace {
|
||||
|
||||
struct CoroSplit : public CallGraphSCCPass {
|
||||
struct CoroSplitLegacy : public CallGraphSCCPass {
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
|
||||
CoroSplit() : CallGraphSCCPass(ID) {
|
||||
initializeCoroSplitPass(*PassRegistry::getPassRegistry());
|
||||
CoroSplitLegacy() : CallGraphSCCPass(ID) {
|
||||
initializeCoroSplitLegacyPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
bool Run = false;
|
||||
@ -1587,16 +1588,16 @@ struct CoroSplit : public CallGraphSCCPass {
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char CoroSplit::ID = 0;
|
||||
char CoroSplitLegacy::ID = 0;
|
||||
|
||||
INITIALIZE_PASS_BEGIN(
|
||||
CoroSplit, "coro-split",
|
||||
CoroSplitLegacy, "coro-split",
|
||||
"Split coroutine into a set of functions driving its state machine", false,
|
||||
false)
|
||||
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
|
||||
INITIALIZE_PASS_END(
|
||||
CoroSplit, "coro-split",
|
||||
CoroSplitLegacy, "coro-split",
|
||||
"Split coroutine into a set of functions driving its state machine", false,
|
||||
false)
|
||||
|
||||
Pass *llvm::createCoroSplitPass() { return new CoroSplit(); }
|
||||
Pass *llvm::createCoroSplitLegacyPass() { return new CoroSplitLegacy(); }
|
||||
|
@ -43,39 +43,39 @@
|
||||
using namespace llvm;
|
||||
|
||||
void llvm::initializeCoroutines(PassRegistry &Registry) {
|
||||
initializeCoroEarlyPass(Registry);
|
||||
initializeCoroSplitPass(Registry);
|
||||
initializeCoroElidePass(Registry);
|
||||
initializeCoroCleanupPass(Registry);
|
||||
initializeCoroEarlyLegacyPass(Registry);
|
||||
initializeCoroSplitLegacyPass(Registry);
|
||||
initializeCoroElideLegacyPass(Registry);
|
||||
initializeCoroCleanupLegacyPass(Registry);
|
||||
}
|
||||
|
||||
static void addCoroutineOpt0Passes(const PassManagerBuilder &Builder,
|
||||
legacy::PassManagerBase &PM) {
|
||||
PM.add(createCoroSplitPass());
|
||||
PM.add(createCoroElidePass());
|
||||
PM.add(createCoroSplitLegacyPass());
|
||||
PM.add(createCoroElideLegacyPass());
|
||||
|
||||
PM.add(createBarrierNoopPass());
|
||||
PM.add(createCoroCleanupPass());
|
||||
PM.add(createCoroCleanupLegacyPass());
|
||||
}
|
||||
|
||||
static void addCoroutineEarlyPasses(const PassManagerBuilder &Builder,
|
||||
legacy::PassManagerBase &PM) {
|
||||
PM.add(createCoroEarlyPass());
|
||||
PM.add(createCoroEarlyLegacyPass());
|
||||
}
|
||||
|
||||
static void addCoroutineScalarOptimizerPasses(const PassManagerBuilder &Builder,
|
||||
legacy::PassManagerBase &PM) {
|
||||
PM.add(createCoroElidePass());
|
||||
PM.add(createCoroElideLegacyPass());
|
||||
}
|
||||
|
||||
static void addCoroutineSCCPasses(const PassManagerBuilder &Builder,
|
||||
legacy::PassManagerBase &PM) {
|
||||
PM.add(createCoroSplitPass());
|
||||
PM.add(createCoroSplitLegacyPass());
|
||||
}
|
||||
|
||||
static void addCoroutineOptimizerLastPasses(const PassManagerBuilder &Builder,
|
||||
legacy::PassManagerBase &PM) {
|
||||
PM.add(createCoroCleanupPass());
|
||||
PM.add(createCoroCleanupLegacyPass());
|
||||
}
|
||||
|
||||
void llvm::addCoroutinePassesToExtensionPoints(PassManagerBuilder &Builder) {
|
||||
@ -635,17 +635,17 @@ void AnyCoroIdRetconInst::checkWellFormed() const {
|
||||
}
|
||||
|
||||
void LLVMAddCoroEarlyPass(LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(createCoroEarlyPass());
|
||||
unwrap(PM)->add(createCoroEarlyLegacyPass());
|
||||
}
|
||||
|
||||
void LLVMAddCoroSplitPass(LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(createCoroSplitPass());
|
||||
unwrap(PM)->add(createCoroSplitLegacyPass());
|
||||
}
|
||||
|
||||
void LLVMAddCoroElidePass(LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(createCoroElidePass());
|
||||
unwrap(PM)->add(createCoroElideLegacyPass());
|
||||
}
|
||||
|
||||
void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(createCoroCleanupPass());
|
||||
unwrap(PM)->add(createCoroCleanupLegacyPass());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user