From 65738a7dbcb8f057258b0e3c6391a45c80f1dcc8 Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Tue, 20 Dec 2005 18:13:32 +0000 Subject: [PATCH] * 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. --- gas/ChangeLog | 7 +++++++ gas/config/tc-xtensa.c | 13 +++++++------ gas/config/xtensa-istack.h | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index c39cf3def03..a8df9a3f4a6 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2005-12-20 Sterling Augustine + + * 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. + 2005-12-20 Nathan Sidwell * doc/t-mt.texi: Update MS1 to MT. diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 57fb7b27b24..6b1b1786d62 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -6403,6 +6403,9 @@ xg_find_narrowest_format (vliw_insn *vinsn) 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; } diff --git a/gas/config/xtensa-istack.h b/gas/config/xtensa-istack.h index c7eaad7e275..248e73f3700 100644 --- a/gas/config/xtensa-istack.h +++ b/gas/config/xtensa-istack.h @@ -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; -- 2.30.2