diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2019-03-12 12:24:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-12 12:24:03 -0700 |
| commit | 3cfccfd4991df01deaf132f11b4eaa6848a32c4e (patch) | |
| tree | f94567d7e6f7601c67b7c201add21fc644ba18fd /docs | |
| parent | 9722990745f4e91ab1bf9fb682c72e173cd123b4 (diff) | |
Add options to control optimization and debug information (#897)
The short version for command-line users is:
* Use `-g` to get debug info in the output, where supported
* Use `-O0` to disable optimizations, in case that improves debugability
* Use `-O2` for optimized/release builds where you can spend the extra compile time
The command-line options are matched with new API functions `spSetDebugInfoLevel()` and `spSetOptimizationLevel()` that set the equivalent information.
Right now these settings only affect how we invoke fxc and dxc. In the longer run I expect we will want to use them to control other things:
* Once we are emitting our own SPIR-V, the `-g` option should control what source-level name information we include in it.
* Whether or not `-g` is used could be used to decide whether we preserve the "name hints" in the IR, which in turn decide whether we output GLSL/HLSL source that uses names based on the original program.
* We will eventually need/want to include some amount of optimization passes on the Slang IR, and the `-O` options should control which of those passes are enabled on a particular invocation.
In this change I decided to expose the options at the level of the entire compile request for API users, and to store the actual information on the Linkage. We might want to revisit this decision and instead allow for the level of optimization to be chosen per-target as part of back-end state. Similarly, we might want to have more fine-grained control over the level of debug output per-target (although we'd still need a front-end setting to determine what debug info is generated into the Slang IR).
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/command-line-slangc.md | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/command-line-slangc.md b/docs/command-line-slangc.md index 5e706f695..65ac7411b 100644 --- a/docs/command-line-slangc.md +++ b/docs/command-line-slangc.md @@ -135,6 +135,14 @@ For completeness, here are the options that `slangc` currently accepts: * `-verbose-paths`: When displaying diagnostic output aim to display more detailed path information. In practice this is typically the complete 'canonical' path to the source file used. +* `-g`: Include debug information in the generated code, where possible. Currently only supported for DXBC and DXIL output (not SPIR-V). + +* `-O`: Control optimization levels. This currently only affects DXBC and DXIL generation. + * `-O0`: Disable all optimizations + * `-O1`, `-O`: Enable a default level of optimization. This is the default if no `-O` options are used. + * `-O2`: Enable aggressive optimizations for speed. + * `-O3`: Enable further optimizations, which might have a significant impact on compile time, or involve unwanted tradeoffs in terms of code size. + * `--`: Stop parsing options, and treat the rest of the command line as input paths ### Specifying where dlls/shared libraries are loaded from |
