comparison gen/cl_options.cpp @ 1170:e40c65bd8c5d

Allow specific optimization passes to be requested from the command line. Now you can run "`ldc test.d -c -mem2reg -simplifycfg`" if you feel the urge. The -O<N> options are still supported, and are inserted in the passes list in the position where they appear on the command line. (so -simplifycfg -O1 -instcombine does the "right thing") One small change: -inline is renamed to -enable-inlining due to a naming conflict with the option to add the -inline pass. -inline now inserts the inlining pass in the position specified, not in the middle of -O<N>. (ldmd has been updated to translate -inline to -enable-inlining)
author Frits van Bommel <fvbommel wxs.nl>
date Sun, 29 Mar 2009 15:46:55 +0200
parents 7ce8355fbcc6
children 29d3861aa2da
comparison
equal deleted inserted replaced
1169:2bff538fa3b9 1170:e40c65bd8c5d
16 16
17 cl::list<std::string> runargs("run", 17 cl::list<std::string> runargs("run",
18 cl::desc("program args..."), 18 cl::desc("program args..."),
19 cl::Positional, 19 cl::Positional,
20 cl::PositionalEatsArgs); 20 cl::PositionalEatsArgs);
21
22
23
24 // TODO: Replace this with a proper PassNameParser-based solution
25 static cl::opt<bool, true> doInline("inline",
26 cl::desc("Do function inlining"),
27 cl::location(global.params.llvmInline),
28 cl::ZeroOrMore,
29 cl::init(false));
30
31 21
32 22
33 static cl::opt<bool, true> useDeprecated("d", 23 static cl::opt<bool, true> useDeprecated("d",
34 cl::desc("Allow deprecated language features"), 24 cl::desc("Allow deprecated language features"),
35 cl::ZeroOrMore, 25 cl::ZeroOrMore,
56 46
57 static cl::opt<bool, true> warnings("w", 47 static cl::opt<bool, true> warnings("w",
58 cl::desc("Enable warnings"), 48 cl::desc("Enable warnings"),
59 cl::ZeroOrMore, 49 cl::ZeroOrMore,
60 cl::location(global.params.warnings)); 50 cl::location(global.params.warnings));
61
62
63 static cl::opt<char, true> optimizeLevel(
64 cl::desc("Setting the optimization level:"),
65 cl::ZeroOrMore,
66 cl::values(
67 clEnumValN(2, "O", "Equivalent to -O2"),
68 clEnumValN(0, "O0", "Trivial optimizations only"),
69 clEnumValN(1, "O1", "Simple optimizations"),
70 clEnumValN(2, "O2", "Good optimizations"),
71 clEnumValN(3, "O3", "Aggressive optimizations"),
72 clEnumValN(4, "O4", "Link-time optimization"), // not implemented?
73 clEnumValN(5, "O5", "Link-time optimization"), // not implemented?
74 clEnumValEnd),
75 cl::location(global.params.optimizeLevel),
76 cl::init(-1));
77 51
78 static cl::opt<char, true> debugInfo( 52 static cl::opt<char, true> debugInfo(
79 cl::desc("Generating debug information:"), 53 cl::desc("Generating debug information:"),
80 cl::ZeroOrMore, 54 cl::ZeroOrMore,
81 cl::values( 55 cl::values(