Patchwork Ping: always supply a mode to plus_constant

login
register
mail settings
Submitter Tristan Gingold
Date May 14, 2012, 2:14 p.m.
Message ID <5C3163C7-CDA6-4C65-BEDE-230F6BE8BD6C@adacore.com>
Download mbox | patch
Permalink /patch/159028/
State New
Headers show

Comments

Tristan Gingold - May 14, 2012, 2:14 p.m.
On May 14, 2012, at 3:23 PM, Richard Sandiford wrote:

> Richard Guenther <richard.guenther@gmail.com> writes:
>> On Sun, May 6, 2012 at 12:23 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Thu, May 3, 2012 at 11:15 AM, Richard Sandiford
>>> <rdsandiford@googlemail.com> wrote:
>>>> Ping for this patch to always supply a mode to plus_constant:
>>>> 
>>>>    http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00892.html
>>>> 
>>>> I've done a diff of the changes since the original test revision
>>>> (which was r186448 FWIW) and there's only been one plus_constant-
>>>> related change since then: Alan's rs6000 prologue/epilogue fixes.
>>>> I'd repeat the original testing before committing.
>>>> 
>>> 
>>> This caused:
>>> 
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53249
>> 
>> It also casuses IA64 build to fail for me:
>> 
>> /gcc/spec/sb-terbium-head-64/gcc/gcc/config/ia64/ia64.c: In function
>> 'ia64_emit_probe_stack_range':
>> /gcc/spec/sb-terbium-head-64/gcc/gcc/config/ia64/ia64.c:3279: error:
>> incompatible type for argument 1 of 'plus_constant'
>> /gcc/spec/sb-terbium-head-64/gcc/gcc/config/ia64/ia64.c:3279: warning:
>> passing argument 2 of 'plus_constant' makes pointer from integer
>> without a cast
>> /gcc/spec/sb-terbium-head-64/gcc/gcc/config/ia64/ia64.c:3279: error:
>> too few arguments to function 'plus_constant'
>> /gcc/spec/sb-terbium-head-64/gcc/gcc/config/ia64/ia64.c:3330: error:
>> incompatible type for argument 1 of 'plus_constant'
>> ...
> 
> I think this was:
> 
> 2012-05-10  Eric Botcazou  <ebotcazou@adacore.com>
> 	    Tristan Gingold  <gingold@adacore.com>
> 
> 	* doc/md.texi (Standard Names): Document probe_stack_address.
> 	* explow.c (emit_stack_probe): Handle probe_stack_address.
> 	* config/ia64/ia64.md (UNSPECV_PROBE_STACK_ADDRESS): New constant.
> 	(UNSPECV_PROBE_STACK_RANGE): Likewise.
> 	(probe_stack_address): New insn.
> 	(probe_stack_range): Likewise.
> 	* config/ia64/ia64.c: Include common/common-target.h.
> 	(ia64_compute_frame_size): Mark r2 and r3 as used if static stack
> 	checking is enabled.
> 	(ia64_emit_probe_stack_range): New function.
> 	(output_probe_stack_range): Likewise.
> 	(ia64_expand_prologue): Invoke ia64_emit_probe_stack_range if static
> 	builtin stack checking is enabled.
> 	(rtx_needs_barrier) <UNSPEC_VOLATILE>: Handle UNSPECV_PROBE_STACK_RANGE
> 	and UNSPECV_PROBE_STACK_ADDRESS.
> 	(unknown_for_bundling_p): New predicate.
> 	(group_barrier_needed): Use important_for_bundling_p.
> 	(ia64_dfa_new_cycle): Use unknown_for_bundling_p.
> 	(issue_nops_and_insn): Likewise.
> 	(bundling): Likewise.
> 	(final_emit_insn_group_barriers): Likewise.
> 	* config/ia64/ia64-protos.h (output_probe_stack_range): Declare.
> 	* config/ia64/hpux.h (STACK_CHECK_STATIC_BUILTIN): Define.
> 	(STACK_CHECK_PROTECT): Likewise.
> 	* config/ia64/linux.h (STACK_CHECK_STATIC_BUILTIN): Likewise.
> 
> which went in a few days after my patch.

The following patch fixes the build (not reg-tested, but looks obvious):

2012-05-14  Tristan Gingold  <gingold@adacore.com>

	* config/ia64/ia64.c (ia64_expand_prologue): Adjust calls to plus_constant.
Eric Botcazou - May 14, 2012, 2:53 p.m.
> The following patch fixes the build (not reg-tested, but looks obvious):
>
> 2012-05-14  Tristan Gingold  <gingold@adacore.com>
>
> 	* config/ia64/ia64.c (ia64_expand_prologue): Adjust calls to plus_constant.

Yes, that's the correct fix.  Sorry for the stupid breakage.
Eric Botcazou - May 15, 2012, 7:40 a.m.
> The following patch fixes the build (not reg-tested, but looks obvious):
>
> 2012-05-14  Tristan Gingold  <gingold@adacore.com>
>
> 	* config/ia64/ia64.c (ia64_expand_prologue): Adjust calls to
> plus_constant.

Applied as obvious after fixing the ChangeLog.

Patch

diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index e10db35..4c6050f 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -3277,7 +3277,7 @@  ia64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size, int sol)
 	 size is at least 4096 - (96 + 2) * 8 = 3312 bytes, which is enough.
 	 Also compute the address of the last probe for the memory stack
 	 (which grows towards lower addresses).  */
-      emit_insn (gen_rtx_SET (VOIDmode, r3, plus_constant (r3, 4095)));
+      emit_insn (gen_rtx_SET (VOIDmode, r3, plus_constant (Pmode, r3, 4095)));
       emit_insn (gen_rtx_SET (VOIDmode, r2,
 			      gen_rtx_PLUS (Pmode, stack_pointer_rtx, r2)));
 
@@ -3329,12 +3329,12 @@  ia64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size, int sol)
       for (i = 2 * PROBE_INTERVAL; i < size; i += PROBE_INTERVAL)
 	{
 	  emit_insn (gen_rtx_SET (VOIDmode, r2,
-				  plus_constant (r2, -PROBE_INTERVAL)));
+				  plus_constant (Pmode, r2, -PROBE_INTERVAL)));
 	  emit_stack_probe (r2);
 	}
 
       emit_insn (gen_rtx_SET (VOIDmode, r2,
-			      plus_constant (r2,
+			      plus_constant (Pmode, r2,
 					     (i - PROBE_INTERVAL) - size)));
       emit_stack_probe (r2);
     }
@@ -3395,7 +3395,8 @@  ia64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size, int sol)
       if (size != rounded_size)
 	{
 	  emit_insn (gen_rtx_SET (VOIDmode, r2,
-				  plus_constant (r2, rounded_size - size)));
+				  plus_constant (Pmode,
+						 r2, rounded_size - size)));
 	  emit_stack_probe (r2);
 	}
     }