- if (AnalyzeOnly) {
- Module *CurMod = 0;
-#if 0
- TimeRegion RegionTimer(BytecodeLoadTimer);
-#endif
- CurMod = ParseBytecodeFile(InputFilename);
- ParseError Err;
- if (!CurMod && !(CurMod = ParseAssemblyFile(InputFilename,&Err))){
- std::cerr << argv[0] << ": " << Err.getMessage() << "\n";
- return 1;
- }
-
- // Create a PassManager to hold and optimize the collection of passes we
- // are about to build...
- PassManager Passes;
-
- // Add an appropriate TargetData instance for this module...
- Passes.add(new TargetData(CurMod));
-
- // Make sure the input LLVM is well formed.
- if (!NoVerify)
- Passes.add(createVerifierPass());
-
- // Create a new optimization pass for each one specified on the
- // command line
- for (unsigned i = 0; i < AnalysesList.size(); ++i) {
- const PassInfo *Analysis = AnalysesList[i];
-
- if (Analysis->getNormalCtor()) {
- Pass *P = Analysis->getNormalCtor()();
- Passes.add(P);
-
- if (BasicBlockPass *BBP = dynamic_cast<BasicBlockPass*>(P))
- Passes.add(new BasicBlockPassPrinter(Analysis));
- else if (FunctionPass *FP = dynamic_cast<FunctionPass*>(P))
- Passes.add(new FunctionPassPrinter(Analysis));
- else
- Passes.add(new ModulePassPrinter(Analysis));
-
- } else
- std::cerr << argv[0] << ": cannot create pass: "
- << Analysis->getPassName() << "\n";
- }
-
- Passes.run(*CurMod);
-
- delete CurMod;
- return 0;
- }
-
- // Allocate a full target machine description only if necessary...