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 | |
parent | 3515c569e89a23663784cf0e26d9c4684dc5b9d3 (diff) | |
download | compiler-explorer-gh-1284.tar.gz compiler-explorer-gh-1284.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')
-rw-r--r-- | lib/compilers/ada.js | 4 | ||||
-rw-r--r-- | lib/compilers/rust.js | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/compilers/ada.js b/lib/compilers/ada.js index 9a6fea6f8..6a93249de 100644 --- a/lib/compilers/ada.js +++ b/lib/compilers/ada.js @@ -46,9 +46,9 @@ export class AdaCompiler extends BaseCompiler { return path.join(dirPath, 'example.o'); } - optionsForBackend(backendOptions){ + optionsForBackend(backendOptions, outputFilename){ // super is needed as it handles the GCC Dump files. - const opts = super.optionsForBackend (backendOptions); + const opts = super.optionsForBackend (backendOptions, outputFilename); if (backendOptions.produceGnatDebug && this.compiler.supportsGnatDebugView) opts.push('-gnatDGL'); 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)]; |