FIXME(eddyb) `structopt` would come a long way to making this nicer.
(args: &[String])
| 269 | |
| 270 | // FIXME(eddyb) `structopt` would come a long way to making this nicer. |
| 271 | pub fn parse(args: &[String]) -> Result<Self, rustc_session::getopts::Fail> { |
| 272 | use rustc_session::getopts; |
| 273 | |
| 274 | // FIXME(eddyb) figure out what casing ("Foo bar" vs "foo bar") to use |
| 275 | // for the descriptions, `rustc` seems a bit inconsistent itself on this. |
| 276 | |
| 277 | let mut opts = getopts::Options::new(); |
| 278 | opts.optflag("h", "help", "Display this message"); |
| 279 | opts.optopt( |
| 280 | "", |
| 281 | "module-output", |
| 282 | "single output or multiple output", |
| 283 | "[single|multiple]", |
| 284 | ); |
| 285 | opts.optflag("", "disassemble", "print module to stderr"); |
| 286 | opts.optopt("", "disassemble-fn", "print function to stderr", "NAME"); |
| 287 | opts.optopt( |
| 288 | "", |
| 289 | "disassemble-entry", |
| 290 | "print entry point to stderr", |
| 291 | "NAME", |
| 292 | ); |
| 293 | opts.optflag("", "disassemble-globals", "print globals to stderr"); |
| 294 | |
| 295 | opts.optopt("", "spirv-metadata", "how much metadata to include", ""); |
| 296 | |
| 297 | // FIXME(eddyb) clean up this `no-` "negation prefix" situation. |
| 298 | opts.optflag( |
| 299 | "", |
| 300 | "no-spirv-val", |
| 301 | "disables running spirv-val on the final output", |
| 302 | ); |
| 303 | |
| 304 | opts.optflag("", "relax-struct-store", "Allow store from one struct type to a different type with compatible layout and members."); |
| 305 | opts.optflag("", "relax-logical-pointer", "Allow allocating an object of a pointer type and returning a pointer value from a function in logical addressing mode"); |
| 306 | opts.optflag("", "relax-block-layout", "Enable VK_KHR_relaxed_block_layout when checking standard uniform, storage buffer, and push constant layouts. This is the default when targeting Vulkan 1.1 or later."); |
| 307 | opts.optflag("", "uniform-buffer-standard-layout", "Enable VK_KHR_uniform_buffer_standard_layout when checking standard uniform buffer layouts."); |
| 308 | opts.optflag("", "scalar-block-layout", "Enable VK_EXT_scalar_block_layout when checking standard uniform, storage buffer, and push constant layouts. Scalar layout rules are more permissive than relaxed block layout so in effect this will override the --relax-block-layout option."); |
| 309 | opts.optflag("", "skip-block-layout", "Skip checking standard uniform/storage buffer layout. Overrides any --relax-block-layout or --scalar-block-layout option."); |
| 310 | |
| 311 | // FIXME(eddyb) clean up this `no-` "negation prefix" situation. |
| 312 | opts.optflag( |
| 313 | "", |
| 314 | "no-spirv-opt", |
| 315 | "disables running spirv-opt on the final output", |
| 316 | ); |
| 317 | |
| 318 | opts.optflag( |
| 319 | "", |
| 320 | "preserve-bindings", |
| 321 | "Preserve unused descriptor bindings. Useful for reflection.", |
| 322 | ); |
| 323 | |
| 324 | // Linker options. |
| 325 | // FIXME(eddyb) should these be handled as `-C linker-args="..."` instead? |
| 326 | { |
| 327 | // FIXME(eddyb) clean up this `no-` "negation prefix" situation. |
| 328 | opts.optflag("", "no-dce", "disables running dead code elimination"); |