Mercurial > projects > ldc
comparison gen/optimizer.cpp @ 1533:d1652c8fb4f6
Get rid of USE_METADATA
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Sat, 11 Jul 2009 14:19:21 +0200 |
parents | c88b16d4a13c |
children | 259b031f3d22 |
comparison
equal
deleted
inserted
replaced
1532:c88b16d4a13c | 1533:d1652c8fb4f6 |
---|---|
51 static cl::opt<bool> | 51 static cl::opt<bool> |
52 disableSimplifyRuntimeCalls("disable-simplify-drtcalls", | 52 disableSimplifyRuntimeCalls("disable-simplify-drtcalls", |
53 cl::desc("Disable simplification of runtime calls in -O<N>"), | 53 cl::desc("Disable simplification of runtime calls in -O<N>"), |
54 cl::ZeroOrMore); | 54 cl::ZeroOrMore); |
55 | 55 |
56 #ifdef USE_METADATA | |
57 static cl::opt<bool> | 56 static cl::opt<bool> |
58 disableGCToStack("disable-gc2stack", | 57 disableGCToStack("disable-gc2stack", |
59 cl::desc("Disable promotion of GC allocations to stack memory in -O<N>"), | 58 cl::desc("Disable promotion of GC allocations to stack memory in -O<N>"), |
60 cl::ZeroOrMore); | 59 cl::ZeroOrMore); |
61 | 60 |
62 // Not recommended; metadata currently triggers an assert in the backend... | 61 // Not recommended; metadata currently triggers an assert in the backend... |
63 static cl::opt<bool> | 62 static cl::opt<bool> |
64 disableStripMetaData("disable-strip-metadata", | 63 disableStripMetaData("disable-strip-metadata", |
65 cl::desc("Disable default metadata stripping (not recommended)"), | 64 cl::desc("Disable default metadata stripping (not recommended)"), |
66 cl::ZeroOrMore); | 65 cl::ZeroOrMore); |
67 #endif | |
68 | 66 |
69 static cl::opt<opts::BoolOrDefaultAdapter, false, opts::FlagParser> | 67 static cl::opt<opts::BoolOrDefaultAdapter, false, opts::FlagParser> |
70 enableInlining("inlining", | 68 enableInlining("inlining", |
71 cl::desc("(*) Enable function inlining in -O<N>"), | 69 cl::desc("(*) Enable function inlining in -O<N>"), |
72 cl::ZeroOrMore); | 70 cl::ZeroOrMore); |
223 // This function runs optimization passes based on command line arguments. | 221 // This function runs optimization passes based on command line arguments. |
224 // Returns true if any optimization passes were invoked. | 222 // Returns true if any optimization passes were invoked. |
225 bool ldc_optimize_module(llvm::Module* m) | 223 bool ldc_optimize_module(llvm::Module* m) |
226 { | 224 { |
227 if (!optimize()) { | 225 if (!optimize()) { |
228 #ifdef USE_METADATA | |
229 if (!disableStripMetaData) { | 226 if (!disableStripMetaData) { |
230 // This one always needs to run if metadata is generated, because | 227 // This one always needs to run if metadata is generated, because |
231 // the code generator will assert if it's not used. | 228 // the code generator will assert if it's not used. |
232 ModulePass* stripMD = createStripMetaData(); | 229 ModulePass* stripMD = createStripMetaData(); |
233 stripMD->runOnModule(*m); | 230 stripMD->runOnModule(*m); |
234 delete stripMD; | 231 delete stripMD; |
235 } | 232 } |
236 #endif | |
237 return false; | 233 return false; |
238 } | 234 } |
239 | 235 |
240 PassManager pm; | 236 PassManager pm; |
241 | 237 |
270 } | 266 } |
271 // insert -O<N> / -enable-inlining if specified at the end, | 267 // insert -O<N> / -enable-inlining if specified at the end, |
272 if (optimize) | 268 if (optimize) |
273 addPassesForOptLevel(pm); | 269 addPassesForOptLevel(pm); |
274 | 270 |
275 #ifdef USE_METADATA | |
276 if (!disableStripMetaData) { | 271 if (!disableStripMetaData) { |
277 // This one is purposely not disabled by disableLangSpecificPasses | 272 // This one is purposely not disabled by disableLangSpecificPasses |
278 // because the code generator will assert if it's not used. | 273 // because the code generator will assert if it's not used. |
279 addPass(pm, createStripMetaData()); | 274 addPass(pm, createStripMetaData()); |
280 } | 275 } |
281 #endif | |
282 | 276 |
283 pm.run(*m); | 277 pm.run(*m); |
284 return true; | 278 return true; |
285 } | 279 } |