diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-01-11 06:55:16 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-01-11 06:55:16 +0000 |
commit | 6bc105fc2c2eb312d08db00b50f419ffbcc189f7 (patch) | |
tree | dd8ce8045530a5376fab6c567da74da46190345c /libcpu | |
parent | 96a739922f7bc651ecfacaf9c70168b015ec5e96 (diff) | |
download | elfutils-6bc105fc2c2eb312d08db00b50f419ffbcc189f7.tar.gz |
Optimize disassembler a bit.
Diffstat (limited to 'libcpu')
-rw-r--r-- | libcpu/ChangeLog | 4 | ||||
-rw-r--r-- | libcpu/i386_data.h | 28 |
2 files changed, 15 insertions, 17 deletions
diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog index d4280cbf..4790dd12 100644 --- a/libcpu/ChangeLog +++ b/libcpu/ChangeLog @@ -1,5 +1,9 @@ 2008-01-10 Ulrich Drepper <drepper@redhat.com> + * i386_data.h (FCT_crdb): New function. + (FCT_ccc): Use FCT_crdb. + (FCT_ddd): Likewise. + * defs/i386: Fix a few instructions with immediate arguments. * i386_disasm.c: Rewrite interface to callback functions for operands diff --git a/libcpu/i386_data.h b/libcpu/i386_data.h index 7815dbc2..c1f2d5e7 100644 --- a/libcpu/i386_data.h +++ b/libcpu/i386_data.h @@ -537,7 +537,8 @@ FCT_ax$w (struct output_data *d) static int -FCT_ccc (struct output_data *d) +__attribute__ ((noinline)) +FCT_crdb (struct output_data *d, const char *regstr) { if (*d->prefixes & has_data16) return -1; @@ -548,8 +549,8 @@ FCT_ccc (struct output_data *d) assert (d->opoff1 / 8 == 2); assert (d->opoff1 % 8 == 2); size_t avail = d->bufsize - *bufcntp; - int needed = snprintf (&d->bufp[*bufcntp], avail, "%%cr%" PRIx32, - (uint32_t) (d->data[d->opoff1 / 8] >> 3) & 7); + int needed = snprintf (&d->bufp[*bufcntp], avail, "%%%s%" PRIx32, + regstr, (uint32_t) (d->data[d->opoff1 / 8] >> 3) & 7); if ((size_t) needed > avail) return needed - avail; *bufcntp += needed; @@ -558,23 +559,16 @@ FCT_ccc (struct output_data *d) static int -FCT_ddd (struct output_data *d) +FCT_ccc (struct output_data *d) { - if (*d->prefixes & has_data16) - return -1; + return FCT_crdb (d, "cr"); +} - size_t *bufcntp = d->bufcntp; - // XXX If this assert is true, use absolute offset below - assert (d->opoff1 / 8 == 2); - assert (d->opoff1 % 8 == 2); - size_t avail = d->bufsize - *bufcntp; - int needed = snprintf (&d->bufp[*bufcntp], avail, "%%db%" PRIx32, - (uint32_t) (d->data[d->opoff1 / 8] >> 3) & 7); - if ((size_t) needed > avail) - return needed - avail; - *bufcntp += needed; - return 0; +static int +FCT_ddd (struct output_data *d) +{ + return FCT_crdb (d, "db"); } |