From: hp Date: Tue, 25 Sep 2007 02:18:37 +0000 (+0000) Subject: * config/mmix/mmix.h (FUNCTION_INCOMING_ARG_REGNO_P): Don't define X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=6d1f3d31aa0c1c542211e67e9dc5978821458ba6 * config/mmix/mmix.h (FUNCTION_INCOMING_ARG_REGNO_P): Don't define bogus target macro. (INCOMING_REGNO, OUTGOING_REGNO): Define. * config/mmix/mmix.c (mmix_opposite_regno): New function. * config/mmix/mmix-protos.h (mmix_opposite_regno): Prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128744 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b46d9373a41..c47a8122b06 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2007-09-25 Hans-Peter Nilsson + * config/mmix/mmix.h (FUNCTION_INCOMING_ARG_REGNO_P): Don't define + bogus target macro. + (INCOMING_REGNO, OUTGOING_REGNO): Define. + * config/mmix/mmix.c (mmix_opposite_regno): New function. + * config/mmix/mmix-protos.h (mmix_opposite_regno): Prototype. + * config/mmix/mmix.md ("*cmpcc_folded"): In condition, gate with REG_P tests before REGNO access. diff --git a/gcc/config/mmix/mmix-protos.h b/gcc/config/mmix/mmix-protos.h index c963147717f..d71064aa6d7 100644 --- a/gcc/config/mmix/mmix-protos.h +++ b/gcc/config/mmix/mmix-protos.h @@ -49,6 +49,7 @@ extern void mmix_asm_output_align (FILE *, int); extern int mmix_shiftable_wyde_value (unsigned HOST_WIDEST_INT); extern void mmix_output_register_setting (FILE *, int, HOST_WIDEST_INT, int); extern void mmix_conditional_register_usage (void); +extern int mmix_opposite_regno (int, int); extern int mmix_local_regno (int); extern int mmix_dbx_register_number (int); extern int mmix_use_simple_return (void); diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 699a30da9fd..a55b0dcc7f3 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -319,6 +319,26 @@ mmix_conditional_register_usage (void) reg_names[i]++; } +/* INCOMING_REGNO and OUTGOING_REGNO worker function. + Those two macros must only be applied to function argument + registers. FIXME: for their current use in gcc, it'd be better + with an explicit specific additional FUNCTION_INCOMING_ARG_REGNO_P + a'la FUNCTION_ARG / FUNCTION_INCOMING_ARG instead of forcing the + target to commit to a fixed mapping and for any unspecified + register use. */ + +int +mmix_opposite_regno (int regno, int incoming) +{ + if (!mmix_function_arg_regno_p (regno, incoming)) + return regno; + + return + regno - (incoming + ? MMIX_FIRST_INCOMING_ARG_REGNUM - MMIX_FIRST_ARG_REGNUM + : MMIX_FIRST_ARG_REGNUM - MMIX_FIRST_INCOMING_ARG_REGNUM); +} + /* LOCAL_REGNO. All registers that are part of the register stack and that will be saved are local. */ diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 8f09cdb21f9..19aab6f4b27 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -319,13 +319,9 @@ extern int target_flags; #define CONDITIONAL_REGISTER_USAGE mmix_conditional_register_usage () -/* No INCOMING_REGNO or OUTGOING_REGNO, since those macros are not usable - for MMIX: it doesn't have a fixed register window size. FIXME: Perhaps - we should say something about $0..$15 may sometimes be the incoming - $16..$31. Those macros need better documentation; it looks like - they're just bogus and that FUNCTION_INCOMING_ARG_REGNO_P and - FUNCTION_OUTGOING_VALUE should be used where they're used. For the - moment, do nothing; things seem to work anyway. */ +#define INCOMING_REGNO(OUT) mmix_opposite_regno (OUT, 0) + +#define OUTGOING_REGNO(IN) mmix_opposite_regno (IN, 1) /* Defining LOCAL_REGNO is necessary in presence of prologue/epilogue, else GCC will be confused that those registers aren't saved and @@ -644,9 +640,6 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS; #define FUNCTION_ARG_REGNO_P(REGNO) \ mmix_function_arg_regno_p (REGNO, 0) -#define FUNCTION_INCOMING_ARG_REGNO_P(REGNO) \ - mmix_function_arg_regno_p (REGNO, 1) - /* Node: Register Arguments */