aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ"orn Rennecke <joern.rennecke@st.com>2009-05-23 05:47:36 +0000
committerJ"orn Rennecke <joern.rennecke@st.com>2009-05-23 05:47:36 +0000
commit3a6b11559f469fe03dc08005b8fb8ce55a4007ad (patch)
tree1352e8ce3b86aeba54a5164dee326d5fa2acb13c
parentac2ddefb1346e45e5e5b0957b11e666a922bcb31 (diff)
* doc/tm.texi: Adjust struct machine_function documentation.
* gengtype.c (open_base_files): Don't emit START_TARGET_SPECIFIC. (finish_root_table): Emit END_TARGET_SPECIFIC. (write_roots): Don't return early for EXTRA_TARGET. Emit START_TARGET_SPECIFIC for each root. (main): Don't emit END_TARGET_SPECIFIC. * gengtype.h (pp_nest, no_extra_nest): Declare. * gengtype-lex.l (pp_nest, no_extra_nest): New variables. (TARGET_SCOPE/{EOID}): New pattern. (^{HWS}"#"{HWS}ifndef{HWS}EXTRA_TARGET[[:alnum:]_][^\n]*): Likewise. (^{HWS}"#"{HWS}ifndef{HWS}EXTRA_TARGET[^\n]*): Likewise. (^{HWS}"#"{HWS}if[^\n]*, ^{HWS}"#"{HWS}endif[^\n]*): Likewise. * function.c (free_after_compilation): Use MACHINE_FUNCTION. (allocate_struct_function_1): Likewise. * function.h (MACHINE_FUNCTION): Define. (struct function): Use machine_function_u for member machine. * gengtype-parse.c (token) [EXTRA_TARGET]: Loop till !no_extra_nest. * gentargtype.cc (u): Remove. (main): Use sizeof (cumulative_args_u). Emit definition for efine machine_function_u. * ggc.h (gt_pch_note_object): No longer target specific. * genmodes.c (struct mode_adjust): New member target. (new_adjust): Set target member. (emit_mode_adjustments): Skip adjustments for other targets. * Makefile.in (EXTRA_TARGET_RULES) <THIS-TARGET/target-gtypes.h>: Set _mf too. (target-types.h): Also emit machine_function_u definition. * config/i386/i386.h (CONDITIONAL_REGISTER_USAGE): Use MACHINE_FUNCTION. (ix86_stack_locals, ix86_varargs_gpr_size): Likewise. (ix86_varargs_fpr_size, ix86_optimize_mode_switching): Likewise. (ix86_current_function_needs_cld: Likewise. * config/i386/i386.c (ix86_cfun_abi, ix86_call_abi_override): Likewise. (ix86_maybe_switch_abi, ix86_frame_pointer_required): Likewise. (ix86_compute_frame_layout, ix86_expand_prologue): Likewise. (ix86_expand_epilogue, get_some_local_dynamic_name_1): Likewise. (x86_output_mi_thunk): Likewise. * config/sh/sh.c (calc_live_regs): Use INCOMING_ARGS_INFO. (sh_expand_prologue, sh_expand_epilogue): Likewise. (sh_builtin_saveregs, sh_va_start): Likewise. (initial_elimination_offset, sh_allocate_initial_value): Likewise. (sh_function_ok_for_sibcall): Likewise. * config/sh/sh.md (return, return_i): Likewise. (shcompact_return_tramp, shcompact_return_tramp_i): Likewise. * config/mxp/mxp.c (struct machine_function): Target specific. (mxp_expand_prologue, mxp_expand_epilogue): Use MACHINE_FUNCTION. * config/rs6000/rs6000.c (rs6000_emit_move): Likewise. (rs6000_emit_move, setup_incoming_varargs, rs6000_va_start): Likewise. (rs6000_secondary_memory_needed_rtx): Likewise. (rs6000_alloc_sdmode_stack_slot, rs6000_instantiate_decls): Likewise. (rs6000_get_some_local_dynamic_name, rs6000_stack_info): Likewise. (rs6000_savres_strategy): Likewise. * config/arc/arc-protos.h (regno_clobbered_p): Target specific. * config/arc/arc.c (arc_ccfsm_current): Use MACHINE_FUNCTION. (arc_compute_function_type, arc_compute_frame_size): Likewise. (arc_save_restore, arc_expand_prologue, arc_expand_epilogue): Likewise. (arc_delay_slots_for_epilogue, arc_ccfsm_cond_exec_p): Likewise. (arc_ccfsm_advance_to, arc_next_active_insn): Likewise. (arc_verify_short, output_short_suffix): Likewise. (arc_final_prescan_insn, arc_initial_elimination_offset): Likewise. (arc_reorg, arc_adjust_insn_length, arc_pad_return): Likewise. (arc_get_unalign, arc_clear_unalign, arc_toggle_unalign): Likewise. (arc_short_long, arc_scheduling_not_expected): Likewise. (machine_function): Rename to... (machine_function_t) ... this. Changed all users. * config/arc/arc.h (struct function): Not target specific. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/arc-milepost-branch@147815 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/Makefile.in21
-rw-r--r--gcc/config/arc/arc-protos.h2
-rw-r--r--gcc/config/arc/arc.c180
-rw-r--r--gcc/config/arc/arc.h3
-rw-r--r--gcc/config/i386/i386.c45
-rw-r--r--gcc/config/i386/i386.h15
-rw-r--r--gcc/config/mxp/mxp.c16
-rw-r--r--gcc/config/rs6000/rs6000.c59
-rw-r--r--gcc/config/sh/sh.c55
-rw-r--r--gcc/config/sh/sh.md8
-rw-r--r--gcc/doc/tm.texi3
-rw-r--r--gcc/function.c4
-rw-r--r--gcc/function.h5
-rw-r--r--gcc/gengtype-lex.l10
-rw-r--r--gcc/gengtype-parse.c9
-rw-r--r--gcc/gengtype.c13
-rw-r--r--gcc/gengtype.h1
-rw-r--r--gcc/genmodes.c18
-rw-r--r--gcc/gentargtype.cc17
-rw-r--r--gcc/ggc.h2
20 files changed, 281 insertions, 205 deletions
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 420775bc5bf..e13b5ae0838 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3491,7 +3491,7 @@ make-THIS-TARGET : THIS-TARGET/Makefile $(XTGT_COPY_FILES) \
$(XTGT_COPY_FILES): THIS-TARGET/% : %
cp $< $@
THIS-TARGET/target-gtypes.h: target-gtypes.h
- sed 's/_ca/THIS_TARGET&/' < $< > $@
+ sed 's/\(_ca\|_mf\)/THIS_TARGET&/' < $< > $@
endef
# EXTRA_TARGET_RULES
@@ -3528,16 +3528,27 @@ target-types.h: Makefile T-extra $(foreach ta,$(EXTRA_TARGETS),$(ta)/T-extra $($
$(foreach file,$($(ta:%_=%)tm_include_list),\
echo '#include "$(file)"';)\
echo 'typedef CUMULATIVE_ARGS $(subst -,_,$(ta))cumulative_args;';\
+ echo 'typedef struct machine_function *$(subst -,_,$(ta))machine_function;';\
echo '}';\
- echo 'using $(subst -,_,$(ta)::$(ta))cumulative_args;') \
+ echo 'using $(subst -,_,$(ta)::$(ta))cumulative_args;'; \
+ echo 'using $(subst -,_,$(ta)::$(ta))machine_function;') \
| cpp -I $(srcdir) >> $@;)
+ echo '' >> $@
echo 'typedef union {' >> $@
$(foreach num,$(call enumerate,_ $(EXTRA_TARGETS)),\
$(foreach ta,$(subst -,_,$(word $(num), _ $(EXTRA_TARGETS:%=%_))),\
- echo '$(ta)cumulative_args GTY ((tag ("$(num) - 1"))) \
+ echo ' $(ta)cumulative_args GTY ((tag ("$(num) - 1"))) \
$(ta)ca;' >> $@;)) \
echo ' void *GTY ((default, skip)) align_dummy[1];' >> $@
echo '} cumulative_args_u;' >> $@
+ echo '' >> $@
+ echo 'typedef union {' >> $@
+ $(foreach num,$(call enumerate,_ $(EXTRA_TARGETS)),\
+ $(foreach ta,$(subst -,_,$(word $(num), _ $(EXTRA_TARGETS:%=%_))),\
+ echo ' $(ta)machine_function GTY ((tag ("$(num) - 1"))) \
+ $(ta)mf;' >> $@;)) \
+ echo ' void *GTY ((default, skip)) align_dummy[1];' >> $@
+ echo '} machine_function_u;' >> $@
echo '#endif /* TARGET_TYPES_H */' >> $@
target-gtypes.h: build/gentargtype$(build_exeext)
$(RUN_GEN) build/gentargtype$(build_exeext) > $@
@@ -3548,6 +3559,10 @@ target-types.h target-gtypes.h: Makefile
echo ' {' >> $@
echo ' CUMULATIVE_ARGS GTY ((tag ("TARGET_NUM"))) _ca;' >> $@
echo ' } cumulative_args_u;' >> $@
+ echo 'typedef union GTY (())' >> $@
+ echo ' {' >> $@
+ echo ' struct machine_function GTY ((tag ("TARGET_NUM"))) _mf;' >> $@
+ echo ' } machine_function_u;' >> $@
endif # !EXTRA_TARGETS
EXTRA_OBJS := $(EXTRA_OBJS) \
$(foreach ta,$(EXTRA_TARGETS),$(addprefix $(ta)/,$($(ta)-EXTRA_OBJS)))
diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h
index d0eb9a36c02..b1d3aea6d23 100644
--- a/gcc/config/arc/arc-protos.h
+++ b/gcc/config/arc/arc-protos.h
@@ -20,9 +20,7 @@ along with GCC; see the file COPYING3. If not see
#ifdef RTX_CODE
/* For arc, insn-attrtab.c needs this, but does not include reload.h. */
-END_TARGET_SPECIFIC
extern int regno_clobbered_p (unsigned int, rtx, enum machine_mode, int);
-START_TARGET_SPECIFIC
#ifdef TREE_CODE
extern rtx arc_va_arg (tree, tree);
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 222e21769a1..f0aec41ecb4 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -87,7 +87,7 @@ struct arc_ccfsm GTY (())
int target_label;
};
-#define arc_ccfsm_current cfun->machine->ccfsm_current
+#define arc_ccfsm_current MACHINE_FUNCTION (*cfun)->ccfsm_current
#define ARC_CCFSM_BRANCH_DELETED_P(STATE) \
((STATE)->state == 1 || (STATE)->state == 2)
@@ -1705,7 +1705,7 @@ typedef struct machine_function GTY (())
rtx ccfsm_current_insn;
char arc_reorg_started;
char prescan_initialized;
-} machine_function;
+} machine_function_t;
/* Type of function DECL.
@@ -1717,7 +1717,7 @@ arc_compute_function_type (struct function *fun)
{
tree decl = fun->decl;
tree a;
- enum arc_function_type fn_type = fun->machine->fn_type;
+ enum arc_function_type fn_type = MACHINE_FUNCTION (*fun)->fn_type;
if (fn_type != ARC_FUNCTION_UNKNOWN)
return fn_type;
@@ -1748,7 +1748,7 @@ arc_compute_function_type (struct function *fun)
}
}
- return fun->machine->fn_type = fn_type;
+ return MACHINE_FUNCTION (*fun)->fn_type = fn_type;
}
#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM))
@@ -1769,7 +1769,7 @@ arc_compute_function_type (struct function *fun)
&& regno == PIC_OFFSET_TABLE_REGNUM) )
#define MUST_SAVE_RETURN_ADDR \
- (cfun->machine->frame_info.save_return_addr)
+ (MACHINE_FUNCTION (*cfun)->frame_info.save_return_addr)
/* Return non-zero if there are registers to be saved or loaded using
millicode thunks. We can only use consecutive sequences starting
@@ -1814,7 +1814,7 @@ arc_compute_frame_size (int size) /* size = # of var. bytes allocated. */
unsigned int gmask;
enum arc_function_type fn_type;
int interrupt_p;
- struct arc_frame_info *frame_info = &cfun->machine->frame_info;
+ struct arc_frame_info *frame_info = &MACHINE_FUNCTION (*cfun)->frame_info;
size = ARC_STACK_ALIGN (size);
@@ -1926,7 +1926,7 @@ arc_save_restore (rtx base_reg, unsigned int offset,
unsigned int gmask, int epilogue_p, int *first_offset)
{
int regno;
- struct arc_frame_info *frame = &cfun->machine->frame_info;
+ struct arc_frame_info *frame = &MACHINE_FUNCTION (*cfun)->frame_info;
rtx sibthunk_insn = NULL_RTX;
rtx extra_pop = NULL_RTX;
@@ -2077,7 +2077,7 @@ void
arc_expand_prologue (void)
{
int size = get_frame_size ();
- unsigned int gmask = cfun->machine->frame_info.gmask;
+ unsigned int gmask = MACHINE_FUNCTION (*cfun)->frame_info.gmask;
/* unsigned int frame_pointer_offset;*/
unsigned int frame_size_to_allocate;
/* (FIXME: The first store will use a PRE_MODIFY; this will usually be r13.
@@ -2088,9 +2088,9 @@ arc_expand_prologue (void)
size = ARC_STACK_ALIGN (size);
/* Compute/get total frame size */
- size = (!cfun->machine->frame_info.initialized
+ size = (!MACHINE_FUNCTION (*cfun)->frame_info.initialized
? arc_compute_frame_size (size)
- : cfun->machine->frame_info.total_size);
+ : MACHINE_FUNCTION (*cfun)->frame_info.total_size);
/* Keep track of frame size to be allocated */
frame_size_to_allocate = size;
@@ -2099,13 +2099,14 @@ arc_expand_prologue (void)
gcc_assert (!(size == 0 && gmask));
/* Allocate space for register arguments if this is a variadic function. */
- if (cfun->machine->frame_info.pretend_size != 0)
+ if (MACHINE_FUNCTION (*cfun)->frame_info.pretend_size != 0)
{
/* Ensure pretend_size is maximum of 8 * word_size */
- gcc_assert (cfun->machine->frame_info.pretend_size <= 32);
+ gcc_assert (MACHINE_FUNCTION (*cfun)->frame_info.pretend_size <= 32);
- frame_stack_add (-cfun->machine->frame_info.pretend_size);
- frame_size_to_allocate -= cfun->machine->frame_info.pretend_size;
+ frame_stack_add (-MACHINE_FUNCTION (*cfun)->frame_info.pretend_size);
+ frame_size_to_allocate
+ -= MACHINE_FUNCTION (*cfun)->frame_info.pretend_size;
}
/* The home-grown ABI says link register is saved first. */
@@ -2139,12 +2140,12 @@ arc_expand_prologue (void)
/* Save any needed call-saved regs (and call-used if this is an
interrupt handler) for ARCompact ISA. */
- if (TARGET_ARCOMPACT && cfun->machine->frame_info.reg_size)
+ if (TARGET_ARCOMPACT && MACHINE_FUNCTION (*cfun)->frame_info.reg_size)
{
- first_offset = -cfun->machine->frame_info.reg_size;
+ first_offset = -MACHINE_FUNCTION (*cfun)->frame_info.reg_size;
/* N.B. FRAME_POINTER_MASK and RETURN_ADDR_MASK are cleared in gmask. */
arc_save_restore (stack_pointer_rtx, 0, gmask, 0, &first_offset);
- frame_size_to_allocate -= cfun->machine->frame_info.reg_size;
+ frame_size_to_allocate -= MACHINE_FUNCTION (*cfun)->frame_info.reg_size;
} /* if */
@@ -2193,7 +2194,8 @@ arc_expand_prologue (void)
if (TARGET_A4)
{
- arc_save_restore (stack_pointer_rtx, cfun->machine->frame_info.reg_offset,
+ arc_save_restore (stack_pointer_rtx,
+ MACHINE_FUNCTION (*cfun)->frame_info.reg_offset,
/* The zeroing of these two bits is unnecessary,
but leave this in for clarity. */
gmask & ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK), 0, 0);
@@ -2214,19 +2216,20 @@ arc_expand_epilogue (int sibcall_p)
enum arc_function_type fn_type = arc_compute_function_type (cfun);
size = ARC_STACK_ALIGN (size);
- size = (!cfun->machine->frame_info.initialized
+ size = (!MACHINE_FUNCTION (*cfun)->frame_info.initialized
? arc_compute_frame_size (size)
- : cfun->machine->frame_info.total_size);
+ : MACHINE_FUNCTION (*cfun)->frame_info.total_size);
if (1)
{
- unsigned int pretend_size = cfun->machine->frame_info.pretend_size;
+ unsigned int pretend_size
+ = MACHINE_FUNCTION (*cfun)->frame_info.pretend_size;
unsigned int frame_size;
unsigned int size_to_deallocate;
int restored, fp_restored_p;
int can_trust_sp_p = !cfun->calls_alloca;
int first_offset = 0;
- int millicode_p = cfun->machine->frame_info.millicode_end_reg > 0;
+ int millicode_p = MACHINE_FUNCTION (*cfun)->frame_info.millicode_end_reg > 0;
size_to_deallocate = size;
@@ -2234,8 +2237,8 @@ arc_expand_epilogue (int sibcall_p)
frame_size = size - pretend_size;
else
frame_size = size - (pretend_size +
- cfun->machine->frame_info.reg_size +
- cfun->machine->frame_info.extra_size);
+ MACHINE_FUNCTION (*cfun)->frame_info.reg_size +
+ MACHINE_FUNCTION (*cfun)->frame_info.extra_size);
/* ??? There are lots of optimizations that can be done here.
EG: Use fp to restore regs if it's closer.
@@ -2264,12 +2267,12 @@ arc_expand_epilogue (int sibcall_p)
{
gcc_assert (0); /* Bitrot. */
#if 0
- if (cfun->machine->frame_info.reg_size)
+ if (MACHINE_FUNCTION (*cfun)->frame_info.reg_size)
arc_save_restore (stack_pointer_rtx,
- cfun->machine->frame_info.reg_offset,
+ MACHINE_FUNCTION (*cfun)->frame_info.reg_offset,
/* The zeroing of these two bits is unnecessary,
but leave this in for clarity. */
- cfun->machine->frame_info.gmask
+ MACHINE_FUNCTION (*cfun)->frame_info.gmask
& ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK), 1, 0);
if (MUST_SAVE_RETURN_ADDR)
fprintf (file, "\tld %s,[%s,%d]\n", reg_names[RETURN_ADDR_REGNUM],
@@ -2294,14 +2297,14 @@ arc_expand_epilogue (int sibcall_p)
*/
if (millicode_p)
{
- int sibthunk_p = (!sibcall_p
- && fn_type == ARC_FUNCTION_NORMAL
- && !cfun->machine->frame_info.pretend_size);
+ int sibthunk_p
+ = (!sibcall_p && fn_type == ARC_FUNCTION_NORMAL
+ && !MACHINE_FUNCTION (*cfun)->frame_info.pretend_size);
- gcc_assert (!(cfun->machine->frame_info.gmask
+ gcc_assert (!(MACHINE_FUNCTION (*cfun)->frame_info.gmask
& (FRAME_POINTER_MASK | RETURN_ADDR_MASK)));
arc_save_restore (stack_pointer_rtx, 0,
- cfun->machine->frame_info.gmask,
+ MACHINE_FUNCTION (*cfun)->frame_info.gmask,
1 + sibthunk_p, &first_offset);
if (sibthunk_p)
return;
@@ -2310,7 +2313,7 @@ arc_expand_epilogue (int sibcall_p)
a limm to be encoded in a PRE_MODIFY, yet we can add it with a
fast add to the stack pointer, do this now. */
if ((!SMALL_INT (first_offset)
- && cfun->machine->frame_info.gmask
+ && MACHINE_FUNCTION (*cfun)->frame_info.gmask
&& ((TARGET_ARC700 && !optimize_size)
? first_offset <= 0x800
: satisfies_constraint_C2a (GEN_INT (first_offset))))
@@ -2318,9 +2321,10 @@ arc_expand_epilogue (int sibcall_p)
address to restore, and they both would need a LIMM. */
|| (MUST_SAVE_RETURN_ADDR
&& !SMALL_INT
- ((cfun->machine->frame_info.reg_size + first_offset)
+ ((MACHINE_FUNCTION (*cfun)->frame_info.reg_size
+ + first_offset)
>> 2)
- && cfun->machine->frame_info.gmask))
+ && MACHINE_FUNCTION (*cfun)->frame_info.gmask))
{
frame_stack_add (first_offset);
first_offset = 0;
@@ -2328,13 +2332,13 @@ arc_expand_epilogue (int sibcall_p)
if (MUST_SAVE_RETURN_ADDR)
{
rtx ra = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM);
- int ra_offs = cfun->machine->frame_info.reg_size + first_offset;
+ int ra_offs = MACHINE_FUNCTION (*cfun)->frame_info.reg_size + first_offset;
rtx addr = plus_constant (stack_pointer_rtx, ra_offs);
/* If the load of blink would need a LIMM, but we can add
the offset quickly to sp, do the latter. */
if (!SMALL_INT (ra_offs >> 2)
- && !cfun->machine->frame_info.gmask
+ && !MACHINE_FUNCTION (*cfun)->frame_info.gmask
&& ((TARGET_ARC700 && !optimize_size)
? ra_offs <= 0x800
: satisfies_constraint_C2a (GEN_INT (ra_offs))))
@@ -2351,12 +2355,13 @@ arc_expand_epilogue (int sibcall_p)
restore. We also want a separate load if the combined insn
would need a limm, but a separate load doesn't. */
if (ra_offs
- && !cfun->machine->frame_info.gmask
+ && !MACHINE_FUNCTION (*cfun)->frame_info.gmask
&& (SMALL_INT (ra_offs) || !SMALL_INT (ra_offs >> 2)))
{
addr = gen_rtx_PRE_MODIFY (Pmode, stack_pointer_rtx, addr);
first_offset = 0;
- size_to_deallocate -= cfun->machine->frame_info.reg_size;
+ size_to_deallocate
+ -= MACHINE_FUNCTION (*cfun)->frame_info.reg_size;
}
else if (!ra_offs && size_to_deallocate == UNITS_PER_WORD)
{
@@ -2369,11 +2374,11 @@ arc_expand_epilogue (int sibcall_p)
if (!millicode_p)
{
- if (cfun->machine->frame_info.reg_size)
+ if (MACHINE_FUNCTION (*cfun)->frame_info.reg_size)
arc_save_restore (stack_pointer_rtx, 0,
/* The zeroing of these two bits is unnecessary,
but leave this in for clarity. */
- cfun->machine->frame_info.gmask
+ MACHINE_FUNCTION (*cfun)->frame_info.gmask
& ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK), 1, &first_offset);
}
@@ -2460,9 +2465,9 @@ arc_delay_slots_for_epilogue (void)
{
if (arc_compute_function_type (cfun) != ARC_FUNCTION_NORMAL)
return 0;
- if (!cfun->machine->frame_info.initialized)
+ if (!MACHINE_FUNCTION (*cfun)->frame_info.initialized)
(void) arc_compute_frame_size (get_frame_size ());
- if (cfun->machine->frame_info.total_size == 0)
+ if (MACHINE_FUNCTION (*cfun)->frame_info.total_size == 0)
return 1;
return 0;
}
@@ -2486,7 +2491,7 @@ arc_eligible_for_epilogue_delay (rtx trial,int slot)
/* ??? Note that this will always be true since only functions with
empty frames have epilogue delay slots. See
arc_delay_slots_for_epilogue. */
- && cfun->machine->frame_info.gmask == 0
+ && MACHINE_FUNCTION (*cfun)->frame_info.gmask == 0
&& ! reg_mentioned_p (stack_pointer_rtx, PATTERN (trial))
&& ! reg_mentioned_p (frame_pointer_rtx, PATTERN (trial)))
return 1;
@@ -3123,9 +3128,10 @@ arc_print_operand (FILE *file,rtx x,int code)
}
break;
case '&':
- if (TARGET_ANNOTATE_ALIGN && cfun->machine->size_reason)
- fprintf (file, "; %s. unalign: %d", cfun->machine->size_reason,
- cfun->machine->unalign);
+ if (TARGET_ANNOTATE_ALIGN && MACHINE_FUNCTION (*cfun)->size_reason)
+ fprintf (file, "; %s. unalign: %d",
+ MACHINE_FUNCTION (*cfun)->size_reason,
+ MACHINE_FUNCTION (*cfun)->unalign);
return;
default :
/* Unknown flag. */
@@ -3378,7 +3384,7 @@ unspec_prof_htab_eq (const void *x, const void *y)
4: make insns conditional
5: make insn conditional (only for outputting anulled delay slot insns)
- special value for cfun->machine->uid_ccfsm_state:
+ special value for MACHINE_FUNCTION (*cfun)->uid_ccfsm_state:
6: return with but one insn before it since function start / call
State transitions (state->state by whom, under what condition):
@@ -3789,14 +3795,14 @@ arc_ccfsm_record_branch_deleted (void)
int
arc_ccfsm_cond_exec_p (void)
{
- return (cfun->machine->prescan_initialized
+ return (MACHINE_FUNCTION (*cfun)->prescan_initialized
&& ARC_CCFSM_COND_EXEC_P (&arc_ccfsm_current));
}
void
arc_ccfsm_advance_to (rtx insn)
{
- struct machine_function *machine = cfun->machine;
+ struct machine_function *machine = MACHINE_FUNCTION (*cfun);
rtx scan = machine->ccfsm_current_insn;
int restarted = 0;
struct arc_ccfsm *statep = &arc_ccfsm_current;
@@ -3843,7 +3849,7 @@ arc_next_active_insn (rtx insn, struct arc_ccfsm *statep)
arc_ccfsm_advance (insn, statep);
}
while (NOTE_P (insn)
- || (cfun->machine->arc_reorg_started
+ || (MACHINE_FUNCTION (*cfun)->arc_reorg_started
&& LABEL_P (insn) && !label_to_alignment (insn))
|| (NONJUMP_INSN_P (insn)
&& (GET_CODE (PATTERN (insn)) == USE
@@ -3888,7 +3894,7 @@ arc_verify_short (rtx insn, int unalign, int check_attr)
int odd = 3; /* 0/2: (mis)alignment specified; 3: keep short. */
enum attr_iscompact iscompact;
struct machine_function *machine;
- const char **rp = &cfun->machine->size_reason;
+ const char **rp = &MACHINE_FUNCTION (*cfun)->size_reason;
int jump_p;
rtx this_sequence = NULL_RTX;
rtx recog_insn = recog_data.insn;
@@ -3899,7 +3905,7 @@ arc_verify_short (rtx insn, int unalign, int check_attr)
if (iscompact == ISCOMPACT_FALSE)
return 0;
}
- machine = cfun->machine;
+ machine = MACHINE_FUNCTION (*cfun);
if (machine->force_short_suffix >= 0)
return machine->force_short_suffix;
@@ -3988,7 +3994,7 @@ arc_verify_short (rtx insn, int unalign, int check_attr)
/* Basic block reordering calculates insn lengths while it has the insns
at the end of a basic block detached from the remainder of the insn
chain. */
- gcc_assert (next || !cfun->machine->arc_reorg_started);
+ gcc_assert (next || !MACHINE_FUNCTION (*cfun)->arc_reorg_started);
if (NEXT_INSN (prev) != insn)
this_sequence = PATTERN (NEXT_INSN (prev));
else if (next && PREV_INSN (next) != insn)
@@ -4238,10 +4244,10 @@ output_short_suffix (FILE *file)
{
rtx insn = current_output_insn;
- if (arc_verify_short (insn, cfun->machine->unalign, 1))
+ if (arc_verify_short (insn, MACHINE_FUNCTION (*cfun)->unalign, 1))
{
fprintf (file, "_s");
- cfun->machine->unalign ^= 2;
+ MACHINE_FUNCTION (*cfun)->unalign ^= 2;
}
/* Restore recog_operand. */
extract_insn_cached (insn);
@@ -4271,15 +4277,15 @@ arc_final_prescan_insn (rtx insn,rtx *opvec ATTRIBUTE_UNUSED,
/* Restore extraction data which might have been clobbered by arc_hazard. */
extract_constrain_insn_cached (insn);
- if (!cfun->machine->prescan_initialized)
+ if (!MACHINE_FUNCTION (*cfun)->prescan_initialized)
{
/* Clear lingering state from branch shortening. */
memset (&arc_ccfsm_current, 0, sizeof arc_ccfsm_current);
- cfun->machine->prescan_initialized = 1;
+ MACHINE_FUNCTION (*cfun)->prescan_initialized = 1;
}
arc_ccfsm_advance (insn, &arc_ccfsm_current);
- cfun->machine->size_reason = 0;
+ MACHINE_FUNCTION (*cfun)->size_reason = 0;
}
/* Define the offset between two registers, one to be eliminated, and
@@ -4288,7 +4294,7 @@ arc_final_prescan_insn (rtx insn,rtx *opvec ATTRIBUTE_UNUSED,
int
arc_initial_elimination_offset (int from,int to)
{
- if (! cfun->machine->frame_info.initialized)
+ if (! MACHINE_FUNCTION (*cfun)->frame_info.initialized)
arc_compute_frame_size (get_frame_size ());
if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
@@ -4296,26 +4302,26 @@ arc_initial_elimination_offset (int from,int to)
if (TARGET_A4)
return 0;
else
- return (cfun->machine->frame_info.extra_size
- + cfun->machine->frame_info.reg_size);
+ return (MACHINE_FUNCTION (*cfun)->frame_info.extra_size
+ + MACHINE_FUNCTION (*cfun)->frame_info.reg_size);
}
if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
{
- return (cfun->machine->frame_info.total_size
- - cfun->machine->frame_info.pretend_size);
+ return (MACHINE_FUNCTION (*cfun)->frame_info.total_size
+ - MACHINE_FUNCTION (*cfun)->frame_info.pretend_size);
}
if ((from == FRAME_POINTER_REGNUM) && (to == STACK_POINTER_REGNUM))
{
if (TARGET_A4)
- return (cfun->machine->frame_info.total_size
- - cfun->machine->frame_info.pretend_size);
+ return (MACHINE_FUNCTION (*cfun)->frame_info.total_size
+ - MACHINE_FUNCTION (*cfun)->frame_info.pretend_size);
else
- return (cfun->machine->frame_info.total_size
- - (cfun->machine->frame_info.pretend_size
- + cfun->machine->frame_info.extra_size
- + cfun->machine->frame_info.reg_size));
+ return (MACHINE_FUNCTION (*cfun)->frame_info.total_size
+ - (MACHINE_FUNCTION (*cfun)->frame_info.pretend_size
+ + MACHINE_FUNCTION (*cfun)->frame_info.extra_size
+ + MACHINE_FUNCTION (*cfun)->frame_info.reg_size));
}
gcc_unreachable ();
@@ -6133,7 +6139,7 @@ arc_reorg (void)
long offset;
int changed;
- cfun->machine->arc_reorg_started = 1;
+ MACHINE_FUNCTION (*cfun)->arc_reorg_started = 1;
arc_reorg_in_progress = 1;
/* Emit special sections for profiling. */
@@ -6391,7 +6397,7 @@ estimate required size increase).
/* Call shorten_branches to calculate the insn lengths */
shorten_branches (get_insns());
- cfun->machine->ccfsm_current_insn = NULL_RTX;
+ MACHINE_FUNCTION (*cfun)->ccfsm_current_insn = NULL_RTX;
if (!INSN_ADDRESSES_SET_P())
fatal_error ("Insn addresses not set after shorten_branches");
@@ -8116,10 +8122,10 @@ arc_adjust_insn_length (rtx insn, int len)
}
/* Rtl changes too much before arc_reorg to keep ccfsm state.
But we are not required to give exact answers then. */
- if (cfun->machine->arc_reorg_started
+ if (MACHINE_FUNCTION (*cfun)->arc_reorg_started
&& (JUMP_P (insn) || (len & 2)))
{
- struct arc_ccfsm *statep = &cfun->machine->ccfsm_current;
+ struct arc_ccfsm *statep = &MACHINE_FUNCTION (*cfun)->ccfsm_current;
arc_ccfsm_advance_to (insn);
switch (statep->state)
@@ -8313,7 +8319,7 @@ arc_pad_return (void)
if (!prev)
{
fputs ("\tnop_s\n", asm_out_file);
- cfun->machine->unalign ^= 2;
+ MACHINE_FUNCTION (*cfun)->unalign ^= 2;
want_long = 1;
}
/* If PREV is a sequence, we know it must be a branch / jump or a tailcall,
@@ -8331,11 +8337,11 @@ arc_pad_return (void)
: CALL_ATTR (prev, NON_SIBCALL)))
{
if (want_long)
- cfun->machine->size_reason
+ MACHINE_FUNCTION (*cfun)->size_reason
= "call/return and return/return must be 6 bytes apart to avoid mispredict";
- else if (TARGET_UNALIGN_BRANCH && cfun->machine->unalign)
+ else if (TARGET_UNALIGN_BRANCH && MACHINE_FUNCTION (*cfun)->unalign)
{
- cfun->machine->size_reason
+ MACHINE_FUNCTION (*cfun)->size_reason
= "Long unaligned jump avoids non-delay slot penalty";
want_long = 1;
}
@@ -8345,9 +8351,9 @@ arc_pad_return (void)
prev = XVECEXP (final_sequence, 0, 1);
gcc_assert (!prev_real_insn (insn)
|| !arc_hazard (prev_real_insn (insn), prev));
- cfun->machine->force_short_suffix = !want_long;
+ MACHINE_FUNCTION (*cfun)->force_short_suffix = !want_long;
final_scan_insn (prev, asm_out_file, optimize, 1, NULL);
- cfun->machine->force_short_suffix = -1;
+ MACHINE_FUNCTION (*cfun)->force_short_suffix = -1;
INSN_DELETED_P (prev) = 1;
current_output_insn = insn;
}
@@ -8356,7 +8362,7 @@ arc_pad_return (void)
else
{
fputs ("\tnop_s\n", asm_out_file);
- cfun->machine->unalign ^= 2;
+ MACHINE_FUNCTION (*cfun)->unalign ^= 2;
}
}
return;
@@ -8368,7 +8374,7 @@ arc_init_machine_status (void)
{
struct machine_function *machine;
machine =
- (machine_function *) ggc_alloc_cleared (sizeof (machine_function));
+ (machine_function_t *) ggc_alloc_cleared (sizeof (machine_function_t));
machine->fn_type = ARC_FUNCTION_UNKNOWN;
machine->force_short_suffix = -1;
@@ -8435,20 +8441,20 @@ arc_check_millicode (rtx op, int offset, int load_p)
int
arc_get_unalign (void)
{
- return cfun->machine->unalign;
+ return MACHINE_FUNCTION (*cfun)->unalign;
}
void
arc_clear_unalign (void)
{
if (cfun)
- cfun->machine->unalign = 0;
+ MACHINE_FUNCTION (*cfun)->unalign = 0;
}
void
arc_toggle_unalign (void)
{
- cfun->machine->unalign ^= 2;
+ MACHINE_FUNCTION (*cfun)->unalign ^= 2;
}
/* Operands 0..2 are the operands of a addsi which uses a 12 bit
@@ -8610,7 +8616,7 @@ arc_split_dilogic (rtx *operands, enum rtx_code code)
const char *
arc_short_long (rtx insn, const char *s_tmpl, const char *l_tmpl)
{
- int is_short = arc_verify_short (insn, cfun->machine->unalign, -1);
+ int is_short = arc_verify_short (insn, MACHINE_FUNCTION (*cfun)->unalign, -1);
extract_constrain_insn_cached (insn);
return is_short ? s_tmpl : l_tmpl;
@@ -8701,7 +8707,7 @@ arc_need_delay (rtx insn)
int
arc_scheduling_not_expected (void)
{
- return cfun->machine->arc_reorg_started;
+ return MACHINE_FUNCTION (*cfun)->arc_reorg_started;
}
/* Oddly enough, sometimes we get a zero overhead loop that branch
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 5007c28eaca..c7bcf434069 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -62,6 +62,8 @@ along with GCC; see the file COPYING3. If not see
/* ashwin : include options.h */
/* #include "options.h" */
+struct function;
+
START_TARGET_SPECIFIC
#undef ASM_SPEC
@@ -1930,7 +1932,6 @@ enum arc_function_type {
((TYPE) == ARC_FUNCTION_ILINK1 || (TYPE) == ARC_FUNCTION_ILINK2)
/* Compute the type of a function from its DECL. Needed for EPILOGUE_USES. */
-struct function;
extern enum arc_function_type arc_compute_function_type (struct function *);
/* Called by crtstuff.c to make calls to function FUNCTION that are defined in
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 47c9c311371..15f48a6eefd 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4589,7 +4589,7 @@ ix86_cfun_abi (void)
{
if (! cfun || ! TARGET_64BIT)
return DEFAULT_ABI;
- return cfun->machine->call_abi;
+ return MACHINE_FUNCTION (*cfun)->call_abi;
}
/* regclass.c */
@@ -4602,9 +4602,10 @@ void
ix86_call_abi_override (const_tree fndecl)
{
if (fndecl == NULL_TREE)
- cfun->machine->call_abi = DEFAULT_ABI;
+ MACHINE_FUNCTION (*cfun)->call_abi = DEFAULT_ABI;
else
- cfun->machine->call_abi = ix86_function_type_abi (TREE_TYPE (fndecl));
+ MACHINE_FUNCTION (*cfun)->call_abi
+ = ix86_function_type_abi (TREE_TYPE (fndecl));
}
/* MS and SYSV ABI have different set of call used registers. Avoid expensive
@@ -4614,7 +4615,7 @@ static void
ix86_maybe_switch_abi (void)
{
if (TARGET_64BIT &&
- call_used_regs[SI_REG] == (cfun->machine->call_abi == MS_ABI))
+ call_used_regs[SI_REG] == (MACHINE_FUNCTION (*cfun)->call_abi == MS_ABI))
reinit_regs ();
}
@@ -7252,7 +7253,7 @@ ix86_frame_pointer_required (void)
{
/* If we accessed previous frames, then the generated code expects
to be able to access the saved ebp value in our frame. */
- if (cfun->machine->accesses_prev_frame)
+ if (MACHINE_FUNCTION (*cfun)->accesses_prev_frame)
return 1;
/* Several x86 os'es need a frame pointer for other reasons,
@@ -7279,7 +7280,7 @@ ix86_frame_pointer_required (void)
void
ix86_setup_frame_addresses (void)
{
- cfun->machine->accesses_prev_frame = 1;
+ MACHINE_FUNCTION (*cfun)->accesses_prev_frame = 1;
}
#if (defined(HAVE_GAS_HIDDEN) && (SUPPORTS_ONE_ONLY - 0)) || TARGET_MACHO
@@ -7647,11 +7648,12 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
didn't change as reload does multiple calls to the function and does not
expect the decision to change within single iteration. */
if (!optimize_function_for_size_p (cfun)
- && cfun->machine->use_fast_prologue_epilogue_nregs != frame->nregs)
+ && (MACHINE_FUNCTION (*cfun)->use_fast_prologue_epilogue_nregs
+ != frame->nregs))
{
int count = frame->nregs;
- cfun->machine->use_fast_prologue_epilogue_nregs = count;
+ MACHINE_FUNCTION (*cfun)->use_fast_prologue_epilogue_nregs = count;
/* The fast prologue uses move instead of push to save registers. This
is significantly longer, but also executes faster as modern hardware
can execute the moves in parallel, but can't do that for push/pop.
@@ -7667,13 +7669,13 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
if (cfun->function_frequency < FUNCTION_FREQUENCY_NORMAL
|| (flag_branch_probabilities
&& cfun->function_frequency < FUNCTION_FREQUENCY_HOT))
- cfun->machine->use_fast_prologue_epilogue = false;
+ MACHINE_FUNCTION (*cfun)->use_fast_prologue_epilogue = false;
else
- cfun->machine->use_fast_prologue_epilogue
+ MACHINE_FUNCTION (*cfun)->use_fast_prologue_epilogue
= !expensive_function_p (count);
}
if (TARGET_PROLOGUE_USING_MOVE
- && cfun->machine->use_fast_prologue_epilogue)
+ && MACHINE_FUNCTION (*cfun)->use_fast_prologue_epilogue)
frame->save_regs_using_mov = true;
else
frame->save_regs_using_mov = false;
@@ -8181,9 +8183,10 @@ ix86_expand_prologue (void)
bool eax_live;
rtx t;
- gcc_assert (!TARGET_64BIT || cfun->machine->call_abi == MS_ABI);
+ gcc_assert (!TARGET_64BIT
+ || MACHINE_FUNCTION (*cfun)->call_abi == MS_ABI);
- if (cfun->machine->call_abi == MS_ABI)
+ if (MACHINE_FUNCTION (*cfun)->call_abi == MS_ABI)
eax_live = false;
else
eax_live = ix86_eax_live_at_start_p ();
@@ -8419,11 +8422,11 @@ ix86_expand_epilogue (int style)
tuning in future. */
if ((!sp_valid && (frame.nregs + frame.nsseregs) <= 1)
|| (TARGET_EPILOGUE_USING_MOVE
- && cfun->machine->use_fast_prologue_epilogue
+ && MACHINE_FUNCTION (*cfun)->use_fast_prologue_epilogue
&& ((frame.nregs + frame.nsseregs) > 1 || frame.to_allocate))
|| (frame_pointer_needed && !(frame.nregs + frame.nsseregs) && frame.to_allocate)
|| (frame_pointer_needed && TARGET_USE_LEAVE
- && cfun->machine->use_fast_prologue_epilogue
+ && MACHINE_FUNCTION (*cfun)->use_fast_prologue_epilogue
&& (frame.nregs + frame.nsseregs) == 1)
|| crtl->calls_eh_return)
{
@@ -8496,7 +8499,7 @@ ix86_expand_epilogue (int style)
style);
/* If not an i386, mov & pop is faster than "leave". */
else if (TARGET_USE_LEAVE || optimize_function_for_size_p (cfun)
- || !cfun->machine->use_fast_prologue_epilogue)
+ || !MACHINE_FUNCTION (*cfun)->use_fast_prologue_epilogue)
emit_insn ((*ix86_gen_leave) ());
else
{
@@ -10688,7 +10691,7 @@ get_some_local_dynamic_name_1 (rtx *px, void *data ATTRIBUTE_UNUSED)
if (GET_CODE (x) == SYMBOL_REF
&& SYMBOL_REF_TLS_MODEL (x) == TLS_MODEL_LOCAL_DYNAMIC)
{
- cfun->machine->some_ld_name = XSTR (x, 0);
+ MACHINE_FUNCTION (*cfun)->some_ld_name = XSTR (x, 0);
return 1;
}
@@ -10700,13 +10703,13 @@ get_some_local_dynamic_name (void)
{
rtx insn;
- if (cfun->machine->some_ld_name)
- return cfun->machine->some_ld_name;
+ if (MACHINE_FUNCTION (*cfun)->some_ld_name)
+ return MACHINE_FUNCTION (*cfun)->some_ld_name;
for (insn = get_insns (); insn ; insn = NEXT_INSN (insn))
if (INSN_P (insn)
&& for_each_rtx (&PATTERN (insn), get_some_local_dynamic_name_1, 0))
- return cfun->machine->some_ld_name;
+ return MACHINE_FUNCTION (*cfun)->some_ld_name;
gcc_unreachable ();
}
@@ -26609,7 +26612,7 @@ x86_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED,
output_asm_insn ("jmp\t%P0", xops);
/* All thunks should be in the same object as their target,
and thus binds_local_p should be true. */
- else if (TARGET_64BIT && cfun->machine->call_abi == MS_ABI)
+ else if (TARGET_64BIT && MACHINE_FUNCTION (*cfun)->call_abi == MS_ABI)
gcc_unreachable ();
else
{
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 8035e84a2f8..73502fc21a8 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -948,7 +948,7 @@ do { \
if (j != INVALID_REGNUM) \
fixed_regs[j] = call_used_regs[j] = 1; \
if (TARGET_64BIT \
- && ((cfun && cfun->machine->call_abi == MS_ABI) \
+ && ((cfun && MACHINE_FUNCTION (*cfun)->call_abi == MS_ABI) \
|| (!cfun && DEFAULT_ABI == MS_ABI))) \
{ \
call_used_regs[SI_REG] = 0; \
@@ -2431,13 +2431,14 @@ struct machine_function GTY(())
int call_abi;
};
-#define ix86_stack_locals (cfun->machine->stack_locals)
-#define ix86_varargs_gpr_size (cfun->machine->varargs_gpr_size)
-#define ix86_varargs_fpr_size (cfun->machine->varargs_fpr_size)
-#define ix86_optimize_mode_switching (cfun->machine->optimize_mode_switching)
-#define ix86_current_function_needs_cld (cfun->machine->needs_cld)
+#define ix86_stack_locals (MACHINE_FUNCTION (*cfun)->stack_locals)
+#define ix86_varargs_gpr_size (MACHINE_FUNCTION (*cfun)->varargs_gpr_size)
+#define ix86_varargs_fpr_size (MACHINE_FUNCTION (*cfun)->varargs_fpr_size)
+#define ix86_optimize_mode_switching \
+ (MACHINE_FUNCTION (*cfun)->optimize_mode_switching)
+#define ix86_current_function_needs_cld (MACHINE_FUNCTION (*cfun)->needs_cld)
#define ix86_tls_descriptor_calls_expanded_in_cfun \
- (cfun->machine->tls_descriptor_call_expanded_p)
+ (MACHINE_FUNCTION (*cfun)->tls_descriptor_call_expanded_p)
/* Since tls_descriptor_call_expanded is not cleared, even if all TLS
calls are optimized away, we try to detect cases in which it was
optimized away. Since such instructions (use (reg REG_SP)), we can
diff --git a/gcc/config/mxp/mxp.c b/gcc/config/mxp/mxp.c
index 4e2ab32f61e..6f526a4febd 100644
--- a/gcc/config/mxp/mxp.c
+++ b/gcc/config/mxp/mxp.c
@@ -40,6 +40,8 @@ along with GCC; see the file COPYING3. If not see
#include "recog.h"
#include "multi-target.h"
+START_TARGET_SPECIFIC
+
struct machine_function GTY(())
{
int rounded_frame_size;
@@ -47,8 +49,6 @@ struct machine_function GTY(())
unsigned char lanes_written[N_HARDWARE_VECREGS];
};
-START_TARGET_SPECIFIC
-
rtx mxp_compare_op0, mxp_compare_op1;
sbitmap mxp_acc_classes;
@@ -458,7 +458,7 @@ mxp_expand_prologue (void)
{
int frame_size = 0;
int save_size;
- unsigned char *buf = cfun->machine->lanes_written;
+ unsigned char *buf = MACHINE_FUNCTION (*cfun)->lanes_written;
/* There are no interrupts, hence we may save registers before adjusting
the stack pointer, and for leaf functions we can leave out the stack
@@ -484,11 +484,11 @@ mxp_expand_prologue (void)
}
}
}
- cfun->machine->saved_regs_size = frame_size;
+ MACHINE_FUNCTION (*cfun)->saved_regs_size = frame_size;
frame_size += get_frame_size ();
/* Round up frame size to keep stack 128-bit aligned. */
frame_size = (frame_size + 15) & -16;
- cfun->machine->rounded_frame_size = frame_size;
+ MACHINE_FUNCTION (*cfun)->rounded_frame_size = frame_size;
if (!current_function_is_leaf && frame_size)
{
/* Adjust stack pointer for register saves, local variables and
@@ -506,16 +506,16 @@ mxp_expand_epilogue (void)
{
int frame_size = get_frame_size ();
int save_size;
- unsigned char *buf = cfun->machine->lanes_written;
+ unsigned char *buf = MACHINE_FUNCTION (*cfun)->lanes_written;
/* Round up frame size to keep stack 128-bit aligned. */
frame_size = (frame_size + 15) & -16;
if (!current_function_is_leaf && frame_size)
emit_insn (gen_add2_insn (stack_pointer_rtx,
- GEN_INT (cfun->machine->rounded_frame_size)));
+ GEN_INT (MACHINE_FUNCTION (*cfun)->rounded_frame_size)));
/* FIXME: restore callee-saved registers. */
- frame_size = cfun->machine->saved_regs_size;
+ frame_size = MACHINE_FUNCTION (*cfun)->saved_regs_size;
for (save_size = 2; save_size <= 16; save_size <<= 1)
{
enum machine_mode save_mode
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 233fbd5bb1f..91e3c435efb 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -5021,14 +5021,16 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
return;
}
- if (reload_in_progress && cfun->machine->sdmode_stack_slot != NULL_RTX)
- cfun->machine->sdmode_stack_slot =
- eliminate_regs (cfun->machine->sdmode_stack_slot, VOIDmode, NULL_RTX);
+ if (reload_in_progress
+ && MACHINE_FUNCTION (*cfun)->sdmode_stack_slot != NULL_RTX)
+ MACHINE_FUNCTION (*cfun)->sdmode_stack_slot =
+ eliminate_regs (MACHINE_FUNCTION (*cfun)->sdmode_stack_slot, VOIDmode,
+ NULL_RTX);
if (reload_in_progress
&& mode == SDmode
&& MEM_P (operands[0])
- && rtx_equal_p (operands[0], cfun->machine->sdmode_stack_slot)
+ && rtx_equal_p (operands[0], MACHINE_FUNCTION (*cfun)->sdmode_stack_slot)
&& REG_P (operands[1]))
{
if (FP_REGNO_P (REGNO (operands[1])))
@@ -5051,7 +5053,7 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
&& mode == SDmode
&& REG_P (operands[0])
&& MEM_P (operands[1])
- && rtx_equal_p (operands[1], cfun->machine->sdmode_stack_slot))
+ && rtx_equal_p (operands[1], MACHINE_FUNCTION (*cfun)->sdmode_stack_slot))
{
if (FP_REGNO_P (REGNO (operands[0])))
{
@@ -6739,7 +6741,7 @@ setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
gcc_assert (reg_save_area == virtual_stack_vars_rtx);
}
- cfun->machine->varargs_save_offset = offset;
+ MACHINE_FUNCTION (*cfun)->varargs_save_offset = offset;
save_area = plus_constant (virtual_stack_vars_rtx, offset);
}
}
@@ -6954,9 +6956,9 @@ rs6000_va_start (tree valist, rtx nextarg)
/* Find the register save area. */
t = make_tree (TREE_TYPE (sav), virtual_stack_vars_rtx);
- if (cfun->machine->varargs_save_offset)
+ if (MACHINE_FUNCTION (*cfun)->varargs_save_offset)
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (sav), t,
- size_int (cfun->machine->varargs_save_offset));
+ size_int (MACHINE_FUNCTION (*cfun)->varargs_save_offset));
t = build2 (MODIFY_EXPR, TREE_TYPE (sav), sav, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -11510,13 +11512,13 @@ rs6000_secondary_memory_needed_rtx (enum machine_mode mode)
return assign_stack_local (mode, GET_MODE_SIZE (mode), 0);
else
{
- rtx mem = cfun->machine->sdmode_stack_slot;
+ rtx mem = MACHINE_FUNCTION (*cfun)->sdmode_stack_slot;
gcc_assert (mem != NULL_RTX);
if (!eliminated)
{
mem = eliminate_regs (mem, VOIDmode, NULL_RTX);
- cfun->machine->sdmode_stack_slot = mem;
+ MACHINE_FUNCTION (*cfun)->sdmode_stack_slot = mem;
eliminated = true;
}
return mem;
@@ -11565,7 +11567,7 @@ rs6000_alloc_sdmode_stack_slot (void)
basic_block bb;
gimple_stmt_iterator gsi;
- gcc_assert (cfun->machine->sdmode_stack_slot == NULL_RTX);
+ gcc_assert (MACHINE_FUNCTION (*cfun)->sdmode_stack_slot == NULL_RTX);
FOR_EACH_BB (bb)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -11574,8 +11576,8 @@ rs6000_alloc_sdmode_stack_slot (void)
if (ret)
{
rtx stack = assign_stack_local (DDmode, GET_MODE_SIZE (DDmode), 0);
- cfun->machine->sdmode_stack_slot = adjust_address_nv (stack,
- SDmode, 0);
+ MACHINE_FUNCTION (*cfun)->sdmode_stack_slot
+ = adjust_address_nv (stack, SDmode, 0);
return;
}
}
@@ -11590,8 +11592,8 @@ rs6000_alloc_sdmode_stack_slot (void)
|| TYPE_MODE (DECL_ARG_TYPE (t)) == SDmode)
{
rtx stack = assign_stack_local (DDmode, GET_MODE_SIZE (DDmode), 0);
- cfun->machine->sdmode_stack_slot = adjust_address_nv (stack,
- SDmode, 0);
+ MACHINE_FUNCTION (*cfun)->sdmode_stack_slot
+ = adjust_address_nv (stack, SDmode, 0);
return;
}
}
@@ -11600,8 +11602,8 @@ rs6000_alloc_sdmode_stack_slot (void)
static void
rs6000_instantiate_decls (void)
{
- if (cfun->machine->sdmode_stack_slot != NULL_RTX)
- instantiate_decl_rtl (cfun->machine->sdmode_stack_slot);
+ if (MACHINE_FUNCTION (*cfun)->sdmode_stack_slot != NULL_RTX)
+ instantiate_decl_rtl (MACHINE_FUNCTION (*cfun)->sdmode_stack_slot);
}
/* Return the register class of a scratch register needed to copy IN into
@@ -11851,14 +11853,14 @@ rs6000_get_some_local_dynamic_name (void)
{
rtx insn;
- if (cfun->machine->some_ld_name)
- return cfun->machine->some_ld_name;
+ if (MACHINE_FUNCTION (*cfun)->some_ld_name)
+ return MACHINE_FUNCTION (*cfun)->some_ld_name;
for (insn = get_insns (); insn ; insn = NEXT_INSN (insn))
if (INSN_P (insn)
&& for_each_rtx (&PATTERN (insn),
rs6000_get_some_local_dynamic_name_1, 0))
- return cfun->machine->some_ld_name;
+ return MACHINE_FUNCTION (*cfun)->some_ld_name;
gcc_unreachable ();
}
@@ -11875,7 +11877,7 @@ rs6000_get_some_local_dynamic_name_1 (rtx *px, void *data ATTRIBUTE_UNUSED)
const char *str = XSTR (x, 0);
if (SYMBOL_REF_TLS_MODEL (x) == TLS_MODEL_LOCAL_DYNAMIC)
{
- cfun->machine->some_ld_name = str;
+ MACHINE_FUNCTION (*cfun)->some_ld_name = str;
return 1;
}
}
@@ -14704,10 +14706,11 @@ rs6000_stack_info (void)
if (TARGET_SPE)
{
/* Cache value so we don't rescan instruction chain over and over. */
- if (cfun->machine->insn_chain_scanned_p == 0)
- cfun->machine->insn_chain_scanned_p
+ if (MACHINE_FUNCTION (*cfun)->insn_chain_scanned_p == 0)
+ MACHINE_FUNCTION (*cfun)->insn_chain_scanned_p
= spe_func_has_64bit_regs_p () + 1;
- info_ptr->spe_64bit_regs_used = cfun->machine->insn_chain_scanned_p - 1;
+ info_ptr->spe_64bit_regs_used
+ = MACHINE_FUNCTION (*cfun)->insn_chain_scanned_p - 1;
}
/* Select which calling sequence. */
@@ -14754,7 +14757,7 @@ rs6000_stack_info (void)
/* Does this function call anything? */
info_ptr->calls_p = (! current_function_is_leaf
- || cfun->machine->ra_needs_full_frame);
+ || MACHINE_FUNCTION (*cfun)->ra_needs_full_frame);
/* Determine if we need to save the link register. */
if ((DEFAULT_ABI == ABI_AIX
@@ -15180,7 +15183,7 @@ rs6000_return_addr (int count, rtx frame)
don't try to be too clever here. */
if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic))
{
- cfun->machine->ra_needs_full_frame = 1;
+ MACHINE_FUNCTION (*cfun)->ra_needs_full_frame = 1;
return
gen_rtx_MEM
@@ -15193,7 +15196,7 @@ rs6000_return_addr (int count, rtx frame)
RETURN_ADDRESS_OFFSET)));
}
- cfun->machine->ra_need_lr = 1;
+ MACHINE_FUNCTION (*cfun)->ra_need_lr = 1;
return get_hard_reg_initial_val (Pmode, LR_REGNO);
}
@@ -16058,7 +16061,7 @@ rs6000_savres_strategy (rs6000_stack_t *info, bool savep,
|| sibcall
|| crtl->calls_eh_return
|| !info->lr_save_p
- || cfun->machine->ra_need_lr
+ || MACHINE_FUNCTION (*cfun)->ra_need_lr
|| info->total_size > 32767);
savres_fprs_inline = (common
|| info->first_fp_reg_save == 64
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index bbf7454347f..aa6c625e268 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -5939,7 +5939,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask)
/* Force PR to be live if the prologue has to call the SHmedia
argument decoder or register saver. */
if (TARGET_SHCOMPACT
- && ((crtl->args.info.call_cookie
+ && ((INCOMING_ARGS_INFO (crtl->args).call_cookie
& ~ CALL_COOKIE_RET_TRAMP (1))
|| crtl->saves_all_registers))
pr_live = 1;
@@ -5966,7 +5966,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask)
: (/* Only push those regs which are used and need to be saved. */
(TARGET_SHCOMPACT
&& flag_pic
- && crtl->args.info.call_cookie
+ && INCOMING_ARGS_INFO (crtl->args).call_cookie
&& reg == PIC_OFFSET_TABLE_REGNUM)
|| (df_regs_ever_live_p (reg)
&& ((!call_really_used_regs[reg]
@@ -6219,13 +6219,14 @@ sh_expand_prologue (void)
pretend_args = crtl->args.pretend_args_size;
if (TARGET_VARARGS_PRETEND_ARGS (current_function_decl)
&& (NPARM_REGS(SImode)
- > crtl->args.info.arg_count[(int) SH_ARG_INT]))
+ > INCOMING_ARGS_INFO (crtl->args).arg_count[(int) SH_ARG_INT]))
pretend_args = 0;
output_stack_adjust (-pretend_args
- - crtl->args.info.stack_regs * 8,
+ - INCOMING_ARGS_INFO (crtl->args).stack_regs * 8,
stack_pointer_rtx, 0, NULL);
- if (TARGET_SHCOMPACT && flag_pic && crtl->args.info.call_cookie)
+ if (TARGET_SHCOMPACT && flag_pic
+ && INCOMING_ARGS_INFO (crtl->args).call_cookie)
/* We're going to use the PIC register to load the address of the
incoming-argument decoder and/or of the return trampoline from
the GOT, so make sure the PIC register is preserved and
@@ -6233,7 +6234,8 @@ sh_expand_prologue (void)
df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
if (TARGET_SHCOMPACT
- && (crtl->args.info.call_cookie & ~ CALL_COOKIE_RET_TRAMP(1)))
+ && (INCOMING_ARGS_INFO (crtl->args).call_cookie
+ & ~ CALL_COOKIE_RET_TRAMP(1)))
{
int reg;
@@ -6241,20 +6243,20 @@ sh_expand_prologue (void)
be pushed onto the stack live, so that register renaming
doesn't overwrite them. */
for (reg = 0; reg < NPARM_REGS (SImode); reg++)
- if (CALL_COOKIE_STACKSEQ_GET (crtl->args.info.call_cookie)
+ if (CALL_COOKIE_STACKSEQ_GET (INCOMING_ARGS_INFO (crtl->args).call_cookie)
>= NPARM_REGS (SImode) - reg)
for (; reg < NPARM_REGS (SImode); reg++)
emit_insn (gen_shcompact_preserve_incoming_args
(gen_rtx_REG (SImode, FIRST_PARM_REG + reg)));
else if (CALL_COOKIE_INT_REG_GET
- (crtl->args.info.call_cookie, reg) == 1)
+ (INCOMING_ARGS_INFO (crtl->args).call_cookie, reg) == 1)
emit_insn (gen_shcompact_preserve_incoming_args
(gen_rtx_REG (SImode, FIRST_PARM_REG + reg)));
emit_move_insn (gen_rtx_REG (Pmode, MACL_REG),
stack_pointer_rtx);
emit_move_insn (gen_rtx_REG (SImode, R0_REG),
- GEN_INT (crtl->args.info.call_cookie));
+ GEN_INT (INCOMING_ARGS_INFO (crtl->args).call_cookie));
emit_move_insn (gen_rtx_REG (SImode, MACH_REG),
gen_rtx_REG (SImode, R0_REG));
}
@@ -6279,7 +6281,7 @@ sh_expand_prologue (void)
rtx insn;
if (i >= (NPARM_REGS(SImode)
- - crtl->args.info.arg_count[(int) SH_ARG_INT]
+ - INCOMING_ARGS_INFO (crtl->args).arg_count[(int) SH_ARG_INT]
))
break;
insn = push (rn);
@@ -6538,7 +6540,8 @@ sh_expand_prologue (void)
frame_insn (GEN_MOV (hard_frame_pointer_rtx, stack_pointer_rtx));
if (TARGET_SHCOMPACT
- && (crtl->args.info.call_cookie & ~ CALL_COOKIE_RET_TRAMP(1)))
+ && (INCOMING_ARGS_INFO (crtl->args).call_cookie
+ & ~ CALL_COOKIE_RET_TRAMP(1)))
{
/* This must NOT go through the PLT, otherwise mach and macl
may be clobbered. */
@@ -6809,7 +6812,7 @@ sh_expand_epilogue (bool sibcall_p)
output_stack_adjust (crtl->args.pretend_args_size
+ save_size + d_rounding
- + crtl->args.info.stack_regs * 8,
+ + INCOMING_ARGS_INFO (crtl->args).stack_regs * 8,
stack_pointer_rtx, e, NULL);
if (crtl->calls_eh_return)
@@ -6926,11 +6929,13 @@ static rtx
sh_builtin_saveregs (void)
{
/* First unnamed integer register. */
- int first_intreg = crtl->args.info.arg_count[(int) SH_ARG_INT];
+ int first_intreg
+ = INCOMING_ARGS_INFO (crtl->args).arg_count[(int) SH_ARG_INT];
/* Number of integer registers we need to save. */
int n_intregs = MAX (0, NPARM_REGS (SImode) - first_intreg);
/* First unnamed SFmode float reg */
- int first_floatreg = crtl->args.info.arg_count[(int) SH_ARG_FLOAT];
+ int first_floatreg
+ = INCOMING_ARGS_INFO (crtl->args).arg_count[(int) SH_ARG_FLOAT];
/* Number of SFmode float regs to save. */
int n_floatregs = MAX (0, NPARM_REGS (SFmode) - first_floatreg);
rtx regbuf, fpregs;
@@ -6945,22 +6950,22 @@ sh_builtin_saveregs (void)
while (pushregs < NPARM_REGS (SImode) - 1
&& (CALL_COOKIE_INT_REG_GET
- (crtl->args.info.call_cookie,
+ (INCOMING_ARGS_INFO (crtl->args).call_cookie,
NPARM_REGS (SImode) - pushregs)
== 1))
{
- crtl->args.info.call_cookie
+ INCOMING_ARGS_INFO (crtl->args).call_cookie
&= ~ CALL_COOKIE_INT_REG (NPARM_REGS (SImode)
- pushregs, 1);
pushregs++;
}
if (pushregs == NPARM_REGS (SImode))
- crtl->args.info.call_cookie
+ INCOMING_ARGS_INFO (crtl->args).call_cookie
|= (CALL_COOKIE_INT_REG (0, 1)
| CALL_COOKIE_STACKSEQ (pushregs - 1));
else
- crtl->args.info.call_cookie
+ INCOMING_ARGS_INFO (crtl->args).call_cookie
|= CALL_COOKIE_STACKSEQ (pushregs);
crtl->args.pretend_args_size += 8 * n_intregs;
@@ -7161,7 +7166,7 @@ sh_va_start (tree valist, rtx nextarg)
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
- nfp = crtl->args.info.arg_count[SH_ARG_FLOAT];
+ nfp = INCOMING_ARGS_INFO (crtl->args).arg_count[SH_ARG_FLOAT];
if (nfp < 8)
nfp = 8 - nfp;
else
@@ -7176,7 +7181,7 @@ sh_va_start (tree valist, rtx nextarg)
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
- nint = crtl->args.info.arg_count[SH_ARG_INT];
+ nint = INCOMING_ARGS_INFO (crtl->args).arg_count[SH_ARG_INT];
if (nint < 4)
nint = 4 - nint;
else
@@ -7884,11 +7889,11 @@ initial_elimination_offset (int from, int to)
if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
return total_saved_regs_space + total_auto_space
- + crtl->args.info.byref_regs * 8;
+ + INCOMING_ARGS_INFO (crtl->args).byref_regs * 8;
if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
return total_saved_regs_space + total_auto_space
- + crtl->args.info.byref_regs * 8;
+ + INCOMING_ARGS_INFO (crtl->args).byref_regs * 8;
/* Initial gap between fp and sp is 0. */
if (from == HARD_FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
@@ -9234,7 +9239,7 @@ sh_allocate_initial_value (rtx hard_reg)
if (current_function_is_leaf
&& ! sh_pr_n_sets ()
&& ! (TARGET_SHCOMPACT
- && ((crtl->args.info.call_cookie
+ && ((INCOMING_ARGS_INFO (crtl->args).call_cookie
& ~ CALL_COOKIE_RET_TRAMP (1))
|| crtl->saves_all_registers)))
x = hard_reg;
@@ -9833,7 +9838,7 @@ sh_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
{
return (1
&& (! TARGET_SHCOMPACT
- || crtl->args.info.stack_regs == 0)
+ || INCOMING_ARGS_INFO (crtl->args).stack_regs == 0)
&& ! sh_cfun_interrupt_handler_p ()
&& (! flag_pic
|| (decl && ! TREE_PUBLIC (decl))
@@ -10732,7 +10737,7 @@ sh_get_pr_initial_val (void)
PR register on SHcompact, because it might be clobbered by the prologue.
We check first if that is known to be the case. */
if (TARGET_SHCOMPACT
- && ((crtl->args.info.call_cookie
+ && ((INCOMING_ARGS_INFO (crtl->args).call_cookie
& ~ CALL_COOKIE_RET_TRAMP (1))
|| crtl->saves_all_registers))
return gen_frame_mem (SImode, return_address_pointer_rtx);
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 24a1bc2c9b2..91271d94a96 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -9363,7 +9363,7 @@ mov.l\\t1f,r0\\n\\
}
if (TARGET_SHCOMPACT
- && (crtl->args.info.call_cookie & CALL_COOKIE_RET_TRAMP (1)))
+ && (INCOMING_ARGS_INFO (crtl->args).call_cookie & CALL_COOKIE_RET_TRAMP (1)))
{
emit_jump_insn (gen_shcompact_return_tramp ());
DONE;
@@ -9373,7 +9373,7 @@ mov.l\\t1f,r0\\n\\
(define_insn "*return_i"
[(return)]
"TARGET_SH1 && ! (TARGET_SHCOMPACT
- && (crtl->args.info.call_cookie
+ && (INCOMING_ARGS_INFO (crtl->args).call_cookie
& CALL_COOKIE_RET_TRAMP (1)))
&& reload_completed
&& lookup_attribute (\"trap_exit\",
@@ -9400,7 +9400,7 @@ mov.l\\t1f,r0\\n\\
(define_expand "shcompact_return_tramp"
[(return)]
"TARGET_SHCOMPACT
- && (crtl->args.info.call_cookie & CALL_COOKIE_RET_TRAMP (1))"
+ && (INCOMING_ARGS_INFO (crtl->args).call_cookie & CALL_COOKIE_RET_TRAMP (1))"
"
{
rtx reg = gen_rtx_REG (Pmode, R0_REG);
@@ -9413,7 +9413,7 @@ mov.l\\t1f,r0\\n\\
(define_insn "shcompact_return_tramp_i"
[(parallel [(return) (use (reg:SI R0_REG))])]
"TARGET_SHCOMPACT
- && (crtl->args.info.call_cookie & CALL_COOKIE_RET_TRAMP (1))"
+ && (INCOMING_ARGS_INFO (crtl->args).call_cookie & CALL_COOKIE_RET_TRAMP (1))"
"jmp @r0%#"
[(set_attr "type" "jump_ind")
(set_attr "needs_delay_slot" "yes")])
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 350db74e5b8..b074570d05b 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -869,7 +869,8 @@ when another one comes along.
GCC defines a data structure called @code{struct function} which
contains all of the data specific to an individual function. This
-structure contains a field called @code{machine} whose type is
+structure contains a field which can be accessed as
+MACHINE_FUNCTION (@var{function}) whose type is
@code{struct machine_function *}, which can be used by targets to point
to their own specific data.
diff --git a/gcc/function.c b/gcc/function.c
index 240dc099e4d..141c2d3b891 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -222,7 +222,7 @@ free_after_compilation (struct function *f)
memset (crtl, 0, sizeof (struct rtl_data));
f->eh = NULL;
- f->machine = NULL;
+ MACHINE_FUNCTION (*f) = NULL;
f->cfg = NULL;
regno_reg_rtx = NULL;
@@ -4132,7 +4132,7 @@ allocate_struct_function_1 (tree fndecl, bool abstract_p)
init_eh_for_function ();
if (init_machine_status)
- cfun->machine = (*init_machine_status) ();
+ MACHINE_FUNCTION (*cfun) = (*init_machine_status) ();
#ifdef OVERRIDE_ABI_FORMAT
OVERRIDE_ABI_FORMAT (fndecl);
diff --git a/gcc/function.h b/gcc/function.h
index b191dcc9b61..ed1c62fbc7f 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -253,8 +253,11 @@ struct incoming_args GTY(())
#define CONCAT(A,B) CONCAT_(A,B)
#define INCOMING_ARGS_INFO(INCOMING_ARGS) \
((INCOMING_ARGS).info.CONCAT(EXTRA_TARGET,_ca))
+#define MACHINE_FUNCTION(FUNCTION) \
+ ((FUNCTION).machine.CONCAT(EXTRA_TARGET,_mf))
#else
#define INCOMING_ARGS_INFO(INCOMING_ARGS) ((INCOMING_ARGS).info._ca)
+#define MACHINE_FUNCTION(FUNCTION) ((FUNCTION).machine._mf)
#endif
/* Data for function partitioning. */
@@ -530,7 +533,7 @@ struct function GTY(())
/* For md files. */
/* tm.h can use this to store whatever it likes. */
- struct machine_function * GTY ((maybe_undef)) machine;
+ machine_function_u GTY ((desc ("%0.target_arch"))) machine;
/* Language-specific code can use this to store whatever it likes. */
struct language_function * language;
diff --git a/gcc/gengtype-lex.l b/gcc/gengtype-lex.l
index d9f1996ccc9..42a8307c5a2 100644
--- a/gcc/gengtype-lex.l
+++ b/gcc/gengtype-lex.l
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
struct fileloc lexer_line;
int lexer_toplevel_done;
+int pp_nest, no_extra_nest;
static void
update_lineno (const char *l, size_t len)
@@ -108,6 +109,7 @@ EOID [^[:alnum:]_]
{WS} { update_lineno (yytext, yyleng); }
\\\n { lexer_line.line++; }
+TARGET_SCOPE/{EOID} |
"const"/{EOID} /* don't care */
"GTY"/{EOID} { return GTY_TOKEN; }
"VEC"/{EOID} { return VEC_TOKEN; }
@@ -157,7 +159,13 @@ EOID [^[:alnum:]_]
"..." { return ELLIPSIS; }
[(){},*:<>;=%|-] { return yytext[0]; }
- /* ignore pp-directives */
+^{HWS}"#"{HWS}ifndef{HWS}EXTRA_TARGET[[:alnum:]_][^\n]* {pp_nest++;}
+^{HWS}"#"{HWS}ifndef{HWS}EXTRA_TARGET[^\n]* {no_extra_nest = ++pp_nest;}
+^{HWS}"#"{HWS}if[^\n]* {pp_nest++;}
+
+^{HWS}"#"{HWS}endif[^\n]* {if (pp_nest-- == no_extra_nest) no_extra_nest = 0;}
+
+ /* ignore other pp-directives */
^{HWS}"#"{HWS}[a-z_]+[^\n]*\n {lexer_line.line++;}
. {
diff --git a/gcc/gengtype-parse.c b/gcc/gengtype-parse.c
index 357981ad3cb..1aa56b82fec 100644
--- a/gcc/gengtype-parse.c
+++ b/gcc/gengtype-parse.c
@@ -46,7 +46,14 @@ token (void)
{
if (!T.valid)
{
- T.code = yylex (&T.value);
+ do
+ {
+ T.code = yylex (&T.value);
+#ifndef EXTRA_TARGET
+ break;
+#endif
+ }
+ while (no_extra_nest);
T.valid = true;
}
return T.code;
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 38346192ba3..6e49306d2ef 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1528,7 +1528,6 @@ open_base_files (void)
header_file = create_file ("GCC", "gtype-desc.h");
oprintf (header_file, "\n#include \"multi-target.h\"\n");
- oprintf (header_file, "\nSTART_TARGET_SPECIFIC\n");
base_files = XNEWVEC (outf_p, num_lang_dirs);
@@ -1556,7 +1555,6 @@ open_base_files (void)
for (ifp = ifiles; *ifp; ifp++)
oprintf (gtype_desc_c, "#include \"%s\"\n", *ifp);
- oprintf (gtype_desc_c, "\nSTART_TARGET_SPECIFIC\n");
/* Make sure we handle "cfun" specially. */
oprintf (gtype_desc_c, "\n/* See definition in function.h. */\n");
oprintf (gtype_desc_c, "#undef cfun\n");
@@ -3053,6 +3051,7 @@ finish_root_table (struct flist *flp, const char *pfx, const char *lastname,
lang_bitmap bitmap = get_lang_bitmap (fli2->name);
int fnum;
+ oprintf (fli2->f, "END_TARGET_SPECIFIC\n");
fli2->started_p = 0;
for (fnum = 0; bitmap != 0; fnum++, bitmap >>= 1)
@@ -3348,9 +3347,6 @@ write_roots (pair_p variables)
}
}
-#ifdef EXTRA_TARGET /* FIXME */
- return;
-#endif
for (v = variables; v; v = v->next)
{
outf_p f = get_output_file_with_visibility (v->line.file);
@@ -3376,6 +3372,7 @@ write_roots (pair_p variables)
{
fli->started_p = 1;
+ oprintf (f, "START_TARGET_SPECIFIC\n");
oprintf (f, "#ifdef __cplusplus\n");
oprintf (f, "extern\n");
oprintf (f, "#endif\n");
@@ -3413,6 +3410,7 @@ write_roots (pair_p variables)
{
fli->started_p = 1;
+ oprintf (f, "START_TARGET_SPECIFIC\n");
oprintf (f, "#ifdef __cplusplus\n");
oprintf (f, "extern\n");
oprintf (f, "#endif\n");
@@ -3460,6 +3458,7 @@ write_roots (pair_p variables)
{
fli->started_p = 1;
+ oprintf (f, "START_TARGET_SPECIFIC\n");
oprintf (f, "#ifdef __cplusplus\n");
oprintf (f, "extern\n");
oprintf (f, "#endif\n");
@@ -3499,6 +3498,7 @@ write_roots (pair_p variables)
{
fli->started_p = 1;
+ oprintf (f, "START_TARGET_SPECIFIC\n");
oprintf (f, "#ifdef __cplusplus\n");
oprintf (f, "extern\n");
oprintf (f, "#endif\n");
@@ -3538,6 +3538,7 @@ write_roots (pair_p variables)
{
fli->started_p = 1;
+ oprintf (f, "START_TARGET_SPECIFIC\n");
oprintf (f, "#ifdef __cplusplus\n");
oprintf (f, "extern\n");
oprintf (f, "#endif\n");
@@ -3664,8 +3665,6 @@ main (int argc, char **argv)
write_local (structures, param_structs);
write_roots (variables);
write_rtx_next ();
- oprintf (get_output_file_with_visibility (NULL), "\nEND_TARGET_SPECIFIC\n");
- oprintf (header_file, "\nEND_TARGET_SPECIFIC\n");
close_output_files ();
if (hit_error)
diff --git a/gcc/gengtype.h b/gcc/gengtype.h
index 533b508b556..17d80d3c5be 100644
--- a/gcc/gengtype.h
+++ b/gcc/gengtype.h
@@ -36,6 +36,7 @@ typedef struct options *options_p;
/* Variables used to communicate between the lexer and the parser. */
extern int lexer_toplevel_done;
extern struct fileloc lexer_line;
+extern int pp_nest, no_extra_nest;
/* Print an error message. */
extern void error_at_line
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index fc562f59d25..0c394c83b0e 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -109,6 +109,7 @@ struct mode_adjust
struct mode_adjust *next;
struct mode_data *mode;
const char *adjustment;
+ const char *target;
const char *file;
unsigned int line;
@@ -262,6 +263,7 @@ new_adjust (const char *name,
a = XNEW (struct mode_adjust);
a->mode = mode;
+ a->target = target;
a->adjustment = adjustment;
a->file = file;
a->line = line;
@@ -1379,6 +1381,8 @@ emit_mode_adjustments (void)
A size adjustment forces us to recalculate the alignment too. */
for (a = adj_bytesize; a; a = a->next)
{
+ if (a->target && a->target != output_target)
+ continue;
printf ("\n /* %s:%d */\n s = %s;\n",
a->file, a->line, a->adjustment);
printf (" mode_size[%smode] = s;\n", a->mode->name);
@@ -1422,6 +1426,8 @@ emit_mode_adjustments (void)
??? This may not be the right thing for vector modes. */
for (a = adj_alignment; a; a = a->next)
{
+ if (a->target && a->target != output_target)
+ continue;
printf ("\n /* %s:%d */\n s = %s;\n",
a->file, a->line, a->adjustment);
printf (" mode_base_align[%smode] = s;\n", a->mode->name);
@@ -1458,6 +1464,8 @@ emit_mode_adjustments (void)
/* Ibit adjustments don't have to propagate. */
for (a = adj_ibit; a; a = a->next)
{
+ if (a->target && a->target != output_target)
+ continue;
printf ("\n /* %s:%d */\n s = %s;\n",
a->file, a->line, a->adjustment);
printf (" mode_ibit[%smode] = s;\n", a->mode->name);
@@ -1466,6 +1474,8 @@ emit_mode_adjustments (void)
/* Fbit adjustments don't have to propagate. */
for (a = adj_fbit; a; a = a->next)
{
+ if (a->target && a->target != output_target)
+ continue;
printf ("\n /* %s:%d */\n s = %s;\n",
a->file, a->line, a->adjustment);
printf (" mode_fbit[%smode] = s;\n", a->mode->name);
@@ -1473,8 +1483,12 @@ emit_mode_adjustments (void)
/* Real mode formats don't have to propagate anywhere. */
for (a = adj_format; a; a = a->next)
- printf ("\n /* %s:%d */\n REAL_MODE_FORMAT (%smode) = %s;\n",
- a->file, a->line, a->mode->name, a->adjustment);
+ {
+ if (a->target && a->target != output_target)
+ continue;
+ printf ("\n /* %s:%d */\n REAL_MODE_FORMAT (%smode) = %s;\n",
+ a->file, a->line, a->mode->name, a->adjustment);
+ }
puts ("}");
}
diff --git a/gcc/gentargtype.cc b/gcc/gentargtype.cc
index 15457dbad99..7144472d400 100644
--- a/gcc/gentargtype.cc
+++ b/gcc/gentargtype.cc
@@ -2,15 +2,28 @@
#include "coretypes.h"
#include "target-types.h"
-cumulative_args_u u;
int
main (void)
{
printf ("typedef union GTY (())\n"
" {\n"
" CUMULATIVE_ARGS GTY ((tag (\"TARGET_NUM\"))) _ca;\n");
- printf (" char GTY ((default)) dummy[%d];\n", (int) sizeof u);
+ printf (" char GTY ((default)) dummy[%d];\n",
+ (int) sizeof (cumulative_args_u));
printf (" void *GTY ((skip)) align_dummy[1];\n"
" } cumulative_args_u;\n");
+ printf ("\n"
+ "START_TARGET_SPECIFIC\n"
+ "struct machine_function;\n"
+ "END_TARGET_SPECIFIC\n"
+ "\n"
+ "typedef union GTY (())\n"
+ " {\n"
+ " struct TARGET_SCOPE machine_function\n"
+ " *GTY ((tag (\"TARGET_NUM\"), maybe_undef)) _mf;\n");
+ printf (" char (*GTY ((default)) dummy)[%d];\n",
+ (int) sizeof (machine_function_u));
+ printf (" void *(*GTY ((skip)) align_dummy)[1];\n"
+ " } machine_function_u;\n");
return 0;
}
diff --git a/gcc/ggc.h b/gcc/ggc.h
index c8fd810f4eb..6abfc4891f8 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -53,11 +53,9 @@ typedef void (*gt_note_pointers) (void *, void *, gt_pointer_operator,
typedef void (*gt_handle_reorder) (void *, void *, gt_pointer_operator,
void *);
-START_TARGET_SPECIFIC
/* Used by the gt_pch_n_* routines. Register an object in the hash table. */
extern int gt_pch_note_object (void *, void *, gt_note_pointers,
enum gt_types_enum);
-END_TARGET_SPECIFIC
/* Used by the gt_pch_n_* routines. Register that an object has a reorder
function. */