aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2011-11-04 09:11:27 +0000
committerTristan Gingold <gingold@gcc.gnu.org>2011-11-04 09:11:27 +0000
commit735f469bdfa64d73fe5721f9a88573e57858a59a (patch)
tree5872b26a85ba3f03da81f01c2a0852daaaca5ae0 /gcc
parent75118c2eadecda75a2b9573fb6985fe841505ad0 (diff)
downloadgcc-735f469bdfa64d73fe5721f9a88573e57858a59a.zip
gcc-735f469bdfa64d73fe5721f9a88573e57858a59a.tar.gz
gcc-735f469bdfa64d73fe5721f9a88573e57858a59a.tar.bz2
alpha.c (alpha_write_linkage): Remove fundecl argument.
2011-11-04 Tristan Gingold <gingold@adacore.com> * config/alpha/alpha.c (alpha_write_linkage): Remove fundecl argument. Conditionally generate crash debug info. Adjust for alpha_funcs_tree removal. (machine_function): Add links field. (alpha_start_function): Conditionally generate crash debug info. (alpha_end_function): Adjust call to alpha_write_linkage. (alpha_funcs): Remove. (links_kind): Remove. (alpha_links): Remove num, target and lkind field. Add func field. (alpha_links_tree): Remove. (alpha_funcs_tree): Remove. (alpha_need_linkage): Remove. (alpha_use_linkage): Change prototype. Adjust. (alpha_write_one_linkage): Use ASM_OUTPUT_INTERNAL_LABEL. Use SYMBOL_REF_EXTERNAL_P and SYMBOL_REF_LOCAL_P macro. * config/alpha/alpha-protos.h (alpha_use_linkage): Update. (alpha_need_linkage): Remove. * config/alpha/alpha.md: Update calls to alpha_use_linkage. Adjust calls to alpha_need_linkage. From-SVN: r180928
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog22
-rw-r--r--gcc/config/alpha/alpha-protos.h3
-rw-r--r--gcc/config/alpha/alpha.c238
-rw-r--r--gcc/config/alpha/alpha.md20
4 files changed, 80 insertions, 203 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 622100e8..13e4097 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,25 @@
+2011-11-04 Tristan Gingold <gingold@adacore.com>
+
+ * config/alpha/alpha.c (alpha_write_linkage): Remove fundecl
+ argument. Conditionally generate crash debug info. Adjust
+ for alpha_funcs_tree removal.
+ (machine_function): Add links field.
+ (alpha_start_function): Conditionally generate crash debug info.
+ (alpha_end_function): Adjust call to alpha_write_linkage.
+ (alpha_funcs): Remove.
+ (links_kind): Remove.
+ (alpha_links): Remove num, target and lkind field. Add func field.
+ (alpha_links_tree): Remove.
+ (alpha_funcs_tree): Remove.
+ (alpha_need_linkage): Remove.
+ (alpha_use_linkage): Change prototype. Adjust.
+ (alpha_write_one_linkage): Use ASM_OUTPUT_INTERNAL_LABEL.
+ Use SYMBOL_REF_EXTERNAL_P and SYMBOL_REF_LOCAL_P macro.
+ * config/alpha/alpha-protos.h (alpha_use_linkage): Update.
+ (alpha_need_linkage): Remove.
+ * config/alpha/alpha.md: Update calls to alpha_use_linkage.
+ Adjust calls to alpha_need_linkage.
+
2011-11-03 Uros Bizjak <ubizjak@gmail.com>
* sched-vis.c (print_value): Handle STRICT_LOW_PART.
diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h
index 13b5ce9..3155168 100644
--- a/gcc/config/alpha/alpha-protos.h
+++ b/gcc/config/alpha/alpha-protos.h
@@ -99,8 +99,7 @@ extern void alpha_split_lock_test_and_set_12 (enum machine_mode, rtx, rtx,
rtx, rtx, rtx);
#endif
-extern rtx alpha_need_linkage (const char *, int);
-extern rtx alpha_use_linkage (rtx, tree, int, int);
+extern rtx alpha_use_linkage (rtx, bool, bool);
#if TARGET_ABI_OPEN_VMS
extern enum avms_arg_type alpha_arg_type (enum machine_mode);
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index e195df5..682e5be 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -196,7 +196,7 @@ static struct machine_function *alpha_init_machine_status (void);
static rtx alpha_emit_xfloating_compare (enum rtx_code *, rtx, rtx);
#if TARGET_ABI_OPEN_VMS
-static void alpha_write_linkage (FILE *, const char *, tree);
+static void alpha_write_linkage (FILE *, const char *);
static bool vms_valid_pointer_mode (enum machine_mode);
#else
#define vms_patch_builtins() gcc_unreachable()
@@ -4509,6 +4509,8 @@ alpha_multipass_dfa_lookahead (void)
/* Machine-specific function data. */
+struct GTY(()) alpha_links;
+
struct GTY(()) machine_function
{
/* For OSF. */
@@ -4518,7 +4520,11 @@ struct GTY(()) machine_function
rtx gp_save_rtx;
/* For VMS condition handlers. */
- bool uses_condition_handler;
+ bool uses_condition_handler;
+
+ /* Linkage entries. */
+ splay_tree GTY ((param1_is (char *), param2_is (struct alpha_links *)))
+ links;
};
/* How to allocate a 'struct machine_function'. */
@@ -7862,16 +7868,17 @@ alpha_start_function (FILE *file, const char *fnname,
fprintf (file, "\t.handler_data %d\n", VMS_COND_HANDLER_FP_OFFSET);
}
- /* Ifdef'ed cause link_section are only available then. */
+#ifdef TARGET_VMS_CRASH_DEBUG
+ /* Support of minimal traceback info. */
switch_to_section (readonly_data_section);
fprintf (file, "\t.align 3\n");
assemble_name (file, fnname); fputs ("..na:\n", file);
fputs ("\t.ascii \"", file);
assemble_name (file, fnname);
fputs ("\\0\"\n", file);
- alpha_need_linkage (fnname, 1);
switch_to_section (text_section);
#endif
+#endif /* TARGET_ABI_OPEN_VMS */
}
/* Emit the .prologue note at the scheduled end of the prologue. */
@@ -8104,7 +8111,8 @@ alpha_end_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED)
output_asm_insn (get_insn_template (CODE_FOR_nop, NULL), NULL);
#if TARGET_ABI_OPEN_VMS
- alpha_write_linkage (file, fnname, decl);
+ /* Write the linkage entries. */
+ alpha_write_linkage (file, fnname);
#endif
/* End the function. */
@@ -9299,32 +9307,19 @@ alpha_elf_section_type_flags (tree decl, const char *name, int reloc)
/* Structure to collect function names for final output in link section. */
/* Note that items marked with GTY can't be ifdef'ed out. */
-enum links_kind {KIND_UNUSED, KIND_LOCAL, KIND_EXTERN};
-enum reloc_kind {KIND_LINKAGE, KIND_CODEADDR};
+enum reloc_kind
+{
+ KIND_LINKAGE,
+ KIND_CODEADDR
+};
struct GTY(()) alpha_links
{
- int num;
- const char *target;
+ rtx func;
rtx linkage;
- enum links_kind lkind;
enum reloc_kind rkind;
};
-struct GTY(()) alpha_funcs
-{
- int num;
- splay_tree GTY ((param1_is (char *), param2_is (struct alpha_links *)))
- links;
-};
-
-static GTY ((param1_is (char *), param2_is (struct alpha_links *)))
- splay_tree alpha_links_tree;
-static GTY ((param1_is (tree), param2_is (struct alpha_funcs *)))
- splay_tree alpha_funcs_tree;
-
-static GTY(()) int alpha_funcs_num;
-
#if TARGET_ABI_OPEN_VMS
/* Return the VMS argument type corresponding to MODE. */
@@ -9358,95 +9353,6 @@ alpha_arg_info_reg_val (CUMULATIVE_ARGS cum)
return GEN_INT (regval);
}
-/* 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.
- Return a SYMBOL_REF suited to the call instruction. */
-
-rtx
-alpha_need_linkage (const char *name, int is_local)
-{
- splay_tree_node node;
- struct alpha_links *al;
- const char *target;
- tree id;
-
- if (name[0] == '*')
- name++;
-
- if (is_local)
- {
- struct alpha_funcs *cfaf;
-
- if (!alpha_funcs_tree)
- alpha_funcs_tree = splay_tree_new_ggc
- (splay_tree_compare_pointers,
- ggc_alloc_splay_tree_tree_node_tree_node_splay_tree_s,
- ggc_alloc_splay_tree_tree_node_tree_node_splay_tree_node_s);
-
-
- cfaf = ggc_alloc_alpha_funcs ();
-
- cfaf->links = 0;
- cfaf->num = ++alpha_funcs_num;
-
- splay_tree_insert (alpha_funcs_tree,
- (splay_tree_key) current_function_decl,
- (splay_tree_value) cfaf);
- }
-
- if (alpha_links_tree)
- {
- /* Is this name already defined? */
-
- node = splay_tree_lookup (alpha_links_tree, (splay_tree_key) name);
- if (node)
- {
- al = (struct alpha_links *) node->value;
- if (is_local)
- {
- /* Defined here but external assumed. */
- if (al->lkind == KIND_EXTERN)
- al->lkind = KIND_LOCAL;
- }
- else
- {
- /* Used here but unused assumed. */
- if (al->lkind == KIND_UNUSED)
- al->lkind = KIND_LOCAL;
- }
- return al->linkage;
- }
- }
- else
- alpha_links_tree = splay_tree_new_ggc
- ((splay_tree_compare_fn) strcmp,
- ggc_alloc_splay_tree_str_alpha_links_splay_tree_s,
- ggc_alloc_splay_tree_str_alpha_links_splay_tree_node_s);
-
- al = ggc_alloc_alpha_links ();
- name = ggc_strdup (name);
-
- /* Assume external if no definition. */
- al->lkind = (is_local ? KIND_UNUSED : KIND_EXTERN);
-
- /* Ensure we have an IDENTIFIER so assemble_name can mark it used
- 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);
- }
-
- al->target = target ? target : name;
- al->linkage = gen_rtx_SYMBOL_REF (Pmode, name);
-
- splay_tree_insert (alpha_links_tree, (splay_tree_key) name,
- (splay_tree_value) al);
-
- 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
@@ -9455,75 +9361,48 @@ alpha_need_linkage (const char *name, int is_local)
reference (code address only), 0 if this is a full reference. */
rtx
-alpha_use_linkage (rtx func, tree cfundecl, int lflag, int rflag)
+alpha_use_linkage (rtx func, bool lflag, bool rflag)
{
- splay_tree_node cfunnode;
- struct alpha_funcs *cfaf;
- struct alpha_links *al;
+ struct alpha_links *al = NULL;
const char *name = XSTR (func, 0);
- cfaf = (struct alpha_funcs *) 0;
- al = (struct alpha_links *) 0;
-
- cfunnode = splay_tree_lookup (alpha_funcs_tree, (splay_tree_key) cfundecl);
- cfaf = (struct alpha_funcs *) cfunnode->value;
-
- if (cfaf->links)
+ if (cfun->machine->links)
{
splay_tree_node lnode;
/* Is this name already defined? */
-
- lnode = splay_tree_lookup (cfaf->links, (splay_tree_key) name);
+ lnode = splay_tree_lookup (cfun->machine->links, (splay_tree_key) name);
if (lnode)
al = (struct alpha_links *) lnode->value;
}
else
- cfaf->links = splay_tree_new_ggc
+ cfun->machine->links = splay_tree_new_ggc
((splay_tree_compare_fn) strcmp,
ggc_alloc_splay_tree_str_alpha_links_splay_tree_s,
ggc_alloc_splay_tree_str_alpha_links_splay_tree_node_s);
- if (!al)
+ if (al == NULL)
{
- size_t name_len;
- size_t buflen;
+ size_t buf_len;
char *linksym;
- splay_tree_node node = 0;
- struct alpha_links *anl;
if (name[0] == '*')
name++;
- name_len = strlen (name);
- linksym = (char *) alloca (name_len + 50);
+ buf_len = strlen (name) + 8 + 9;
+ linksym = (char *) alloca (buf_len);
+ snprintf (linksym, buf_len, "$%d..%s..lk", cfun->funcdef_no, name);
al = ggc_alloc_alpha_links ();
- al->num = cfaf->num;
- al->target = NULL;
-
- node = splay_tree_lookup (alpha_links_tree, (splay_tree_key) name);
- if (node)
- {
- anl = (struct alpha_links *) node->value;
- al->lkind = anl->lkind;
- name = anl->target;
- }
-
- sprintf (linksym, "$%d..%s..lk", cfaf->num, name);
- buflen = strlen (linksym);
+ al->func = func;
+ al->linkage = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (linksym));
- al->linkage = gen_rtx_SYMBOL_REF
- (Pmode, ggc_alloc_string (linksym, buflen + 1));
-
- splay_tree_insert (cfaf->links, (splay_tree_key) name,
+ splay_tree_insert (cfun->machine->links,
+ (splay_tree_key) ggc_strdup (name),
(splay_tree_value) al);
}
- if (rflag)
- al->rkind = KIND_CODEADDR;
- else
- al->rkind = KIND_LINKAGE;
+ al->rkind = rflag ? KIND_CODEADDR : KIND_LINKAGE;
if (lflag)
return gen_rtx_MEM (Pmode, plus_constant (al->linkage, 8));
@@ -9538,31 +9417,24 @@ alpha_write_one_linkage (splay_tree_node node, void *data)
struct alpha_links *link = (struct alpha_links *) node->value;
FILE *stream = (FILE *) data;
- fprintf (stream, "$%d..%s..lk:\n", link->num, name);
+ ASM_OUTPUT_INTERNAL_LABEL (stream, XSTR (link->linkage, 0));
if (link->rkind == KIND_CODEADDR)
{
- if (link->lkind == KIND_LOCAL)
- {
- /* Local and used */
- fprintf (stream, "\t.quad %s..en\n", name);
- }
- else
- {
- /* External and used, request code address. */
- fprintf (stream, "\t.code_address %s\n", name);
- }
+ /* External and used, request code address. */
+ fprintf (stream, "\t.code_address %s\n", name);
}
else
{
- if (link->lkind == KIND_LOCAL)
+ if (!SYMBOL_REF_EXTERNAL_P (link->func)
+ && SYMBOL_REF_LOCAL_P (link->func))
{
- /* Local and used, build linkage pair. */
+ /* Locally defined, build linkage pair. */
fprintf (stream, "\t.quad %s..en\n", name);
fprintf (stream, "\t.quad %s\n", name);
}
else
{
- /* External and used, request linkage pair. */
+ /* External, request linkage pair. */
fprintf (stream, "\t.linkage %s\n", name);
}
}
@@ -9571,21 +9443,18 @@ alpha_write_one_linkage (splay_tree_node node, void *data)
}
static void
-alpha_write_linkage (FILE *stream, const char *funname, tree fundecl)
+alpha_write_linkage (FILE *stream, const char *funname)
{
- splay_tree_node node;
- struct alpha_funcs *func;
-
fprintf (stream, "\t.link\n");
fprintf (stream, "\t.align 3\n");
in_section = NULL;
- node = splay_tree_lookup (alpha_funcs_tree, (splay_tree_key) fundecl);
- func = (struct alpha_funcs *) node->value;
-
+#ifdef TARGET_VMS_CRASH_DEBUG
fputs ("\t.name ", stream);
assemble_name (stream, funname);
fputs ("..na\n", stream);
+#endif
+
ASM_OUTPUT_LABEL (stream, funname);
fprintf (stream, "\t.pdesc ");
assemble_name (stream, funname);
@@ -9593,9 +9462,9 @@ alpha_write_linkage (FILE *stream, const char *funname, tree fundecl)
alpha_procedure_type == PT_STACK ? "stack"
: alpha_procedure_type == PT_REGISTER ? "reg" : "null");
- if (func->links)
+ if (cfun->machine->links)
{
- splay_tree_foreach (func->links, alpha_write_one_linkage, stream);
+ splay_tree_foreach (cfun->machine->links, alpha_write_one_linkage, stream);
/* splay_tree_delete (func->links); */
}
}
@@ -9641,19 +9510,10 @@ vms_asm_out_destructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
assemble_integer (symbol, UNITS_PER_WORD, BITS_PER_WORD, 1);
}
#else
-
-rtx
-alpha_need_linkage (const char *name ATTRIBUTE_UNUSED,
- int is_local ATTRIBUTE_UNUSED)
-{
- return NULL_RTX;
-}
-
rtx
alpha_use_linkage (rtx func ATTRIBUTE_UNUSED,
- tree cfundecl ATTRIBUTE_UNUSED,
- int lflag ATTRIBUTE_UNUSED,
- int rflag ATTRIBUTE_UNUSED)
+ bool lflag ATTRIBUTE_UNUSED,
+ bool rflag ATTRIBUTE_UNUSED)
{
return NULL_RTX;
}
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index b83510d..6422924 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -3965,8 +3965,6 @@
emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
if (GET_CODE (operands[0]) == SYMBOL_REF)
{
- alpha_need_linkage (XSTR (operands[0], 0), 0);
-
operands[2] = const0_rtx;
}
else
@@ -4042,8 +4040,6 @@
emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
if (GET_CODE (operands[1]) == SYMBOL_REF)
{
- alpha_need_linkage (XSTR (operands[1], 0), 0);
-
operands[3] = const0_rtx;
}
else
@@ -4244,8 +4240,8 @@
case 0:
return "mov %2,$27\;jsr $26,0\;ldq $27,0($29)";
case 1:
- operands [2] = alpha_use_linkage (operands [0], cfun->decl, 1, 0);
- operands [3] = alpha_use_linkage (operands [0], cfun->decl, 0, 0);
+ operands [2] = alpha_use_linkage (operands [0], true, false);
+ operands [3] = alpha_use_linkage (operands [0], false, false);
return "ldq $26,%3\;ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)";
default:
gcc_unreachable ();
@@ -5472,7 +5468,7 @@
(clobber (reg:DI 27))])]
"TARGET_ABI_OPEN_VMS"
{
- operands[4] = alpha_need_linkage ("OTS$MOVE", 0);
+ operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$MOVE");
})
(define_insn "*movmemdi_1"
@@ -5491,7 +5487,7 @@
(clobber (reg:DI 27))]
"TARGET_ABI_OPEN_VMS"
{
- operands [5] = alpha_use_linkage (operands [4], cfun->decl, 0, 1);
+ operands [5] = alpha_use_linkage (operands [4], false, true);
switch (which_alternative)
{
case 0:
@@ -5539,7 +5535,7 @@
if (operands[2] != const0_rtx)
FAIL;
- operands[4] = alpha_need_linkage ("OTS$ZERO", 0);
+ operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO");
})
(define_insn "*clrmemdi_1"
@@ -5555,7 +5551,7 @@
(clobber (reg:DI 27))]
"TARGET_ABI_OPEN_VMS"
{
- operands [4] = alpha_use_linkage (operands [3], cfun->decl, 0, 1);
+ operands [4] = alpha_use_linkage (operands [3], false, true);
switch (which_alternative)
{
case 0:
@@ -6825,8 +6821,8 @@
case 0:
return "mov %3,$27\;jsr $26,0\;ldq $27,0($29)";
case 1:
- operands [3] = alpha_use_linkage (operands [1], cfun->decl, 1, 0);
- operands [4] = alpha_use_linkage (operands [1], cfun->decl, 0, 0);
+ operands [3] = alpha_use_linkage (operands [1], true, false);
+ operands [4] = alpha_use_linkage (operands [1], false, false);
return "ldq $26,%4\;ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)";
default:
gcc_unreachable ();