diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-11-09 14:44:02 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-11-09 14:44:02 -0800 |
commit | 34f6fb0a65b247442afcb2148c8c80112ab4cd59 (patch) | |
tree | d6de82ace10cb5da3709efc3e83b37f60a3766ce /listing.c | |
parent | 7eaf919a22fa70208eea4de37ddccc344dd49ad8 (diff) | |
download | nasm-34f6fb0a65b247442afcb2148c8c80112ab4cd59.tar.gz nasm-34f6fb0a65b247442afcb2148c8c80112ab4cd59.tar.bz2 nasm-34f6fb0a65b247442afcb2148c8c80112ab4cd59.zip |
Don't combine type and size into a single argument
Don't combine type and size into a single argument; *every* backend
immediately breaks them apart, so it's really just a huge waste of
effort. Additionally, it avoids using short immediates in the
resulting code, which is a bad thing.
Diffstat (limited to 'listing.c')
-rw-r--r-- | listing.c | 55 |
1 files changed, 43 insertions, 12 deletions
@@ -125,18 +125,15 @@ static void list_out(int32_t offset, char *str) strcat(listdata, str); } -static void list_output(int32_t offset, const void *data, uint64_t type) +static void list_output(int32_t offset, const void *data, + enum out_type type, uint64_t size) { - uint64_t typ, size; - if (!listp || suppress || user_nolist) /* fbk - 9/2/00 */ return; - typ = type & OUT_TYPMASK; - size = type & OUT_SIZMASK; - - - if (typ == OUT_RAWDATA) { + switch (type) { + case OUT_RAWDATA: + { uint8_t const *p = data; char q[3]; while (size--) { @@ -145,7 +142,10 @@ static void list_output(int32_t offset, const void *data, uint64_t type) list_out(offset++, q); p++; } - } else if (typ == OUT_ADDRESS) { + break; + } + case OUT_ADDRESS: + { uint64_t d = *(int64_t *)data; char q[20]; uint8_t p[8], *r = p; @@ -182,7 +182,10 @@ static void list_output(int32_t offset, const void *data, uint64_t type) HEX(q + 3, p[1]); list_out(offset, q); } - } else if (typ == OUT_REL2ADR) { + break; + } + case OUT_REL2ADR: + { uint32_t d = *(int32_t *)data; char q[11]; uint8_t p[4], *r = p; @@ -193,7 +196,10 @@ static void list_output(int32_t offset, const void *data, uint64_t type) HEX(q + 1, p[0]); HEX(q + 3, p[1]); list_out(offset, q); - } else if (typ == OUT_REL4ADR) { + break; + } + case OUT_REL4ADR: + { uint32_t d = *(int32_t *)data; char q[11]; uint8_t p[4], *r = p; @@ -206,10 +212,35 @@ static void list_output(int32_t offset, const void *data, uint64_t type) HEX(q + 5, p[2]); HEX(q + 7, p[3]); list_out(offset, q); - } else if (typ == OUT_RESERVE) { + break; + } + case OUT_REL8ADR: + { + uint64_t d = *(int64_t *)data; + char q[19]; + uint8_t p[4], *r = p; + q[0] = '('; + q[17] = ')'; + q[18] = '\0'; + WRITEDLONG(r, d); + HEX(q + 1, p[0]); + HEX(q + 3, p[1]); + HEX(q + 5, p[2]); + HEX(q + 7, p[3]); + HEX(q + 9, p[4]); + HEX(q + 11, p[5]); + HEX(q + 13, p[6]); + HEX(q + 15, p[7]); + list_out(offset, q); + break; + } + case OUT_RESERVE: + { char q[20]; snprintf(q, sizeof(q), "<res %08"PRIX64">", size); list_out(offset, q); + break; + } } } |