Skip to content

Commit f49ce31

Browse files
committed
chg: add label-tags
1 parent 559067b commit f49ce31

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/lib/asmWriter.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,19 @@ export function writeASM(ast, functionsAsm, config)
242242
}
243243
}
244244

245+
let tag = '';
246+
for(const ann of asm.annotations) {
247+
if(ann.name === ANNOTATIONS.Tag) {
248+
tag = `TAG_${ann.value}: `;
249+
break;
250+
}
251+
}
245252

246253
// ASM Text output
247254
switch (asm.type) {
248255
case ASM_TYPE.INLINE:
249-
case ASM_TYPE.OP : writeLine(` ${stringifyInstr(asm).padEnd(debugInfo ? 50 : 0,' ')}${debugInfo}`);break;
250-
case ASM_TYPE.LABEL : writeLine(` ${asm.label}:`); break;
256+
case ASM_TYPE.OP : writeLine(` ${tag}${stringifyInstr(asm).padEnd(debugInfo ? 50 : 0,' ')}${debugInfo}`);break;
257+
case ASM_TYPE.LABEL : writeLine(` ${tag}${asm.label}:`); break;
251258
default: state.throwError("Unknown ASM type: " + asm.type, asm);
252259
}
253260

src/lib/syntax/annotations.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const ANNOTATIONS = {
1111
NoReturn: "NoReturn",
1212
Unlikely: "Unlikely",
1313
NoRegAlloc: "NoRegAlloc",
14+
Tag: "Tag"
1415
};
1516

1617
export const KNOWN_ANNOTATIONS = Object.keys(ANNOTATIONS);

0 commit comments

Comments
 (0)