aboutsummaryrefslogtreecommitdiffhomepage
path: root/ir.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-06-20 09:45:26 +0200
committerlemon <lsof@mailbox.org>2023-06-20 09:45:26 +0200
commit945d17aff2aa92dd1fbb0304d4ee7ab5ea6ce496 (patch)
treebb63bc06b372058d0931ef4a2ad915836b64ce96 /ir.h
parent981906a54e6c8dd727b7b6be2a428c547877ef78 (diff)
fix cls logic for comparison instrs
previously instr.cls always represented the output dataclass. this doesn't work for comparisons because we know the output is always a boolean integer and we care about the actual comparison dataclass. so now .cls represents the operation dataclass, which matches the result class except for comparisons where the result is always KI4V
Diffstat (limited to 'ir.h')
-rw-r--r--ir.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/ir.h b/ir.h
index 3858d0d..72a0bd5 100644
--- a/ir.h
+++ b/ir.h
@@ -91,7 +91,7 @@ enum op {
#undef _
};
-#define oiscmp(o) in_range(o, Oequ, Oulte)
+#define oiscmp(o) in_range(o, Oequ, Ougte)
#define oisalloca(o) in_range(o, Oalloca1, Oalloca16)
#define oisstore(o) in_range(o, Ostore1, Ostore8)
#define oisload(o) in_range(o, Oloads1, Oloadf8)
@@ -105,7 +105,8 @@ enum intrin {
};
struct instr {
- uchar op, cls;
+ uchar op,
+ cls; /* operation data class; also result class except for cmp ops (always i4) */
uchar skip : 1; /* ignore during codegen: forms part of one machine instruction */
uchar inplace : 1; /* set (by isel) for instructions which modify its first arg in place */
uchar reg; /* 0 -> no reg; else reg + 1 */
@@ -189,6 +190,7 @@ extern struct calltab {vec_of(struct call);} calltab;
extern struct phitab {vec_of(struct phi);} phitab;
extern struct dattab {vec_of(struct irdat);} dattab;
extern struct addr addrht[];
+#define insrescls(ins) (oiscmp((ins).op) ? KI4 : (ins).cls)
#define NOREF ((union ref) {0})
#define ZEROREF ((union ref) {{ RICON, 0 }})
#define mkref(t, x) ((union ref) {{ (t), (x) }})