From d8392fd9d7709174f48de10328a8de1eb7d48cd0 Mon Sep 17 00:00:00 2001 From: Sterling Augustine Date: Thu, 20 Aug 2009 18:12:21 +0000 Subject: [PATCH] 2009-08-20 Sterling Augustine * config/tc-xtensa.c (xg_copy_vinsn): New function. (finish_vinsn): Call xg_copy_vinsn. --- gas/ChangeLog | 5 +++++ gas/config/tc-xtensa.c | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 2292534..624e7c9 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2009-08-20 Sterling Augustine + + * config/tc-xtensa.c (xg_copy_vinsn): New function. + (finish_vinsn): Call xg_copy_vinsn. + 2009-08-19 Sterling Augustine * config/tc-xtensa.h (xtensa_frag_data): Rename unused field fr_prev diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 645af97..fdca232 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -527,6 +527,7 @@ static int get_num_stack_literal_bytes (IStack *); /* vliw_insn functions. */ static void xg_init_vinsn (vliw_insn *); +static void xg_copy_vinsn (vliw_insn *, vliw_insn *); static void xg_clear_vinsn (vliw_insn *); static bfd_boolean vinsn_has_specific_opcodes (vliw_insn *); static void xg_free_vinsn (vliw_insn *); @@ -6653,7 +6654,6 @@ xg_find_narrowest_format (vliw_insn *vinsn) xtensa_isa isa = xtensa_default_isa; xtensa_format format; - vliw_insn v_copy = *vinsn; xtensa_opcode nop_opcode = xtensa_nop_opcode; if (vinsn->num_slots == 1) @@ -6661,7 +6661,8 @@ xg_find_narrowest_format (vliw_insn *vinsn) for (format = 0; format < xtensa_isa_num_formats (isa); format++) { - v_copy = *vinsn; + vliw_insn v_copy; + xg_copy_vinsn (&v_copy, vinsn); if (xtensa_format_num_slots (isa, format) == v_copy.num_slots) { int slot; @@ -6696,7 +6697,7 @@ xg_find_narrowest_format (vliw_insn *vinsn) } if (fit == v_copy.num_slots) { - *vinsn = v_copy; + xg_copy_vinsn (vinsn, &v_copy); xtensa_format_encode (isa, format, vinsn->insnbuf); vinsn->format = format; break; @@ -11702,6 +11703,16 @@ xg_clear_vinsn (vliw_insn *v) } +static void +xg_copy_vinsn (vliw_insn *dst, vliw_insn *src) +{ + memcpy (dst, src, + offsetof(vliw_insn, slots) + src->num_slots * sizeof(TInsn)); + dst->insnbuf = src->insnbuf; + memcpy (dst->slotbuf, src->slotbuf, src->num_slots * sizeof(xtensa_insnbuf)); +} + + static bfd_boolean vinsn_has_specific_opcodes (vliw_insn *v) { -- 2.7.4