DECL_FIELD_CONTEXT (f_cs) = sjlj_fc_type_node;
tmp = build_index_type (build_int_cst (NULL_TREE, 4 - 1));
- tmp = build_array_type (lang_hooks.types.type_for_mode (word_mode, 1),
+ tmp = build_array_type (lang_hooks.types.type_for_mode
+ (targetm.unwind_word_mode (), 1),
tmp);
f_data = build_decl (FIELD_DECL, get_identifier ("__data"), tmp);
DECL_FIELD_CONTEXT (f_data) = sjlj_fc_type_node;
void
init_eh_for_function (void)
{
- cfun->eh = ggc_alloc_cleared (sizeof (struct eh_status));
+ cfun->eh = GGC_CNEW (struct eh_status);
}
\f
/* Routines to generate the exception tree somewhat directly.
#endif
/* Insert a new blank region as a leaf in the tree. */
- new = ggc_alloc_cleared (sizeof (*new));
+ new = GGC_CNEW (struct eh_region);
new->type = type;
new->outer = outer;
if (outer)
cfun->eh->region_array, region_nr);
gcc_assert (!reg->resume);
+ do_pending_stack_adjust ();
reg->resume = emit_jump_insn (gen_rtx_RESX (VOIDmode, region_nr));
emit_barrier ();
}
struct eh_region *r;
rtx insn;
- uid_region_num = xcalloc (get_max_uid (), sizeof(int));
- reachable = xcalloc (cfun->eh->last_region_number + 1, sizeof(bool));
+ uid_region_num = XCNEWVEC (int, get_max_uid ());
+ reachable = XCNEWVEC (bool, cfun->eh->last_region_number + 1);
for (i = cfun->eh->last_region_number; i > 0; --i)
{
LABEL_PRESERVE_P (label) = 1;
- entry = ggc_alloc (sizeof (*entry));
+ entry = GGC_NEW (struct ehl_map_entry);
entry->label = label;
entry->region = region;
{
eh_region ret, n;
- ret = n = ggc_alloc (sizeof (struct eh_region));
+ ret = n = GGC_NEW (struct eh_region);
*n = *old;
n->outer = outer;
r->landing_pad = dispatch_label;
lp_info[i].action_index = collect_one_action_chain (ar_hash, r);
if (lp_info[i].action_index != -1)
- cfun->uses_eh_lsda = 1;
+ crtl->uses_eh_lsda = 1;
}
htab_delete (ar_hash);
emit_move_insn (mem, eh_personality_libfunc);
mem = adjust_address (fc, Pmode, sjlj_fc_lsda_ofs);
- if (cfun->uses_eh_lsda)
+ if (crtl->uses_eh_lsda)
{
char buf[20];
rtx sym;
static void
sjlj_emit_dispatch_table (rtx dispatch_label, struct sjlj_lp_info *lp_info)
{
+ enum machine_mode unwind_word_mode = targetm.unwind_word_mode ();
+ enum machine_mode filter_mode = targetm.eh_return_filter_mode ();
int i, first_reachable;
rtx mem, dispatch, seq, fc;
rtx before;
sjlj_fc_call_site_ofs);
dispatch = copy_to_reg (mem);
- mem = adjust_address (fc, word_mode, sjlj_fc_data_ofs);
- if (word_mode != ptr_mode)
+ mem = adjust_address (fc, unwind_word_mode, sjlj_fc_data_ofs);
+ if (unwind_word_mode != ptr_mode)
{
#ifdef POINTERS_EXTEND_UNSIGNED
mem = convert_memory_address (ptr_mode, mem);
}
emit_move_insn (crtl->eh.exc_ptr, mem);
- mem = adjust_address (fc, word_mode, sjlj_fc_data_ofs + UNITS_PER_WORD);
+ mem = adjust_address (fc, unwind_word_mode,
+ sjlj_fc_data_ofs + GET_MODE_SIZE (unwind_word_mode));
+ if (unwind_word_mode != filter_mode)
+ mem = convert_to_mode (filter_mode, mem, 0);
emit_move_insn (crtl->eh.filter, mem);
/* Jump to one of the directly reachable regions. */
static void
arh_to_landing_pad (struct eh_region *region, void *data)
{
- rtx *p_handlers = data;
+ rtx *p_handlers = (rtx *) data;
if (! *p_handlers)
*p_handlers = alloc_INSN_LIST (region->landing_pad, NULL_RTX);
}
static void
arh_to_label (struct eh_region *region, void *data)
{
- rtx *p_handlers = data;
+ rtx *p_handlers = (rtx *) data;
*p_handlers = alloc_INSN_LIST (region->label, *p_handlers);
}
return can_throw_external_1 (INTVAL (XEXP (note, 0)), false);
}
-/* Set TREE_NOTHROW and cfun->all_throwers_are_sibcalls. */
+/* Set TREE_NOTHROW and crtl->all_throwers_are_sibcalls. */
unsigned int
set_nothrow_function_flags (void)
TREE_NOTHROW (current_function_decl) = 1;
- /* Assume cfun->all_throwers_are_sibcalls until we encounter
+ /* Assume crtl->all_throwers_are_sibcalls until we encounter
something that can throw an exception. We specifically exempt
CALL_INSNs that are SIBLING_CALL_P, as these are really jumps,
and can't throw. Most CALL_INSNs are not SIBLING_CALL_P, so this
is optimistic. */
- cfun->all_throwers_are_sibcalls = 1;
+ crtl->all_throwers_are_sibcalls = 1;
if (! flag_exceptions)
return 0;
if (!CALL_P (insn) || !SIBLING_CALL_P (insn))
{
- cfun->all_throwers_are_sibcalls = 0;
+ crtl->all_throwers_are_sibcalls = 0;
return 0;
}
}
- for (insn = current_function_epilogue_delay_list; insn;
+ for (insn = crtl->epilogue_delay_list; insn;
insn = XEXP (insn, 1))
if (can_throw_external (insn))
{
if (!CALL_P (insn) || !SIBLING_CALL_P (insn))
{
- cfun->all_throwers_are_sibcalls = 0;
+ crtl->all_throwers_are_sibcalls = 0;
return 0;
}
}
{
/* Set this so all the registers get saved in our frame; we need to be
able to copy the saved values for any registers from frames we unwind. */
- current_function_saves_all_registers = 1;
+ crtl->saves_all_registers = 1;
#ifdef SETUP_FRAME_ADDRESSES
SETUP_FRAME_ADDRESSES ();
if (! crtl->eh.ehr_label)
return;
- current_function_calls_eh_return = 1;
+ crtl->calls_eh_return = 1;
#ifdef EH_RETURN_STACKADJ_RTX
emit_move_insn (EH_RETURN_STACKADJ_RTX, const0_rtx);
extend = 1;
#endif
- return convert_modes (word_mode, ptr_mode, addr, extend);
+ return convert_modes (targetm.unwind_word_mode (), ptr_mode, addr, extend);
}
\f
/* In the following functions, we represent entries in the action table
if ((new = *slot) == NULL)
{
- new = xmalloc (sizeof (*new));
+ new = XNEW (struct action_record);
new->offset = VARRAY_ACTIVE_SIZE (crtl->eh.action_record_data) + 1;
new->filter = filter;
new->next = next;
{
call_site_record record;
- record = ggc_alloc (sizeof (struct call_site_record));
+ record = GGC_NEW (struct call_site_record);
record->landing_pad = landing_pad;
record->action = action;
/* Existence of catch handlers, or must-not-throw regions
implies that an lsda is needed (even if empty). */
if (this_action != -1)
- cfun->uses_eh_lsda = 1;
+ crtl->uses_eh_lsda = 1;
/* Delay creation of region notes for no-action regions
until we're sure that an lsda will be required. */
static int
dw2_size_of_call_site_table (void)
{
- int n = cfun->eh->call_site_data_used;
+ int n = VEC_length (call_site_record, crtl->eh.call_site_record);
int size = n * (4 + 4 + 4);
int i;
for (i = 0; i < n; ++i)
{
- struct call_site_record *cs = &cfun->eh->call_site_data[i];
+ struct call_site_record *cs = VEC_index (call_site_record, crtl->eh.call_site_record, i);
size += size_of_uleb128 (cs->action);
}
static int
sjlj_size_of_call_site_table (void)
{
- int n = cfun->eh->call_site_data_used;
+ int n = VEC_length (call_site_record, crtl->eh.call_site_record);
int size = 0;
int i;
for (i = 0; i < n; ++i)
{
- struct call_site_record *cs = &cfun->eh->call_site_data[i];
+ struct call_site_record *cs = VEC_index (call_site_record, crtl->eh.call_site_record, i);
size += size_of_uleb128 (INTVAL (cs->landing_pad));
size += size_of_uleb128 (cs->action);
}
#ifdef HAVE_LD_EH_GC_SECTIONS
if (flag_function_sections)
{
- char *section_name = xmalloc (strlen (fnname) + 32);
+ char *section_name = XNEWVEC (char, strlen (fnname) + 32);
sprintf (section_name, ".gcc_except_table.%s", fnname);
s = get_section (section_name, flags, NULL);
free (section_name);
int tt_format_size = 0;
/* Not all functions need anything. */
- if (! cfun->uses_eh_lsda)
+ if (! crtl->uses_eh_lsda)
return;
if (eh_personality_libfunc)