print-rtl.c (debug_call_placeholder_verbose): New variable.
authorAlexandre Oliva <aoliva@redhat.com>
Mon, 11 Sep 2000 21:03:26 +0000 (21:03 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Mon, 11 Sep 2000 21:03:26 +0000 (21:03 +0000)
* print-rtl.c (debug_call_placeholder_verbose): New variable.
(print_rtx) [CALL_PLACEHOLDER]: Dump all call sequences if it is
set.
* integrate.c (copy_rtx_and_substitute): Don't share
LEAF_REG_REMAPpable registers with the inlined function.  Don't
share the function value with calling sequences.

From-SVN: r36329

gcc/ChangeLog
gcc/integrate.c
gcc/print-rtl.c

index a2e3b40e870d8a17b46bc252887406a1fd4b1cc3..1f902ca852954970d70887a3ec93ee7e244654bd 100644 (file)
@@ -1,3 +1,12 @@
+2000-09-11  Alexandre Oliva  <aoliva@redhat.com>
+
+       * print-rtl.c (debug_call_placeholder_verbose): New variable.
+       (print_rtx) [CALL_PLACEHOLDER]: Dump all call sequences if it is
+       set.
+       * integrate.c (copy_rtx_and_substitute): Don't share
+       LEAF_REG_REMAPpable registers with the inlined function.  Don't
+       share the function value with calling sequences.
+
 2000-09-11  Jakub Jelinek  <jakub@redhat.com>
 
        * c-decl.c (do_case): Fix a typo.
index 70666750119546d8616185dad11e88243ccd159d..6128aaf895d974638d454ebb55546361a7addcd5 100644 (file)
@@ -1746,7 +1746,15 @@ copy_rtx_and_substitute (orig, map, for_lhs)
        {
          /* Some hard registers are also mapped,
             but others are not translated.  */
-         if (map->reg_map[regno] != 0)
+         if (map->reg_map[regno] != 0
+             /* We shouldn't usually have reg_map set for return
+                register, but it may happen if we have leaf-register
+                remapping and the return register is used in one of
+                the calling sequences of a call_placeholer.  In this
+                case, we'll end up with a reg_map set for this
+                register, but we don't want to use for registers
+                marked as return values.  */
+             && ! REG_FUNCTION_VALUE_P (orig))
            return map->reg_map[regno];
 
          /* If this is the virtual frame pointer, make space in current
@@ -1757,7 +1765,7 @@ copy_rtx_and_substitute (orig, map, for_lhs)
             equivalence for it to be the address.  This will substitute the
             address into insns where it can be substituted and use the new
             pseudo where it can't.  */
-         if (regno == VIRTUAL_STACK_VARS_REGNUM)
+         else if (regno == VIRTUAL_STACK_VARS_REGNUM)
            {
              rtx loc, seq;
              int size = get_func_frame_size (DECL_SAVED_INSNS (map->fndecl));
@@ -1844,7 +1852,26 @@ copy_rtx_and_substitute (orig, map, for_lhs)
              else
                return map->inline_target;
            }
-         return orig;
+#if defined (LEAF_REGISTERS) && defined (LEAF_REG_REMAP)
+         /* If leaf_renumber_regs_insn() might remap this register to
+            some other number, make sure we don't share it with the
+            inlined function, otherwise delayed optimization of the
+            inlined function may change it in place, breaking our
+            reference to it.  We may still shared it within the
+            function, so create an entry for this register in the
+            reg_map.  */
+         if (map->integrating && regno < FIRST_PSEUDO_REGISTER
+             && LEAF_REGISTERS[regno] && LEAF_REG_REMAP (regno) != regno)
+           {
+             temp = gen_rtx_REG (mode, regno);
+             map->reg_map[regno] = temp;
+             return temp;
+           }
+#endif
+         else
+           return orig;
+
+         abort ();
        }
       if (map->reg_map[regno] == NULL)
        {
index 5d7cd5feebba8e82dfd301dbc82a786850ca8858..31eac815cef57fe7b9db7d5976351eb8d41ceb43 100644 (file)
@@ -63,6 +63,9 @@ int flag_dump_unnumbered = 0;
 /* Nonzero if we are dumping graphical description.  */
 int dump_for_graph;
 
+/* Nonzero to dump all call_placeholder alternatives.  */
+static int debug_call_placeholder_verbose;
+
 /* Print IN_RTX onto OUTFILE.  This is the recursive part of printing.  */
 
 static void
@@ -421,6 +424,37 @@ print_rtx (in_rtx)
       break;
 
     case CALL_PLACEHOLDER:
+      if (debug_call_placeholder_verbose)
+       {
+         fputs (" (cond [\n  (const_string \"normal\") (sequence [", outfile);
+         for (tem = XEXP (in_rtx, 0); tem != 0; tem = NEXT_INSN (tem))
+           {
+             fputs ("\n    ", outfile);
+             print_inline_rtx (outfile, tem, 4);
+           }
+
+         tem = XEXP (in_rtx, 1);
+         if (tem)
+           fputs ("\n    ])\n  (const_string \"tail_call\") (sequence [", outfile);
+         for (; tem != 0; tem = NEXT_INSN (tem))
+           {
+             fputs ("\n    ", outfile);
+             print_inline_rtx (outfile, tem, 4);
+           }
+
+         tem = XEXP (in_rtx, 2);
+         if (tem)
+           fputs ("\n    ])\n  (const_string \"tail_recursion\") (sequence [", outfile);
+         for (; tem != 0; tem = NEXT_INSN (tem))
+           {
+             fputs ("\n    ", outfile);
+             print_inline_rtx (outfile, tem, 4);
+           }
+
+         fputs ("\n    ])\n  ])", outfile);
+         break;
+       }
+
       for (tem = XEXP (in_rtx, 0); tem != 0; tem = NEXT_INSN (tem))
        if (GET_CODE (tem) == CALL_INSN)
          {