mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
[PM] Add module and function printing passes for the new pass manager.
This implements the legacy passes in terms of the new ones. It adds basic testing using explicit runs of the passes. Next up will be wiring the basic output mechanism of opt up when the new pass manager is engaged unless bitcode writing is requested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199049 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -15,7 +15,9 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Passes.h"
|
||||
#include "llvm/IR/IRPrintingPasses.h"
|
||||
#include "llvm/IR/PassManager.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -39,12 +41,14 @@ struct NoOpFunctionPass {
|
||||
// under different macros.
|
||||
static bool isModulePassName(StringRef Name) {
|
||||
if (Name == "no-op-module") return true;
|
||||
if (Name == "print") return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool isFunctionPassName(StringRef Name) {
|
||||
if (Name == "no-op-function") return true;
|
||||
if (Name == "print") return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -54,6 +58,10 @@ static bool parseModulePassName(ModulePassManager &MPM, StringRef Name) {
|
||||
MPM.addPass(NoOpModulePass());
|
||||
return true;
|
||||
}
|
||||
if (Name == "print") {
|
||||
MPM.addPass(PrintModulePass(dbgs()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -62,6 +70,10 @@ static bool parseFunctionPassName(FunctionPassManager &FPM, StringRef Name) {
|
||||
FPM.addPass(NoOpFunctionPass());
|
||||
return true;
|
||||
}
|
||||
if (Name == "print") {
|
||||
FPM.addPass(PrintFunctionPass(dbgs()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user