Mercurial > projects > ldc
comparison gen/optimizer.cpp @ 1558:3adcb70700cb
Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Fri, 31 Jul 2009 11:28:31 +0200 |
parents | 259b031f3d22 |
children | 4551475bc6b6 |
comparison
equal
deleted
inserted
replaced
1557:d11aeae19b95 | 1558:3adcb70700cb |
---|---|
158 if (optimizeLevel >= 2) { | 158 if (optimizeLevel >= 2) { |
159 if (!disableLangSpecificPasses) { | 159 if (!disableLangSpecificPasses) { |
160 if (!disableSimplifyRuntimeCalls) | 160 if (!disableSimplifyRuntimeCalls) |
161 addPass(pm, createSimplifyDRuntimeCalls()); | 161 addPass(pm, createSimplifyDRuntimeCalls()); |
162 | 162 |
163 #if USE_METADATA | |
163 if (!disableGCToStack) | 164 if (!disableGCToStack) |
164 addPass(pm, createGarbageCollect2Stack()); | 165 addPass(pm, createGarbageCollect2Stack()); |
166 #endif // USE_METADATA | |
165 } | 167 } |
166 // Run some clean-up passes | 168 // Run some clean-up passes |
167 addPass(pm, createInstructionCombiningPass()); | 169 addPass(pm, createInstructionCombiningPass()); |
168 addPass(pm, createScalarReplAggregatesPass()); | 170 addPass(pm, createScalarReplAggregatesPass()); |
169 addPass(pm, createCFGSimplificationPass()); | 171 addPass(pm, createCFGSimplificationPass()); |
219 // This function runs optimization passes based on command line arguments. | 221 // This function runs optimization passes based on command line arguments. |
220 // Returns true if any optimization passes were invoked. | 222 // Returns true if any optimization passes were invoked. |
221 bool ldc_optimize_module(llvm::Module* m) | 223 bool ldc_optimize_module(llvm::Module* m) |
222 { | 224 { |
223 if (!optimize()) { | 225 if (!optimize()) { |
226 #if USE_METADATA | |
224 if (!disableStripMetaData) { | 227 if (!disableStripMetaData) { |
225 // This one always needs to run if metadata is generated, because | 228 // This one always needs to run if metadata is generated, because |
226 // the code generator will assert if it's not used. | 229 // the code generator will assert if it's not used. |
227 ModulePass* stripMD = createStripMetaData(); | 230 ModulePass* stripMD = createStripMetaData(); |
228 stripMD->runOnModule(*m); | 231 stripMD->runOnModule(*m); |
229 delete stripMD; | 232 delete stripMD; |
230 } | 233 } |
234 #endif | |
231 return false; | 235 return false; |
232 } | 236 } |
233 | 237 |
234 PassManager pm; | 238 PassManager pm; |
235 | 239 |
264 } | 268 } |
265 // insert -O<N> / -enable-inlining if specified at the end, | 269 // insert -O<N> / -enable-inlining if specified at the end, |
266 if (optimize) | 270 if (optimize) |
267 addPassesForOptLevel(pm); | 271 addPassesForOptLevel(pm); |
268 | 272 |
273 #if USE_METADATA | |
269 if (!disableStripMetaData) { | 274 if (!disableStripMetaData) { |
270 // This one is purposely not disabled by disableLangSpecificPasses | 275 // This one is purposely not disabled by disableLangSpecificPasses |
271 // because the code generator will assert if it's not used. | 276 // because the code generator will assert if it's not used. |
272 addPass(pm, createStripMetaData()); | 277 addPass(pm, createStripMetaData()); |
273 } | 278 } |
279 #endif // USE_METADATA | |
274 | 280 |
275 pm.run(*m); | 281 pm.run(*m); |
276 return true; | 282 return true; |
277 } | 283 } |