diff options
author | Florian Hahn <flo@fhahn.com> | 2020-01-04 15:01:43 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2020-01-04 15:47:23 +0000 |
commit | 0bb22b91ea335b964b99862834164b0b3a866eb4 (patch) | |
tree | d76e85a805f172466d61d3626b8a8c4e22891436 /llvm/tools | |
parent | b7ecf1c1c373c53183ef6ef66efbe4237ff7b96d (diff) | |
download | bcm5719-llvm-0bb22b91ea335b964b99862834164b0b3a866eb4.tar.gz bcm5719-llvm-0bb22b91ea335b964b99862834164b0b3a866eb4.zip |
Re-apply "[Examples] Add IRTransformations directory to examples."
This reverts commit 19fd8925a4afe6efd248688cce06aceff50efe0c.
Should include a fix for PR44197.
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/opt/CMakeLists.txt | 4 | ||||
-rw-r--r-- | llvm/tools/opt/opt.cpp | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt index b1929184957..79613c836c5 100644 --- a/llvm/tools/opt/CMakeLists.txt +++ b/llvm/tools/opt/CMakeLists.txt @@ -40,3 +40,7 @@ add_llvm_tool(opt SUPPORT_PLUGINS ) export_executable_symbols(opt) + +if(LLVM_BUILD_EXAMPLES) + target_link_libraries(opt PRIVATE ExampleIRTransforms) +endif(LLVM_BUILD_EXAMPLES) diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index 6c947e77b55..75a6cdc3892 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -482,6 +482,10 @@ static TargetMachine* GetTargetMachine(Triple TheTriple, StringRef CPUStr, getCodeModel(), GetCodeGenOptLevel()); } +#ifdef BUILD_EXAMPLES +void initializeExampleIRTransforms(llvm::PassRegistry &Registry); +#endif + void exportDebugifyStats(llvm::StringRef Path, const DebugifyStatsMap &Map) { std::error_code EC; @@ -559,6 +563,10 @@ int main(int argc, char **argv) { initializeHardwareLoopsPass(Registry); initializeTypePromotionPass(Registry); +#ifdef BUILD_EXAMPLES + initializeExampleIRTransforms(Registry); +#endif + cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .bc modular optimizer and analysis printer\n"); |