[polly] r330181 - [NewPM] Update pass registration for the LLVM plugin interface

Philip Pfaffe via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 17 00:59:46 PDT 2018


Author: pfaffe
Date: Tue Apr 17 00:59:46 2018
New Revision: 330181

URL: http://llvm.org/viewvc/llvm-project?rev=330181&view=rev
Log:
[NewPM] Update pass registration for the LLVM plugin interface

Summary:
As of rL329273, LLVM has a mechanism to load new-pm plugins in opt. Use
this API in Polly.

Reviewers: grosser, Meinersbur, bollu

Reviewed By: grosser, Meinersbur

Subscribers: lksbhm, bollu, pollydev, llvm-commits

Differential Revision: https://reviews.llvm.org/D45484

Added:
    polly/trunk/test/Support/
    polly/trunk/test/Support/Plugins.ll
Modified:
    polly/trunk/lib/Support/RegisterPasses.cpp
    polly/trunk/test/lit.site.cfg.in

Modified: polly/trunk/lib/Support/RegisterPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/RegisterPasses.cpp?rev=330181&r1=330180&r2=330181&view=diff
==============================================================================
--- polly/trunk/lib/Support/RegisterPasses.cpp (original)
+++ polly/trunk/lib/Support/RegisterPasses.cpp Tue Apr 17 00:59:46 2018
@@ -42,6 +42,7 @@
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Verifier.h"
 #include "llvm/Passes/PassBuilder.h"
+#include "llvm/Passes/PassPlugin.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
@@ -703,3 +704,10 @@ void RegisterPollyPasses(PassBuilder &PB
   // FIXME else Error?
 }
 } // namespace polly
+
+// Plugin Entrypoint:
+extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK LLVM_PLUGIN_EXPORT
+llvmGetPassPluginInfo() {
+  return {LLVM_PLUGIN_API_VERSION, "Polly", LLVM_VERSION_STRING,
+          polly::RegisterPollyPasses};
+}

Added: polly/trunk/test/Support/Plugins.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Support/Plugins.ll?rev=330181&view=auto
==============================================================================
--- polly/trunk/test/Support/Plugins.ll (added)
+++ polly/trunk/test/Support/Plugins.ll Tue Apr 17 00:59:46 2018
@@ -0,0 +1,13 @@
+; RUN: opt %loadPolly -passes='polly-prepare,scop(print<polly-ast>)' -S < %s \
+; RUN: | FileCheck %s
+
+; This testcase tests plugin registration. Check-lines below serve to verify
+; that the passes actually ran.
+
+; CHECK-LABEL: void @foo
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label %entry.split
+define void @foo() {
+entry:
+  ret void
+}

Modified: polly/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/lit.site.cfg.in?rev=330181&r1=330180&r2=330181&view=diff
==============================================================================
--- polly/trunk/test/lit.site.cfg.in (original)
+++ polly/trunk/test/lit.site.cfg.in Tue Apr 17 00:59:46 2018
@@ -46,6 +46,8 @@ if config.link_polly_into_tools == '' or
    config.link_polly_into_tools.lower() == 'link_polly_into_tools-notfound':
     config.substitutions.append(('%loadPolly', '-load '
                                  + config.polly_lib_dir + '/LLVMPolly at LLVM_SHLIBEXT@'
+                                 + ' -load-pass-plugin '
+                                 + config.polly_lib_dir + '/LLVMPolly at LLVM_SHLIBEXT@'
                                  + ' -polly-process-unprofitable '
                                  + ' -polly-remarks-minimal '
                                  + ' -polly-use-llvm-names '




More information about the llvm-commits mailing list