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>
* fixinc/tests/base/...: new base result files
......
......@@ -338,6 +338,7 @@ HOST_WIDE_INT
get_alias_set (t)
tree t;
{
tree orig_t;
HOST_WIDE_INT set;
HOST_WIDE_INT bitsize, bitpos;
tree offset;
......@@ -357,45 +358,50 @@ get_alias_set (t)
language-specific routine may make mutually-recursive calls to
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.
But first remove nops since we care only about the actual object. */
while (TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR
|| TREE_CODE (t) == NON_LVALUE_EXPR)
t = TREE_OPERAND (t, 0);
/* Now give the language a chance to do something. */
if (lang_get_alias_set != 0
&& (set = (*lang_get_alias_set) (t)) != -1)
return set;
/* If this is a reference, go inside it and use the underlying object. */
if (TREE_CODE_CLASS (TREE_CODE (t)) == 'r')
t = get_inner_reference (t, &bitsize, &bitpos, &offset, &mode,
&unsignedp, &volatilep, &alignment);
if (TREE_CODE (t) == INDIRECT_REF)
First handle things that aren't types and start by removing nops
since we care only about the actual object. */
if (! TYPE_P (t))
{
/* Check for accesses through restrict-qualified pointers. */
tree decl = find_base_decl (TREE_OPERAND (t, 0));
while (TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR
|| TREE_CODE (t) == NON_LVALUE_EXPR)
t = TREE_OPERAND (t, 0);
/* 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
&& (set = (*lang_get_alias_set) (t)) != -1)
return set;
/* If this is a reference, go inside it and use the underlying
object. */
if (TREE_CODE_CLASS (TREE_CODE (t)) == 'r')
t = get_inner_reference (t, &bitsize, &bitpos, &offset, &mode,
&unsignedp, &volatilep, &alignment);
if (TREE_CODE (t) == INDIRECT_REF)
{
/* Check for accesses through restrict-qualified pointers. */
tree decl = find_base_decl (TREE_OPERAND (t, 0));
if (decl && DECL_POINTER_ALIAS_SET_KNOWN_P (decl))
/* We use the alias set indicated in the declaration. */
return DECL_POINTER_ALIAS_SET (decl);
if (decl && DECL_POINTER_ALIAS_SET_KNOWN_P (decl))
/* We use the alias set indicated in the declaration. */
return DECL_POINTER_ALIAS_SET (decl);
/* If we have an INDIRECT_REF via a void pointer, we don't know anything
about what that might alias. */
if (TREE_CODE (TREE_TYPE (t)) == VOID_TYPE)
return 0;
}
/* If we have an INDIRECT_REF via a void pointer, we don't
know anything about what that might alias. */
if (TREE_CODE (TREE_TYPE (t)) == VOID_TYPE)
return 0;
}
/* Give the language another chance to do something special. */
if (lang_get_alias_set != 0
&& (set = (*lang_get_alias_set) (t)) != -1)
return set;
/* Give the language another chance to do something special. */
if (orig_t != t && lang_get_alias_set != 0
&& (set = (*lang_get_alias_set) (t)) != -1)
return set;
/* Now we are done with expressions, so get the type if this isn't
a type. */
if (! TYPE_P (t))
t = TREE_TYPE (t);
/* Now all we care about is the type. */
t = TREE_TYPE (t);
}
/* 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. */
......
......@@ -3284,33 +3284,22 @@ c_get_alias_set (t)
return 0;
/* If this is a char *, the ANSI C standard says it can alias
anything. */
else if (TREE_CODE (t) == INDIRECT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == INTEGER_TYPE
&& (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (t, 0)))
== TYPE_PRECISION (char_type_node)))
anything. Note that all references need do this. */
if (TREE_CODE_CLASS (TREE_CODE (t)) == 'r'
&& TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE
&& TYPE_PRECISION (TREE_TYPE (t)) == TYPE_PRECISION (char_type_node))
return 0;
/* That's all the expressions we handle specially. */
if (! TYPE_P (t))
return -1;
if (TREE_CODE (t) == INTEGER_TYPE)
{
/* The C standard specifically allows aliasing between signed and
unsigned variants of the same type. We treat the signed
variant as canonical. */
tree signed_variant = 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);
}
/* The C standard specifically allows aliasing between signed and
unsigned variants of the same type. We treat the signed
variant as canonical. */
if (TREE_CODE (t) == INTEGER_TYPE && TREE_UNSIGNED (t))
return get_alias_set (signed_type (t));
else if (POINTER_TYPE_P (t))
{
tree t1;
......
......@@ -559,7 +559,6 @@ make_function_rtl (decl)
DECL_RTL (decl)
= gen_rtx_MEM (DECL_MODE (decl),
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
information such as that it is a function name. If the name
......@@ -812,7 +811,8 @@ make_decl_rtl (decl, asmspec, top_level)
= get_identifier (name[0] == '*' ? name + 1 : name);
DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
gen_rtx_SYMBOL_REF (Pmode, name));
set_mem_attributes (DECL_RTL (decl), decl, 1);
if (TREE_CODE (decl) != FUNCTION_DECL)
set_mem_attributes (DECL_RTL (decl), decl, 1);
/* Optionally set flags or add text to the name to record information
such as that it is a function name.
......
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