diff options
| author | 2023-06-20 09:45:26 +0200 | |
|---|---|---|
| committer | 2023-06-20 09:45:26 +0200 | |
| commit | 945d17aff2aa92dd1fbb0304d4ee7ab5ea6ce496 (patch) | |
| tree | bb63bc06b372058d0931ef4a2ad915836b64ce96 /amd64/emit.c | |
| parent | 981906a54e6c8dd727b7b6be2a428c547877ef78 (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 'amd64/emit.c')
| -rw-r--r-- | amd64/emit.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/amd64/emit.c b/amd64/emit.c index c7c6258..21a59b7 100644 --- a/amd64/emit.c +++ b/amd64/emit.c @@ -529,10 +529,11 @@ Xjcc(uchar **pcode, enum cc cc, struct block *dst) } static void -Xsetcc(uchar **pcode, enum cc cc, int reg) +Xsetcc(uchar **pcode, enum cc cc, enum reg reg) { int rex = 0; assert(in_range(cc, 0x0, 0xF)); + assert(in_range(reg, RAX, R15)); if (in_range(reg, RSP, RDI)) rex = 0x40; rex |= (reg >> 3); /* REX.B */ |