OSDN Git Service

* fold-const.c (fold) <TRUNC_MOD_EXPR>: The transformation "X % -Y"
[pf3gnuchains/gcc-fork.git] / gcc / integrate.c
index df2c823..855960c 100644 (file)
@@ -105,9 +105,8 @@ function_attribute_inlinable_p (tree fndecl)
   return true;
 }
 \f
-/* Copy NODE (which must be a DECL, but not a PARM_DECL).  The DECL
-   originally was in the FROM_FN, but now it will be in the
-   TO_FN.  */
+/* Copy NODE (which must be a DECL).  The DECL originally was in the FROM_FN,
+   but now it will be in the TO_FN.  */
 
 tree
 copy_decl_for_inlining (tree decl, tree from_fn, tree to_fn)
@@ -117,36 +116,14 @@ copy_decl_for_inlining (tree decl, tree from_fn, tree to_fn)
   /* Copy the declaration.  */
   if (TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == RESULT_DECL)
     {
-      tree type;
-      int invisiref = 0;
-
-      /* See if the frontend wants to pass this by invisible reference.  */
-      if (TREE_CODE (decl) == PARM_DECL
-         && DECL_ARG_TYPE (decl) != TREE_TYPE (decl)
-         && POINTER_TYPE_P (DECL_ARG_TYPE (decl))
-         && TREE_TYPE (DECL_ARG_TYPE (decl)) == TREE_TYPE (decl))
-       {
-         invisiref = 1;
-         type = DECL_ARG_TYPE (decl);
-       }
-      else
-       type = TREE_TYPE (decl);
+      tree type = TREE_TYPE (decl);
 
-      /* For a parameter, we must make an equivalent VAR_DECL, not a
+      /* For a parameter or result, we must make an equivalent VAR_DECL, not a
         new PARM_DECL.  */
       copy = build_decl (VAR_DECL, DECL_NAME (decl), type);
-      if (!invisiref)
-       {
-         TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (decl);
-         TREE_READONLY (copy) = TREE_READONLY (decl);
-         TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (decl);
-       }
-      else
-       {
-         TREE_ADDRESSABLE (copy) = 0;
-         TREE_READONLY (copy) = 1;
-         TREE_THIS_VOLATILE (copy) = 0;
-       }
+      TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (decl);
+      TREE_READONLY (copy) = TREE_READONLY (decl);
+      TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (decl);
     }
   else
     {
@@ -161,10 +138,14 @@ copy_decl_for_inlining (tree decl, tree from_fn, tree to_fn)
       if (TREE_CODE (copy) == LABEL_DECL)
        {
          TREE_ADDRESSABLE (copy) = 0;
-         DECL_TOO_LATE (copy) = 0;
        }
     }
 
+  /* Don't generate debug information for the copy if we wouldn't have
+     generated it for the copy either.  */
+  DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (decl);
+  DECL_IGNORED_P (copy) = DECL_IGNORED_P (decl);
+
   /* Set the DECL_ABSTRACT_ORIGIN so the debugging routines know what
      declaration inspired this copy.  */
   DECL_ABSTRACT_ORIGIN (copy) = DECL_ORIGIN (decl);
@@ -326,19 +307,6 @@ copy_rtx_and_substitute (rtx orig, struct inline_remap *map, int for_lhs)
              emit_insn_after (seq, map->insns_at_start);
              return temp;
            }
-         else if (REG_FUNCTION_VALUE_P (orig))
-           {
-             if (rtx_equal_function_value_matters)
-               /* This is an ignored return value.  We must not
-                  leave it in with REG_FUNCTION_VALUE_P set, since
-                  that would confuse subsequent inlining of the
-                  current function into a later function.  */
-               return gen_rtx_REG (GET_MODE (orig), regno);
-             else
-               /* Must be unrolling loops or replicating code if we
-                  reach here, so return the register unchanged.  */
-               return orig;
-           }
          else
            return orig;
 
@@ -364,46 +332,11 @@ copy_rtx_and_substitute (rtx orig, struct inline_remap *map, int for_lhs)
                                  GET_MODE (SUBREG_REG (orig)),
                                  SUBREG_BYTE (orig));
 
-    case ADDRESSOF:
-      copy = gen_rtx_ADDRESSOF (mode,
-                               copy_rtx_and_substitute (XEXP (orig, 0),
-                                                        map, for_lhs),
-                               0, ADDRESSOF_DECL (orig));
-      regno = ADDRESSOF_REGNO (orig);
-      if (map->reg_map[regno])
-       regno = REGNO (map->reg_map[regno]);
-      else if (regno > LAST_VIRTUAL_REGISTER)
-       {
-         temp = XEXP (orig, 0);
-         map->reg_map[regno] = gen_reg_rtx (GET_MODE (temp));
-         REG_USERVAR_P (map->reg_map[regno]) = REG_USERVAR_P (temp);
-         REG_LOOP_TEST_P (map->reg_map[regno]) = REG_LOOP_TEST_P (temp);
-         RTX_UNCHANGING_P (map->reg_map[regno]) = RTX_UNCHANGING_P (temp);
-         /* A reg with REG_FUNCTION_VALUE_P true will never reach here.  */
-
-         /* Objects may initially be represented as registers, but
-            but turned into a MEM if their address is taken by
-            put_var_into_stack.  Therefore, the register table may have
-            entries which are MEMs.
-
-            We briefly tried to clear such entries, but that ended up
-            cascading into many changes due to the optimizers not being
-            prepared for empty entries in the register table.  So we've
-            decided to allow the MEMs in the register table for now.  */
-         if (REG_P (map->x_regno_reg_rtx[regno])
-             && REG_POINTER (map->x_regno_reg_rtx[regno]))
-           mark_reg_pointer (map->reg_map[regno],
-                             map->regno_pointer_align[regno]);
-         regno = REGNO (map->reg_map[regno]);
-       }
-      ADDRESSOF_REGNO (copy) = regno;
-      return copy;
-
     case USE:
     case CLOBBER:
       /* USE and CLOBBER are ordinary, but we convert (use (subreg foo))
         to (use foo) if the original insn didn't have a subreg.
-        Removing the subreg distorts the VAX movstrhi pattern
+        Removing the subreg distorts the VAX movmemhi pattern
         by changing the mode of an operand.  */
       copy = copy_rtx_and_substitute (XEXP (orig, 0), map, code == CLOBBER);
       if (GET_CODE (copy) == SUBREG && GET_CODE (XEXP (orig, 0)) != SUBREG)
@@ -439,13 +372,6 @@ copy_rtx_and_substitute (rtx orig, struct inline_remap *map, int for_lhs)
           && ! (CODE_LABEL_NUMBER (XEXP (copy, 0)) >= get_first_label_num ()
                 && CODE_LABEL_NUMBER (XEXP (copy, 0)) < max_label_num ()));
 
-      /* If we have made a nonlocal label local, it means that this
-        inlined call will be referring to our nonlocal goto handler.
-        So make sure we create one for this block; we normally would
-        not since this is not otherwise considered a "call".  */
-      if (LABEL_REF_NONLOCAL_P (orig) && ! LABEL_REF_NONLOCAL_P (copy))
-       function_call_count++;
-
       return copy;
 
     case PC:
@@ -505,8 +431,13 @@ copy_rtx_and_substitute (rtx orig, struct inline_remap *map, int for_lhs)
          ASM_OPERANDS_INPUT_VEC (copy) = map->copy_asm_operands_vector;
          ASM_OPERANDS_INPUT_CONSTRAINT_VEC (copy)
            = map->copy_asm_constraints_vector;
+#ifdef USE_MAPPED_LOCATION
+         ASM_OPERANDS_SOURCE_LOCATION (copy)
+           = ASM_OPERANDS_SOURCE_LOCATION (orig);
+#else
          ASM_OPERANDS_SOURCE_FILE (copy) = ASM_OPERANDS_SOURCE_FILE (orig);
          ASM_OPERANDS_SOURCE_LINE (copy) = ASM_OPERANDS_SOURCE_LINE (orig);
+#endif
          return copy;
        }
       break;
@@ -675,7 +606,7 @@ try_constants (rtx insn, struct inline_remap *map)
 
   /* Enforce consistency between the addresses in the regular insn flow
      and the ones in CALL_INSN_FUNCTION_USAGE lists, if any.  */
-  if (GET_CODE (insn) == CALL_INSN && CALL_INSN_FUNCTION_USAGE (insn))
+  if (CALL_P (insn) && CALL_INSN_FUNCTION_USAGE (insn))
     {
       subst_constants (&CALL_INSN_FUNCTION_USAGE (insn), insn, map, 1);
       apply_change_group ();
@@ -765,7 +696,7 @@ subst_constants (rtx *loc, rtx insn, struct inline_remap *map, int memonly)
     case CLOBBER:
       /* The only thing we can do with a USE or CLOBBER is possibly do
         some substitutions in a MEM within it.  */
-      if (GET_CODE (XEXP (x, 0)) == MEM)
+      if (MEM_P (XEXP (x, 0)))
        subst_constants (&XEXP (XEXP (x, 0), 0), insn, map, 0);
       return;
 
@@ -866,7 +797,7 @@ subst_constants (rtx *loc, rtx insn, struct inline_remap *map, int memonly)
          }
 
        /* Do substitute in the address of a destination in memory.  */
-       if (GET_CODE (*dest_loc) == MEM)
+       if (MEM_P (*dest_loc))
          subst_constants (&XEXP (*dest_loc, 0), insn, map, 0);
 
        /* Check for the case of DEST a SUBREG, both it and the underlying
@@ -1300,7 +1231,7 @@ emit_initial_value_sets (void)
   seq = get_insns ();
   end_sequence ();
 
-  emit_insn_after (seq, get_insns ());
+  emit_insn_after (seq, entry_of_function ());
 }
 
 /* If the backend knows where to allocate pseudos for hard
@@ -1322,7 +1253,7 @@ allocate_initial_values (rtx *reg_equiv_memory_loc ATTRIBUTE_UNUSED)
 
       if (x == NULL_RTX || REG_N_SETS (REGNO (ivs->entries[i].pseudo)) > 1)
        ; /* Do nothing.  */
-      else if (GET_CODE (x) == MEM)
+      else if (MEM_P (x))
        reg_equiv_memory_loc[regno] = x;
       else if (REG_P (x))
        {