Clang] Fix expansion of response files in -Wp after integrated-cc1 change
[llvm-project.git] / llvm / tools / llc / llc.cpp
blob0cf65139d5a3cd9f3d5a8f6a40dfa16fa1f8141d
1 //===-- llc.cpp - Implement the LLVM Native Code Generator ----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This is the llc code generator driver. It provides a convenient
10 // command-line interface for generating native assembly-language code
11 // or C code, given LLVM bitcode.
13 //===----------------------------------------------------------------------===//
15 #include "llvm/ADT/STLExtras.h"
16 #include "llvm/ADT/Triple.h"
17 #include "llvm/Analysis/TargetLibraryInfo.h"
18 #include "llvm/CodeGen/CommandFlags.inc"
19 #include "llvm/CodeGen/LinkAllAsmWriterComponents.h"
20 #include "llvm/CodeGen/LinkAllCodegenComponents.h"
21 #include "llvm/CodeGen/MIRParser/MIRParser.h"
22 #include "llvm/CodeGen/MachineFunctionPass.h"
23 #include "llvm/CodeGen/MachineModuleInfo.h"
24 #include "llvm/CodeGen/TargetPassConfig.h"
25 #include "llvm/CodeGen/TargetSubtargetInfo.h"
26 #include "llvm/IR/AutoUpgrade.h"
27 #include "llvm/IR/DataLayout.h"
28 #include "llvm/IR/DiagnosticInfo.h"
29 #include "llvm/IR/DiagnosticPrinter.h"
30 #include "llvm/IR/IRPrintingPasses.h"
31 #include "llvm/IR/LLVMContext.h"
32 #include "llvm/IR/LegacyPassManager.h"
33 #include "llvm/IR/Module.h"
34 #include "llvm/IR/RemarkStreamer.h"
35 #include "llvm/IR/Verifier.h"
36 #include "llvm/IRReader/IRReader.h"
37 #include "llvm/InitializePasses.h"
38 #include "llvm/MC/SubtargetFeature.h"
39 #include "llvm/Pass.h"
40 #include "llvm/Support/CommandLine.h"
41 #include "llvm/Support/Debug.h"
42 #include "llvm/Support/FileSystem.h"
43 #include "llvm/Support/FormattedStream.h"
44 #include "llvm/Support/Host.h"
45 #include "llvm/Support/InitLLVM.h"
46 #include "llvm/Support/ManagedStatic.h"
47 #include "llvm/Support/PluginLoader.h"
48 #include "llvm/Support/SourceMgr.h"
49 #include "llvm/Support/TargetRegistry.h"
50 #include "llvm/Support/TargetSelect.h"
51 #include "llvm/Support/ToolOutputFile.h"
52 #include "llvm/Support/WithColor.h"
53 #include "llvm/Target/TargetMachine.h"
54 #include "llvm/Transforms/Utils/Cloning.h"
55 #include <memory>
56 using namespace llvm;
58 // General options for llc. Other pass-specific options are specified
59 // within the corresponding llc passes, and target-specific options
60 // and back-end code generation options are specified with the target machine.
62 static cl::opt<std::string>
63 InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
65 static cl::opt<std::string>
66 InputLanguage("x", cl::desc("Input language ('ir' or 'mir')"));
68 static cl::opt<std::string>
69 OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
71 static cl::opt<std::string>
72 SplitDwarfOutputFile("split-dwarf-output",
73 cl::desc(".dwo output filename"),
74 cl::value_desc("filename"));
76 static cl::opt<unsigned>
77 TimeCompilations("time-compilations", cl::Hidden, cl::init(1u),
78 cl::value_desc("N"),
79 cl::desc("Repeat compilation N times for timing"));
81 static cl::opt<bool>
82 NoIntegratedAssembler("no-integrated-as", cl::Hidden,
83 cl::desc("Disable integrated assembler"));
85 static cl::opt<bool>
86 PreserveComments("preserve-as-comments", cl::Hidden,
87 cl::desc("Preserve Comments in outputted assembly"),
88 cl::init(true));
90 // Determine optimization level.
91 static cl::opt<char>
92 OptLevel("O",
93 cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
94 "(default = '-O2')"),
95 cl::Prefix,
96 cl::ZeroOrMore,
97 cl::init(' '));
99 static cl::opt<std::string>
100 TargetTriple("mtriple", cl::desc("Override target triple for module"));
102 static cl::opt<std::string> SplitDwarfFile(
103 "split-dwarf-file",
104 cl::desc(
105 "Specify the name of the .dwo file to encode in the DWARF output"));
107 static cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
108 cl::desc("Do not verify input module"));
110 static cl::opt<bool> DisableSimplifyLibCalls("disable-simplify-libcalls",
111 cl::desc("Disable simplify-libcalls"));
113 static cl::opt<bool> ShowMCEncoding("show-mc-encoding", cl::Hidden,
114 cl::desc("Show encoding in .s output"));
116 static cl::opt<bool> EnableDwarfDirectory(
117 "enable-dwarf-directory", cl::Hidden,
118 cl::desc("Use .file directives with an explicit directory."));
120 static cl::opt<bool> AsmVerbose("asm-verbose",
121 cl::desc("Add comments to directives."),
122 cl::init(true));
124 static cl::opt<bool>
125 CompileTwice("compile-twice", cl::Hidden,
126 cl::desc("Run everything twice, re-using the same pass "
127 "manager and verify the result is the same."),
128 cl::init(false));
130 static cl::opt<bool> DiscardValueNames(
131 "discard-value-names",
132 cl::desc("Discard names from Value (other than GlobalValue)."),
133 cl::init(false), cl::Hidden);
135 static cl::list<std::string> IncludeDirs("I", cl::desc("include search path"));
137 static cl::opt<bool> RemarksWithHotness(
138 "pass-remarks-with-hotness",
139 cl::desc("With PGO, include profile count in optimization remarks"),
140 cl::Hidden);
142 static cl::opt<unsigned>
143 RemarksHotnessThreshold("pass-remarks-hotness-threshold",
144 cl::desc("Minimum profile count required for "
145 "an optimization remark to be output"),
146 cl::Hidden);
148 static cl::opt<std::string>
149 RemarksFilename("pass-remarks-output",
150 cl::desc("Output filename for pass remarks"),
151 cl::value_desc("filename"));
153 static cl::opt<std::string>
154 RemarksPasses("pass-remarks-filter",
155 cl::desc("Only record optimization remarks from passes whose "
156 "names match the given regular expression"),
157 cl::value_desc("regex"));
159 static cl::opt<std::string> RemarksFormat(
160 "pass-remarks-format",
161 cl::desc("The format used for serializing remarks (default: YAML)"),
162 cl::value_desc("format"), cl::init("yaml"));
164 namespace {
165 static ManagedStatic<std::vector<std::string>> RunPassNames;
167 struct RunPassOption {
168 void operator=(const std::string &Val) const {
169 if (Val.empty())
170 return;
171 SmallVector<StringRef, 8> PassNames;
172 StringRef(Val).split(PassNames, ',', -1, false);
173 for (auto PassName : PassNames)
174 RunPassNames->push_back(PassName);
179 static RunPassOption RunPassOpt;
181 static cl::opt<RunPassOption, true, cl::parser<std::string>> RunPass(
182 "run-pass",
183 cl::desc("Run compiler only for specified passes (comma separated list)"),
184 cl::value_desc("pass-name"), cl::ZeroOrMore, cl::location(RunPassOpt));
186 static int compileModule(char **, LLVMContext &);
188 static std::unique_ptr<ToolOutputFile> GetOutputStream(const char *TargetName,
189 Triple::OSType OS,
190 const char *ProgName) {
191 // If we don't yet have an output filename, make one.
192 if (OutputFilename.empty()) {
193 if (InputFilename == "-")
194 OutputFilename = "-";
195 else {
196 // If InputFilename ends in .bc or .ll, remove it.
197 StringRef IFN = InputFilename;
198 if (IFN.endswith(".bc") || IFN.endswith(".ll"))
199 OutputFilename = IFN.drop_back(3);
200 else if (IFN.endswith(".mir"))
201 OutputFilename = IFN.drop_back(4);
202 else
203 OutputFilename = IFN;
205 switch (FileType) {
206 case CGFT_AssemblyFile:
207 if (TargetName[0] == 'c') {
208 if (TargetName[1] == 0)
209 OutputFilename += ".cbe.c";
210 else if (TargetName[1] == 'p' && TargetName[2] == 'p')
211 OutputFilename += ".cpp";
212 else
213 OutputFilename += ".s";
214 } else
215 OutputFilename += ".s";
216 break;
217 case CGFT_ObjectFile:
218 if (OS == Triple::Win32)
219 OutputFilename += ".obj";
220 else
221 OutputFilename += ".o";
222 break;
223 case CGFT_Null:
224 OutputFilename += ".null";
225 break;
230 // Decide if we need "binary" output.
231 bool Binary = false;
232 switch (FileType) {
233 case CGFT_AssemblyFile:
234 break;
235 case CGFT_ObjectFile:
236 case CGFT_Null:
237 Binary = true;
238 break;
241 // Open the file.
242 std::error_code EC;
243 sys::fs::OpenFlags OpenFlags = sys::fs::OF_None;
244 if (!Binary)
245 OpenFlags |= sys::fs::OF_Text;
246 auto FDOut = std::make_unique<ToolOutputFile>(OutputFilename, EC, OpenFlags);
247 if (EC) {
248 WithColor::error() << EC.message() << '\n';
249 return nullptr;
252 return FDOut;
255 struct LLCDiagnosticHandler : public DiagnosticHandler {
256 bool *HasError;
257 LLCDiagnosticHandler(bool *HasErrorPtr) : HasError(HasErrorPtr) {}
258 bool handleDiagnostics(const DiagnosticInfo &DI) override {
259 if (DI.getSeverity() == DS_Error)
260 *HasError = true;
262 if (auto *Remark = dyn_cast<DiagnosticInfoOptimizationBase>(&DI))
263 if (!Remark->isEnabled())
264 return true;
266 DiagnosticPrinterRawOStream DP(errs());
267 errs() << LLVMContext::getDiagnosticMessagePrefix(DI.getSeverity()) << ": ";
268 DI.print(DP);
269 errs() << "\n";
270 return true;
274 static void InlineAsmDiagHandler(const SMDiagnostic &SMD, void *Context,
275 unsigned LocCookie) {
276 bool *HasError = static_cast<bool *>(Context);
277 if (SMD.getKind() == SourceMgr::DK_Error)
278 *HasError = true;
280 SMD.print(nullptr, errs());
282 // For testing purposes, we print the LocCookie here.
283 if (LocCookie)
284 WithColor::note() << "!srcloc = " << LocCookie << "\n";
287 // main - Entry point for the llc compiler.
289 int main(int argc, char **argv) {
290 InitLLVM X(argc, argv);
292 // Enable debug stream buffering.
293 EnableDebugBuffering = true;
295 LLVMContext Context;
297 // Initialize targets first, so that --version shows registered targets.
298 InitializeAllTargets();
299 InitializeAllTargetMCs();
300 InitializeAllAsmPrinters();
301 InitializeAllAsmParsers();
303 // Initialize codegen and IR passes used by llc so that the -print-after,
304 // -print-before, and -stop-after options work.
305 PassRegistry *Registry = PassRegistry::getPassRegistry();
306 initializeCore(*Registry);
307 initializeCodeGen(*Registry);
308 initializeLoopStrengthReducePass(*Registry);
309 initializeLowerIntrinsicsPass(*Registry);
310 initializeEntryExitInstrumenterPass(*Registry);
311 initializePostInlineEntryExitInstrumenterPass(*Registry);
312 initializeUnreachableBlockElimLegacyPassPass(*Registry);
313 initializeConstantHoistingLegacyPassPass(*Registry);
314 initializeScalarOpts(*Registry);
315 initializeVectorization(*Registry);
316 initializeScalarizeMaskedMemIntrinPass(*Registry);
317 initializeExpandReductionsPass(*Registry);
318 initializeHardwareLoopsPass(*Registry);
320 // Initialize debugging passes.
321 initializeScavengerTestPass(*Registry);
323 // Register the target printer for --version.
324 cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
326 cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
328 Context.setDiscardValueNames(DiscardValueNames);
330 // Set a diagnostic handler that doesn't exit on the first error
331 bool HasError = false;
332 Context.setDiagnosticHandler(
333 std::make_unique<LLCDiagnosticHandler>(&HasError));
334 Context.setInlineAsmDiagnosticHandler(InlineAsmDiagHandler, &HasError);
336 Expected<std::unique_ptr<ToolOutputFile>> RemarksFileOrErr =
337 setupOptimizationRemarks(Context, RemarksFilename, RemarksPasses,
338 RemarksFormat, RemarksWithHotness,
339 RemarksHotnessThreshold);
340 if (Error E = RemarksFileOrErr.takeError()) {
341 WithColor::error(errs(), argv[0]) << toString(std::move(E)) << '\n';
342 return 1;
344 std::unique_ptr<ToolOutputFile> RemarksFile = std::move(*RemarksFileOrErr);
346 if (InputLanguage != "" && InputLanguage != "ir" &&
347 InputLanguage != "mir") {
348 WithColor::error(errs(), argv[0])
349 << "input language must be '', 'IR' or 'MIR'\n";
350 return 1;
353 // Compile the module TimeCompilations times to give better compile time
354 // metrics.
355 for (unsigned I = TimeCompilations; I; --I)
356 if (int RetVal = compileModule(argv, Context))
357 return RetVal;
359 if (RemarksFile)
360 RemarksFile->keep();
361 return 0;
364 static bool addPass(PassManagerBase &PM, const char *argv0,
365 StringRef PassName, TargetPassConfig &TPC) {
366 if (PassName == "none")
367 return false;
369 const PassRegistry *PR = PassRegistry::getPassRegistry();
370 const PassInfo *PI = PR->getPassInfo(PassName);
371 if (!PI) {
372 WithColor::error(errs(), argv0)
373 << "run-pass " << PassName << " is not registered.\n";
374 return true;
377 Pass *P;
378 if (PI->getNormalCtor())
379 P = PI->getNormalCtor()();
380 else {
381 WithColor::error(errs(), argv0)
382 << "cannot create pass: " << PI->getPassName() << "\n";
383 return true;
385 std::string Banner = std::string("After ") + std::string(P->getPassName());
386 PM.add(P);
387 TPC.printAndVerify(Banner);
389 return false;
392 static int compileModule(char **argv, LLVMContext &Context) {
393 // Load the module to be compiled...
394 SMDiagnostic Err;
395 std::unique_ptr<Module> M;
396 std::unique_ptr<MIRParser> MIR;
397 Triple TheTriple;
398 std::string CPUStr = getCPUStr(), FeaturesStr = getFeaturesStr();
400 // Set attributes on functions as loaded from MIR from command line arguments.
401 auto setMIRFunctionAttributes = [&CPUStr, &FeaturesStr](Function &F) {
402 setFunctionAttributes(CPUStr, FeaturesStr, F);
405 bool SkipModule = MCPU == "help" ||
406 (!MAttrs.empty() && MAttrs.front() == "help");
408 // If user just wants to list available options, skip module loading
409 if (!SkipModule) {
410 if (InputLanguage == "mir" ||
411 (InputLanguage == "" && StringRef(InputFilename).endswith(".mir"))) {
412 MIR = createMIRParserFromFile(InputFilename, Err, Context,
413 setMIRFunctionAttributes);
414 if (MIR)
415 M = MIR->parseIRModule();
416 } else
417 M = parseIRFile(InputFilename, Err, Context, false);
418 if (!M) {
419 Err.print(argv[0], WithColor::error(errs(), argv[0]));
420 return 1;
423 // If we are supposed to override the target triple, do so now.
424 if (!TargetTriple.empty())
425 M->setTargetTriple(Triple::normalize(TargetTriple));
426 TheTriple = Triple(M->getTargetTriple());
427 } else {
428 TheTriple = Triple(Triple::normalize(TargetTriple));
431 if (TheTriple.getTriple().empty())
432 TheTriple.setTriple(sys::getDefaultTargetTriple());
434 // Get the target specific parser.
435 std::string Error;
436 const Target *TheTarget = TargetRegistry::lookupTarget(MArch, TheTriple,
437 Error);
438 if (!TheTarget) {
439 WithColor::error(errs(), argv[0]) << Error;
440 return 1;
443 CodeGenOpt::Level OLvl = CodeGenOpt::Default;
444 switch (OptLevel) {
445 default:
446 WithColor::error(errs(), argv[0]) << "invalid optimization level.\n";
447 return 1;
448 case ' ': break;
449 case '0': OLvl = CodeGenOpt::None; break;
450 case '1': OLvl = CodeGenOpt::Less; break;
451 case '2': OLvl = CodeGenOpt::Default; break;
452 case '3': OLvl = CodeGenOpt::Aggressive; break;
455 TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
456 Options.DisableIntegratedAS = NoIntegratedAssembler;
457 Options.MCOptions.ShowMCEncoding = ShowMCEncoding;
458 Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
459 Options.MCOptions.AsmVerbose = AsmVerbose;
460 Options.MCOptions.PreserveAsmComments = PreserveComments;
461 Options.MCOptions.IASSearchPaths = IncludeDirs;
462 Options.MCOptions.SplitDwarfFile = SplitDwarfFile;
464 // On AIX, setting the relocation model to anything other than PIC is considered
465 // a user error.
466 Optional<Reloc::Model> RM = getRelocModel();
467 if (TheTriple.isOSAIX() && RM.hasValue() && *RM != Reloc::PIC_) {
468 WithColor::error(errs(), argv[0])
469 << "invalid relocation model, AIX only supports PIC.\n";
470 return 1;
473 std::unique_ptr<TargetMachine> Target(TheTarget->createTargetMachine(
474 TheTriple.getTriple(), CPUStr, FeaturesStr, Options, RM,
475 getCodeModel(), OLvl));
477 assert(Target && "Could not allocate target machine!");
479 // If we don't have a module then just exit now. We do this down
480 // here since the CPU/Feature help is underneath the target machine
481 // creation.
482 if (SkipModule)
483 return 0;
485 assert(M && "Should have exited if we didn't have a module!");
486 if (FloatABIForCalls != FloatABI::Default)
487 Options.FloatABIType = FloatABIForCalls;
489 // Figure out where we are going to send the output.
490 std::unique_ptr<ToolOutputFile> Out =
491 GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]);
492 if (!Out) return 1;
494 std::unique_ptr<ToolOutputFile> DwoOut;
495 if (!SplitDwarfOutputFile.empty()) {
496 std::error_code EC;
497 DwoOut = std::make_unique<ToolOutputFile>(SplitDwarfOutputFile, EC,
498 sys::fs::OF_None);
499 if (EC) {
500 WithColor::error(errs(), argv[0]) << EC.message() << '\n';
501 return 1;
505 // Build up all of the passes that we want to do to the module.
506 legacy::PassManager PM;
508 // Add an appropriate TargetLibraryInfo pass for the module's triple.
509 TargetLibraryInfoImpl TLII(Triple(M->getTargetTriple()));
511 // The -disable-simplify-libcalls flag actually disables all builtin optzns.
512 if (DisableSimplifyLibCalls)
513 TLII.disableAllFunctions();
514 PM.add(new TargetLibraryInfoWrapperPass(TLII));
516 // Add the target data from the target machine, if it exists, or the module.
517 M->setDataLayout(Target->createDataLayout());
519 // This needs to be done after setting datalayout since it calls verifier
520 // to check debug info whereas verifier relies on correct datalayout.
521 UpgradeDebugInfo(*M);
523 // Verify module immediately to catch problems before doInitialization() is
524 // called on any passes.
525 if (!NoVerify && verifyModule(*M, &errs())) {
526 std::string Prefix =
527 (Twine(argv[0]) + Twine(": ") + Twine(InputFilename)).str();
528 WithColor::error(errs(), Prefix) << "input module is broken!\n";
529 return 1;
532 // Override function attributes based on CPUStr, FeaturesStr, and command line
533 // flags.
534 setFunctionAttributes(CPUStr, FeaturesStr, *M);
536 if (RelaxAll.getNumOccurrences() > 0 &&
537 FileType != CGFT_ObjectFile)
538 WithColor::warning(errs(), argv[0])
539 << ": warning: ignoring -mc-relax-all because filetype != obj";
542 raw_pwrite_stream *OS = &Out->os();
544 // Manually do the buffering rather than using buffer_ostream,
545 // so we can memcmp the contents in CompileTwice mode
546 SmallVector<char, 0> Buffer;
547 std::unique_ptr<raw_svector_ostream> BOS;
548 if ((FileType != CGFT_AssemblyFile &&
549 !Out->os().supportsSeeking()) ||
550 CompileTwice) {
551 BOS = std::make_unique<raw_svector_ostream>(Buffer);
552 OS = BOS.get();
555 const char *argv0 = argv[0];
556 LLVMTargetMachine &LLVMTM = static_cast<LLVMTargetMachine &>(*Target);
557 MachineModuleInfoWrapperPass *MMIWP =
558 new MachineModuleInfoWrapperPass(&LLVMTM);
560 // Construct a custom pass pipeline that starts after instruction
561 // selection.
562 if (!RunPassNames->empty()) {
563 if (!MIR) {
564 WithColor::warning(errs(), argv[0])
565 << "run-pass is for .mir file only.\n";
566 return 1;
568 TargetPassConfig &TPC = *LLVMTM.createPassConfig(PM);
569 if (TPC.hasLimitedCodeGenPipeline()) {
570 WithColor::warning(errs(), argv[0])
571 << "run-pass cannot be used with "
572 << TPC.getLimitedCodeGenPipelineReason(" and ") << ".\n";
573 return 1;
576 TPC.setDisableVerify(NoVerify);
577 PM.add(&TPC);
578 PM.add(MMIWP);
579 TPC.printAndVerify("");
580 for (const std::string &RunPassName : *RunPassNames) {
581 if (addPass(PM, argv0, RunPassName, TPC))
582 return 1;
584 TPC.setInitialized();
585 PM.add(createPrintMIRPass(*OS));
586 PM.add(createFreeMachineFunctionPass());
587 } else if (Target->addPassesToEmitFile(PM, *OS,
588 DwoOut ? &DwoOut->os() : nullptr,
589 FileType, NoVerify, MMIWP)) {
590 WithColor::warning(errs(), argv[0])
591 << "target does not support generation of this"
592 << " file type!\n";
593 return 1;
596 if (MIR) {
597 assert(MMIWP && "Forgot to create MMIWP?");
598 if (MIR->parseMachineFunctions(*M, MMIWP->getMMI()))
599 return 1;
602 // Before executing passes, print the final values of the LLVM options.
603 cl::PrintOptionValues();
605 // If requested, run the pass manager over the same module again,
606 // to catch any bugs due to persistent state in the passes. Note that
607 // opt has the same functionality, so it may be worth abstracting this out
608 // in the future.
609 SmallVector<char, 0> CompileTwiceBuffer;
610 if (CompileTwice) {
611 std::unique_ptr<Module> M2(llvm::CloneModule(*M));
612 PM.run(*M2);
613 CompileTwiceBuffer = Buffer;
614 Buffer.clear();
617 PM.run(*M);
619 auto HasError =
620 ((const LLCDiagnosticHandler *)(Context.getDiagHandlerPtr()))->HasError;
621 if (*HasError)
622 return 1;
624 // Compare the two outputs and make sure they're the same
625 if (CompileTwice) {
626 if (Buffer.size() != CompileTwiceBuffer.size() ||
627 (memcmp(Buffer.data(), CompileTwiceBuffer.data(), Buffer.size()) !=
628 0)) {
629 errs()
630 << "Running the pass manager twice changed the output.\n"
631 "Writing the result of the second run to the specified output\n"
632 "To generate the one-run comparison binary, just run without\n"
633 "the compile-twice option\n";
634 Out->os() << Buffer;
635 Out->keep();
636 return 1;
640 if (BOS) {
641 Out->os() << Buffer;
645 // Declare success.
646 Out->keep();
647 if (DwoOut)
648 DwoOut->keep();
650 return 0;