diff options
author | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2021-09-15 22:56:20 +0200 |
---|---|---|
committer | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2021-09-16 14:58:42 +0200 |
commit | d9fc3d879e6da153f9b892642e2fe28bed6254a7 (patch) | |
tree | 2171de60fe3f3956fa10bc068212ef588e23fba2 /llvm/lib | |
parent | 8f8616655c4d643d73601c6bf4b492fb9d3b52c8 (diff) | |
download | llvm-d9fc3d879e6da153f9b892642e2fe28bed6254a7.zip llvm-d9fc3d879e6da153f9b892642e2fe28bed6254a7.tar.gz llvm-d9fc3d879e6da153f9b892642e2fe28bed6254a7.tar.bz2 |
[NewPM] Replace 'kasan-module' by 'asan-module<kernel>'
Change the asan-module pass into a MODULE_PASS_WITH_PARAMS in the
pass registry, and add a single parameter called 'kernel' that
can be set instead of having a special pass name 'kasan-module'
to trigger that special pass config.
Main reason is to make sure that we have a unique mapping from
ClassName to PassName in the new passmanager framework, making it
possible to correctly identify the passes when dealing with options
such as -print-after and -print-pipeline-passes.
This is a follow-up to D105006 and D105007.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Passes/PassRegistry.def | 11 | ||||
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 10 |
3 files changed, 23 insertions, 2 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index a868f10..cda24c8 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -574,6 +574,10 @@ Expected<bool> parseLowerMatrixIntrinsicsPassOptions(StringRef Params) { return parseSinglePassOption(Params, "minimal", "LowerMatrixIntrinsics"); } +Expected<bool> parseModuleAddressSanitizerPassOptions(StringRef Params) { + return parseSinglePassOption(Params, "kernel", "ModuleAddressSanitizer"); +} + Expected<AddressSanitizerOptions> parseASanPassOptions(StringRef Params) { AddressSanitizerOptions Result; while (!Params.empty()) { diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def index 689ae62..bb71ebe 100644 --- a/llvm/lib/Passes/PassRegistry.def +++ b/llvm/lib/Passes/PassRegistry.def @@ -109,10 +109,8 @@ MODULE_PASS("synthetic-counts-propagation", SyntheticCountsPropagation()) MODULE_PASS("verify", VerifierPass()) MODULE_PASS("wholeprogramdevirt", WholeProgramDevirtPass()) MODULE_PASS("dfsan", DataFlowSanitizerPass()) -MODULE_PASS("asan-module", ModuleAddressSanitizerPass(/*CompileKernel=*/false, false, true, false)) MODULE_PASS("msan-module", ModuleMemorySanitizerPass({})) MODULE_PASS("tsan-module", ModuleThreadSanitizerPass()) -MODULE_PASS("kasan-module", ModuleAddressSanitizerPass(/*CompileKernel=*/true, false, true, false)) MODULE_PASS("sancov-module", ModuleSanitizerCoveragePass()) MODULE_PASS("memprof-module", ModuleMemProfilerPass()) MODULE_PASS("poison-checking", PoisonCheckingPass()) @@ -138,6 +136,15 @@ MODULE_PASS_WITH_PARAMS("hwasan", }, parseHWASanPassOptions, "kernel;recover") +MODULE_PASS_WITH_PARAMS("asan-module", + "ModuleAddressSanitizerPass", + [](bool CompileKernel) { + return ModuleAddressSanitizerPass(CompileKernel, + false, true, + false); + }, + parseModuleAddressSanitizerPassOptions, + "kernel") #undef MODULE_PASS_WITH_PARAMS #ifndef CGSCC_ANALYSIS diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index b2cb623..65c9459 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -1283,6 +1283,16 @@ void AddressSanitizerPass::printPipeline( OS << ">"; } +void ModuleAddressSanitizerPass::printPipeline( + raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) { + static_cast<PassInfoMixin<ModuleAddressSanitizerPass> *>(this)->printPipeline( + OS, MapClassName2PassName); + OS << "<"; + if (CompileKernel) + OS << "kernel"; + OS << ">"; +} + ModuleAddressSanitizerPass::ModuleAddressSanitizerPass( bool CompileKernel, bool Recover, bool UseGlobalGC, bool UseOdrIndicator, AsanDtorKind DestructorKind) |