summaryrefslogtreecommitdiff
path: root/libcpu/i386_data.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-01-11 06:55:16 +0000
committerUlrich Drepper <drepper@redhat.com>2008-01-11 06:55:16 +0000
commit6bc105fc2c2eb312d08db00b50f419ffbcc189f7 (patch)
treedd8ce8045530a5376fab6c567da74da46190345c /libcpu/i386_data.h
parent96a739922f7bc651ecfacaf9c70168b015ec5e96 (diff)
downloadelfutils-6bc105fc2c2eb312d08db00b50f419ffbcc189f7.tar.gz
Optimize disassembler a bit.
Diffstat (limited to 'libcpu/i386_data.h')
-rw-r--r--libcpu/i386_data.h28
1 files changed, 11 insertions, 17 deletions
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");
}