This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
speed up Xtensa GAS port
- From: Bob Wilson <bwilson at tensilica dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 20 Dec 2005 10:13:41 -0800
- Subject: speed up Xtensa GAS port
I'm committing this patch to speed up the Xtensa port of GAS. It makes a minor
change to the order of fields in the "vliw_insn" structure so that most of the
fields can be zero'ed with a single memset call. It also adds a small
optimization for the common case of an instruction with a single operation slot.
Tested with no regressions for an xtensa-elf target.
2005-12-20 Sterling Augustine <sterling@tensilica.com>
* config/tc-xtensa.c (xg_find_narrowest_format): Optimize 1 slot case.
(xg_init_vinsn): Remove redundant initialization.
(xg_clear_vinsn): Zero all the slots with a single memset.
* config/xtensa-istack.h (vliw_insn): Move insnbuf field after slots.
Index: config/tc-xtensa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xtensa.c,v
retrieving revision 1.49
diff -u -p -r1.49 tc-xtensa.c
--- config/tc-xtensa.c 27 Oct 2005 22:16:31 -0000 1.49
+++ config/tc-xtensa.c 20 Dec 2005 17:51:13 -0000
@@ -6403,6 +6403,9 @@ xg_find_narrowest_format (vliw_insn *vin
vliw_insn v_copy = *vinsn;
xtensa_opcode nop_opcode = xtensa_nop_opcode;
+ if (vinsn->num_slots == 1)
+ return xg_get_single_format (vinsn->slots[0].opcode);
+
for (format = 0; format < xtensa_isa_num_formats (isa); format++)
{
v_copy = *vinsn;
@@ -11417,8 +11420,6 @@ xg_init_vinsn (vliw_insn *v)
for (i = 0; i < MAX_SLOTS; i++)
{
- tinsn_init (&v->slots[i]);
- v->slots[i].opcode = XTENSA_UNDEFINED;
v->slotbuf[i] = xtensa_insnbuf_alloc (isa);
if (v->slotbuf[i] == NULL)
as_fatal (_("out of memory"));
@@ -11430,6 +11431,9 @@ static void
xg_clear_vinsn (vliw_insn *v)
{
int i;
+
+ memset (v, 0, offsetof (vliw_insn, insnbuf));
+
v->format = XTENSA_UNDEFINED;
v->num_slots = 0;
v->inside_bundle = FALSE;
@@ -11438,10 +11442,7 @@ xg_clear_vinsn (vliw_insn *v)
debug_type = xt_saved_debug_type;
for (i = 0; i < MAX_SLOTS; i++)
- {
- memset (&v->slots[i], 0, sizeof (TInsn));
- v->slots[i].opcode = XTENSA_UNDEFINED;
- }
+ v->slots[i].opcode = XTENSA_UNDEFINED;
}
Index: config/xtensa-istack.h
===================================================================
RCS file: /cvs/src/src/gas/config/xtensa-istack.h,v
retrieving revision 1.6
diff -u -p -r1.6 xtensa-istack.h
--- config/xtensa-istack.h 17 Oct 2005 18:17:08 -0000 1.6
+++ config/xtensa-istack.h 20 Dec 2005 17:51:13 -0000
@@ -89,10 +89,10 @@ expressionS *tinsn_get_tok (TInsn *, int
typedef struct vliw_insn
{
xtensa_format format;
- xtensa_insnbuf insnbuf;
int num_slots;
unsigned int inside_bundle;
TInsn slots[MAX_SLOTS];
+ xtensa_insnbuf insnbuf;
xtensa_insnbuf slotbuf[MAX_SLOTS];
} vliw_insn;