summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-13 13:59:00 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-13 13:59:00 +0000
commit26dfc4577ef0b6a585f0825b65535b489fba16a4 (patch)
treed0cc1485f0444d16267f642aaa62f86e34308a1e /gcc/c-common.c
parente746d02c2855feb21ef3fb8a2cc574254674b2d2 (diff)
downloadgcc-26dfc4577ef0b6a585f0825b65535b489fba16a4.tar.gz
* alias.c (nonlocal_reference_p): Take a care for
CALL_INSNS's fusage field. * calls.c (ECF_PURE): New flag. (emit_call_1): Handle ECF_PURE calls. (initialize_argument_information): Unset ECF_PURE flag too. (precompute_arguments): Precompute for ECF_PURE too. (expand_call): Handle ECF_PURE calls too. (emit_library_call_value_1): Rename no_queue argument to fn_type, accept value of 2 as pure function. (emit_library_call_value, emit_library_call): Rename no_queue argument to fn_type. * optabs.c (prepare_cmp_insn): Pass fn_type 2 to memcmp call. * tree.h (DECL_IS_PURE): New macro. (struct tree_decl): Add pure_flag. * c-common.c (enum attrs): Add attribute "pure". (init_attributes): Initialize attribute "pure" (decl_attributes): Handle attribute "pure". * extend.texi (Attribute "pure"): Document. * calls.c (expand_call): Add (mem:BLK (scratch)) to "equal from" in pure function. (flags_from_decl_or_type): Support attribute "pure". git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33138 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 97aba258b12..1033035db23 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -145,7 +145,7 @@ enum attrs {A_PACKED, A_NOCOMMON, A_COMMON, A_NORETURN, A_CONST, A_T_UNION,
A_NO_CHECK_MEMORY_USAGE, A_NO_INSTRUMENT_FUNCTION,
A_CONSTRUCTOR, A_DESTRUCTOR, A_MODE, A_SECTION, A_ALIGNED,
A_UNUSED, A_FORMAT, A_FORMAT_ARG, A_WEAK, A_ALIAS, A_MALLOC,
- A_NO_LIMIT_STACK};
+ A_NO_LIMIT_STACK, A_PURE};
enum format_type { printf_format_type, scanf_format_type,
strftime_format_type };
@@ -457,6 +457,7 @@ init_attributes ()
add_attribute (A_NO_CHECK_MEMORY_USAGE, "no_check_memory_usage", 0, 0, 1);
add_attribute (A_MALLOC, "malloc", 0, 0, 1);
add_attribute (A_NO_LIMIT_STACK, "no_stack_limit", 0, 0, 1);
+ add_attribute (A_PURE, "pure", 0, 0, 1);
}
/* Default implementation of valid_lang_attribute, below. By default, there
@@ -596,6 +597,7 @@ decl_attributes (node, attributes, prefix_attributes)
case A_MALLOC:
if (TREE_CODE (decl) == FUNCTION_DECL)
DECL_IS_MALLOC (decl) = 1;
+ /* ??? TODO: Support types. */
else
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
break;
@@ -625,6 +627,15 @@ decl_attributes (node, attributes, prefix_attributes)
warning ( "`%s' attribute ignored", IDENTIFIER_POINTER (name));
break;
+ case A_PURE:
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ DECL_IS_PURE (decl) = 1;
+ /* ??? TODO: Support types. */
+ else
+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ break;
+
+
case A_T_UNION:
if (is_type
&& TREE_CODE (type) == UNION_TYPE