aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJ. Ryan Stinnett <jryans@gmail.com>2023-12-03 16:33:42 +0000
committerGitHub <noreply@github.com>2023-12-03 11:33:42 -0500
commitc3e1b04c310729d713a8fa7d4a40c1bcd752b384 (patch)
tree4b408daefe05fb52e03d1417e4e82a6be585693c /lib
parentc02f94233ed46c42600bec411262cba15c8e5b6f (diff)
downloadcompiler-explorer-gh-9794.tar.gz
compiler-explorer-gh-9794.zip
Rename opt pipeline without LLVM prefix (#5828)gh-9794
This prepares for future work that will reuse the opt pipeline view outside of the LLVM ecosystem by renaming related components to remove the LLVM prefix. The pass dumper keep its LLVM prefix, as it is assumed this part is likely to be customised for each compiler ecosystem. The historical component name has been preserved in the component list as an alias to keep old links working.
Diffstat (limited to 'lib')
-rw-r--r--lib/base-compiler.ts60
-rw-r--r--lib/compilers/argument-parsers.ts24
-rw-r--r--lib/compilers/hlsl.ts6
-rw-r--r--lib/compilers/llc.ts8
-rw-r--r--lib/compilers/opt.ts8
-rw-r--r--lib/compilers/rust.ts8
-rw-r--r--lib/compilers/snowball.ts2
-rw-r--r--lib/compilers/swift.ts8
-rw-r--r--lib/demangler/llvm.ts6
-rw-r--r--lib/parsers/llvm-pass-dump-parser.ts24
10 files changed, 77 insertions, 77 deletions
diff --git a/lib/base-compiler.ts b/lib/base-compiler.ts
index 9e3b9b27d..6a2ccf985 100644
--- a/lib/base-compiler.ts
+++ b/lib/base-compiler.ts
@@ -44,9 +44,9 @@ import {
bypassExecutionCache,
} from '../types/compilation/compilation.interfaces.js';
import type {
- LLVMOptPipelineBackendOptions,
- LLVMOptPipelineOutput,
-} from '../types/compilation/llvm-opt-pipeline-output.interfaces.js';
+ OptPipelineBackendOptions,
+ OptPipelineOutput,
+} from '../types/compilation/opt-pipeline-output.interfaces.js';
import type {CompilerInfo, ICompiler, PreliminaryCompilerInfo} from '../types/compiler.interfaces.js';
import {
BasicExecutionResult,
@@ -1349,8 +1349,8 @@ export class BaseCompiler implements ICompiler {
.filter(option => option !== '-fcolor-diagnostics')
.concat(unwrap(this.compiler.irArg));
- if (irOptions.noDiscardValueNames && this.compiler.llvmOptNoDiscardValueNamesArg) {
- newOptions.push(...this.compiler.llvmOptNoDiscardValueNamesArg);
+ if (irOptions.noDiscardValueNames && this.compiler.optPipelineNoDiscardValueNamesArg) {
+ newOptions.push(...this.compiler.optPipelineNoDiscardValueNamesArg);
}
const execOptions = this.getDefaultExecOptions();
@@ -1402,19 +1402,19 @@ export class BaseCompiler implements ICompiler {
};
}
- async generateLLVMOptPipeline(
+ async generateOptPipeline(
inputFilename: string,
options: string[],
filters: ParseFiltersAndOutputOptions,
- llvmOptPipelineOptions: LLVMOptPipelineBackendOptions,
- ): Promise<LLVMOptPipelineOutput | undefined> {
+ optPipelineOptions: OptPipelineBackendOptions,
+ ): Promise<OptPipelineOutput | undefined> {
// These options make Clang produce the pass dumps
const newOptions = options
.filter(option => option !== '-fcolor-diagnostics')
- .concat(unwrap(this.compiler.llvmOptArg))
- .concat(llvmOptPipelineOptions.fullModule ? unwrap(this.compiler.llvmOptModuleScopeArg) : [])
+ .concat(unwrap(this.compiler.optPipelineArg))
+ .concat(optPipelineOptions.fullModule ? unwrap(this.compiler.optPipelineModuleScopeArg) : [])
.concat(
- llvmOptPipelineOptions.noDiscardValueNames ? unwrap(this.compiler.llvmOptNoDiscardValueNamesArg) : [],
+ optPipelineOptions.noDiscardValueNames ? unwrap(this.compiler.optPipelineNoDiscardValueNamesArg) : [],
)
.concat(this.compiler.debugPatched ? ['-mllvm', '--debug-to-stdout'] : []);
@@ -1429,7 +1429,7 @@ export class BaseCompiler implements ICompiler {
return {
error: 'Clang invocation timed out',
results: {},
- clangTime: output.execTime || compileEnd - compileStart,
+ compileTime: output.execTime || compileEnd - compileStart,
};
}
@@ -1439,15 +1439,15 @@ export class BaseCompiler implements ICompiler {
try {
const parseStart = performance.now();
- const llvmOptPipeline = await this.processLLVMOptPipeline(
+ const optPipeline = await this.processOptPipeline(
output,
filters,
- llvmOptPipelineOptions,
+ optPipelineOptions,
this.compiler.debugPatched,
);
const parseEnd = performance.now();
- if (llvmOptPipelineOptions.demangle) {
+ if (optPipelineOptions.demangle) {
// apply demangles after parsing, would otherwise greatly complicate the parsing of the passes
// new this.demanglerClass(this.compiler.demangler, this);
const demangler = new LLVMIRDemangler(this.compiler.demangler, this);
@@ -1458,14 +1458,14 @@ export class BaseCompiler implements ICompiler {
demangler.collect({asm: output.stderr});
}
return {
- results: await demangler.demangleLLVMPasses(llvmOptPipeline),
- clangTime: compileEnd - compileStart,
+ results: await demangler.demangleLLVMPasses(optPipeline),
+ compileTime: compileEnd - compileStart,
parseTime: parseEnd - parseStart,
};
} else {
return {
- results: llvmOptPipeline,
- clangTime: compileEnd - compileStart,
+ results: optPipeline,
+ compileTime: compileEnd - compileStart,
parseTime: parseEnd - parseStart,
};
}
@@ -1473,21 +1473,21 @@ export class BaseCompiler implements ICompiler {
return {
error: e.toString(),
results: {},
- clangTime: compileEnd - compileStart,
+ compileTime: compileEnd - compileStart,
};
}
}
- async processLLVMOptPipeline(
+ async processOptPipeline(
output,
filters: ParseFiltersAndOutputOptions,
- llvmOptPipelineOptions: LLVMOptPipelineBackendOptions,
+ optPipelineOptions: OptPipelineBackendOptions,
debugPatched?: boolean,
) {
return this.llvmPassDumpParser.process(
debugPatched ? output.stdout : output.stderr,
filters,
- llvmOptPipelineOptions,
+ optPipelineOptions,
);
}
@@ -2228,7 +2228,7 @@ export class BaseCompiler implements ICompiler {
const makeGnatDebug = backendOptions.produceGnatDebug && this.compiler.supportsGnatDebugViews;
const makeGnatDebugTree = backendOptions.produceGnatDebugTree && this.compiler.supportsGnatDebugViews;
const makeIr = backendOptions.produceIr && this.compiler.supportsIrView;
- const makeLLVMOptPipeline = backendOptions.produceLLVMOptPipeline && this.compiler.supportsLLVMOptPipelineView;
+ const makeOptPipeline = backendOptions.produceOptPipeline && this.compiler.supportsOptPipelineView;
const makeRustMir = backendOptions.produceRustMir && this.compiler.supportsRustMirView;
const makeRustMacroExp = backendOptions.produceRustMacroExp && this.compiler.supportsRustMacroExpView;
const makeRustHir = backendOptions.produceRustHir && this.compiler.supportsRustHirView;
@@ -2244,7 +2244,7 @@ export class BaseCompiler implements ICompiler {
astResult,
ppResult,
irResult,
- llvmOptPipelineResult,
+ optPipelineResult,
rustHirResult,
rustMacroExpResult,
toolsResult,
@@ -2261,8 +2261,8 @@ export class BaseCompiler implements ICompiler {
filters,
)
: null,
- makeLLVMOptPipeline
- ? this.generateLLVMOptPipeline(inputFilename, options, filters, backendOptions.produceLLVMOptPipeline)
+ makeOptPipeline
+ ? this.generateOptPipeline(inputFilename, options, filters, backendOptions.produceOptPipeline)
: null,
makeRustHir ? this.generateRustHir(inputFilename, options) : null,
makeRustMacroExp ? this.generateRustMacroExpansion(inputFilename, options) : null,
@@ -2359,9 +2359,9 @@ export class BaseCompiler implements ICompiler {
asmResult.hasIrOutput = true;
asmResult.irOutput = irResult;
}
- if (llvmOptPipelineResult) {
- asmResult.hasLLVMOptPipelineOutput = true;
- asmResult.llvmOptPipelineOutput = llvmOptPipelineResult;
+ if (optPipelineResult) {
+ asmResult.hasOptPipelineOutput = true;
+ asmResult.optPipelineOutput = optPipelineResult;
}
if (rustMirResult) {
asmResult.hasRustMirOutput = true;
diff --git a/lib/compilers/argument-parsers.ts b/lib/compilers/argument-parsers.ts
index 604eb434a..cd89e9783 100644
--- a/lib/compilers/argument-parsers.ts
+++ b/lib/compilers/argument-parsers.ts
@@ -275,15 +275,15 @@ export class ClangParser extends BaseParser {
this.mllvmOptions.has('--print-before-all') &&
this.mllvmOptions.has('--print-after-all')
) {
- compiler.compiler.supportsLLVMOptPipelineView = true;
- compiler.compiler.llvmOptArg = ['-mllvm', '--print-before-all', '-mllvm', '--print-after-all'];
- compiler.compiler.llvmOptModuleScopeArg = [];
- compiler.compiler.llvmOptNoDiscardValueNamesArg = [];
+ compiler.compiler.supportsOptPipelineView = true;
+ compiler.compiler.optPipelineArg = ['-mllvm', '--print-before-all', '-mllvm', '--print-after-all'];
+ compiler.compiler.optPipelineModuleScopeArg = [];
+ compiler.compiler.optPipelineNoDiscardValueNamesArg = [];
if (this.mllvmOptions.has('--print-module-scope')) {
- compiler.compiler.llvmOptModuleScopeArg = ['-mllvm', '-print-module-scope'];
+ compiler.compiler.optPipelineModuleScopeArg = ['-mllvm', '-print-module-scope'];
}
if (this.hasSupport(options, '-fno-discard-value-names')) {
- compiler.compiler.llvmOptNoDiscardValueNamesArg = ['-fno-discard-value-names'];
+ compiler.compiler.optPipelineNoDiscardValueNamesArg = ['-fno-discard-value-names'];
}
}
@@ -496,15 +496,15 @@ export class LDCParser extends BaseParser {
}
if (this.hasSupport(options, '--print-before-all') && this.hasSupport(options, '--print-after-all')) {
- compiler.compiler.supportsLLVMOptPipelineView = true;
- compiler.compiler.llvmOptArg = ['--print-before-all', '--print-after-all'];
- compiler.compiler.llvmOptModuleScopeArg = [];
- compiler.compiler.llvmOptNoDiscardValueNamesArg = [];
+ compiler.compiler.supportsOptPipelineView = true;
+ compiler.compiler.optPipelineArg = ['--print-before-all', '--print-after-all'];
+ compiler.compiler.optPipelineModuleScopeArg = [];
+ compiler.compiler.optPipelineNoDiscardValueNamesArg = [];
if (this.hasSupport(options, '--print-module-scope')) {
- compiler.compiler.llvmOptModuleScopeArg = ['--print-module-scope'];
+ compiler.compiler.optPipelineModuleScopeArg = ['--print-module-scope'];
}
if (this.hasSupport(options, '--fno-discard-value-names')) {
- compiler.compiler.llvmOptNoDiscardValueNamesArg = ['--fno-discard-value-names'];
+ compiler.compiler.optPipelineNoDiscardValueNamesArg = ['--fno-discard-value-names'];
}
}
diff --git a/lib/compilers/hlsl.ts b/lib/compilers/hlsl.ts
index 0b5662ac7..c4d2f8e48 100644
--- a/lib/compilers/hlsl.ts
+++ b/lib/compilers/hlsl.ts
@@ -41,9 +41,9 @@ export class HLSLCompiler extends BaseCompiler {
this.compiler.supportsIntel = false;
this.spirvAsm = new SPIRVAsmParser(this.compilerProps);
- this.compiler.supportsLLVMOptPipelineView = true;
- this.compiler.llvmOptArg = ['-print-before-all', '-print-after-all'];
- this.compiler.llvmOptNoDiscardValueNamesArg = [];
+ this.compiler.supportsOptPipelineView = true;
+ this.compiler.optPipelineArg = ['-print-before-all', '-print-after-all'];
+ this.compiler.optPipelineNoDiscardValueNamesArg = [];
}
override async generateAST(inputFilename, options): Promise<ResultLine[]> {
diff --git a/lib/compilers/llc.ts b/lib/compilers/llc.ts
index f15915321..dc7144817 100644
--- a/lib/compilers/llc.ts
+++ b/lib/compilers/llc.ts
@@ -36,10 +36,10 @@ export class LLCCompiler extends BaseCompiler {
constructor(info: PreliminaryCompilerInfo, env) {
super(info, env);
this.compiler.supportsIntel = true;
- this.compiler.supportsLLVMOptPipelineView = true;
- this.compiler.llvmOptArg = ['-print-after-all', '-print-before-all'];
- this.compiler.llvmOptModuleScopeArg = ['-print-module-scope'];
- this.compiler.llvmOptNoDiscardValueNamesArg = [];
+ this.compiler.supportsOptPipelineView = true;
+ this.compiler.optPipelineArg = ['-print-after-all', '-print-before-all'];
+ this.compiler.optPipelineModuleScopeArg = ['-print-module-scope'];
+ this.compiler.optPipelineNoDiscardValueNamesArg = [];
}
override getSharedLibraryPathsAsArguments() {
diff --git a/lib/compilers/opt.ts b/lib/compilers/opt.ts
index f5c0d4cb6..418230f31 100644
--- a/lib/compilers/opt.ts
+++ b/lib/compilers/opt.ts
@@ -35,10 +35,10 @@ export class OptCompiler extends BaseCompiler {
constructor(info: PreliminaryCompilerInfo, env) {
super(info, env);
- this.compiler.supportsLLVMOptPipelineView = true;
- this.compiler.llvmOptArg = ['-print-after-all', '-print-before-all'];
- this.compiler.llvmOptModuleScopeArg = ['-print-module-scope'];
- this.compiler.llvmOptNoDiscardValueNamesArg = [];
+ this.compiler.supportsOptPipelineView = true;
+ this.compiler.optPipelineArg = ['-print-after-all', '-print-before-all'];
+ this.compiler.optPipelineModuleScopeArg = ['-print-module-scope'];
+ this.compiler.optPipelineNoDiscardValueNamesArg = [];
}
override optionsForFilter(filters: ParseFiltersAndOutputOptions, outputFilename: string) {
diff --git a/lib/compilers/rust.ts b/lib/compilers/rust.ts
index 98683f6d9..e57a86840 100644
--- a/lib/compilers/rust.ts
+++ b/lib/compilers/rust.ts
@@ -49,7 +49,7 @@ export class RustCompiler extends BaseCompiler {
super(info, env);
this.compiler.supportsIntel = true;
this.compiler.supportsIrView = true;
- this.compiler.supportsLLVMOptPipelineView = true;
+ this.compiler.supportsOptPipelineView = true;
this.compiler.supportsRustMirView = true;
const isNightly = this.isNightly();
@@ -60,9 +60,9 @@ export class RustCompiler extends BaseCompiler {
this.compiler.irArg = ['--emit', 'llvm-ir'];
this.compiler.minIrArgs = ['--emit=llvm-ir'];
- this.compiler.llvmOptArg = ['-C', 'llvm-args=-print-after-all -print-before-all'];
- this.compiler.llvmOptModuleScopeArg = ['-C', 'llvm-args=-print-module-scope'];
- this.compiler.llvmOptNoDiscardValueNamesArg = isNightly ? ['-Z', 'fewer-names=no'] : [];
+ this.compiler.optPipelineArg = ['-C', 'llvm-args=-print-after-all -print-before-all'];
+ this.compiler.optPipelineModuleScopeArg = ['-C', 'llvm-args=-print-module-scope'];
+ this.compiler.optPipelineNoDiscardValueNamesArg = isNightly ? ['-Z', 'fewer-names=no'] : [];
this.linker = this.compilerProps<string>('linker');
}
diff --git a/lib/compilers/snowball.ts b/lib/compilers/snowball.ts
index b39c09808..2e3a3d1e2 100644
--- a/lib/compilers/snowball.ts
+++ b/lib/compilers/snowball.ts
@@ -40,7 +40,7 @@ export class SnowballCompiler extends BaseCompiler {
super(info, env);
this.compiler.supportsIntel = true;
this.compiler.supportsIrView = true;
- this.compiler.supportsLLVMOptPipelineView = true;
+ this.compiler.supportsOptPipelineView = true;
this.compiler.supportsCfg = true;
this.compiler.irArg = ['--emit', 'llvm-ir'];
diff --git a/lib/compilers/swift.ts b/lib/compilers/swift.ts
index 6b4406aeb..7d943752f 100644
--- a/lib/compilers/swift.ts
+++ b/lib/compilers/swift.ts
@@ -35,10 +35,10 @@ export class SwiftCompiler extends BaseCompiler {
constructor(info: PreliminaryCompilerInfo, env) {
super(info, env);
- this.compiler.supportsLLVMOptPipelineView = true;
- this.compiler.llvmOptArg = ['-Xllvm', '-print-after-all', '-Xllvm', '-print-before-all'];
- this.compiler.llvmOptModuleScopeArg = ['-Xllvm', '-print-module-scope'];
- this.compiler.llvmOptNoDiscardValueNamesArg = [];
+ this.compiler.supportsOptPipelineView = true;
+ this.compiler.optPipelineArg = ['-Xllvm', '-print-after-all', '-Xllvm', '-print-before-all'];
+ this.compiler.optPipelineModuleScopeArg = ['-Xllvm', '-print-module-scope'];
+ this.compiler.optPipelineNoDiscardValueNamesArg = [];
}
override getSharedLibraryPathsAsArguments() {
diff --git a/lib/demangler/llvm.ts b/lib/demangler/llvm.ts
index a7144207b..5d4b247b9 100644
--- a/lib/demangler/llvm.ts
+++ b/lib/demangler/llvm.ts
@@ -22,7 +22,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-import {LLVMOptPipelineResults} from '../../types/compilation/llvm-opt-pipeline-output.interfaces.js';
+import {OptPipelineResults} from '../../types/compilation/opt-pipeline-output.interfaces.js';
import {ResultLine} from '../../types/resultline/resultline.interfaces.js';
import {logger} from '../logger.js';
import {SymbolStore} from '../symbol-store.js';
@@ -59,7 +59,7 @@ export class LLVMIRDemangler extends BaseDemangler {
}
}
- protected processPassOutput(passOutput: LLVMOptPipelineResults, demanglerOutput) {
+ protected processPassOutput(passOutput: OptPipelineResults, demanglerOutput) {
if (demanglerOutput.stdout.length === 0 && demanglerOutput.stderr.length > 0) {
logger.error(`Error executing demangler ${this.demanglerExe}`, demanglerOutput);
return passOutput;
@@ -95,7 +95,7 @@ export class LLVMIRDemangler extends BaseDemangler {
return passOutput;
}
- public async demangleLLVMPasses(passOutput: LLVMOptPipelineResults) {
+ public async demangleLLVMPasses(passOutput: OptPipelineResults) {
const options = {
input: this.getInput(),
};
diff --git a/lib/parsers/llvm-pass-dump-parser.ts b/lib/parsers/llvm-pass-dump-parser.ts
index 0729bcc82..5786dccee 100644
--- a/lib/parsers/llvm-pass-dump-parser.ts
+++ b/lib/parsers/llvm-pass-dump-parser.ts
@@ -23,10 +23,10 @@
// POSSIBILITY OF SUCH DAMAGE.
import {
- LLVMOptPipelineBackendOptions,
- LLVMOptPipelineResults,
+ OptPipelineBackendOptions,
+ OptPipelineResults,
Pass,
-} from '../../types/compilation/llvm-opt-pipeline-output.interfaces.js';
+} from '../../types/compilation/opt-pipeline-output.interfaces.js';
import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
import {ResultLine} from '../../types/resultline/resultline.interfaces.js';
import {assert} from '../assert.js';
@@ -345,7 +345,7 @@ export class LlvmPassDumpParser {
matchPassDumps(passDumpsByFunction: Record<string, PassDump[]>) {
// We have all the passes for each function, now we will go through each function and match the before/after
// dumps
- const final_output: LLVMOptPipelineResults = {};
+ const final_output: OptPipelineResults = {};
for (const [function_name, passDumps] of Object.entries(passDumpsByFunction)) {
// I had a fantastic chunk2 method to iterate the passes in chunks of 2 but I've been foiled by an edge
// case: At least the "Delete dead loops" may only print a before dump and no after dump
@@ -414,10 +414,10 @@ export class LlvmPassDumpParser {
return final_output;
}
- breakdownOutput(ir: ResultLine[], llvmOptPipelineOptions: LLVMOptPipelineBackendOptions) {
+ breakdownOutput(ir: ResultLine[], optPipelineOptions: OptPipelineBackendOptions) {
// break down output by "*** IR Dump After XYZ ***" markers
const raw_passes = this.breakdownOutputIntoPassDumps(ir);
- if (llvmOptPipelineOptions.fullModule) {
+ if (optPipelineOptions.fullModule) {
const passDumpsByFunction = this.associateFullDumpsWithFunctions(raw_passes);
// Match before / after pass dumps and we're done
return this.matchPassDumps(passDumpsByFunction);
@@ -432,15 +432,15 @@ export class LlvmPassDumpParser {
}
}
- applyIrFilters(ir: ResultLine[], llvmOptPipelineOptions: LLVMOptPipelineBackendOptions) {
+ applyIrFilters(ir: ResultLine[], optPipelineOptions: OptPipelineBackendOptions) {
// Additional filters conditionally enabled by `filterDebugInfo`/`filterIRMetadata`
let filters = this.filters;
let lineFilters = this.lineFilters;
- if (llvmOptPipelineOptions.filterDebugInfo) {
+ if (optPipelineOptions.filterDebugInfo) {
filters = filters.concat(this.debugInfoFilters);
lineFilters = lineFilters.concat(this.debugInfoLineFilters);
}
- if (llvmOptPipelineOptions.filterIRMetadata) {
+ if (optPipelineOptions.filterIRMetadata) {
lineFilters = lineFilters.concat(this.metadataLineFilters);
}
@@ -472,13 +472,13 @@ export class LlvmPassDumpParser {
process(
output: ResultLine[],
_: ParseFiltersAndOutputOptions,
- llvmOptPipelineOptions: LLVMOptPipelineBackendOptions,
+ optPipelineOptions: OptPipelineBackendOptions,
) {
// Crop out any junk before the pass dumps (e.g. warnings)
const ir = output.slice(
output.findIndex(line => line.text.match(this.irDumpHeader) || line.text.match(this.machineCodeDumpHeader)),
);
- const preprocessed_lines = this.applyIrFilters(ir, llvmOptPipelineOptions);
- return this.breakdownOutput(preprocessed_lines, llvmOptPipelineOptions);
+ const preprocessed_lines = this.applyIrFilters(ir, optPipelineOptions);
+ return this.breakdownOutput(preprocessed_lines, optPipelineOptions);
}
}