commit 4dc5b92907d3a61fe637e01358d1a18e0a2ce403
parent 57ff62dc0c5dae01e8065a47bcd6d92e7d30f5ae
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 4 Nov 2022 03:24:39 +0100
cc2/qbe: Use explicit names for asm labels
The generic code uses 0 for asm instruction that only set
labels but we can highlight it in the arch code using an
enum with a name related to lables to make clear why 0
happens in the prog listing.
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cmd/cc/cc2/target/qbe/arch.h b/src/cmd/cc/cc2/target/qbe/arch.h
@@ -1,5 +1,5 @@
enum asmop {
- ASNOP = 0,
+ ASLABEL = 0,
ASSTB,
ASSTH,
ASSTW,
diff --git a/src/cmd/cc/cc2/target/qbe/code.c b/src/cmd/cc/cc2/target/qbe/code.c
@@ -402,7 +402,7 @@ writeout(void)
haslabel = 1;
printf("%s\n", symname(pc->label));
}
- if (!pc->op)
+ if (pc->op == ASLABEL)
continue;
if (pc->flags&BBENTRY && !haslabel)
printf("%s\n", symname(newlabel()));