Skip to content

Commit

Permalink
Add initialOptionsState, initialFiltersState to compiler.optPipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
OfekShilon committed Sep 29, 2024
1 parent d48fab3 commit 7b74a4f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
8 changes: 6 additions & 2 deletions lib/compilers/argument-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,14 @@ export class ClangirParser extends ClangParser {
arg: [],
moduleScopeArg: ['-mmlir', '--mlir-print-ir-before-all', '-mmlir', '--mlir-print-ir-after-all'],
noDiscardValueNamesArg: [],
// Currently 'dump-full-module' is locked to checked by the front-end
// supportedOptions: ['dump-full-module', 'demangle-symbols'],
supportedOptions: ['demangle-symbols'],
supportedFilters: [],
initialOptionsState: {
'dump-full-module': true,
'demangle-symbols': true,
'-fno-discard-value-names': false,
},
initialFiltersState: {'filter-debug-info': false, 'filter-instruction-metadata': false},
};
}
}
Expand Down
23 changes: 13 additions & 10 deletions static/panes/opt-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ export class OptPipeline extends MonacoPane<monaco.editor.IStandaloneDiffEditor,
updateButtons() {
if (!this.compiler || !this.compiler.optPipeline) return;

const {supportedOptions, supportedFilters} = this.compiler.optPipeline;
const {supportedOptions, supportedFilters, initialOptionsState, initialFiltersState} =
this.compiler.optPipeline;
if (supportedOptions) {
for (const key of ['dump-full-module', '-fno-discard-value-names', 'demangle-symbols']) {
this.options.enableToggle(key, supportedOptions.includes(key));
Expand All @@ -241,6 +242,16 @@ export class OptPipeline extends MonacoPane<monaco.editor.IStandaloneDiffEditor,
this.filters.enableToggle(key, supportedFilters.includes(key));
}
}
if (initialOptionsState) {
for (const key in initialOptionsState) {
this.options.set(key, initialOptionsState[key]);
}
}
if (initialFiltersState) {
for (const key in initialFiltersState) {
this.filters.set(key, initialFiltersState[key]);
}
}
}

initResizeDrag(e: MouseEvent) {
Expand Down Expand Up @@ -338,19 +349,11 @@ export class OptPipeline extends MonacoPane<monaco.editor.IStandaloneDiffEditor,
this.updateTitle();
this.compiler = compiler;
this.updateGroupName();
this.updateButtons();
this.updateEditor();
if (compiler && !compiler.optPipeline) {
//this.editor.setValue('<Opt pipeline output is not supported for this compiler>');
}

// TODO: un-hackify this
if (this.compilerInfo.compilerName.includes('clangir')) {
this.options.set('dump-full-module', true);
this.filters.set('filter-debug-info', false);
this.filters.set('filter-instruction-metadata', false);
}

this.updateButtons();
}

updateGroupName() {
Expand Down
2 changes: 2 additions & 0 deletions types/compiler.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ export type CompilerInfo = {
moduleScopeArg?: string[];
noDiscardValueNamesArg?: string[];
monacoLanguage?: string;
initialOptionsState?: Record<string, boolean>;
initialFiltersState?: Record<string, boolean>;
};
cachedPossibleArguments?: any;
nvdisasm?: string;
Expand Down

0 comments on commit 7b74a4f

Please sign in to comment.