diff options
| author | 2025-11-20 11:01:52 +0100 | |
|---|---|---|
| committer | 2025-11-20 13:36:49 +0100 | |
| commit | 1f8c531151d0a83e6b2531fdb443c4d6c62c2aab (patch) | |
| tree | 613e965655d0509640948818da061f5a47e876cd /amd64 | |
| parent | 9d043755a73c170b56d364a0a671f18700a2aa19 (diff) | |
ir: for easier debugging, keep ctype in dats, print as literal when possible
Diffstat (limited to 'amd64')
| -rw-r--r-- | amd64/isel.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/amd64/isel.c b/amd64/isel.c index 86eeb56..a010b90 100644 --- a/amd64/isel.c +++ b/amd64/isel.c @@ -73,14 +73,18 @@ fixarg(union ref *r, struct instr *ins, struct block *blk, int *curi) /* float immediates & 64bit immediates are loaded from memory */ uchar data[8]; uint ksiz = cls2siz[con->cls]; + union type ctype; if (con->cls <= KPTR && in_range(ins->op, Ocopy, Omove)) /* in this case we can use movabs */ return; - if (con->cls != KF4) wr64le(data, con->i); - else { + if (con->cls != KF4) { + wr64le(data, con->i); + ctype = mktype(con->cls == KF8 ? TYDOUBLE : TYVLONG); + } else { union { float f; int i; } pun = { con->f }; wr32le(data, pun.i); + ctype = mktype(TYFLOAT); } - *r = mkdatref(NULL, ksiz, /*align*/ksiz, data, ksiz, /*deref*/1); + *r = mkdatref(NULL, ctype, ksiz, /*align*/ksiz, data, ksiz, /*deref*/1); if (&ins->l != r && ins->l.t == RADDR) { /* can't use memory arg in rhs if lhs is memory */ *r = insertinstr(blk, (*curi)++, mkinstr(Ocopy, con->cls, *r)); |