Generalize the pass registration mechanism used by Polly to any third-party tool
authorserge_sans_paille <sguelton@redhat.com>
Sat, 8 Jun 2019 15:37:47 +0000 (17:37 +0200)
committerserge-sans-paille <sguelton@redhat.com>
Thu, 2 Jan 2020 15:45:31 +0000 (16:45 +0100)
commit24ab9b537e61b3fe5e6a1019492ff6530d82a3ee
treea44734fd73e2789f7817cf49b5a30f638a1a4a63
parent8d7ecc16291ff415da0d5bfccb6363590a1310ad
Generalize the pass registration mechanism used by Polly to any third-party tool

There's quite a lot of references to Polly in the LLVM CMake codebase. However
the registration pattern used by Polly could be useful to other external
projects: thanks to that mechanism it would be possible to develop LLVM
extension without touching the LLVM code base.

This patch has two effects:

1. Remove all code specific to Polly in the llvm/clang codebase, replaicing it
   with a generic mechanism

2. Provide a generic mechanism to register compiler extensions.

A compiler extension is similar to a pass plugin, with the notable difference
that the compiler extension can be configured to be built dynamically (like
plugins) or statically (like regular passes).

As a result, people willing to add extra passes to clang/opt can do it using a
separate code repo, but still have their pass be linked in clang/opt as built-in
passes.

Differential Revision: https://reviews.llvm.org/D61446
35 files changed:
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CMakeLists.txt
clang/tools/driver/CMakeLists.txt
clang/tools/driver/cc1_main.cpp
llvm/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
llvm/docs/WritingAnLLVMPass.rst
llvm/examples/Bye/Bye.cpp [new file with mode: 0644]
llvm/examples/Bye/CMakeLists.txt [new file with mode: 0644]
llvm/examples/CMakeLists.txt
llvm/include/llvm/Config/llvm-config.h.cmake
llvm/test/Feature/load_extension.ll [new file with mode: 0644]
llvm/test/Other/new-pm-defaults.ll
llvm/test/Other/new-pm-thinlto-defaults.ll
llvm/test/Other/opt-O0-pipeline.ll
llvm/test/Other/opt-O2-pipeline.ll
llvm/test/Other/opt-O3-pipeline.ll
llvm/test/Other/opt-Os-pipeline.ll
llvm/test/lit.cfg.py
llvm/test/lit.site.cfg.py.in
llvm/tools/CMakeLists.txt
llvm/tools/bugpoint/CMakeLists.txt
llvm/tools/bugpoint/bugpoint.cpp
llvm/tools/opt/CMakeLists.txt
llvm/tools/opt/NewPMDriver.cpp
llvm/tools/opt/opt.cpp
llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
polly/include/polly/RegisterPasses.h
polly/lib/CMakeLists.txt
polly/lib/Plugin/Polly.cpp [new file with mode: 0644]
polly/lib/Polly.cpp [deleted file]
polly/lib/Support/RegisterPasses.cpp
polly/test/Unit/lit.site.cfg.in
polly/test/lit.site.cfg.in
polly/test/update_check.py