+2009-08-21 Sterling Augustine <sterling@jaw.hq.tensilica.com>
+
+ * config/tc-xtensa.c (config_max_slots): New global variable.
+ (md_begin): Set config_max_slots.
+ (total_frag_text_expansion): Use config_max_slots instead of
+ MAX_SLOTS.
+ (xg_init_vinsn): Likewise.
+ (xg_clear_vinsn): Likewise.
+ (xg_free_vinsn): Likewise.
+
2009-08-20 Sterling Augustine <sterling@jaw.hq.tensilica.com>
* config/tc-xtensa.c (xg_copy_vinsn): New function.
static xtensa_opcode xtensa_retw_n_opcode;
static xtensa_opcode xtensa_rsr_lcount_opcode;
static xtensa_opcode xtensa_waiti_opcode;
+static int config_max_slots = 0;
\f
/* Command-line Options. */
segT current_section = now_seg;
int current_subsec = now_subseg;
xtensa_isa isa;
+ int i;
xtensa_default_isa = xtensa_isa_init (0, 0);
isa = xtensa_default_isa;
subseg_set (current_section, current_subsec);
- xg_init_vinsn (&cur_vinsn);
-
xtensa_addi_opcode = xtensa_opcode_lookup (isa, "addi");
xtensa_addmi_opcode = xtensa_opcode_lookup (isa, "addmi");
xtensa_call0_opcode = xtensa_opcode_lookup (isa, "call0");
xtensa_rsr_lcount_opcode = xtensa_opcode_lookup (isa, "rsr.lcount");
xtensa_waiti_opcode = xtensa_opcode_lookup (isa, "waiti");
+ for (i = 0; i < xtensa_isa_num_formats (isa); i++)
+ {
+ int format_slots = xtensa_format_num_slots (isa, i);
+ if (format_slots > config_max_slots)
+ config_max_slots = format_slots;
+ }
+
+ xg_init_vinsn (&cur_vinsn);
+
xtensa_num_pipe_stages = xtensa_isa_num_pipe_stages (isa);
init_op_placement_info_table ();
int slot;
int total_expansion = 0;
- for (slot = 0; slot < MAX_SLOTS; slot++)
+ for (slot = 0; slot < config_max_slots; slot++)
total_expansion += fragP->tc_frag_data.text_expansion[slot];
return total_expansion;
if (v->insnbuf == NULL)
as_fatal (_("out of memory"));
- for (i = 0; i < MAX_SLOTS; i++)
+ for (i = 0; i < config_max_slots; i++)
{
v->slotbuf[i] = xtensa_insnbuf_alloc (isa);
if (v->slotbuf[i] == NULL)
{
int i;
- memset (v, 0, offsetof (vliw_insn, insnbuf));
+ memset (v, 0, offsetof (vliw_insn, slots)
+ + sizeof(TInsn) * config_max_slots);
v->format = XTENSA_UNDEFINED;
v->num_slots = 0;
if (xt_saved_debug_type != DEBUG_NONE)
debug_type = xt_saved_debug_type;
- for (i = 0; i < MAX_SLOTS; i++)
+ for (i = 0; i < config_max_slots; i++)
v->slots[i].opcode = XTENSA_UNDEFINED;
}
{
int i;
xtensa_insnbuf_free (xtensa_default_isa, v->insnbuf);
- for (i = 0; i < MAX_SLOTS; i++)
+ for (i = 0; i < config_max_slots; i++)
xtensa_insnbuf_free (xtensa_default_isa, v->slotbuf[i]);
}