#include "llvm/Support/CommandLine.h"
using namespace llvm;
-static cl::opt<bool> PrintLSR("print-lsr-output");
+static cl::opt<bool> PrintLSR("print-lsr-output", cl::Hidden,
+ cl::desc("Print LLVM IR produced by the loop-reduce pass"));
+static cl::opt<bool> PrintISelInput("print-isel-input", cl::Hidden,
+ cl::desc("Print LLVM IR input to isel pass"));
FileModel::Model
LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
// FIXME: Implement efficient support for garbage collection intrinsics.
PM.add(createLowerGCPass());
-
- // FIXME: Implement the invoke/unwind instructions!
+
if (!ExceptionHandling)
PM.add(createLowerInvokePass(getTargetLowering()));
-
+
// Make sure that no unreachable blocks are instruction selected.
PM.add(createUnreachableBlockEliminationPass());
+ if (!Fast)
+ PM.add(createCodeGenPreparePass(getTargetLowering()));
+
+ if (PrintISelInput)
+ PM.add(new PrintFunctionPass("\n\n*** Final LLVM Code input to ISel *** \n",
+ &cerr));
+
// Ask the target for an isel.
if (addInstSelector(PM, Fast))
return FileModel::Error;
// Branch folding must be run after regalloc and prolog/epilog insertion.
if (!Fast)
- PM.add(createBranchFoldingPass());
+ PM.add(createBranchFoldingPass(getEnableTailMergeDefault()));
// Fold redundant debug labels.
PM.add(createDebugLabelFoldingPass());
// Standard LLVM-Level Passes.
// Run loop strength reduction before anything else.
- if (!Fast) PM.add(createLoopStrengthReducePass(getTargetLowering()));
+ if (!Fast) {
+ PM.add(createLoopStrengthReducePass(getTargetLowering()));
+ if (PrintLSR)
+ PM.add(new PrintFunctionPass("\n\n*** Code after LSR *** \n", &cerr));
+ }
// FIXME: Implement efficient support for garbage collection intrinsics.
PM.add(createLowerGCPass());
// Make sure that no unreachable blocks are instruction selected.
PM.add(createUnreachableBlockEliminationPass());
+ if (!Fast)
+ PM.add(createCodeGenPreparePass(getTargetLowering()));
+
+ if (PrintISelInput)
+ PM.add(new PrintFunctionPass("\n\n*** Final LLVM Code input to ISel *** \n",
+ &cerr));
+
// Ask the target for an isel.
if (addInstSelector(PM, Fast))
return true;
// Branch folding must be run after regalloc and prolog/epilog insertion.
if (!Fast)
- PM.add(createBranchFoldingPass());
+ PM.add(createBranchFoldingPass(getEnableTailMergeDefault()));
if (addPreEmitPass(PM, Fast) && PrintMachineCode)
PM.add(createMachineFunctionPrinterPass(cerr));