]> granicus.if.org Git - llvm/commitdiff
Ensure backends available in 'opt' are also available in 'bugpoint'
authorTobias Grosser <tobias@grosser.es>
Sat, 24 Jun 2017 08:09:33 +0000 (08:09 +0000)
committerTobias Grosser <tobias@grosser.es>
Sat, 24 Jun 2017 08:09:33 +0000 (08:09 +0000)
This patch links LLVM back-ends into bugpoint the same way they are already
available in 'opt' and 'clang'. This resolves an inconsistency that allowed the
use of LLVM backends in loadable modules that run in 'opt', but that would
prevent the debugging of these modules with bugpoint due to unavailable /
unresolved symbols.

For e.g. In D31859, Polly requires the NVPTX back-end.

Reviewers: hfinkel, bogner, chandlerc, grosser, Meinersbur

Subscribers: bollu, mgorny, grosser, Meinersbur

Tags: #polly

Contributed by: Singapuram Sanjay

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306208 cdac9f57-aa62-4fd3-8940-286f4534e8a0

tools/bugpoint/CMakeLists.txt
tools/bugpoint/LLVMBuild.txt
tools/bugpoint/bugpoint.cpp

index 7598657427e8ba9bea1c8621f95b74b59b0cbcd4..8975e67634340abc7b7698dbc0b94f4f9eadb714 100644 (file)
@@ -1,4 +1,5 @@
 set(LLVM_LINK_COMPONENTS
+  ${LLVM_TARGETS_TO_BUILD}
   Analysis
   BitWriter
   CodeGen
index 37a605870548f8bad399a96acfe0f8a6a0ef3d00..68ecb8c8f4f9124155b4b4671372509adb5429a8 100644 (file)
@@ -30,3 +30,4 @@ required_libraries =
  Linker
  ObjCARC
  Scalar
+ all-targets
index 85c1ddd8277d9017331ef771f44c207354e1fc48..a486342457c55184ad1cb50f9bccb0f64bb054cf 100644 (file)
@@ -26,6 +26,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
+#include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/Valgrind.h"
 #include "llvm/Transforms/IPO/AlwaysInliner.h"
 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
@@ -138,6 +139,14 @@ int main(int argc, char **argv) {
   polly::initializePollyPasses(Registry);
 #endif
 
+  if (std::getenv("bar") == (char*) -1) {
+    InitializeAllTargets();
+    InitializeAllTargetMCs();
+    InitializeAllAsmPrinters();
+    InitializeAllAsmParsers();
+    InitializeAllDisassemblers();
+  }
+
   cl::ParseCommandLineOptions(argc, argv,
                               "LLVM automatic testcase reducer. See\nhttp://"
                               "llvm.org/cmds/bugpoint.html"