]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Optimize disassembler a bit.
authorUlrich Drepper <drepper@redhat.com>
Fri, 11 Jan 2008 06:55:16 +0000 (06:55 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 11 Jan 2008 06:55:16 +0000 (06:55 +0000)
libcpu/ChangeLog
libcpu/i386_data.h

index d4280cbfd1d73909dcc3a58e7e94b332d2e8899b..4790dd1228d47596f1697c97df01489230992a8c 100644 (file)
@@ -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
index 7815dbc2f04f150c5c267426f8462deadc6258e3..c1f2d5e737855768326260842cedc8a5c3790d1e 100644 (file)
@@ -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");
 }