mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 10:07:32 -06:00
Beware that the way it is working causes several dump files to be empty. The
list of potential files is based on `-fdump-passes` output, but during the
actual compilation, some passes may or may not emit something (eg. a passe may
not be executed at all because it's not applicable). The drop down list will
contain some dump names that will simply display message like:
Pass 'cselim (tree)' was requested
but nothing was dumped. Possible causes are:
- pass is not valid in this (maybe you changed the compiler options);
- pass is valid but did not emit anything (eg. it was not executed).
This is expected and until someone has a better idea, this will be the case :)
fixes: #2868
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
68 lines
3.1 KiB
JavaScript
68 lines
3.1 KiB
JavaScript
// Copyright (c) 2021, Compiler Explorer Authors
|
|
// All rights reserved.
|
|
//
|
|
// Redistribution and use in source and binary forms, with or without
|
|
// modification, are permitted provided that the following conditions are met:
|
|
//
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
// this list of conditions and the following disclaimer.
|
|
// * Redistributions in binary form must reproduce the above copyright
|
|
// notice, this list of conditions and the following disclaimer in the
|
|
// documentation and/or other materials provided with the distribution.
|
|
//
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
import path from 'path';
|
|
|
|
import { RustCompiler } from './rust';
|
|
|
|
export class RustcCgGCCCompiler extends RustCompiler {
|
|
static get key() { return 'rustc-cg-gcc'; }
|
|
|
|
constructor(info, env) {
|
|
super(info, env);
|
|
this.compiler.supportsIrView = false;
|
|
|
|
// Enable GCC dump code,
|
|
this.compiler.supportsGccDump = true;
|
|
|
|
// but do not try to filter out empty dumps:
|
|
// This filtering needs to dump all files but currently libgccjit (used by
|
|
// this rustc backend) and compiler-explorer's use of jails makes this task a bit tricky.
|
|
// The user will be presented more dumps than effectively created.
|
|
// Turning this to 'true' will break the dumps.
|
|
|
|
this.compiler.removeEmptyGccDump = false;
|
|
}
|
|
|
|
getGccDumpOptions(gccDumpOptions, removeEmptyPasses){
|
|
return [ '-C' , 'llvm-args=' + super.getGccDumpOptions(gccDumpOptions, removeEmptyPasses).join(' ')];
|
|
}
|
|
|
|
optionsForFilter(filters, outputFilename, userOptions) {
|
|
// these options are direcly taken from rustc_codegen_gcc doc.
|
|
// See https://github.com/antoyo/rustc_codegen_gcc
|
|
let toolroot = path.resolve(path.dirname(this.compiler.exe), '..');
|
|
|
|
let options = ['-C', 'panic=abort',
|
|
'-Z', 'codegen-backend=librustc_codegen_gcc.so',
|
|
'--sysroot', toolroot + '/sysroot' ];
|
|
|
|
// rust.js makes the asumption that LLVM is used. This may go away when cranelift is available.
|
|
// Until this is the case and the super() class is refactored, simply ditch -Cllvm arg.
|
|
let super_options = super.optionsForFilter(filters, outputFilename, userOptions).filter(arg => !/-Cllvm.*/.test(arg));
|
|
options = options.concat(super_options);
|
|
return options;
|
|
}
|
|
}
|