Commit 67dfe110 by Kazu Hirata Committed by Kazu Hirata

hooks.c (hook_tree_tree_identity): New.

	* 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
parent dd0a905f
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>
......
......@@ -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"
......@@ -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. */
......
......@@ -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
......
......@@ -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;
}
......@@ -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
......@@ -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. */
......
......@@ -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 \
......
......@@ -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, \
......
......@@ -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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment