[patch, mips] Allow users to avoid promoting prototypes.

Steve Ellcey sellcey@imgtec.com
Thu May 2 20:12:00 GMT 2013


MIPS architectures set TARGET_PROMOTE_PROTOTYPES to true.  I would like
to have an option to set this to false in order to avoid extra masking
when passing char or short types.  I don't think we can change this by
default since it would affect the ABI, but I would like to allow users
the option of turning if off if desired.

Tested on mips-mti-elf.  OK for checkin?

Steve Ellcey
sellcey@imgtec.com


2013-05-02  Steve Ellcey  <sellcey@imgtec.com>

	* config/mips/mips.c (mips_promote_prototypes) :New.
	(TARGET_PROMOTE_PROTOTYPES): Change to use mips_promote_prototypes.
	* config/mips/mips.opt (mpromote-prototypes): New.


diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 7545b60..072a68b 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -5721,6 +5721,15 @@ mips_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED)
 	  ? TYPE_MODE (type) == BLKmode
 	  : !IN_RANGE (int_size_in_bytes (type), 0, 2 * UNITS_PER_WORD));
 }
+
+/* Implement TARGET_PROMOTE_PROTOTYPES.  It is true by default but can
+   be turned off with -mno-promote-prototypes.  */
+
+static bool
+mips_promote_prototypes (const_tree t ATTRIBUTE_UNUSED)
+{
+  return (mips_do_promote_prototypes != 0);
+}
 
 /* Implement TARGET_SETUP_INCOMING_VARARGS.  */
 
@@ -18708,7 +18717,7 @@ mips_expand_vec_minmax (rtx target, rtx op0, rtx op1,
 #undef  TARGET_PROMOTE_FUNCTION_MODE
 #define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
 #undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
+#define TARGET_PROMOTE_PROTOTYPES mips_promote_prototypes
 
 #undef TARGET_FUNCTION_VALUE
 #define TARGET_FUNCTION_VALUE mips_function_value
diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt
index e11710d..1881d9d 100644
--- a/gcc/config/mips/mips.opt
+++ b/gcc/config/mips/mips.opt
@@ -305,6 +305,10 @@ mpaired-single
 Target Report Mask(PAIRED_SINGLE_FLOAT)
 Use paired-single floating-point instructions
 
+mpromote-prototypes
+Target Report Var(mips_do_promote_prototypes) Init(1)
+Promote integral arguments smaller then an int to int.
+
 mr10k-cache-barrier=
 Target Joined RejectNegative Enum(mips_r10k_cache_barrier_setting) Var(mips_r10k_cache_barrier) Init(R10K_CACHE_BARRIER_NONE)
 -mr10k-cache-barrier=SETTING	Specify when r10k cache barriers should be inserted



More information about the Gcc-patches mailing list