optimisation for default_print_insn().
matthew green
mrg@cygnus.com
Mon Apr 9 03:58:00 GMT 2001
hi folks.
i've been looking at the cgen generated disassemblers lately
and i've noticed that it reads target memory twice for the
initial portion of the instruction. in default_print_insn(),
there is a call to (*info->read_memory_func)() and then it
calls print_insn(). the first thing print_insn() does is
call read_insn() which performs the exact same read_memory_func
call (same arguments, buffers, etc.) as read_insn() is used
in other places, i believe the best way to fix this double
read is to remove the copy in default_print_insn(). i have
tested this with a couple of ports and nothing appeas to be
broken.
the patch below simply comments the block in
default_print_insn() rather than removing it entirely. if
people think it should be removed, i can change my patch.
OK to commit?
.mrg.
2001-04-09 matthew green <mrg@redhat.com>
* cgen-dis.in (default_print_insn): Remove redundant call to
(*info->read_memory_func)().
Index: cgen-dis.in
===================================================================
RCS file: /cvs/src/src/opcodes/cgen-dis.in,v
retrieving revision 1.5
diff -p -r1.5 cgen-dis.in
*** cgen-dis.in 2001/01/09 17:00:21 1.5
--- cgen-dis.in 2001/04/09 10:55:03
*************** default_print_insn (cd, pc, info)
*** 319,324 ****
--- 319,325 ----
char buf[CGEN_MAX_INSN_SIZE];
int status;
+ #if 0 /* Done in print_insn(). */
/* Read the base part of the insn. */
status = (*info->read_memory_func) (pc, buf, cd->base_insn_bitsize / 8, info);
*************** default_print_insn (cd, pc, info)
*** 327,332 ****
--- 328,334 ----
(*info->memory_error_func) (status, pc, info);
return -1;
}
+ #endif
return print_insn (cd, pc, info, buf, cd->base_insn_bitsize / 8);
}
More information about the Binutils
mailing list