diff options
author | Marc Poulhiès <dkm@kataplop.net> | 2021-11-21 14:15:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-21 14:15:30 +0100 |
commit | 20ebcf7417a6a3001eafdf8745f4e316fb73198d (patch) | |
tree | cc3d066bfe67dc9cf03b4b2183f4c52c1e6bdf93 /lib/compilers/rust.js | |
parent | 3515c569e89a23663784cf0e26d9c4684dc5b9d3 (diff) | |
download | compiler-explorer-20ebcf7417a6a3001eafdf8745f4e316fb73198d.tar.gz compiler-explorer-20ebcf7417a6a3001eafdf8745f4e316fb73198d.zip |
Honour rustc flags when emitting MIR and emit both assembly and MIR in the same execution (#3116)gh-1284
* Honor compiler flags in rustc MIR output view
* Refactor rustc/MIR execution handling
Apply the same receipe as for GNAT and GCC for minimizing the number of
executions for getting extra outputs (here MIR).
After discussions in #3107, the way the output files are created is also
changed to use the syntax `--emit KIND=PATH` (see
https://doc.bccnsoft.com/docs/rust-1.36.0-docs-html/rustc/command-line-arguments.html)
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
* fixup! Refactor rustc/MIR execution handling
Co-authored-by: Nico Lehmann <nico.lehmannm@gmail.com>
Diffstat (limited to 'lib/compilers/rust.js')
-rw-r--r-- | lib/compilers/rust.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/compilers/rust.js b/lib/compilers/rust.js index 3072e8db4..7043b2b00 100644 --- a/lib/compilers/rust.js +++ b/lib/compilers/rust.js @@ -45,10 +45,22 @@ export class RustCompiler extends BaseCompiler { this.linker = this.compilerProps('linker'); } + getRustMirOutputFilename(outputFilename) { + return outputFilename.replace(path.extname(outputFilename), '.mir'); + } + getSharedLibraryPathsAsArguments() { return []; } + optionsForBackend(backendOptions, outputFilename) { + if (backendOptions.produceRustMir && this.compiler.supportsRustMirView) { + const of = this.getRustMirOutputFilename(outputFilename); + return ['--emit', `mir=${of}`]; + } + return []; + } + optionsForFilter(filters, outputFilename, userOptions) { let options = ['-C', 'debuginfo=1', '-o', this.filename(outputFilename)]; |