Opt needs to initialize the different targets.
authorNadav Rotem <nrotem@apple.com>
Wed, 24 Oct 2012 17:23:50 +0000 (17:23 +0000)
committerNadav Rotem <nrotem@apple.com>
Wed, 24 Oct 2012 17:23:50 +0000 (17:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166595 91177308-0d34-0410-b5e6-96231b3b80d8

tools/opt/opt.cpp

index 8d8d73179e523e69f0269bb9197ddb79d1a194c8..c78f97fa607ee3c52676ad472da786a689c18e67 100644 (file)
@@ -39,6 +39,7 @@
 #include "llvm/Support/SystemUtils.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Support/TargetSelect.h"
 #include "llvm/MC/SubtargetFeature.h"
 #include "llvm/LinkAllPasses.h"
 #include "llvm/LinkAllVMCore.h"
@@ -564,6 +565,11 @@ int main(int argc, char **argv) {
   llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
   LLVMContext &Context = getGlobalContext();
 
+  InitializeAllTargets();
+  InitializeAllTargetMCs();
+  InitializeAllAsmPrinters();
+  InitializeAllAsmParsers();
+
   // Initialize passes
   PassRegistry &Registry = *PassRegistry::getPassRegistry();
   initializeCore(Registry);