]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
hooks.c (hook_tree_tree_identity): New.
authorKazu Hirata <kazu@cs.umass.edu>
Wed, 3 Mar 2004 23:55:52 +0000 (23:55 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Wed, 3 Mar 2004 23:55:52 +0000 (23:55 +0000)
* hooks.c (hook_tree_tree_identity): New.
* hooks.h: Add a prototype for hook_tree_tree_identity.
* stmt.c (expand_asm_operands): Use targetm.md_asm_clobbers
instead of MD_ASM_CLOBBERS.
* system.h (MD_ASM_CLOBBERS): Poison.
* target-def.h (TARGET_MD_ASM_CLOBBERS): New.
(TARGET_INITIALIZER): Add TARGET_MD_ASM_CLOBBERS.
* target.h (gcc_target): Add md_asm_clobbers.
* config/i386/i386.c (TARGET_MD_ASM_CLOBBERS): New.
(ix86_md_asm_clobbers): New.
* config/i386/i386.h (MD_ASM_CLOBBERS): Remove.
* doc/tm.texi (MD_ASM_CLOBBERS): Change to
TARGET_MD_ASM_CLOBBERS.

From-SVN: r78868

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/doc/tm.texi
gcc/hooks.c
gcc/hooks.h
gcc/stmt.c
gcc/system.h
gcc/target-def.h
gcc/target.h

index c9ec65af3f146041bf77ae81a553462bcdcaaecd..3dfb6068ca043d98c45fd66a492c7c448b66f97f 100644 (file)
@@ -1,4 +1,21 @@
+2004-03-03  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * hooks.c (hook_tree_tree_identity): New.
+       * hooks.h: Add a prototype for hook_tree_tree_identity.
+       * stmt.c (expand_asm_operands): Use targetm.md_asm_clobbers
+       instead of MD_ASM_CLOBBERS.
+       * system.h (MD_ASM_CLOBBERS): Poison.
+       * target-def.h (TARGET_MD_ASM_CLOBBERS): New.
+       (TARGET_INITIALIZER): Add TARGET_MD_ASM_CLOBBERS.
+       * target.h (gcc_target): Add md_asm_clobbers.
+       * config/i386/i386.c (TARGET_MD_ASM_CLOBBERS): New.
+       (ix86_md_asm_clobbers): New.
+       * config/i386/i386.h (MD_ASM_CLOBBERS): Remove.
+       * doc/tm.texi (MD_ASM_CLOBBERS): Change to
+       TARGET_MD_ASM_CLOBBERS.
+
 2004-03-03  Stuart Hastings  <stuart@apple.com>
+
        * gcc/config.gcc: Arrange for Darwin/x86 to build libgcc_eh.a.
        
 2004-03-03  Eric Botcazou  <ebotcazou@libertysurf.fr>
index d90d616c6feec99970347efb66c1c48a4bfb9ae3..2a12bd870f2593896e7b01174dbaba49de5a97c4 100644 (file)
@@ -886,6 +886,7 @@ static tree ix86_handle_struct_attribute (tree *, tree, tree, int, bool *);
 static int extended_reg_mentioned_1 (rtx *, void *);
 static bool ix86_rtx_costs (rtx, int, int, int *);
 static int min_insn_size (rtx);
+static tree ix86_md_asm_clobbers (tree clobbers);
 
 #if defined (DO_GLOBAL_CTORS_BODY) && defined (HAS_INIT_SECTION)
 static void ix86_svr3_asm_out_constructor (rtx, int);
@@ -1027,6 +1028,9 @@ static void init_ext_80387_constants (void);
 #undef TARGET_BUILD_BUILTIN_VA_LIST
 #define TARGET_BUILD_BUILTIN_VA_LIST ix86_build_builtin_va_list
 
+#undef TARGET_MD_ASM_CLOBBERS
+#define TARGET_MD_ASM_CLOBBERS ix86_md_asm_clobbers
+
 #undef TARGET_PROMOTE_PROTOTYPES
 #define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
 
@@ -16024,4 +16028,21 @@ ix86_expand_vector_init (rtx target, rtx vals)
     }
 }
 
+/* Worker function for TARGET_MD_ASM_CLOBBERS.
+
+   We do this in the new i386 backend to maintain source compatibility
+   with the old cc0-based compiler.  */
+
+static tree
+ix86_md_asm_clobbers (tree clobbers)
+{
+  clobbers = tree_cons (NULL_TREE, build_string (5, "flags"),  
+                       clobbers);                              
+  clobbers = tree_cons (NULL_TREE, build_string (4, "fpsr"),   
+                       clobbers);                              
+  clobbers = tree_cons (NULL_TREE, build_string (7, "dirflag"),        
+                       clobbers);                              
+  return clobbers;
+}
+
 #include "gt-i386.h"
index 3c4720a42725e5f0a57ca0f2575d19659c63dd78..910ab791bd22fa4e6657f701a7d02737154d9fad 100644 (file)
@@ -1591,22 +1591,6 @@ enum reg_class
      || MAYBE_MMX_CLASS_P (CLASS)                      \
    : GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)                \
    ? reg_classes_intersect_p (FLOAT_REGS, (CLASS)) : 0)
-
-/* A C statement that adds to CLOBBERS any hard regs the port wishes
-   to automatically clobber for all asms.
-
-   We do this in the new i386 backend to maintain source compatibility
-   with the old cc0-based compiler.  */
-
-#define MD_ASM_CLOBBERS(CLOBBERS)                                      \
-  do {                                                                 \
-    (CLOBBERS) = tree_cons (NULL_TREE, build_string (5, "flags"),      \
-                           (CLOBBERS));                                \
-    (CLOBBERS) = tree_cons (NULL_TREE, build_string (4, "fpsr"),       \
-                           (CLOBBERS));                                \
-    (CLOBBERS) = tree_cons (NULL_TREE, build_string (7, "dirflag"),    \
-                           (CLOBBERS));                                \
-  } while (0)
 \f
 /* Stack layout; function entry, exit and calling.  */
 
index 3d253a1a28f924a6f88fed5dae86298072ef32b4..79a13f79cc8a8d45ef8bc6fa548c4ad7f11c00d1 100644 (file)
@@ -8864,10 +8864,12 @@ without user intervention.  For instance, under Microsoft Windows
 symbols must be explicitly imported from shared libraries (DLLs).
 @end defmac
 
-@defmac MD_ASM_CLOBBERS (@var{clobbers})
-A C statement that adds to @var{clobbers} @code{STRING_CST} trees for
+@deftypefn {Target Hook} tree TARGET_MD_ASM_CLOBBERS (tree @var{clobbers})
+This target hook should add to @var{clobbers} @code{STRING_CST} trees for
 any hard regs the port wishes to automatically clobber for all asms.
-@end defmac
+It should return the result of the last @code{tree_cons} used to add a
+clobber.
+@end deftypefn
 
 @defmac MATH_LIBRARY
 Define this macro as a C string constant for the linker argument to link
index 090a45aba290e83a98f0c27bfbaa6d21df6b870f..ef90ce131c30986807061fa236242c5df80e76b2 100644 (file)
@@ -209,3 +209,10 @@ hook_bool_voidp_size_t_false (void * a ATTRIBUTE_UNUSED,
 {
   return false;
 }
+
+/* Generic hook that takes a tree and returns it as is.  */
+tree
+hook_tree_tree_identity (tree a)
+{
+  return a;
+}
index 60355f5f169326938aa69f698b7cee4799395a22..40b5e255025d12822adea2c69969c1cef710cf6c 100644 (file)
@@ -57,5 +57,6 @@ extern rtx hook_rtx_rtx_null (rtx);
 extern rtx hook_rtx_tree_int_null (tree, int);
 extern void * hook_voidp_size_t_null (size_t);
 extern bool hook_bool_voidp_size_t_false (void *, size_t);
+extern tree hook_tree_tree_identity (tree a);
 
 #endif
index 092720fb52b2b9fb034fa0d1af38fd218ae383e1..b0cd4fa3d2507f75dbba593a02aa990deb088e66 100644 (file)
@@ -1486,13 +1486,11 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
   for (t = inputs; t ; t = TREE_CHAIN (t), i++)
     constraints[i] = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
 
-#ifdef MD_ASM_CLOBBERS
   /* Sometimes we wish to automatically clobber registers across an asm.
      Case in point is when the i386 backend moved from cc0 to a hard reg --
      maintaining source-level compatibility means automatically clobbering
      the flags register.  */
-  MD_ASM_CLOBBERS (clobbers);
-#endif
+  clobbers = targetm.md_asm_clobbers (clobbers);
 
   /* Count the number of meaningful clobbered registers, ignoring what
      we would ignore later.  */
index 8d91547fe986deacc12a07008cb64fd531141ba4..424ac5f9275c1f4d574a82038acd9fc3d07b0e07 100644 (file)
@@ -640,7 +640,8 @@ typedef char _Bool;
        MAX_WCHAR_TYPE_SIZE GCOV_TYPE_SIZE SHARED_SECTION_ASM_OP           \
        FINAL_REG_PARM_STACK_SPACE MAYBE_REG_PARM_STACK_SPACE              \
        TRADITIONAL_PIPELINE_INTERFACE DFA_PIPELINE_INTERFACE              \
-       DBX_OUTPUT_STANDARD_TYPES BUILTIN_SETJMP_FRAME_VALUE
+       DBX_OUTPUT_STANDARD_TYPES BUILTIN_SETJMP_FRAME_VALUE               \
+       MD_ASM_CLOBBERS
 
 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE  \
index 9b04c3032164726cff0b08f8883760c59e2fe105..89af47e12ee3dfed2b7a304dc1c49309db42a193 100644 (file)
@@ -333,6 +333,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #define TARGET_BUILTIN_SETJMP_FRAME_VALUE default_builtin_setjmp_frame_value
 
+#define TARGET_MD_ASM_CLOBBERS hook_tree_tree_identity
+
 #define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_false
 #define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_false
 #define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_false
@@ -400,6 +402,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   TARGET_PCH_VALID_P,                          \
   TARGET_DEFAULT_SHORT_ENUMS,                  \
   TARGET_BUILTIN_SETJMP_FRAME_VALUE,           \
+  TARGET_MD_ASM_CLOBBERS,                      \
   TARGET_HAVE_NAMED_SECTIONS,                  \
   TARGET_HAVE_CTORS_DTORS,                     \
   TARGET_HAVE_TLS,                             \
index 7366215cb9311040f32d44a111e957057eeef04f..2387e4dd38a4080b3f74dccee3b4636307dc6752 100644 (file)
@@ -425,6 +425,10 @@ struct gcc_target
      of the current frame into the built-in setjmp buffer.  */
   rtx (* builtin_setjmp_frame_value) (void);
 
+  /* This target hook should add STRING_CST trees for any hard regs
+     the port wishes to automatically clobber for all asms.  */
+  tree (* md_asm_clobbers) (tree);
+
   /* Leave the boolean fields at the end.  */
 
   /* True if arbitrary sections are supported.  */