mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 04:39:46 -06:00
Stuff
This commit is contained in:
+13
-8
@@ -42,7 +42,7 @@ import {
|
||||
LLVMOptPipelineBackendOptions,
|
||||
LLVMOptPipelineOutput,
|
||||
} from '../types/compilation/llvm-opt-pipeline-output.interfaces';
|
||||
import {CompilerInfo, ICompiler} from '../types/compiler.interfaces';
|
||||
import {CompilerInfo, ICompiler, PreliminaryCompilerInfo} from '../types/compiler.interfaces';
|
||||
import {
|
||||
BasicExecutionResult,
|
||||
ExecutableExecutionOptions,
|
||||
@@ -80,6 +80,7 @@ import {PropertyGetter} from './properties.interfaces';
|
||||
import {getToolchainPath} from './toolchain-utils';
|
||||
import {ITool} from './tooling/base-tool.interface';
|
||||
import * as utils from './utils';
|
||||
import {unwrap} from './assert';
|
||||
|
||||
const compilationTimeHistogram = new PromClient.Histogram({
|
||||
name: 'ce_base_compiler_compilation_duration_seconds',
|
||||
@@ -126,9 +127,9 @@ export class BaseCompiler implements ICompiler {
|
||||
labelNames: [],
|
||||
});
|
||||
|
||||
constructor(compilerInfo: CompilerInfo, env: CompilationEnvironment) {
|
||||
constructor(compilerInfo: PreliminaryCompilerInfo, env: CompilationEnvironment) {
|
||||
// Information about our compiler
|
||||
this.compiler = compilerInfo;
|
||||
this.compiler = compilerInfo as CompilerInfo; // we'll populate later
|
||||
this.lang = languages[compilerInfo.lang];
|
||||
if (!this.lang) {
|
||||
throw new Error(`Missing language info for ${compilerInfo.lang}`);
|
||||
@@ -891,7 +892,7 @@ export class BaseCompiler implements ICompiler {
|
||||
}
|
||||
|
||||
if (this.compiler.supportsOptOutput && backendOptions.produceOptInfo) {
|
||||
options = options.concat(this.compiler.optArg);
|
||||
options = options.concat(unwrap(this.compiler.optArg));
|
||||
}
|
||||
|
||||
const libIncludes = this.getIncludeArguments(libraries);
|
||||
@@ -1042,7 +1043,9 @@ export class BaseCompiler implements ICompiler {
|
||||
|
||||
async generateIR(inputFilename: string, options: string[], filters: ParseFiltersAndOutputOptions) {
|
||||
// These options make Clang produce an IR
|
||||
const newOptions = options.filter(option => option !== '-fcolor-diagnostics').concat(this.compiler.irArg);
|
||||
const newOptions = options
|
||||
.filter(option => option !== '-fcolor-diagnostics')
|
||||
.concat(unwrap(this.compiler.irArg));
|
||||
|
||||
const execOptions = this.getDefaultExecOptions();
|
||||
// A higher max output is needed for when the user includes headers
|
||||
@@ -1078,9 +1081,11 @@ export class BaseCompiler implements ICompiler {
|
||||
// These options make Clang produce the pass dumps
|
||||
const newOptions = options
|
||||
.filter(option => option !== '-fcolor-diagnostics')
|
||||
.concat(this.compiler.llvmOptArg)
|
||||
.concat(llvmOptPipelineOptions.fullModule ? this.compiler.llvmOptModuleScopeArg : [])
|
||||
.concat(llvmOptPipelineOptions.noDiscardValueNames ? this.compiler.llvmOptNoDiscardValueNamesArg : [])
|
||||
.concat(unwrap(this.compiler.llvmOptArg))
|
||||
.concat(llvmOptPipelineOptions.fullModule ? unwrap(this.compiler.llvmOptModuleScopeArg) : [])
|
||||
.concat(
|
||||
llvmOptPipelineOptions.noDiscardValueNames ? unwrap(this.compiler.llvmOptNoDiscardValueNamesArg) : [],
|
||||
)
|
||||
.concat(this.compiler.debugPatched ? ['-mllvm', '--debug-to-stdout'] : []);
|
||||
|
||||
const execOptions = this.getDefaultExecOptions();
|
||||
|
||||
@@ -28,6 +28,7 @@ import {CompilerInfo} from '../../types/compiler.interfaces';
|
||||
import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces';
|
||||
|
||||
import {Win32Compiler} from './win32';
|
||||
import {unwrap} from '../assert';
|
||||
|
||||
export class ClangCLCompiler extends Win32Compiler {
|
||||
static override get key() {
|
||||
@@ -47,7 +48,7 @@ export class ClangCLCompiler extends Win32Compiler {
|
||||
// These options make Clang produce an IR
|
||||
const newOptions = options
|
||||
.filter(option => option !== '/FA' && !option.startsWith('/Fa'))
|
||||
.concat(this.compiler.irArg);
|
||||
.concat(unwrap(this.compiler.irArg));
|
||||
|
||||
const execOptions = this.getDefaultExecOptions();
|
||||
// A higher max output is needed for when the user includes headers
|
||||
|
||||
@@ -31,6 +31,7 @@ import {BaseCompiler} from '../base-compiler';
|
||||
import {asSafeVer} from '../utils';
|
||||
|
||||
import {ISPCParser} from './argument-parsers';
|
||||
import {unwrap} from '../assert';
|
||||
|
||||
export class ISPCCompiler extends BaseCompiler {
|
||||
static get key() {
|
||||
@@ -56,7 +57,7 @@ export class ISPCCompiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
override async generateIR(inputFilename: string, options: string[], filters: ParseFiltersAndOutputOptions) {
|
||||
const newOptions = [...options, ...this.compiler.irArg, '-o', this.getIrOutputFilename(inputFilename)];
|
||||
const newOptions = [...options, ...unwrap(this.compiler.irArg), '-o', this.getIrOutputFilename(inputFilename)];
|
||||
return super.generateIR(inputFilename, newOptions, filters);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import _ from 'underscore';
|
||||
import {CompilationResult, ExecutionOptions} from '../../types/compilation/compilation.interfaces';
|
||||
import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces';
|
||||
import {BaseCompiler} from '../base-compiler';
|
||||
import {unwrap} from '../assert';
|
||||
|
||||
export class PonyCompiler extends BaseCompiler {
|
||||
static get key() {
|
||||
@@ -62,7 +63,9 @@ export class PonyCompiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
override async generateIR(inputFilename: string, options: string[], filters: ParseFiltersAndOutputOptions) {
|
||||
const newOptions = _.filter(options, option => !['--pass', 'asm'].includes(option)).concat(this.compiler.irArg);
|
||||
const newOptions = _.filter(options, option => !['--pass', 'asm'].includes(option)).concat(
|
||||
unwrap(this.compiler.irArg),
|
||||
);
|
||||
|
||||
const execOptions = this.getDefaultExecOptions();
|
||||
// A higher max output is needed for when the user includes headers
|
||||
|
||||
@@ -33,6 +33,7 @@ import {BaseCompiler} from '../base-compiler';
|
||||
import {logger} from '../logger';
|
||||
import {SPIRVAsmParser} from '../parsers/asm-parser-spirv';
|
||||
import * as utils from '../utils';
|
||||
import {unwrap} from '../assert';
|
||||
|
||||
export class SPIRVCompiler extends BaseCompiler {
|
||||
protected translatorPath: string;
|
||||
@@ -72,7 +73,7 @@ export class SPIRVCompiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
if (this.compiler.supportsOptOutput && backendOptions.produceOptInfo) {
|
||||
options = options.concat(this.compiler.optArg);
|
||||
options = options.concat(unwrap(this.compiler.optArg));
|
||||
}
|
||||
|
||||
const libIncludes = this.getIncludeArguments(libraries);
|
||||
|
||||
@@ -35,6 +35,7 @@ import {MapFileReaderVS} from '../mapfiles/map-file-vs';
|
||||
import {AsmParser} from '../parsers/asm-parser';
|
||||
import {PELabelReconstructor} from '../pe32-support';
|
||||
import * as utils from '../utils';
|
||||
import {unwrap} from '../assert';
|
||||
|
||||
export class Win32Compiler extends BaseCompiler {
|
||||
static get key() {
|
||||
@@ -106,7 +107,7 @@ export class Win32Compiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
if (this.compiler.supportsOptOutput && backendOptions.produceOptInfo) {
|
||||
options = options.concat(this.compiler.optArg);
|
||||
options = options.concat(unwrap(this.compiler.optArg));
|
||||
}
|
||||
|
||||
const libIncludes = this.getIncludeArguments(libraries);
|
||||
|
||||
@@ -37,7 +37,7 @@ import {CompilerInfo, ICompiler, PreliminaryCompilerInfo} from '../../types/comp
|
||||
import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces';
|
||||
import {BaseCompiler} from '../base-compiler';
|
||||
import {CompilationEnvironment} from '../compilation-env';
|
||||
import {getCompilerTypeByKey} from '../compilers';
|
||||
import {FakeCompiler, getCompilerTypeByKey} from '../compilers';
|
||||
import {logger} from '../logger';
|
||||
import {PropertyGetter} from '../properties.interfaces';
|
||||
import * as utils from '../utils';
|
||||
@@ -190,7 +190,7 @@ export class CompileHandler {
|
||||
const isPrediscovered = !!compiler.version;
|
||||
|
||||
const type = compiler.compilerType || 'default';
|
||||
let compilerClass;
|
||||
let compilerClass: ReturnType<typeof getCompilerTypeByKey>;
|
||||
try {
|
||||
compilerClass = getCompilerTypeByKey(type);
|
||||
} catch (e) {
|
||||
|
||||
@@ -1152,7 +1152,7 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
|
||||
if (filters.libraryCode && !this.compiler.supportsLibraryCodeFilter) {
|
||||
delete filters.libraryCode;
|
||||
}
|
||||
this.compiler.disabledFilters.forEach(filter => {
|
||||
unwrap(this.compiler.disabledFilters).forEach(filter => {
|
||||
if (filters[filter]) {
|
||||
delete filters[filter];
|
||||
}
|
||||
@@ -2556,13 +2556,13 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
|
||||
this.filterLibraryCodeButton.prop('disabled', !this.compiler.supportsLibraryCodeFilter);
|
||||
formatFilterTitle(this.filterLibraryCodeButton, this.filterLibraryCodeTitle);
|
||||
|
||||
this.filterLabelsButton.prop('disabled', this.compiler.disabledFilters.includes('labels'));
|
||||
this.filterLabelsButton.prop('disabled', unwrap(this.compiler.disabledFilters).includes('labels'));
|
||||
formatFilterTitle(this.filterLabelsButton, this.filterLabelsTitle);
|
||||
this.filterDirectivesButton.prop('disabled', this.compiler.disabledFilters.includes('directives'));
|
||||
this.filterDirectivesButton.prop('disabled', unwrap(this.compiler.disabledFilters).includes('directives'));
|
||||
formatFilterTitle(this.filterDirectivesButton, this.filterDirectivesTitle);
|
||||
this.filterCommentsButton.prop('disabled', this.compiler.disabledFilters.includes('commentOnly'));
|
||||
this.filterCommentsButton.prop('disabled', unwrap(this.compiler.disabledFilters).includes('commentOnly'));
|
||||
formatFilterTitle(this.filterCommentsButton, this.filterCommentsTitle);
|
||||
this.filterTrimButton.prop('disabled', this.compiler.disabledFilters.includes('trim'));
|
||||
this.filterTrimButton.prop('disabled', unwrap(this.compiler.disabledFilters).includes('trim'));
|
||||
formatFilterTitle(this.filterTrimButton, this.filterTrimTitle);
|
||||
|
||||
if (this.flagsButton) {
|
||||
|
||||
@@ -106,14 +106,14 @@ export type CompilerInfo = {
|
||||
preamble?: string;
|
||||
};
|
||||
remote: any;
|
||||
disabledFilters: string[];
|
||||
optArg: string;
|
||||
disabledFilters?: string[];
|
||||
optArg?: string;
|
||||
externalparser: any;
|
||||
removeEmptyGccDump: boolean;
|
||||
irArg: string[];
|
||||
llvmOptArg: string[];
|
||||
llvmOptModuleScopeArg: string[];
|
||||
llvmOptNoDiscardValueNamesArg: string[];
|
||||
removeEmptyGccDump?: boolean;
|
||||
irArg?: string[];
|
||||
llvmOptArg?: string[];
|
||||
llvmOptModuleScopeArg?: string[];
|
||||
llvmOptNoDiscardValueNamesArg?: string[];
|
||||
cachedPossibleArguments?: any;
|
||||
nvdisasm?: string;
|
||||
mtime?: any;
|
||||
@@ -122,18 +122,7 @@ export type CompilerInfo = {
|
||||
// Compiler information collected by the compiler-finder
|
||||
export type PreliminaryCompilerInfo = Omit<
|
||||
CompilerInfo,
|
||||
| 'version'
|
||||
| 'fullVersion'
|
||||
| 'remote'
|
||||
| 'baseName'
|
||||
| '$groups'
|
||||
| 'disabledFilters'
|
||||
| 'optArg'
|
||||
| 'removeEmptyGccDump'
|
||||
| 'irArg'
|
||||
| 'llvmOptArg'
|
||||
| 'llvmOptModuleScopeArg'
|
||||
| 'llvmOptNoDiscardValueNamesArg'
|
||||
'version' | 'fullVersion' | 'remote' | 'baseName' | '$groups'
|
||||
> & {version?: string};
|
||||
|
||||
export interface ICompiler {
|
||||
@@ -143,6 +132,6 @@ export interface ICompiler {
|
||||
lang: Language;
|
||||
compile(source, options, backendOptions, filters, bypassCache, tools, executionParameters, libraries, files);
|
||||
cmake(files, key);
|
||||
initialise(mtime: Date, clientOptions, isPrediscovered: boolean);
|
||||
//initialise(mtime: Date, clientOptions, isPrediscovered: boolean);
|
||||
getInfo(): CompilerInfo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user