From b934d999d98d0512173de2d9ab3a2e97c5fda015 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 26 Apr 2021 18:19:17 -0500 Subject: Keep go asm in UPPERCASE. See #2620 --- lib/compilers/golang.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'lib/compilers/golang.js') diff --git a/lib/compilers/golang.js b/lib/compilers/golang.js index 73a64aac7..bbcba3195 100644 --- a/lib/compilers/golang.js +++ b/lib/compilers/golang.js @@ -31,21 +31,15 @@ import { ClangParser } from './argument-parsers'; // Each arch has a list of jump instructions in // Go source src/cmd/asm/internal/arch. -const jumpPrefixes = [ - 'j', - 'b', - - // arm - 'cb', - 'tb', - - // s390x - 'cmpb', - 'cmpub', -]; +// x86 -> j, b +// arm -> cb, tb +// s390x -> cmpb, cmpub +const jumpRe = /^(j|b|cb|tb|cmpb|cmpub).*/i; export class GolangCompiler extends BaseCompiler { - static get key() { return 'golang'; } + static get key() { + return 'golang'; + } convertNewGoL(code) { const re = /^\s+(0[Xx]?[\dA-Za-z]+)?\s?(\d+)\s*\(([^:]+):(\d+)\)\s*([A-Z]+)(.*)/; @@ -129,7 +123,6 @@ export class GolangCompiler extends BaseCompiler { prevLine = lineMatch; } - ins = ins.toLowerCase(); args = this.replaceJump(func, funcCollisions[func], ins, args, usedLabels); res.push(`\t${ins}${args}`); return res; @@ -155,7 +148,7 @@ export class GolangCompiler extends BaseCompiler { } // Check instruction has a jump prefix - if (_.any(jumpPrefixes, prefix => ins.startsWith(prefix))) { + if (ins.match(jumpRe)) { let label = `${func}_pc${match[2]}`; if (collisions > 0) { label += `_${collisions}`; -- cgit v1.2.3