Commit b714133e by Eric Botcazou Committed by Douglas Rupp

alpha.c (alpha_links): Add 'target' field.


	* config/alpha/alpha.c (alpha_links): Add 'target' field.
	(alpha_need_linkage): Handle aliases.  Return function symbol.
	(alpha_use_linkage): Rename 'linkage' argument to 'func'.
	Use ultimate alias target for the linkage name.
	* config/alpha/alpha.md (movmemdi): Use the symbol returned
	by alpha_need_linkage for the function symbol.
	(setmemdi): Likewise.


Co-Authored-By: Douglas B Rupp <rupp@gnat.com>

From-SVN: r150611
parent 3bd1b109
2009-08-09 Eric Botcazou <botcazou@adacore.com>
Douglas B Rupp <rupp@gnat.com>
* config/alpha/alpha.c (alpha_links): Add 'target' field.
(alpha_need_linkage): Handle aliases. Return function symbol.
(alpha_use_linkage): Rename 'linkage' argument to 'func'.
Use ultimate alias target for the linkage name.
* config/alpha/alpha.md (movmemdi): Use the symbol returned
by alpha_need_linkage for the function symbol.
(setmemdi): Likewise.
2009-08-09 Douglas B Rupp <rupp@gnat.com> 2009-08-09 Douglas B Rupp <rupp@gnat.com>
* config/alpha/alpha.c (TARGET_ASM_UNALIGNED_*_OP): Define if on VMS. * config/alpha/alpha.c (TARGET_ASM_UNALIGNED_*_OP): Define if on VMS.
......
...@@ -9583,6 +9583,7 @@ enum reloc_kind {KIND_LINKAGE, KIND_CODEADDR}; ...@@ -9583,6 +9583,7 @@ enum reloc_kind {KIND_LINKAGE, KIND_CODEADDR};
struct GTY(()) alpha_links struct GTY(()) alpha_links
{ {
int num; int num;
const char *target;
rtx linkage; rtx linkage;
enum links_kind lkind; enum links_kind lkind;
enum reloc_kind rkind; enum reloc_kind rkind;
...@@ -9635,17 +9636,17 @@ alpha_arg_info_reg_val (CUMULATIVE_ARGS cum) ...@@ -9635,17 +9636,17 @@ alpha_arg_info_reg_val (CUMULATIVE_ARGS cum)
return GEN_INT (regval); return GEN_INT (regval);
} }
/* Make (or fake) .linkage entry for function call. /* Register the need for a (fake) .linkage entry for calls to function NAME.
IS_LOCAL is 1 if this is for a definition, 0 if this is for a real call.
IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. Return a SYMBOL_REF suited to the call instruction. */
Return an SYMBOL_REF rtx for the linkage. */
rtx rtx
alpha_need_linkage (const char *name, int is_local) alpha_need_linkage (const char *name, int is_local)
{ {
splay_tree_node node; splay_tree_node node;
struct alpha_links *al; struct alpha_links *al;
const char *target;
tree id;
if (name[0] == '*') if (name[0] == '*')
name++; name++;
...@@ -9700,19 +9701,18 @@ alpha_need_linkage (const char *name, int is_local) ...@@ -9700,19 +9701,18 @@ alpha_need_linkage (const char *name, int is_local)
/* Assume external if no definition. */ /* Assume external if no definition. */
al->lkind = (is_local ? KIND_UNUSED : KIND_EXTERN); al->lkind = (is_local ? KIND_UNUSED : KIND_EXTERN);
/* Ensure we have an IDENTIFIER so assemble_name can mark it used. */ /* Ensure we have an IDENTIFIER so assemble_name can mark it used
get_identifier (name); and find the ultimate alias target like assemble_name. */
id = get_identifier (name);
target = NULL;
while (IDENTIFIER_TRANSPARENT_ALIAS (id))
{
id = TREE_CHAIN (id);
target = IDENTIFIER_POINTER (id);
}
/* Construct a SYMBOL_REF for us to call. */ al->target = target ? target : name;
{ al->linkage = gen_rtx_SYMBOL_REF (Pmode, name);
size_t name_len = strlen (name);
char *linksym = XALLOCAVEC (char, name_len + 6);
linksym[0] = '$';
memcpy (linksym + 1, name, name_len);
memcpy (linksym + 1 + name_len, "..lk", 5);
al->linkage = gen_rtx_SYMBOL_REF (Pmode,
ggc_alloc_string (linksym, name_len + 5));
}
splay_tree_insert (alpha_links_tree, (splay_tree_key) name, splay_tree_insert (alpha_links_tree, (splay_tree_key) name,
(splay_tree_value) al); (splay_tree_value) al);
...@@ -9720,13 +9720,19 @@ alpha_need_linkage (const char *name, int is_local) ...@@ -9720,13 +9720,19 @@ alpha_need_linkage (const char *name, int is_local)
return al->linkage; return al->linkage;
} }
/* Return a SYMBOL_REF representing the reference to the .linkage entry
of function FUNC built for calls made from CFUNDECL. LFLAG is 1 if
this is the reference to the linkage pointer value, 0 if this is the
reference to the function entry value. RFLAG is 1 if this a reduced
reference (code address only), 0 if this is a full reference. */
rtx rtx
alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag) alpha_use_linkage (rtx func, tree cfundecl, int lflag, int rflag)
{ {
splay_tree_node cfunnode; splay_tree_node cfunnode;
struct alpha_funcs *cfaf; struct alpha_funcs *cfaf;
struct alpha_links *al; struct alpha_links *al;
const char *name = XSTR (linkage, 0); const char *name = XSTR (func, 0);
cfaf = (struct alpha_funcs *) 0; cfaf = (struct alpha_funcs *) 0;
al = (struct alpha_links *) 0; al = (struct alpha_links *) 0;
...@@ -9751,7 +9757,6 @@ alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag) ...@@ -9751,7 +9757,6 @@ alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag)
{ {
size_t name_len; size_t name_len;
size_t buflen; size_t buflen;
char buf [512];
char *linksym; char *linksym;
splay_tree_node node = 0; splay_tree_node node = 0;
struct alpha_links *anl; struct alpha_links *anl;
...@@ -9760,6 +9765,7 @@ alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag) ...@@ -9760,6 +9765,7 @@ alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag)
name++; name++;
name_len = strlen (name); name_len = strlen (name);
linksym = (char *) alloca (name_len + 50);
al = (struct alpha_links *) ggc_alloc (sizeof (struct alpha_links)); al = (struct alpha_links *) ggc_alloc (sizeof (struct alpha_links));
al->num = cfaf->num; al->num = cfaf->num;
...@@ -9769,12 +9775,11 @@ alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag) ...@@ -9769,12 +9775,11 @@ alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag)
{ {
anl = (struct alpha_links *) node->value; anl = (struct alpha_links *) node->value;
al->lkind = anl->lkind; al->lkind = anl->lkind;
name = anl->target;
} }
sprintf (buf, "$%d..%s..lk", cfaf->num, name); sprintf (linksym, "$%d..%s..lk", cfaf->num, name);
buflen = strlen (buf); buflen = strlen (linksym);
linksym = XALLOCAVEC (char, buflen + 1);
memcpy (linksym, buf, buflen + 1);
al->linkage = gen_rtx_SYMBOL_REF al->linkage = gen_rtx_SYMBOL_REF
(Pmode, ggc_alloc_string (linksym, buflen + 1)); (Pmode, ggc_alloc_string (linksym, buflen + 1));
...@@ -9944,7 +9949,7 @@ alpha_need_linkage (const char *name ATTRIBUTE_UNUSED, ...@@ -9944,7 +9949,7 @@ alpha_need_linkage (const char *name ATTRIBUTE_UNUSED,
} }
rtx rtx
alpha_use_linkage (rtx linkage ATTRIBUTE_UNUSED, alpha_use_linkage (rtx func ATTRIBUTE_UNUSED,
tree cfundecl ATTRIBUTE_UNUSED, tree cfundecl ATTRIBUTE_UNUSED,
int lflag ATTRIBUTE_UNUSED, int lflag ATTRIBUTE_UNUSED,
int rflag ATTRIBUTE_UNUSED) int rflag ATTRIBUTE_UNUSED)
......
;; Machine description for DEC Alpha for GNU C compiler ;; Machine description for DEC Alpha for GNU C compiler
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
;; 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
;; Free Software Foundation, Inc. ;; Free Software Foundation, Inc.
;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
;; ;;
...@@ -6460,8 +6460,7 @@ ...@@ -6460,8 +6460,7 @@
(clobber (reg:DI 27))])] (clobber (reg:DI 27))])]
"TARGET_ABI_OPEN_VMS" "TARGET_ABI_OPEN_VMS"
{ {
operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$MOVE"); operands[4] = alpha_need_linkage ("OTS$MOVE", 0);
alpha_need_linkage (XSTR (operands[4], 0), 0);
}) })
(define_insn "*movmemdi_1" (define_insn "*movmemdi_1"
...@@ -6528,8 +6527,7 @@ ...@@ -6528,8 +6527,7 @@
if (operands[2] != const0_rtx) if (operands[2] != const0_rtx)
FAIL; FAIL;
operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO"); operands[4] = alpha_need_linkage ("OTS$ZERO", 0);
alpha_need_linkage (XSTR (operands[4], 0), 0);
}) })
(define_insn "*clrmemdi_1" (define_insn "*clrmemdi_1"
......
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