diff options
author | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-03 23:55:52 +0000 |
---|---|---|
committer | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-03 23:55:52 +0000 |
commit | 0fb2666c490bdf52cb07a655acf271f9093cd410 (patch) | |
tree | 8bbdd20f2db68edcbad7b5407da0d4c5ce549749 | |
parent | c3db176afa2ff0afa4d502ac46ba37a995ef342b (diff) | |
download | gcc-0fb2666c490bdf52cb07a655acf271f9093cd410.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78868 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 21 | ||||
-rw-r--r-- | gcc/config/i386/i386.h | 16 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 8 | ||||
-rw-r--r-- | gcc/hooks.c | 7 | ||||
-rw-r--r-- | gcc/hooks.h | 1 | ||||
-rw-r--r-- | gcc/stmt.c | 4 | ||||
-rw-r--r-- | gcc/system.h | 3 | ||||
-rw-r--r-- | gcc/target-def.h | 3 | ||||
-rw-r--r-- | gcc/target.h | 4 |
10 files changed, 61 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9ec65af3f1..3dfb6068ca0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index d90d616c6fe..2a12bd870f2 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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" diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 3c4720a4272..910ab791bd2 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -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) /* Stack layout; function entry, exit and calling. */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 3d253a1a28f..79a13f79cc8 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -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 diff --git a/gcc/hooks.c b/gcc/hooks.c index 090a45aba29..ef90ce131c3 100644 --- a/gcc/hooks.c +++ b/gcc/hooks.c @@ -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; +} diff --git a/gcc/hooks.h b/gcc/hooks.h index 60355f5f169..40b5e255025 100644 --- a/gcc/hooks.h +++ b/gcc/hooks.h @@ -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 diff --git a/gcc/stmt.c b/gcc/stmt.c index 092720fb52b..b0cd4fa3d25 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -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. */ diff --git a/gcc/system.h b/gcc/system.h index 8d91547fe98..424ac5f9275 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -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 \ diff --git a/gcc/target-def.h b/gcc/target-def.h index 9b04c303216..89af47e12ee 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -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, \ diff --git a/gcc/target.h b/gcc/target.h index 7366215cb93..2387e4dd38a 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -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. */ |