Skip to content

Commit

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

const supportedOptions = this.compiler.optPipeline.supportedOptions;
const {supportedOptions, supportedFilters} = 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));
}
}
const supportedFilters = this.compiler.optPipeline.supportedFilters;
if (supportedFilters) {
for (const key of ['filter-debug-info', 'filter-instruction-metadata']) {
this.filters.enableToggle(key, supportedFilters.includes(key));
Expand Down Expand Up @@ -339,16 +338,19 @@ 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.enableToggle('dump-full-module', false, true);
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
5 changes: 1 addition & 4 deletions static/widgets/toggles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,12 @@ export class Toggles extends EventEmitter {
this.emit('change', before, this.get());
}

enableToggle(key: string, enable: boolean, lockChecked: boolean = false) {
enableToggle(key: string, enable: boolean) {
for (const element of this.buttons) {
const widget = $(element);
const button = widget.find('button');
const bind = button.data('bind');
if (bind === key) {
if (lockChecked) {
this.set(key, true); // Ensure the toggle is checked
}
button.prop('disabled', !enable);
}
}
Expand Down

0 comments on commit d48fab3

Please sign in to comment.