[PM] Wire up the analysis managers in the opt driver. This isn't really
[oota-llvm.git] / tools / opt / opt.cpp
index dcff891bcd07aad428b87cec554e8f52d179db14..782cac213f034f1ad7510b1ea4f197ec9a3c97c6 100644 (file)
@@ -676,11 +676,17 @@ int main(int argc, char **argv) {
     if (!NoOutput)
       OK = OutputAssembly ? OK_OutputAssembly : OK_OutputBitcode;
 
+    VerifierKind VK = VK_VerifyInAndOut;
+    if (NoVerify)
+      VK = VK_NoVerifier;
+    else if (VerifyEach)
+      VK = VK_VerifyEachPass;
+
     // The user has asked to use the new pass manager and provided a pipeline
     // string. Hand off the rest of the functionality to the new code for that
     // layer.
     return runPassPipeline(argv[0], Context, *M.get(), Out.get(), PassPipeline,
-                           OK)
+                           OK, VK)
                ? 0
                : 1;
   }
@@ -795,7 +801,9 @@ int main(int argc, char **argv) {
 
     const PassInfo *PassInf = PassList[i];
     Pass *P = 0;
-    if (PassInf->getNormalCtor())
+    if (PassInf->getTargetMachineCtor())
+      P = PassInf->getTargetMachineCtor()(TM.get());
+    else if (PassInf->getNormalCtor())
       P = PassInf->getNormalCtor()();
     else
       errs() << argv[0] << ": cannot create pass: "