On 06/05/15 15:22, Christian Bruel wrote:
Re-implement ARM_DECLARE_FUNCTION_NAME as a function. That will make
changed related to unified/divided and mode directives easier to insert.

Patch could be smaller as below.


Thanks

Christian

2014-09-23  Christian Bruel  <christian.br...@st.com>

        * config/arm/arm-protos.h (arm_declare_function_name): Declare.
        (is_called_in_ARM_mode): Remove.
        * config/arm/arm.c (is_called_in_ARM_mode): Declare static bool.
        (arm_declare_function_name): Moved from from ARM_DECLARE_FUNCTION_NAME.
        * config/arm/arm.h (ARM_DECLARE_FUNCTION_NAME): Call
         arm_declare_function_name.

diff '--exclude=.svn' -ruN gnu_trunk.p2/gcc/gcc/config/arm/arm.c 
gnu_trunk.p3/gcc/gcc/config/arm/arm.c
--- gnu_trunk.p2/gcc/gcc/config/arm/arm.c       2015-05-06 14:27:41.042302661 
+0200
+++ gnu_trunk.p3/gcc/gcc/config/arm/arm.c       2015-05-06 14:31:48.750726995 
+0200
@@ -23451,6 +23451,23 @@
   fprintf (f, "}\n");
 }

+/* Return nonzero if FUNC must be entered in ARM mode.  */
+static bool
+is_called_in_ARM_mode (tree func)
+{
+  gcc_assert (TREE_CODE (func) == FUNCTION_DECL);
+
+  /* Ignore the problem about functions whose address is taken.  */
+  if (TARGET_CALLEE_INTERWORKING && TREE_PUBLIC (func))
+    return true;
+
+#ifdef ARM_PE
+  return lookup_attribute ("interfacearm", DECL_ATTRIBUTES (func)) != 
NULL_TREE;
+#else
+  return false;
+#endif
+}
+
 /* Generate code to return from a thumb function.
    If 'reg_containing_return_addr' is -1, then the return address is
    actually on the stack, at the stack pointer.  */
@@ -23886,22 +23903,6 @@
   return 0;
 }

-/* Return nonzero if FUNC must be entered in ARM mode.  */
-int
-is_called_in_ARM_mode (tree func)
-{
-  gcc_assert (TREE_CODE (func) == FUNCTION_DECL);
-
-  /* Ignore the problem about functions whose address is taken.  */
-  if (TARGET_CALLEE_INTERWORKING && TREE_PUBLIC (func))
-    return TRUE;
-
-#ifdef ARM_PE
-  return lookup_attribute ("interfacearm", DECL_ATTRIBUTES (func)) != 
NULL_TREE;
-#else
-  return FALSE;
-#endif
-}

Instead of moving this around , just redefine with static bool.


 /* Given the stack offsets and register mask in OFFSETS, decide how
    many additional registers to push instead of subtracting a constant
@@ -29270,6 +29271,25 @@
          && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)));
 }

+void
+arm_declare_function_name (FILE *stream, const char *name, tree decl)
+{
+  if (TARGET_THUMB)
+    {
+      if (is_called_in_ARM_mode (decl)
+         || (TARGET_THUMB1 && !TARGET_THUMB1_ONLY
+             && cfun->is_thunk))
+       fprintf (stream, "\t.code 32\n");
+      else if (TARGET_THUMB1)
+       fprintf (stream, "\t.code\t16\n\t.thumb_func\n");
+      else
+       fprintf (stream, "\t.thumb\n\t.thumb_func\n");
+    }
+
+  if (TARGET_POKE_FUNCTION_NAME)
+    arm_poke_function_name (stream, (const char *) name);
+}
+

Move to end of file.

 /* If MEM is in the form of [base+offset], extract the two parts
    of address and set to BASE and OFFSET, otherwise return false
    after clearing BASE and OFFSET.  */
@@ -29390,4 +29410,5 @@
   *pri = tmp;
   return;
 }
+
 #include "gt-arm.h"
diff '--exclude=.svn' -ruN gnu_trunk.p2/gcc/gcc/config/arm/arm.h 
gnu_trunk.p3/gcc/gcc/config/arm/arm.h
--- gnu_trunk.p2/gcc/gcc/config/arm/arm.h       2015-05-06 14:27:45.362310057 
+0200
+++ gnu_trunk.p3/gcc/gcc/config/arm/arm.h       2015-05-06 14:31:48.750726995 
+0200
@@ -2157,23 +2157,7 @@
    ? 1 : 0)

 #define ARM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL)  \
-  do                                                   \
-    {                                                  \
-      if (TARGET_THUMB)                                \
-        {                                              \
-          if (is_called_in_ARM_mode (DECL)             \
-             || (TARGET_THUMB1 && !TARGET_THUMB1_ONLY  \
-                 && cfun->is_thunk))        \
-            fprintf (STREAM, "\t.code 32\n") ;               \
-          else if (TARGET_THUMB1)                      \
-           fprintf (STREAM, "\t.code\t16\n\t.thumb_func\n") ;        \
-          else                                         \
-           fprintf (STREAM, "\t.thumb\n\t.thumb_func\n") ;   \
-        }                                              \
-      if (TARGET_POKE_FUNCTION_NAME)                   \
-        arm_poke_function_name (STREAM, (const char *) NAME);  \
-    }                                                  \
-  while (0)
+  arm_declare_function_name ((STREAM), (NAME), (DECL));

 /* For aliases of functions we use .thumb_set instead.  */
 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL1, DECL2)          \
diff '--exclude=.svn' -ruN gnu_trunk.p2/gcc/gcc/config/arm/arm-protos.h 
gnu_trunk.p3/gcc/gcc/config/arm/arm-protos.h
--- gnu_trunk.p2/gcc/gcc/config/arm/arm-protos.h        2015-05-06 
14:27:45.362310057 +0200
+++ gnu_trunk.p3/gcc/gcc/config/arm/arm-protos.h        2015-05-06 
14:31:48.750726995 +0200
@@ -30,6 +30,7 @@
 extern int arm_volatile_func (void);
 extern void arm_expand_prologue (void);
 extern void arm_expand_epilogue (bool);
+extern void arm_declare_function_name (FILE *, const char *, tree);
 extern void thumb2_expand_return (bool);
 extern const char *arm_strip_name_encoding (const char *);
 extern void arm_asm_output_labelref (FILE *, const char *);
@@ -181,9 +182,6 @@
 extern void thumb1_expand_prologue (void);
 extern void thumb1_expand_epilogue (void);
 extern const char *thumb1_output_interwork (void);
-#ifdef TREE_CODE
-extern int is_called_in_ARM_mode (tree);
-#endif
 extern int thumb_shiftable_const (unsigned HOST_WIDE_INT);
 #ifdef RTX_CODE
 extern enum arm_cond_code maybe_get_arm_condition_code (rtx);


Ok with those changes.

Ramana

Reply via email to