mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 03:29:45 -06:00
Some quick llvm ir fixes
This commit is contained in:
@@ -36,12 +36,12 @@ import {PrefixTree} from './prefix-tree.js';
|
||||
|
||||
export class BaseDemangler extends AsmRegex {
|
||||
readonly demanglerExe: string;
|
||||
demanglerArguments: string[];
|
||||
readonly demanglerArguments: string[];
|
||||
symbolstore: SymbolStore | null;
|
||||
othersymbols: SymbolStore;
|
||||
result: ParsedAsmResult;
|
||||
input: string[];
|
||||
includeMetadata: boolean;
|
||||
readonly includeMetadata: boolean;
|
||||
readonly compiler: BaseCompiler;
|
||||
|
||||
readonly jumpDef = /(j\w+|b|bl|blx)\s+([$_a-z][\w$@]*)/i;
|
||||
@@ -212,14 +212,16 @@ export class BaseDemangler extends AsmRegex {
|
||||
|
||||
if (!this.symbolstore) {
|
||||
this.symbolstore = new SymbolStore();
|
||||
this.collectLabels();
|
||||
}
|
||||
|
||||
this.collectLabels();
|
||||
|
||||
options.input = this.getInput();
|
||||
|
||||
if (options.input === '') {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
return this.processOutput(await this.execDemangler(options));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ export class TiC2000Demangler extends CppDemangler {
|
||||
}
|
||||
|
||||
constructor(demanglerExe, compiler) {
|
||||
super(demanglerExe, compiler);
|
||||
this.demanglerArguments = ['-q'];
|
||||
super(demanglerExe, compiler, ['-q']);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -45,13 +45,12 @@ export class LlvmIrParser {
|
||||
private metaNodeOptionsRe: RegExp;
|
||||
private llvmDebugLine: RegExp;
|
||||
private llvmDebugAnnotation: RegExp;
|
||||
private otherMetadataAnnotation: RegExp;
|
||||
private attributeAnnotation: RegExp;
|
||||
private attributeDirective: RegExp;
|
||||
private moduleMetadata: RegExp;
|
||||
private functionAttrs: RegExp;
|
||||
|
||||
// TODO(jeremy-rifkin) can awful state things happen because of soring a demangler? Usually they're constructed
|
||||
// fresh for each compile.
|
||||
constructor(compilerProps, private readonly irDemangler: LLVMIRDemangler) {
|
||||
this.maxIrLines = 5000;
|
||||
if (compilerProps) {
|
||||
@@ -66,6 +65,7 @@ export class LlvmIrParser {
|
||||
|
||||
this.llvmDebugLine = /^\s*call void @llvm\.dbg\..*$/;
|
||||
this.llvmDebugAnnotation = /,? !dbg !\d+/;
|
||||
this.otherMetadataAnnotation = /,? !(?!dbg)[\w.]+ (!\d+)/;
|
||||
this.attributeAnnotation = /,? #\d+(?= )/;
|
||||
this.attributeDirective = /^attributes #\d+ = { .+ }$/;
|
||||
this.functionAttrs = /^; Function Attrs: .+$/;
|
||||
@@ -150,7 +150,8 @@ export class LlvmIrParser {
|
||||
const result: IRResultLine[] = [];
|
||||
const irLines = utils.splitLines(ir);
|
||||
const debugInfo: Record<string, MetaNode> = {};
|
||||
let prevLineEmpty = false;
|
||||
// Set to true initially to prevent any leading newlines as a result of filtering
|
||||
let prevLineEmpty = true;
|
||||
|
||||
const filters: RegExp[] = [];
|
||||
const lineFilters: RegExp[] = [];
|
||||
@@ -164,6 +165,7 @@ export class LlvmIrParser {
|
||||
filters.push(this.metaNodeRe);
|
||||
filters.push(this.otherMetaDirective);
|
||||
filters.push(this.namedMetaDirective);
|
||||
lineFilters.push(this.otherMetadataAnnotation);
|
||||
}
|
||||
if (options.filterAttributes) {
|
||||
filters.push(this.attributeDirective);
|
||||
|
||||
Reference in New Issue
Block a user