Commit f824e5c3 by Richard Kenner Committed by Richard Kenner

alias.c (get_alias_set): Don't call language-specific routine more than is…

alias.c (get_alias_set): Don't call language-specific routine more than is needed and clean up code a bit.

	* alias.c (get_alias_set): Don't call language-specific routine more
	than is needed and clean up code a bit.
	* c-common.c (c_get_alias_set): All references whose type
	is char get alias set 0, but character types need not.
	* varasm.c (make_function_rtl): Don't call set_mem_attributes.
	(make_decl_rtl): Don't call it for FUNCTION_DECL.

From-SVN: r34341
parent 611a4b87
Thu Jun 1 12:24:21 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* alias.c (get_alias_set): Don't call language-specific routine more
than is needed and clean up code a bit.
* c-common.c (c_get_alias_set): All references whose type
is char get alias set 0, but character types need not.
* varasm.c (make_function_rtl): Don't call set_mem_attributes.
(make_decl_rtl): Don't call it for FUNCTION_DECL.
2000-06-01 Bruce Korb <bkorb@gnu.org> 2000-06-01 Bruce Korb <bkorb@gnu.org>
* fixinc/tests/base/...: new base result files * fixinc/tests/base/...: new base result files
......
...@@ -338,6 +338,7 @@ HOST_WIDE_INT ...@@ -338,6 +338,7 @@ HOST_WIDE_INT
get_alias_set (t) get_alias_set (t)
tree t; tree t;
{ {
tree orig_t;
HOST_WIDE_INT set; HOST_WIDE_INT set;
HOST_WIDE_INT bitsize, bitpos; HOST_WIDE_INT bitsize, bitpos;
tree offset; tree offset;
...@@ -357,17 +358,23 @@ get_alias_set (t) ...@@ -357,17 +358,23 @@ get_alias_set (t)
language-specific routine may make mutually-recursive calls to language-specific routine may make mutually-recursive calls to
each other to figure out what to do. At each juncture, we see if each other to figure out what to do. At each juncture, we see if
this is a tree that the language may need to handle specially. this is a tree that the language may need to handle specially.
But first remove nops since we care only about the actual object. */ First handle things that aren't types and start by removing nops
since we care only about the actual object. */
if (! TYPE_P (t))
{
while (TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR while (TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR
|| TREE_CODE (t) == NON_LVALUE_EXPR) || TREE_CODE (t) == NON_LVALUE_EXPR)
t = TREE_OPERAND (t, 0); t = TREE_OPERAND (t, 0);
/* Now give the language a chance to do something. */ /* Now give the language a chance to do something but record what we
gave it this time. */
orig_t = t;
if (lang_get_alias_set != 0 if (lang_get_alias_set != 0
&& (set = (*lang_get_alias_set) (t)) != -1) && (set = (*lang_get_alias_set) (t)) != -1)
return set; return set;
/* If this is a reference, go inside it and use the underlying object. */ /* If this is a reference, go inside it and use the underlying
object. */
if (TREE_CODE_CLASS (TREE_CODE (t)) == 'r') if (TREE_CODE_CLASS (TREE_CODE (t)) == 'r')
t = get_inner_reference (t, &bitsize, &bitpos, &offset, &mode, t = get_inner_reference (t, &bitsize, &bitpos, &offset, &mode,
&unsignedp, &volatilep, &alignment); &unsignedp, &volatilep, &alignment);
...@@ -381,21 +388,20 @@ get_alias_set (t) ...@@ -381,21 +388,20 @@ get_alias_set (t)
/* We use the alias set indicated in the declaration. */ /* We use the alias set indicated in the declaration. */
return DECL_POINTER_ALIAS_SET (decl); return DECL_POINTER_ALIAS_SET (decl);
/* If we have an INDIRECT_REF via a void pointer, we don't know anything /* If we have an INDIRECT_REF via a void pointer, we don't
about what that might alias. */ know anything about what that might alias. */
if (TREE_CODE (TREE_TYPE (t)) == VOID_TYPE) if (TREE_CODE (TREE_TYPE (t)) == VOID_TYPE)
return 0; return 0;
} }
/* Give the language another chance to do something special. */ /* Give the language another chance to do something special. */
if (lang_get_alias_set != 0 if (orig_t != t && lang_get_alias_set != 0
&& (set = (*lang_get_alias_set) (t)) != -1) && (set = (*lang_get_alias_set) (t)) != -1)
return set; return set;
/* Now we are done with expressions, so get the type if this isn't /* Now all we care about is the type. */
a type. */
if (! TYPE_P (t))
t = TREE_TYPE (t); t = TREE_TYPE (t);
}
/* Variant qualifiers don't affect the alias set, so get the main /* Variant qualifiers don't affect the alias set, so get the main
variant. If this is a type with a known alias set, return it. */ variant. If this is a type with a known alias set, return it. */
......
...@@ -3284,33 +3284,22 @@ c_get_alias_set (t) ...@@ -3284,33 +3284,22 @@ c_get_alias_set (t)
return 0; return 0;
/* If this is a char *, the ANSI C standard says it can alias /* If this is a char *, the ANSI C standard says it can alias
anything. */ anything. Note that all references need do this. */
else if (TREE_CODE (t) == INDIRECT_REF if (TREE_CODE_CLASS (TREE_CODE (t)) == 'r'
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == INTEGER_TYPE && TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE
&& (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (t, 0))) && TYPE_PRECISION (TREE_TYPE (t)) == TYPE_PRECISION (char_type_node))
== TYPE_PRECISION (char_type_node)))
return 0; return 0;
/* That's all the expressions we handle specially. */ /* That's all the expressions we handle specially. */
if (! TYPE_P (t)) if (! TYPE_P (t))
return -1; return -1;
if (TREE_CODE (t) == INTEGER_TYPE)
{
/* The C standard specifically allows aliasing between signed and /* The C standard specifically allows aliasing between signed and
unsigned variants of the same type. We treat the signed unsigned variants of the same type. We treat the signed
variant as canonical. */ variant as canonical. */
tree signed_variant = signed_type (t); if (TREE_CODE (t) == INTEGER_TYPE && TREE_UNSIGNED (t))
return get_alias_set (signed_type (t));
if (signed_variant == signed_char_type_node)
/* The C standard guarantess that any object may be accessed
via an lvalue that has character type. We don't have to
check for unsigned_char_type_node or char_type_node because
we are specifically looking at the signed variant. */
return 0;
else if (signed_variant != t)
return get_alias_set (signed_variant);
}
else if (POINTER_TYPE_P (t)) else if (POINTER_TYPE_P (t))
{ {
tree t1; tree t1;
......
...@@ -559,7 +559,6 @@ make_function_rtl (decl) ...@@ -559,7 +559,6 @@ make_function_rtl (decl)
DECL_RTL (decl) DECL_RTL (decl)
= gen_rtx_MEM (DECL_MODE (decl), = gen_rtx_MEM (DECL_MODE (decl),
gen_rtx_SYMBOL_REF (Pmode, name)); gen_rtx_SYMBOL_REF (Pmode, name));
set_mem_attributes (DECL_RTL (decl), decl, 1);
/* Optionally set flags or add text to the name to record /* Optionally set flags or add text to the name to record
information such as that it is a function name. If the name information such as that it is a function name. If the name
...@@ -812,6 +811,7 @@ make_decl_rtl (decl, asmspec, top_level) ...@@ -812,6 +811,7 @@ make_decl_rtl (decl, asmspec, top_level)
= get_identifier (name[0] == '*' ? name + 1 : name); = get_identifier (name[0] == '*' ? name + 1 : name);
DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl), DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
gen_rtx_SYMBOL_REF (Pmode, name)); gen_rtx_SYMBOL_REF (Pmode, name));
if (TREE_CODE (decl) != FUNCTION_DECL)
set_mem_attributes (DECL_RTL (decl), decl, 1); set_mem_attributes (DECL_RTL (decl), decl, 1);
/* Optionally set flags or add text to the name to record information /* Optionally set flags or add text to the name to record information
......
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