Mercurial > projects > ldc
comparison gen/linker.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 | f756c47f310a |
children | 461a85f0db31 |
comparison
equal
deleted
inserted
replaced
1169:2bff538fa3b9 | 1170:e40c65bd8c5d |
---|---|
11 #include "module.h" | 11 #include "module.h" |
12 | 12 |
13 #define NO_COUT_LOGGER | 13 #define NO_COUT_LOGGER |
14 #include "gen/logger.h" | 14 #include "gen/logger.h" |
15 #include "gen/cl_options.h" | 15 #include "gen/cl_options.h" |
16 #include "gen/optimizer.h" | |
16 | 17 |
17 ////////////////////////////////////////////////////////////////////////////// | 18 ////////////////////////////////////////////////////////////////////////////// |
18 | 19 |
19 // Is this useful? | 20 // Is this useful? |
20 llvm::cl::opt<bool> quiet("quiet", | 21 llvm::cl::opt<bool> quiet("quiet", |
109 // strip debug info | 110 // strip debug info |
110 if (!global.params.symdebug) | 111 if (!global.params.symdebug) |
111 args.push_back("-strip-debug"); | 112 args.push_back("-strip-debug"); |
112 | 113 |
113 // optimization level | 114 // optimization level |
114 if (!global.params.optimize) | 115 if (!optimize()) |
115 args.push_back("-disable-opt"); | 116 args.push_back("-disable-opt"); |
116 else | 117 else |
117 { | 118 { |
118 const char* s = 0; | 119 const char* s = 0; |
119 switch(global.params.optimizeLevel) | 120 switch(optLevel()) |
120 { | 121 { |
121 case 0: | 122 case 0: |
122 args.push_back("-disable-opt"); | 123 args.push_back("-disable-opt"); |
123 args.push_back("-globaldce"); | 124 args.push_back("-globaldce"); |
124 break; | 125 break; |
136 assert(0); | 137 assert(0); |
137 } | 138 } |
138 } | 139 } |
139 | 140 |
140 // inlining | 141 // inlining |
141 if (!(global.params.useInline || global.params.llvmInline)) | 142 if (!(global.params.useInline || doInline())) |
142 { | 143 { |
143 args.push_back("-disable-inlining"); | 144 args.push_back("-disable-inlining"); |
144 } | 145 } |
145 | 146 |
146 // additional linker switches | 147 // additional linker switches |