summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2020-01-04 15:01:43 +0000
committerFlorian Hahn <flo@fhahn.com>2020-01-04 15:47:23 +0000
commit0bb22b91ea335b964b99862834164b0b3a866eb4 (patch)
treed76e85a805f172466d61d3626b8a8c4e22891436 /llvm/tools
parentb7ecf1c1c373c53183ef6ef66efbe4237ff7b96d (diff)
downloadbcm5719-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.txt4
-rw-r--r--llvm/tools/opt/opt.cpp8
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");
OpenPOWER on IntegriCloud