mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-01 20:09:27 -06:00
Formatter + type fixes
This commit is contained in:
@@ -210,7 +210,7 @@ export class BaseCompiler {
|
||||
protected cmakeBaseEnv: Record<string, string>;
|
||||
protected buildenvsetup: null | any;
|
||||
protected externalparser: null | ExternalParserBase;
|
||||
protected supportedLibraries?: Record<string, OptionsHandlerLibrary>;n
|
||||
protected supportedLibraries?: Record<string, OptionsHandlerLibrary>;
|
||||
protected packager: Packager;
|
||||
protected defaultRpathFlag = '-Wl,-rpath,';
|
||||
private static objdumpAndParseCounter = new PromClient.Counter({
|
||||
|
||||
@@ -212,10 +212,9 @@ export class BaseCFGParser {
|
||||
return name.substring(0, pos + 1) + suffix;
|
||||
};
|
||||
const bb = arrBB[bbIdx];
|
||||
if (hasName(asmArr, bb))
|
||||
return asmArr[bb.end].text;
|
||||
if (hasName(asmArr, bb)) return asmArr[bb.end].text;
|
||||
const newBbName = generateName(bb.nameId, bb.end);
|
||||
arrBB[bbIdx+1].nameId = newBbName;
|
||||
arrBB[bbIdx + 1].nameId = newBbName;
|
||||
return newBbName;
|
||||
}
|
||||
|
||||
@@ -241,7 +240,11 @@ export class BaseCFGParser {
|
||||
if (actPosSz === 1)
|
||||
return [
|
||||
{nameId: basicBlock.nameId, start: basicBlock.start, end: actionPos[0] + 1},
|
||||
{nameId: basicBlock.nameId + this.getLabelSeparator() + (actionPos[0] + 1), start: actionPos[0] + 1, end: basicBlock.end},
|
||||
{
|
||||
nameId: basicBlock.nameId + this.getLabelSeparator() + (actionPos[0] + 1),
|
||||
start: actionPos[0] + 1,
|
||||
end: basicBlock.end,
|
||||
},
|
||||
];
|
||||
|
||||
let cur = 0;
|
||||
@@ -258,7 +261,11 @@ export class BaseCFGParser {
|
||||
result.push(_.clone(tmp));
|
||||
}
|
||||
|
||||
tmp = {nameId: blockName + this.getLabelSeparator() + (actionPos[first] + 1), start: actionPos[first] + 1, end: basicBlock.end};
|
||||
tmp = {
|
||||
nameId: blockName + this.getLabelSeparator() + (actionPos[first] + 1),
|
||||
start: actionPos[first] + 1,
|
||||
end: basicBlock.end,
|
||||
};
|
||||
result.push(_.clone(tmp));
|
||||
|
||||
return result;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
import _ from 'underscore';
|
||||
|
||||
|
||||
import {AssemblyLine, BaseCFGParser, Range} from './base.js';
|
||||
|
||||
export class VcCFGParser extends BaseCFGParser {
|
||||
@@ -42,12 +41,16 @@ export class VcCFGParser extends BaseCFGParser {
|
||||
newText = line.text.substring(0, pos).trimEnd();
|
||||
}
|
||||
return {...line, text: newText};
|
||||
}
|
||||
};
|
||||
const noCommentLines = assembly.map(removeComment).filter(line => line.text.length > 0);
|
||||
const isFuncStart = (line: string) => { return line.endsWith(' PROC'); };
|
||||
const isFuncEnd = (line: string) => { return line.endsWith(' ENDP'); };
|
||||
const isFuncStart = (line: string) => {
|
||||
return line.endsWith(' PROC');
|
||||
};
|
||||
const isFuncEnd = (line: string) => {
|
||||
return line.endsWith(' ENDP');
|
||||
};
|
||||
|
||||
let newRes: AssemblyLine[] = [];
|
||||
const newRes: AssemblyLine[] = [];
|
||||
let inFunction = false;
|
||||
for (const line of noCommentLines) {
|
||||
if (isFuncStart(line.text)) {
|
||||
@@ -71,9 +74,9 @@ export class VcCFGParser extends BaseCFGParser {
|
||||
const fnRange: Range = {start: 0, end: 0};
|
||||
do {
|
||||
if (this.isFunctionEnd(asmArr[cur].text)) {
|
||||
fnRange.end = cur+1;
|
||||
fnRange.end = cur + 1;
|
||||
result.push(_.clone(fnRange));
|
||||
fnRange.start = cur+1;
|
||||
fnRange.start = cur + 1;
|
||||
}
|
||||
++cur;
|
||||
} while (cur < last);
|
||||
@@ -95,7 +98,7 @@ export class VcCFGParser extends BaseCFGParser {
|
||||
override extractJmpTargetName(inst: string) {
|
||||
return inst.match(/\$.*/) + ':';
|
||||
}
|
||||
|
||||
|
||||
override getLabelSeparator() {
|
||||
// `@` is used natively by MSVC labels, so we use `#` instead
|
||||
return '#';
|
||||
|
||||
+3
-6
@@ -67,12 +67,9 @@ export async function generateStructure(
|
||||
// dex2oat is a special case because it can output different instruction
|
||||
// sets. Create an OAT parser instead of searching by ISA.
|
||||
let parser: BaseCFGParser;
|
||||
if (compilerGroup?.includes('dex2oat'))
|
||||
parser = new OatCFGParser(instructionSet);
|
||||
else if (compilerGroup?.startsWith('vc'))
|
||||
parser = new (getParserByKey('vc'))(instructionSet)
|
||||
else
|
||||
parser = new (getParserByKey(compilerGroup))(instructionSet);
|
||||
if (compilerGroup?.includes('dex2oat')) parser = new OatCFGParser(instructionSet);
|
||||
else if (compilerGroup?.startsWith('vc')) parser = new (getParserByKey('vc'))(instructionSet);
|
||||
else parser = new (getParserByKey(compilerGroup))(instructionSet);
|
||||
|
||||
let code = parser.filterData(asmArr);
|
||||
code = await parser.processFuncNames(code, fullRes);
|
||||
|
||||
Reference in New Issue
Block a user