[PATCH] rs6000: Use parameterized names for tablejump

Alan Modra amodra@gmail.com
Wed Sep 30 04:01:40 GMT 2020


On Wed, Sep 30, 2020 at 12:04:25AM +0000, Segher Boessenkool wrote:
> 	* config/rs6000/rs6000.md (tablejump): Simplify.
> 	(tablejumpsi): Merge this ...
> 	(tablejumpdi): ... and this ...
> 	(@tablejump<mode>_normal): ... into this.
> 	(tablejumpsi_nospec): Merge this ...
> 	(tablejumpdi_nospec): ... and this ...
> 	(@tablejump<mode>_nospec): ... into this.
> 	(*tablejump<mode>_internal1): Delete, rename to ...
> 	(@tablejump<mode>_insn_normal): ... this.
> 	(*tablejump<mode>_internal1_nospec): Delete, rename to ...
> 	(@tablejump<mode>_insn_nospec): ... this.

decQuad.o] Error 1
*** stack smashing detected ***: terminated
during RTL pass: expand

I'll commit this as obvious after my regstraps finish.

	* config/rs6000/rs6000.md (@tablejump<mode>_normal): Don't use
	non-existent operands[].
	(@tablejump<mode>_nospec): Likewise.

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 24ad80993ad..779bfd11237 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -12716,21 +12716,22 @@
    (use (match_operand:P 1))]
   "rs6000_speculate_indirect_jumps"
 {
+  rtx off;
   operands[0] = force_reg (SImode, operands[0]);
   if (<MODE>mode == SImode)
-    operands[4] = operands[0];
+    off = operands[0];
   else
     {
-      operands[4] = gen_reg_rtx (Pmode);
+      off = gen_reg_rtx (Pmode);
       rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, operands[0]);
-      emit_move_insn (operands[4], src);
+      emit_move_insn (off, src);
     }
 
-  operands[2] = force_reg (Pmode, gen_rtx_LABEL_REF (Pmode, operands[1]));
-  operands[3] = gen_reg_rtx (Pmode);
+  rtx lab = force_reg (Pmode, gen_rtx_LABEL_REF (Pmode, operands[1]));
+  rtx addr = gen_reg_rtx (Pmode);
 
-  emit_insn (gen_add<mode>3 (operands[3], operands[4], operands[2]));
-  emit_jump_insn (gen_tablejump_insn_normal (Pmode, operands[3], operands[1]));
+  emit_insn (gen_add<mode>3 (addr, off, lab));
+  emit_jump_insn (gen_tablejump_insn_normal (Pmode, addr, operands[1]));
   DONE;
 })
 
@@ -12740,21 +12741,22 @@
    (use (match_operand:CC 2))]
   "!rs6000_speculate_indirect_jumps"
 {
+  rtx off;
   operands[0] = force_reg (SImode, operands[0]);
   if (<MODE>mode == SImode)
-    operands[4] = operands[0];
+    off = operands[0];
   else
     {
-      operands[4] = gen_reg_rtx (Pmode);
+      off = gen_reg_rtx (Pmode);
       rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, operands[0]);
-      emit_move_insn (operands[4], src);
+      emit_move_insn (off, src);
     }
 
-  operands[5] = force_reg (Pmode, gen_rtx_LABEL_REF (Pmode, operands[1]));
-  operands[3] = gen_reg_rtx (Pmode);
+  rtx lab = force_reg (Pmode, gen_rtx_LABEL_REF (Pmode, operands[1]));
+  rtx addr = gen_reg_rtx (Pmode);
 
-  emit_insn (gen_add<mode>3 (operands[3], operands[4], operands[5]));
-  emit_jump_insn (gen_tablejump_insn_nospec (Pmode, operands[3], operands[1],
+  emit_insn (gen_add<mode>3 (addr, off, lab));
+  emit_jump_insn (gen_tablejump_insn_nospec (Pmode, addr, operands[1],
 					     operands[2]));
   DONE;
 })


-- 
Alan Modra
Australia Development Lab, IBM


More information about the Gcc-patches mailing list