attribs.c (handle_no_check_memory_usage_atribute): Deleted.
* attribs.c (handle_no_check_memory_usage_atribute): Deleted. (c_com): Delete its reference. * builtins.c: Delete memory checking code. * calls.c, expr.c, function.c, stmt.c: Likewise. * builtins.c (expand_builtin_arg_info): Remove reference to EXPAND_MEMORY_USE_* modifiers. * explow.c (expr_size): Likewise. * expr.c (expand_expr, expand_increment): Likewise. * expr.h (ARGS_SIZE_RTX): Likewise. * function.c (assign_parms, expand_pending_sizeso): Likewise. * c-decl.c (duplicate_decls): Don't handle DECL_NO_CHECK_MEMORY_USAGE. * expr.c (in_check_memory_usage): Delete. (get_push_address, get_memory_usage_from_modifier): Delete. (expand_assigment): Use EXPAND_WRITE on destination. (expand_expr): Delete ro_modifier. * expr.h (expand_modifier): Delete EXPAND_MEMORY_* entries and add EXPAND_WRITE. (memory_use_mode): Delete. * flags.h (flag_check_memory_usage): Deleted. (flag_prefix_function_name): Likewise. * function.c (expand_function_start): Don't set current_function_check_memory_usage. * function.h (check_memory_usage): Delete. * libfuncs.h, optabs.c: Delete chkr_* stuff. * stmt.c (expand_asm_opernd): Change EXPAND_MEMORY_USE_WO to EXPAND_WRITE. * toplev.c (flag_check_memory_usage): Deleted. (flag_prefix_function_name): Likewise. (f_options, process_options): Delete references to above. * tree.h (DECL_NO_CHECK_MEMORY_USAGE): Deleted. * varasm.c (CHKR_PREFIX): Deleted. (make_decl_rtl): Remove flag_prefix_function_name handling. (assemble_name): Likewise. * doc/extend.texi: Remove no_check_memory_usage attribute. * doc/invoke.texi: Remove -fcheck-memory-usage and -fprefix-function-name. * cp/decl.c (duplicate_decls): Don't copy DECL_NO_CHECK_MEMORY_USAGE. From-SVN: r47697
This commit is contained in:
parent
0228de0c4f
commit
37a08a298f
|
@ -1,3 +1,42 @@
|
|||
Wed Dec 5 16:03:04 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
||||
|
||||
* attribs.c (handle_no_check_memory_usage_atribute): Deleted.
|
||||
(c_com): Delete its reference.
|
||||
* builtins.c: Delete memory checking code.
|
||||
* calls.c, expr.c, function.c, stmt.c: Likewise.
|
||||
* builtins.c (expand_builtin_arg_info): Remove reference to
|
||||
EXPAND_MEMORY_USE_* modifiers.
|
||||
* explow.c (expr_size): Likewise.
|
||||
* expr.c (expand_expr, expand_increment): Likewise.
|
||||
* expr.h (ARGS_SIZE_RTX): Likewise.
|
||||
* function.c (assign_parms, expand_pending_sizeso): Likewise.
|
||||
* c-decl.c (duplicate_decls): Don't handle DECL_NO_CHECK_MEMORY_USAGE.
|
||||
* expr.c (in_check_memory_usage): Delete.
|
||||
(get_push_address, get_memory_usage_from_modifier): Delete.
|
||||
(expand_assigment): Use EXPAND_WRITE on destination.
|
||||
(expand_expr): Delete ro_modifier.
|
||||
* expr.h (expand_modifier): Delete EXPAND_MEMORY_* entries and
|
||||
add EXPAND_WRITE.
|
||||
(memory_use_mode): Delete.
|
||||
* flags.h (flag_check_memory_usage): Deleted.
|
||||
(flag_prefix_function_name): Likewise.
|
||||
* function.c (expand_function_start): Don't set
|
||||
current_function_check_memory_usage.
|
||||
* function.h (check_memory_usage): Delete.
|
||||
* libfuncs.h, optabs.c: Delete chkr_* stuff.
|
||||
* stmt.c (expand_asm_opernd): Change EXPAND_MEMORY_USE_WO to
|
||||
EXPAND_WRITE.
|
||||
* toplev.c (flag_check_memory_usage): Deleted.
|
||||
(flag_prefix_function_name): Likewise.
|
||||
(f_options, process_options): Delete references to above.
|
||||
* tree.h (DECL_NO_CHECK_MEMORY_USAGE): Deleted.
|
||||
* varasm.c (CHKR_PREFIX): Deleted.
|
||||
(make_decl_rtl): Remove flag_prefix_function_name handling.
|
||||
(assemble_name): Likewise.
|
||||
* doc/extend.texi: Remove no_check_memory_usage attribute.
|
||||
* doc/invoke.texi: Remove -fcheck-memory-usage
|
||||
and -fprefix-function-name.
|
||||
|
||||
2001-12-05 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* Makefile.in (STMP_FIXPROTO, STMP_FIXINC): Use substituted values
|
||||
|
|
|
@ -76,8 +76,6 @@ static tree handle_alias_attribute PARAMS ((tree *, tree, tree, int,
|
|||
static tree handle_no_instrument_function_attribute PARAMS ((tree *, tree,
|
||||
tree, int,
|
||||
bool *));
|
||||
static tree handle_no_check_memory_usage_attribute PARAMS ((tree *, tree, tree,
|
||||
int, bool *));
|
||||
static tree handle_malloc_attribute PARAMS ((tree *, tree, tree, int,
|
||||
bool *));
|
||||
static tree handle_no_limit_stack_attribute PARAMS ((tree *, tree, tree, int,
|
||||
|
@ -131,8 +129,6 @@ static const struct attribute_spec c_common_attribute_table[] =
|
|||
handle_alias_attribute },
|
||||
{ "no_instrument_function", 0, 0, true, false, false,
|
||||
handle_no_instrument_function_attribute },
|
||||
{ "no_check_memory_usage", 0, 0, true, false, false,
|
||||
handle_no_check_memory_usage_attribute },
|
||||
{ "malloc", 0, 0, true, false, false,
|
||||
handle_malloc_attribute },
|
||||
{ "no_stack_limit", 0, 0, true, false, false,
|
||||
|
@ -1044,39 +1040,6 @@ handle_no_instrument_function_attribute (node, name, args, flags, no_add_attrs)
|
|||
return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Handle a "no_check_memory_usage" attribute; arguments as in
|
||||
struct attribute_spec.handler. */
|
||||
|
||||
static tree
|
||||
handle_no_check_memory_usage_attribute (node, name, args, flags, no_add_attrs)
|
||||
tree *node;
|
||||
tree name;
|
||||
tree args ATTRIBUTE_UNUSED;
|
||||
int flags ATTRIBUTE_UNUSED;
|
||||
bool *no_add_attrs;
|
||||
{
|
||||
tree decl = *node;
|
||||
|
||||
if (TREE_CODE (decl) != FUNCTION_DECL)
|
||||
{
|
||||
error_with_decl (decl,
|
||||
"`%s' attribute applies only to functions",
|
||||
IDENTIFIER_POINTER (name));
|
||||
*no_add_attrs = true;
|
||||
}
|
||||
else if (DECL_INITIAL (decl))
|
||||
{
|
||||
error_with_decl (decl,
|
||||
"can't set `%s' attribute after definition",
|
||||
IDENTIFIER_POINTER (name));
|
||||
*no_add_attrs = true;
|
||||
}
|
||||
else
|
||||
DECL_NO_CHECK_MEMORY_USAGE (decl) = 1;
|
||||
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Handle a "malloc" attribute; arguments as in
|
||||
struct attribute_spec.handler. */
|
||||
|
||||
|
|
|
@ -1617,13 +1617,6 @@ expand_builtin_strlen (exp, target)
|
|||
source operand later. */
|
||||
before_strlen = get_last_insn();
|
||||
|
||||
/* Check the string is readable and has an end. */
|
||||
if (current_function_check_memory_usage)
|
||||
emit_library_call (chkr_check_str_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 2, src_reg, Pmode,
|
||||
GEN_INT (MEMORY_USE_RO),
|
||||
TYPE_MODE (integer_type_node));
|
||||
|
||||
char_rtx = const0_rtx;
|
||||
char_mode = insn_data[(int) icode].operand[2].mode;
|
||||
if (! (*insn_data[(int) icode].operand[2].predicate) (char_rtx,
|
||||
|
@ -1672,8 +1665,7 @@ expand_builtin_strstr (arglist, target, mode)
|
|||
rtx target;
|
||||
enum machine_mode mode;
|
||||
{
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)
|
||||
|| current_function_check_memory_usage)
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
|
@ -1729,8 +1721,7 @@ expand_builtin_strchr (arglist, target, mode)
|
|||
rtx target;
|
||||
enum machine_mode mode;
|
||||
{
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)
|
||||
|| current_function_check_memory_usage)
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
|
@ -1776,8 +1767,7 @@ expand_builtin_strrchr (arglist, target, mode)
|
|||
rtx target;
|
||||
enum machine_mode mode;
|
||||
{
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)
|
||||
|| current_function_check_memory_usage)
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
|
@ -1831,8 +1821,7 @@ expand_builtin_strpbrk (arglist, target, mode)
|
|||
rtx target;
|
||||
enum machine_mode mode;
|
||||
{
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)
|
||||
|| current_function_check_memory_usage)
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
|
@ -1939,7 +1928,6 @@ expand_builtin_memcpy (arglist)
|
|||
by pieces, we can avoid loading the string from memory
|
||||
and only stored the computed constants. */
|
||||
if (src_str
|
||||
&& !current_function_check_memory_usage
|
||||
&& GET_CODE (len_rtx) == CONST_INT
|
||||
&& (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1
|
||||
&& can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str,
|
||||
|
@ -1954,13 +1942,6 @@ expand_builtin_memcpy (arglist)
|
|||
src_mem = get_memory_rtx (src);
|
||||
set_mem_align (src_mem, src_align);
|
||||
|
||||
/* Just copy the rights of SRC to the rights of DEST. */
|
||||
if (current_function_check_memory_usage)
|
||||
emit_library_call (chkr_copy_bitmap_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 3, XEXP (dest_mem, 0), Pmode,
|
||||
XEXP (src_mem, 0), Pmode,
|
||||
len_rtx, TYPE_MODE (sizetype));
|
||||
|
||||
/* Copy word part most expediently. */
|
||||
dest_addr = emit_block_move (dest_mem, src_mem, len_rtx);
|
||||
|
||||
|
@ -2143,10 +2124,9 @@ expand_builtin_memset (exp)
|
|||
{
|
||||
if (!host_integerp (len, 1))
|
||||
return 0;
|
||||
if (current_function_check_memory_usage
|
||||
|| !can_store_by_pieces (tree_low_cst (len, 1),
|
||||
builtin_memset_read_str,
|
||||
(PTR) &c, dest_align))
|
||||
if (!can_store_by_pieces (tree_low_cst (len, 1),
|
||||
builtin_memset_read_str, (PTR) &c,
|
||||
dest_align))
|
||||
return 0;
|
||||
|
||||
dest_mem = get_memory_rtx (dest);
|
||||
|
@ -2160,16 +2140,6 @@ expand_builtin_memset (exp)
|
|||
|
||||
dest_mem = get_memory_rtx (dest);
|
||||
set_mem_align (dest_mem, dest_align);
|
||||
|
||||
/* Just check DST is writable and mark it as readable. */
|
||||
if (current_function_check_memory_usage)
|
||||
emit_library_call (chkr_check_addr_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 3, XEXP (dest_mem, 0), Pmode,
|
||||
len_rtx, TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_WO),
|
||||
TYPE_MODE (integer_type_node));
|
||||
|
||||
|
||||
dest_addr = clear_storage (dest_mem, len_rtx);
|
||||
|
||||
if (dest_addr == 0)
|
||||
|
@ -2225,10 +2195,6 @@ expand_builtin_memcmp (exp, arglist, target)
|
|||
tree arglist;
|
||||
rtx target;
|
||||
{
|
||||
/* If we need to check memory accesses, call the library function. */
|
||||
if (current_function_check_memory_usage)
|
||||
return 0;
|
||||
|
||||
if (!validate_arglist (arglist,
|
||||
POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
|
@ -2309,10 +2275,6 @@ expand_builtin_strcmp (exp, target, mode)
|
|||
tree arg1, arg2;
|
||||
const char *p1, *p2;
|
||||
|
||||
/* If we need to check memory accesses, call the library function. */
|
||||
if (current_function_check_memory_usage)
|
||||
return 0;
|
||||
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
|
||||
|
@ -2414,10 +2376,6 @@ expand_builtin_strncmp (exp, target, mode)
|
|||
tree arg1, arg2, arg3;
|
||||
const char *p1, *p2;
|
||||
|
||||
/* If we need to check memory accesses, call the library function. */
|
||||
if (current_function_check_memory_usage)
|
||||
return 0;
|
||||
|
||||
if (!validate_arglist (arglist,
|
||||
POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
|
@ -2518,10 +2476,6 @@ expand_builtin_strcat (arglist, target, mode)
|
|||
rtx target;
|
||||
enum machine_mode mode;
|
||||
{
|
||||
/* If we need to check memory accesses, call the library function. */
|
||||
if (current_function_check_memory_usage)
|
||||
return 0;
|
||||
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
else
|
||||
|
@ -2548,10 +2502,6 @@ expand_builtin_strncat (arglist, target, mode)
|
|||
rtx target;
|
||||
enum machine_mode mode;
|
||||
{
|
||||
/* If we need to check memory accesses, call the library function. */
|
||||
if (current_function_check_memory_usage)
|
||||
return 0;
|
||||
|
||||
if (!validate_arglist (arglist,
|
||||
POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
|
@ -2605,10 +2555,6 @@ expand_builtin_strspn (arglist, target, mode)
|
|||
rtx target;
|
||||
enum machine_mode mode;
|
||||
{
|
||||
/* If we need to check memory accesses, call the library function. */
|
||||
if (current_function_check_memory_usage)
|
||||
return 0;
|
||||
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
else
|
||||
|
@ -2646,10 +2592,6 @@ expand_builtin_strcspn (arglist, target, mode)
|
|||
rtx target;
|
||||
enum machine_mode mode;
|
||||
{
|
||||
/* If we need to check memory accesses, call the library function. */
|
||||
if (current_function_check_memory_usage)
|
||||
return 0;
|
||||
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
else
|
||||
|
@ -2791,7 +2733,7 @@ expand_builtin_args_info (exp)
|
|||
TREE_STATIC (result) = 1;
|
||||
result = build1 (INDIRECT_REF, build_pointer_type (type), result);
|
||||
TREE_CONSTANT (result) = 1;
|
||||
return expand_expr (result, NULL_RTX, VOIDmode, EXPAND_MEMORY_USE_BAD);
|
||||
return expand_expr (result, NULL_RTX, VOIDmode, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3280,8 +3222,7 @@ expand_builtin_fputs (arglist, ignore)
|
|||
return 0;
|
||||
|
||||
/* Verify the arguments in the original call. */
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)
|
||||
|| current_function_check_memory_usage)
|
||||
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
|
||||
return 0;
|
||||
|
||||
/* Get the length of the string passed to fputs. If the length
|
||||
|
|
|
@ -1906,13 +1906,9 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
|
|||
{
|
||||
DECL_STATIC_CONSTRUCTOR(newdecl) |= DECL_STATIC_CONSTRUCTOR(olddecl);
|
||||
DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
|
||||
|
||||
DECL_NO_LIMIT_STACK (newdecl) |= DECL_NO_LIMIT_STACK (olddecl);
|
||||
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
|
||||
|= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
|
||||
DECL_NO_CHECK_MEMORY_USAGE (newdecl)
|
||||
|= DECL_NO_CHECK_MEMORY_USAGE (olddecl);
|
||||
DECL_NO_LIMIT_STACK (newdecl)
|
||||
|= DECL_NO_LIMIT_STACK (olddecl);
|
||||
}
|
||||
}
|
||||
/* If cannot merge, then use the new type and qualifiers,
|
||||
|
|
42
gcc/calls.c
42
gcc/calls.c
|
@ -1675,17 +1675,6 @@ rtx_for_function_call (fndecl, exp)
|
|||
funaddr = funexp
|
||||
= expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
|
||||
pop_temp_slots (); /* FUNEXP can't be BLKmode. */
|
||||
|
||||
/* Check the function is executable. */
|
||||
if (current_function_check_memory_usage)
|
||||
{
|
||||
#ifdef POINTERS_EXTEND_UNSIGNED
|
||||
if (GET_MODE (funexp) != ptr_mode)
|
||||
funaddr = convert_memory_address (ptr_mode, funexp);
|
||||
#endif
|
||||
emit_library_call (chkr_check_exec_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 1, funaddr, ptr_mode);
|
||||
}
|
||||
emit_queue ();
|
||||
}
|
||||
return funexp;
|
||||
|
@ -2162,13 +2151,6 @@ expand_call (exp, target, ignore)
|
|||
/* The alignment of the stack, in bytes. */
|
||||
HOST_WIDE_INT preferred_unit_stack_boundary;
|
||||
|
||||
/* The value of the function call can be put in a hard register. But
|
||||
if -fcheck-memory-usage, code which invokes functions (and thus
|
||||
damages some hard registers) can be inserted before using the value.
|
||||
So, target is always a pseudo-register in that case. */
|
||||
if (current_function_check_memory_usage)
|
||||
target = 0;
|
||||
|
||||
/* See if this is "nothrow" function call. */
|
||||
if (TREE_NOTHROW (exp))
|
||||
flags |= ECF_NOTHROW;
|
||||
|
@ -3014,16 +2996,6 @@ expand_call (exp, target, ignore)
|
|||
force_operand (structure_value_addr,
|
||||
NULL_RTX)));
|
||||
|
||||
/* Mark the memory for the aggregate as write-only. */
|
||||
if (current_function_check_memory_usage)
|
||||
emit_library_call (chkr_set_right_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 3,
|
||||
structure_value_addr, ptr_mode,
|
||||
GEN_INT (struct_value_size),
|
||||
TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_WO),
|
||||
TYPE_MODE (integer_type_node));
|
||||
|
||||
if (GET_CODE (struct_value_rtx) == REG)
|
||||
use_reg (&call_fusage, struct_value_rtx);
|
||||
}
|
||||
|
@ -4422,18 +4394,8 @@ store_one_arg (arg, argblock, flags, variable_size, reg_parm_stack_space)
|
|||
do_pending_stack_adjust ();
|
||||
|
||||
if (arg->value == arg->stack)
|
||||
{
|
||||
/* If the value is already in the stack slot, we are done. */
|
||||
if (current_function_check_memory_usage && GET_CODE (arg->stack) == MEM)
|
||||
{
|
||||
emit_library_call (chkr_set_right_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 3, XEXP (arg->stack, 0), Pmode,
|
||||
ARGS_SIZE_RTX (arg->size),
|
||||
TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_RW),
|
||||
TYPE_MODE (integer_type_node));
|
||||
}
|
||||
}
|
||||
/* If the value is already in the stack slot, we are done. */
|
||||
;
|
||||
else if (arg->mode != BLKmode)
|
||||
{
|
||||
int size;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
Wed Dec 5 17:00:49 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
||||
|
||||
* decl.c (duplicate_decls): Don't copy DECL_NO_CHECK_MEMORY_USAGE.
|
||||
|
||||
2001-12-04 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* pt.c (end_template_parm_list): Clear TREE_CHAIN of each parm.
|
||||
|
|
|
@ -3586,8 +3586,6 @@ duplicate_decls (newdecl, olddecl)
|
|||
{
|
||||
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
|
||||
|= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
|
||||
DECL_NO_CHECK_MEMORY_USAGE (newdecl)
|
||||
|= DECL_NO_CHECK_MEMORY_USAGE (olddecl);
|
||||
DECL_NO_LIMIT_STACK (newdecl)
|
||||
|= DECL_NO_LIMIT_STACK (olddecl);
|
||||
}
|
||||
|
|
|
@ -1917,11 +1917,11 @@ attributes are currently defined for functions on all targets:
|
|||
@code{noreturn}, @code{noinline}, @code{pure}, @code{const},
|
||||
@code{format}, @code{format_arg}, @code{no_instrument_function},
|
||||
@code{section}, @code{constructor}, @code{destructor}, @code{used},
|
||||
@code{unused}, @code{weak}, @code{malloc}, @code{alias} and
|
||||
@code{no_check_memory_usage}. Several other attributes are defined for
|
||||
functions on particular target systems. Other attributes, including
|
||||
@code{section} are supported for variables declarations (@pxref{Variable
|
||||
Attributes}) and for types (@pxref{Type Attributes}).
|
||||
@code{unused}, @code{weak}, @code{malloc}, and @code{alias}. Several
|
||||
other attributes are defined for functions on particular target systems.
|
||||
Other attributes, including @code{section} are supported for variables
|
||||
declarations (@pxref{Variable Attributes}) and for types (@pxref{Type
|
||||
Attributes}).
|
||||
|
||||
You may also specify attributes with @samp{__} preceding and following
|
||||
each keyword. This allows you to use them in header files without
|
||||
|
@ -2212,23 +2212,6 @@ mangled name for the target must be used.
|
|||
|
||||
Not all target machines support this attribute.
|
||||
|
||||
@item no_check_memory_usage
|
||||
@cindex @code{no_check_memory_usage} function attribute
|
||||
@opindex fcheck-memory-usage
|
||||
The @code{no_check_memory_usage} attribute causes GCC to omit checks
|
||||
of memory references when it generates code for that function. Normally
|
||||
if you specify @option{-fcheck-memory-usage} (see @pxref{Code Gen
|
||||
Options}), GCC generates calls to support routines before most memory
|
||||
accesses to permit support code to record usage and detect uses of
|
||||
uninitialized or unallocated storage. Since GCC cannot handle
|
||||
@code{asm} statements properly they are not allowed in such functions.
|
||||
If you declare a function with this attribute, GCC will not generate
|
||||
memory checking code for that function, permitting the use of @code{asm}
|
||||
statements without having to compile that function with different
|
||||
options. This also allows you to write support routines of your own if
|
||||
you wish, without getting infinite recursion if they get compiled with
|
||||
@option{-fcheck-memory-usage}.
|
||||
|
||||
@item regparm (@var{number})
|
||||
@cindex functions that are passed arguments in registers on the 386
|
||||
On the Intel 386, the @code{regparm} attribute causes the compiler to
|
||||
|
|
|
@ -617,7 +617,6 @@ in the following sections.
|
|||
-ffixed-@var{reg} -fexceptions @gol
|
||||
-fnon-call-exceptions -funwind-tables -fasynchronous-unwind-tables @gol
|
||||
-finhibit-size-directive -finstrument-functions @gol
|
||||
-fcheck-memory-usage -fprefix-function-name @gol
|
||||
-fno-common -fno-ident -fno-gnu-linker @gol
|
||||
-fpcc-struct-return -fpic -fPIC @gol
|
||||
-freg-struct-return -fshared-data -fshort-enums @gol
|
||||
|
@ -9988,75 +9987,6 @@ Pack all structure members together without holes. Usually you would
|
|||
not want to use this option, since it makes the code suboptimal, and
|
||||
the offsets of structure members won't agree with system libraries.
|
||||
|
||||
@item -fcheck-memory-usage
|
||||
@opindex fcheck-memory-usage
|
||||
Generate extra code to check each memory access. GCC will generate
|
||||
code that is suitable for a detector of bad memory accesses such as
|
||||
@file{Checker}.
|
||||
|
||||
Normally, you should compile all, or none, of your code with this option.
|
||||
|
||||
If you do mix code compiled with and without this option,
|
||||
you must ensure that all code that has side effects
|
||||
and that is called by code compiled with this option
|
||||
is, itself, compiled with this option.
|
||||
If you do not, you might get erroneous messages from the detector.
|
||||
|
||||
If you use functions from a library that have side-effects (such as
|
||||
@code{read}), you might not be able to recompile the library and
|
||||
specify this option. In that case, you can enable the
|
||||
@option{-fprefix-function-name} option, which requests GCC to encapsulate
|
||||
your code and make other functions look as if they were compiled with
|
||||
@option{-fcheck-memory-usage}. This is done by calling ``stubs'',
|
||||
which are provided by the detector. If you cannot find or build
|
||||
stubs for every function you call, you might have to specify
|
||||
@option{-fcheck-memory-usage} without @option{-fprefix-function-name}.
|
||||
|
||||
If you specify this option, you can not use the @code{asm} or
|
||||
@code{__asm__} keywords in functions with memory checking enabled. GCC
|
||||
cannot understand what the @code{asm} statement may do, and therefore
|
||||
cannot generate the appropriate code, so it will reject it. However, if
|
||||
you specify the function attribute @code{no_check_memory_usage}
|
||||
(@pxref{Function Attributes}), GCC will disable memory checking within a
|
||||
function; you may use @code{asm} statements inside such functions. You
|
||||
may have an inline expansion of a non-checked function within a checked
|
||||
function; in that case GCC will not generate checks for the inlined
|
||||
function's memory accesses.
|
||||
|
||||
If you move your @code{asm} statements to non-checked inline functions
|
||||
and they do access memory, you can add calls to the support code in your
|
||||
inline function, to indicate any reads, writes, or copies being done.
|
||||
These calls would be similar to those done in the stubs described above.
|
||||
|
||||
@item -fprefix-function-name
|
||||
@opindex fprefix-function-name
|
||||
Request GCC to add a prefix to the symbols generated for function names.
|
||||
GCC adds a prefix to the names of functions defined as well as
|
||||
functions called. Code compiled with this option and code compiled
|
||||
without the option can't be linked together, unless stubs are used.
|
||||
|
||||
If you compile the following code with @option{-fprefix-function-name}
|
||||
@example
|
||||
extern void bar (int);
|
||||
void
|
||||
foo (int a)
|
||||
@{
|
||||
return bar (a + 5);
|
||||
@}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
GCC will compile the code as if it was written:
|
||||
@example
|
||||
extern void prefix_bar (int);
|
||||
void
|
||||
prefix_foo (int a)
|
||||
@{
|
||||
return prefix_bar (a + 5);
|
||||
@}
|
||||
@end example
|
||||
This option is designed to be used with @option{-fcheck-memory-usage}.
|
||||
|
||||
@item -finstrument-functions
|
||||
@opindex finstrument-functions
|
||||
Generate instrumentation calls for entry and exit to functions. Just
|
||||
|
|
|
@ -297,8 +297,8 @@ expr_size (exp)
|
|||
&& contains_placeholder_p (size))
|
||||
size = build (WITH_RECORD_EXPR, sizetype, size, exp);
|
||||
|
||||
return expand_expr (size, NULL_RTX, TYPE_MODE (sizetype),
|
||||
EXPAND_MEMORY_USE_BAD);
|
||||
return expand_expr (size, NULL_RTX, TYPE_MODE (sizetype), 0);
|
||||
|
||||
}
|
||||
|
||||
/* Return a copy of X in which all memory references
|
||||
|
|
387
gcc/expr.c
387
gcc/expr.c
|
@ -81,11 +81,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||
the same indirect address eventually. */
|
||||
int cse_not_expected;
|
||||
|
||||
/* Don't check memory usage, since code is being emitted to check a memory
|
||||
usage. Used when current_function_check_memory_usage is true, to avoid
|
||||
infinite recursion. */
|
||||
static int in_check_memory_usage;
|
||||
|
||||
/* Chain of pending expressions for PLACEHOLDER_EXPR to replace. */
|
||||
static tree placeholder_list = 0;
|
||||
|
||||
|
@ -124,8 +119,6 @@ struct store_by_pieces
|
|||
|
||||
extern struct obstack permanent_obstack;
|
||||
|
||||
static rtx get_push_address PARAMS ((int));
|
||||
|
||||
static rtx enqueue_insn PARAMS ((rtx, rtx));
|
||||
static unsigned HOST_WIDE_INT move_by_pieces_ninsns
|
||||
PARAMS ((unsigned HOST_WIDE_INT,
|
||||
|
@ -152,8 +145,6 @@ static rtx store_field PARAMS ((rtx, HOST_WIDE_INT,
|
|||
HOST_WIDE_INT, enum machine_mode,
|
||||
tree, enum machine_mode, int, tree,
|
||||
int));
|
||||
static enum memory_use_mode
|
||||
get_memory_usage_from_modifier PARAMS ((enum expand_modifier));
|
||||
static rtx var_rtx PARAMS ((tree));
|
||||
static HOST_WIDE_INT highest_pow2_factor PARAMS ((tree));
|
||||
static rtx expand_increment PARAMS ((tree, int, int));
|
||||
|
@ -3124,26 +3115,6 @@ push_block (size, extra, below)
|
|||
return memory_address (GET_CLASS_NARROWEST_MODE (MODE_INT), temp);
|
||||
}
|
||||
|
||||
|
||||
/* Return an rtx for the address of the beginning of an as-if-it-was-pushed
|
||||
block of SIZE bytes. */
|
||||
|
||||
static rtx
|
||||
get_push_address (size)
|
||||
int size;
|
||||
{
|
||||
rtx temp;
|
||||
|
||||
if (STACK_PUSH_CODE == POST_DEC)
|
||||
temp = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (size));
|
||||
else if (STACK_PUSH_CODE == POST_INC)
|
||||
temp = gen_rtx_MINUS (Pmode, stack_pointer_rtx, GEN_INT (size));
|
||||
else
|
||||
temp = stack_pointer_rtx;
|
||||
|
||||
return copy_to_reg (temp);
|
||||
}
|
||||
|
||||
#ifdef PUSH_ROUNDING
|
||||
|
||||
/* Emit single push insn. */
|
||||
|
@ -3325,28 +3296,6 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra,
|
|||
anti_adjust_stack (GEN_INT (extra));
|
||||
|
||||
move_by_pieces (NULL, xinner, INTVAL (size) - used, align);
|
||||
|
||||
if (current_function_check_memory_usage && ! in_check_memory_usage)
|
||||
{
|
||||
rtx temp;
|
||||
|
||||
in_check_memory_usage = 1;
|
||||
temp = get_push_address (INTVAL (size) - used);
|
||||
if (GET_CODE (x) == MEM && type && AGGREGATE_TYPE_P (type))
|
||||
emit_library_call (chkr_copy_bitmap_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3, temp,
|
||||
Pmode, XEXP (xinner, 0), Pmode,
|
||||
GEN_INT (INTVAL (size) - used),
|
||||
TYPE_MODE (sizetype));
|
||||
else
|
||||
emit_library_call (chkr_set_right_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3, temp,
|
||||
Pmode, GEN_INT (INTVAL (size) - used),
|
||||
TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_RW),
|
||||
TYPE_MODE (integer_type_node));
|
||||
in_check_memory_usage = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* PUSH_ROUNDING */
|
||||
|
@ -3385,26 +3334,6 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra,
|
|||
args_addr,
|
||||
args_so_far),
|
||||
skip));
|
||||
if (current_function_check_memory_usage && ! in_check_memory_usage)
|
||||
{
|
||||
in_check_memory_usage = 1;
|
||||
target = copy_to_reg (temp);
|
||||
if (GET_CODE (x) == MEM && type && AGGREGATE_TYPE_P (type))
|
||||
emit_library_call (chkr_copy_bitmap_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3,
|
||||
target, Pmode,
|
||||
XEXP (xinner, 0), Pmode,
|
||||
size, TYPE_MODE (sizetype));
|
||||
else
|
||||
emit_library_call (chkr_set_right_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3,
|
||||
target, Pmode,
|
||||
size, TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_RW),
|
||||
TYPE_MODE (integer_type_node));
|
||||
in_check_memory_usage = 0;
|
||||
}
|
||||
|
||||
target = gen_rtx_MEM (BLKmode, temp);
|
||||
|
||||
if (type != 0)
|
||||
|
@ -3605,27 +3534,6 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra,
|
|||
emit_move_insn (dest, x);
|
||||
}
|
||||
|
||||
if (current_function_check_memory_usage && ! in_check_memory_usage)
|
||||
{
|
||||
in_check_memory_usage = 1;
|
||||
if (target == 0)
|
||||
target = get_push_address (GET_MODE_SIZE (mode));
|
||||
|
||||
if (GET_CODE (x) == MEM && type && AGGREGATE_TYPE_P (type))
|
||||
emit_library_call (chkr_copy_bitmap_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3, target,
|
||||
Pmode, XEXP (x, 0), Pmode,
|
||||
GEN_INT (GET_MODE_SIZE (mode)),
|
||||
TYPE_MODE (sizetype));
|
||||
else
|
||||
emit_library_call (chkr_set_right_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3, target,
|
||||
Pmode, GEN_INT (GET_MODE_SIZE (mode)),
|
||||
TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_RW),
|
||||
TYPE_MODE (integer_type_node));
|
||||
in_check_memory_usage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ret:
|
||||
|
@ -3724,8 +3632,8 @@ expand_assignment (to, from, want_value, suggest_reg)
|
|||
if (mode1 == VOIDmode && want_value)
|
||||
tem = stabilize_reference (tem);
|
||||
|
||||
orig_to_rtx = to_rtx
|
||||
= expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_MEMORY_USE_DONT);
|
||||
orig_to_rtx = to_rtx = expand_expr (tem, NULL_RTX, VOIDmode,
|
||||
EXPAND_WRITE);
|
||||
if (offset != 0)
|
||||
{
|
||||
rtx offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, 0);
|
||||
|
@ -3812,36 +3720,6 @@ expand_assignment (to, from, want_value, suggest_reg)
|
|||
MEM_KEEP_ALIAS_SET_P (to_rtx) = 1;
|
||||
}
|
||||
|
||||
/* Check the access. */
|
||||
if (current_function_check_memory_usage && GET_CODE (to_rtx) == MEM)
|
||||
{
|
||||
rtx to_addr;
|
||||
int size;
|
||||
int best_mode_size;
|
||||
enum machine_mode best_mode;
|
||||
|
||||
best_mode = get_best_mode (bitsize, bitpos,
|
||||
TYPE_ALIGN (TREE_TYPE (tem)),
|
||||
mode1, volatilep);
|
||||
if (best_mode == VOIDmode)
|
||||
best_mode = QImode;
|
||||
|
||||
best_mode_size = GET_MODE_BITSIZE (best_mode);
|
||||
to_addr = plus_constant (XEXP (to_rtx, 0), bitpos / BITS_PER_UNIT);
|
||||
size = CEIL ((bitpos % best_mode_size) + bitsize, best_mode_size);
|
||||
size *= GET_MODE_SIZE (best_mode);
|
||||
|
||||
/* Check the access right of the pointer. */
|
||||
in_check_memory_usage = 1;
|
||||
if (size)
|
||||
emit_library_call (chkr_check_addr_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 3, to_addr, Pmode,
|
||||
GEN_INT (size), TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_WO),
|
||||
TYPE_MODE (integer_type_node));
|
||||
in_check_memory_usage = 0;
|
||||
}
|
||||
|
||||
result = store_field (to_rtx, bitsize, bitpos, mode1, from,
|
||||
(want_value
|
||||
/* Spurious cast for HPUX compiler. */
|
||||
|
@ -3883,7 +3761,7 @@ expand_assignment (to, from, want_value, suggest_reg)
|
|||
push_temp_slots ();
|
||||
value = expand_expr (from, NULL_RTX, VOIDmode, 0);
|
||||
if (to_rtx == 0)
|
||||
to_rtx = expand_expr (to, NULL_RTX, VOIDmode, EXPAND_MEMORY_USE_WO);
|
||||
to_rtx = expand_expr (to, NULL_RTX, VOIDmode, EXPAND_WRITE);
|
||||
|
||||
/* Handle calls that return values in multiple non-contiguous locations.
|
||||
The Irix 6 ABI has examples of this. */
|
||||
|
@ -3910,7 +3788,7 @@ expand_assignment (to, from, want_value, suggest_reg)
|
|||
Don't re-expand if it was expanded already (in COMPONENT_REF case). */
|
||||
|
||||
if (to_rtx == 0)
|
||||
to_rtx = expand_expr (to, NULL_RTX, VOIDmode, EXPAND_MEMORY_USE_WO);
|
||||
to_rtx = expand_expr (to, NULL_RTX, VOIDmode, EXPAND_WRITE);
|
||||
|
||||
/* Don't move directly into a return register. */
|
||||
if (TREE_CODE (to) == RESULT_DECL
|
||||
|
@ -3943,17 +3821,7 @@ expand_assignment (to, from, want_value, suggest_reg)
|
|||
|
||||
push_temp_slots ();
|
||||
size = expr_size (from);
|
||||
from_rtx = expand_expr (from, NULL_RTX, VOIDmode,
|
||||
EXPAND_MEMORY_USE_DONT);
|
||||
|
||||
/* Copy the rights of the bitmap. */
|
||||
if (current_function_check_memory_usage)
|
||||
emit_library_call (chkr_copy_bitmap_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 3, XEXP (to_rtx, 0), Pmode,
|
||||
XEXP (from_rtx, 0), Pmode,
|
||||
convert_to_mode (TYPE_MODE (sizetype),
|
||||
size, TREE_UNSIGNED (sizetype)),
|
||||
TYPE_MODE (sizetype));
|
||||
from_rtx = expand_expr (from, NULL_RTX, VOIDmode, 0);
|
||||
|
||||
#ifdef TARGET_MEM_FUNCTIONS
|
||||
emit_library_call (memmove_libfunc, LCT_NORMAL,
|
||||
|
@ -4195,28 +4063,9 @@ store_expr (exp, target, want_value)
|
|||
temp = convert_modes (GET_MODE (target), TYPE_MODE (TREE_TYPE (exp)),
|
||||
temp, TREE_UNSIGNED (TREE_TYPE (exp)));
|
||||
|
||||
if (current_function_check_memory_usage
|
||||
&& GET_CODE (target) == MEM
|
||||
&& AGGREGATE_TYPE_P (TREE_TYPE (exp)))
|
||||
{
|
||||
in_check_memory_usage = 1;
|
||||
if (GET_CODE (temp) == MEM)
|
||||
emit_library_call (chkr_copy_bitmap_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 3, XEXP (target, 0), Pmode,
|
||||
XEXP (temp, 0), Pmode,
|
||||
expr_size (exp), TYPE_MODE (sizetype));
|
||||
else
|
||||
emit_library_call (chkr_check_addr_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 3, XEXP (target, 0), Pmode,
|
||||
expr_size (exp), TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_WO),
|
||||
TYPE_MODE (integer_type_node));
|
||||
in_check_memory_usage = 0;
|
||||
}
|
||||
|
||||
/* If value was not generated in the target, store it there.
|
||||
Convert the value to TARGET's type first if nec. */
|
||||
/* If TEMP and TARGET compare equal according to rtx_equal_p, but
|
||||
Convert the value to TARGET's type first if necessary.
|
||||
If TEMP and TARGET compare equal according to rtx_equal_p, but
|
||||
one or both of them are volatile memory refs, we have to distinguish
|
||||
two cases:
|
||||
- expand_expr has used TARGET. In this case, we must not generate
|
||||
|
@ -4305,19 +4154,7 @@ store_expr (exp, target, want_value)
|
|||
}
|
||||
|
||||
if (size != const0_rtx)
|
||||
{
|
||||
/* Be sure we can write on ADDR. */
|
||||
in_check_memory_usage = 1;
|
||||
if (current_function_check_memory_usage)
|
||||
emit_library_call (chkr_check_addr_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3,
|
||||
XEXP (target, 0), Pmode,
|
||||
size, TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_WO),
|
||||
TYPE_MODE (integer_type_node));
|
||||
in_check_memory_usage = 0;
|
||||
clear_storage (target, size);
|
||||
}
|
||||
clear_storage (target, size);
|
||||
|
||||
if (label)
|
||||
emit_label (label);
|
||||
|
@ -5508,37 +5345,6 @@ handled_component_p (t)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Subroutine of expand_exp: compute memory_usage from modifier. */
|
||||
|
||||
static enum memory_use_mode
|
||||
get_memory_usage_from_modifier (modifier)
|
||||
enum expand_modifier modifier;
|
||||
{
|
||||
switch (modifier)
|
||||
{
|
||||
case EXPAND_NORMAL:
|
||||
case EXPAND_SUM:
|
||||
return MEMORY_USE_RO;
|
||||
break;
|
||||
case EXPAND_MEMORY_USE_WO:
|
||||
return MEMORY_USE_WO;
|
||||
break;
|
||||
case EXPAND_MEMORY_USE_RW:
|
||||
return MEMORY_USE_RW;
|
||||
break;
|
||||
case EXPAND_MEMORY_USE_DONT:
|
||||
/* EXPAND_CONST_ADDRESS and EXPAND_INITIALIZER are converted into
|
||||
MEMORY_USE_DONT, because they are modifiers to a call of
|
||||
expand_expr in the ADDR_EXPR case of expand_expr. */
|
||||
case EXPAND_CONST_ADDRESS:
|
||||
case EXPAND_INITIALIZER:
|
||||
return MEMORY_USE_DONT;
|
||||
case EXPAND_MEMORY_USE_BAD:
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Given an rtx VALUE that may contain additions and multiplications, return
|
||||
an equivalent value that just refers to a register, memory, or constant.
|
||||
|
@ -6133,8 +5939,6 @@ expand_expr (exp, target, tmode, modifier)
|
|||
rtx subtarget, original_target;
|
||||
int ignore;
|
||||
tree context;
|
||||
/* Used by check-memory-usage to make modifier read only. */
|
||||
enum expand_modifier ro_modifier;
|
||||
|
||||
/* Handle ERROR_MARK before anybody tries to access its type. */
|
||||
if (TREE_CODE (exp) == ERROR_MARK || TREE_CODE (type) == ERROR_MARK)
|
||||
|
@ -6155,13 +5959,6 @@ expand_expr (exp, target, tmode, modifier)
|
|||
|| code == COND_EXPR || code == VIEW_CONVERT_EXPR)
|
||||
&& TREE_CODE (type) == VOID_TYPE));
|
||||
|
||||
/* Make a read-only version of the modifier. */
|
||||
if (modifier == EXPAND_NORMAL || modifier == EXPAND_SUM
|
||||
|| modifier == EXPAND_CONST_ADDRESS || modifier == EXPAND_INITIALIZER)
|
||||
ro_modifier = modifier;
|
||||
else
|
||||
ro_modifier = EXPAND_NORMAL;
|
||||
|
||||
/* If we are going to ignore this result, we need only do something
|
||||
if there is a side-effect somewhere in the expression. If there
|
||||
is, short-circuit the most common cases here. Note that we must
|
||||
|
@ -6180,7 +5977,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
&& mode != VOIDmode && mode != BLKmode
|
||||
&& modifier != EXPAND_CONST_ADDRESS)
|
||||
{
|
||||
temp = expand_expr (exp, NULL_RTX, VOIDmode, ro_modifier);
|
||||
temp = expand_expr (exp, NULL_RTX, VOIDmode, modifier);
|
||||
if (GET_CODE (temp) == MEM)
|
||||
temp = copy_to_reg (temp);
|
||||
return const0_rtx;
|
||||
|
@ -6188,34 +5985,30 @@ expand_expr (exp, target, tmode, modifier)
|
|||
|
||||
if (TREE_CODE_CLASS (code) == '1' || code == COMPONENT_REF
|
||||
|| code == INDIRECT_REF || code == BUFFER_REF)
|
||||
return expand_expr (TREE_OPERAND (exp, 0), const0_rtx,
|
||||
VOIDmode, ro_modifier);
|
||||
return expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode,
|
||||
modifier);
|
||||
|
||||
else if (TREE_CODE_CLASS (code) == '2' || TREE_CODE_CLASS (code) == '<'
|
||||
|| code == ARRAY_REF || code == ARRAY_RANGE_REF)
|
||||
{
|
||||
expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode,
|
||||
ro_modifier);
|
||||
expand_expr (TREE_OPERAND (exp, 1), const0_rtx, VOIDmode,
|
||||
ro_modifier);
|
||||
expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, modifier);
|
||||
expand_expr (TREE_OPERAND (exp, 1), const0_rtx, VOIDmode, modifier);
|
||||
return const0_rtx;
|
||||
}
|
||||
else if ((code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR)
|
||||
&& ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
|
||||
/* If the second operand has no side effects, just evaluate
|
||||
the first. */
|
||||
return expand_expr (TREE_OPERAND (exp, 0), const0_rtx,
|
||||
VOIDmode, ro_modifier);
|
||||
return expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode,
|
||||
modifier);
|
||||
else if (code == BIT_FIELD_REF)
|
||||
{
|
||||
expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode,
|
||||
ro_modifier);
|
||||
expand_expr (TREE_OPERAND (exp, 1), const0_rtx, VOIDmode,
|
||||
ro_modifier);
|
||||
expand_expr (TREE_OPERAND (exp, 2), const0_rtx, VOIDmode,
|
||||
ro_modifier);
|
||||
expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, modifier);
|
||||
expand_expr (TREE_OPERAND (exp, 1), const0_rtx, VOIDmode, modifier);
|
||||
expand_expr (TREE_OPERAND (exp, 2), const0_rtx, VOIDmode, modifier);
|
||||
return const0_rtx;
|
||||
}
|
||||
;
|
||||
|
||||
target = 0;
|
||||
}
|
||||
|
||||
|
@ -6331,35 +6124,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
set_mem_attributes (value, exp, 1);
|
||||
SET_DECL_RTL (exp, value);
|
||||
}
|
||||
}
|
||||
|
||||
/* Although static-storage variables start off initialized, according to
|
||||
ANSI C, a memcpy could overwrite them with uninitialized values. So
|
||||
we check them too. This also lets us check for read-only variables
|
||||
accessed via a non-const declaration, in case it won't be detected
|
||||
any other way (e.g., in an embedded system or OS kernel without
|
||||
memory protection).
|
||||
|
||||
Aggregates are not checked here; they're handled elsewhere. */
|
||||
if (cfun && current_function_check_memory_usage
|
||||
&& code == VAR_DECL
|
||||
&& GET_CODE (DECL_RTL (exp)) == MEM
|
||||
&& ! AGGREGATE_TYPE_P (TREE_TYPE (exp)))
|
||||
{
|
||||
enum memory_use_mode memory_usage;
|
||||
memory_usage = get_memory_usage_from_modifier (modifier);
|
||||
|
||||
in_check_memory_usage = 1;
|
||||
if (memory_usage != MEMORY_USE_DONT)
|
||||
emit_library_call (chkr_check_addr_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3,
|
||||
XEXP (DECL_RTL (exp), 0), Pmode,
|
||||
GEN_INT (int_size_in_bytes (type)),
|
||||
TYPE_MODE (sizetype),
|
||||
GEN_INT (memory_usage),
|
||||
TYPE_MODE (integer_type_node));
|
||||
in_check_memory_usage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* ... fall through ... */
|
||||
|
||||
|
@ -6473,8 +6238,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
TREE_INT_CST_HIGH (exp), mode);
|
||||
|
||||
case CONST_DECL:
|
||||
return expand_expr (DECL_INITIAL (exp), target, VOIDmode,
|
||||
EXPAND_MEMORY_USE_BAD);
|
||||
return expand_expr (DECL_INITIAL (exp), target, VOIDmode, 0);
|
||||
|
||||
case REAL_CST:
|
||||
/* If optimized, generate immediate CONST_DOUBLE
|
||||
|
@ -6587,8 +6351,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
}
|
||||
|
||||
if (temp == const0_rtx)
|
||||
expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode,
|
||||
EXPAND_MEMORY_USE_BAD);
|
||||
expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
|
||||
else
|
||||
store_expr (TREE_OPERAND (exp, 0), temp, 0);
|
||||
|
||||
|
@ -6630,7 +6393,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
abort ();
|
||||
|
||||
placeholder_list = TREE_CHAIN (placeholder_expr);
|
||||
temp = expand_expr (exp, original_target, tmode, ro_modifier);
|
||||
temp = expand_expr (exp, original_target, tmode, modifier);
|
||||
placeholder_list = old_list;
|
||||
return temp;
|
||||
}
|
||||
|
@ -6643,8 +6406,8 @@ expand_expr (exp, target, tmode, modifier)
|
|||
and pop the list. */
|
||||
placeholder_list = tree_cons (TREE_OPERAND (exp, 1), NULL_TREE,
|
||||
placeholder_list);
|
||||
target = expand_expr (TREE_OPERAND (exp, 0), original_target,
|
||||
tmode, ro_modifier);
|
||||
target = expand_expr (TREE_OPERAND (exp, 0), original_target, tmode,
|
||||
modifier);
|
||||
placeholder_list = TREE_CHAIN (placeholder_list);
|
||||
return target;
|
||||
|
||||
|
@ -6709,7 +6472,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
vars = TREE_CHAIN (vars);
|
||||
}
|
||||
|
||||
temp = expand_expr (TREE_OPERAND (exp, 1), target, tmode, ro_modifier);
|
||||
temp = expand_expr (TREE_OPERAND (exp, 1), target, tmode, modifier);
|
||||
|
||||
expand_end_bindings (TREE_OPERAND (exp, 0), 0, 0);
|
||||
|
||||
|
@ -6734,9 +6497,10 @@ expand_expr (exp, target, tmode, modifier)
|
|||
if (ignore)
|
||||
{
|
||||
tree elt;
|
||||
|
||||
for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
|
||||
expand_expr (TREE_VALUE (elt), const0_rtx, VOIDmode,
|
||||
EXPAND_MEMORY_USE_BAD);
|
||||
expand_expr (TREE_VALUE (elt), const0_rtx, VOIDmode, 0);
|
||||
|
||||
return const0_rtx;
|
||||
}
|
||||
|
||||
|
@ -6798,39 +6562,19 @@ expand_expr (exp, target, tmode, modifier)
|
|||
&& compare_tree_int (index, TREE_STRING_LENGTH (string)) < 0
|
||||
&& GET_MODE_CLASS (mode) == MODE_INT
|
||||
&& GET_MODE_SIZE (mode) == 1
|
||||
&& modifier != EXPAND_MEMORY_USE_WO)
|
||||
&& modifier != EXPAND_WRITE)
|
||||
return
|
||||
GEN_INT (TREE_STRING_POINTER (string)[TREE_INT_CST_LOW (index)]);
|
||||
|
||||
op0 = expand_expr (exp1, NULL_RTX, VOIDmode, EXPAND_SUM);
|
||||
op0 = memory_address (mode, op0);
|
||||
|
||||
if (cfun && current_function_check_memory_usage
|
||||
&& ! AGGREGATE_TYPE_P (TREE_TYPE (exp)))
|
||||
{
|
||||
enum memory_use_mode memory_usage;
|
||||
memory_usage = get_memory_usage_from_modifier (modifier);
|
||||
|
||||
if (memory_usage != MEMORY_USE_DONT)
|
||||
{
|
||||
in_check_memory_usage = 1;
|
||||
emit_library_call (chkr_check_addr_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3, op0,
|
||||
Pmode, GEN_INT (int_size_in_bytes (type)),
|
||||
TYPE_MODE (sizetype),
|
||||
GEN_INT (memory_usage),
|
||||
TYPE_MODE (integer_type_node));
|
||||
in_check_memory_usage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
temp = gen_rtx_MEM (mode, op0);
|
||||
set_mem_attributes (temp, exp, 0);
|
||||
|
||||
/* If we are writing to this object and its type is a record with
|
||||
readonly fields, we must mark it as readonly so it will
|
||||
conflict with readonly references to those fields. */
|
||||
if (modifier == EXPAND_MEMORY_USE_WO && readonly_fields_p (type))
|
||||
if (modifier == EXPAND_WRITE && readonly_fields_p (type))
|
||||
RTX_UNCHANGING_P (temp) = 1;
|
||||
|
||||
return temp;
|
||||
|
@ -6892,8 +6636,8 @@ expand_expr (exp, target, tmode, modifier)
|
|||
;
|
||||
|
||||
if (elem)
|
||||
return expand_expr (fold (TREE_VALUE (elem)), target,
|
||||
tmode, ro_modifier);
|
||||
return expand_expr (fold (TREE_VALUE (elem)), target, tmode,
|
||||
modifier);
|
||||
}
|
||||
|
||||
else if (optimize >= 1
|
||||
|
@ -6919,7 +6663,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
|
||||
if (elem && !TREE_SIDE_EFFECTS (TREE_VALUE (elem)))
|
||||
return expand_expr (fold (TREE_VALUE (elem)), target,
|
||||
tmode, ro_modifier);
|
||||
tmode, modifier);
|
||||
}
|
||||
else if (TREE_CODE (init) == STRING_CST
|
||||
&& 0 > compare_tree_int (index,
|
||||
|
@ -7117,34 +6861,6 @@ expand_expr (exp, target, tmode, modifier)
|
|||
MEM_VOLATILE_P (op0) = 1;
|
||||
}
|
||||
|
||||
/* Check the access. */
|
||||
if (cfun != 0 && current_function_check_memory_usage
|
||||
&& GET_CODE (op0) == MEM)
|
||||
{
|
||||
enum memory_use_mode memory_usage;
|
||||
memory_usage = get_memory_usage_from_modifier (modifier);
|
||||
|
||||
if (memory_usage != MEMORY_USE_DONT)
|
||||
{
|
||||
rtx to;
|
||||
int size;
|
||||
|
||||
to = plus_constant (XEXP (op0, 0), (bitpos / BITS_PER_UNIT));
|
||||
size = (bitpos % BITS_PER_UNIT) + bitsize + BITS_PER_UNIT - 1;
|
||||
|
||||
/* Check the access right of the pointer. */
|
||||
in_check_memory_usage = 1;
|
||||
if (size > BITS_PER_UNIT)
|
||||
emit_library_call (chkr_check_addr_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3, to,
|
||||
Pmode, GEN_INT (size / BITS_PER_UNIT),
|
||||
TYPE_MODE (sizetype),
|
||||
GEN_INT (memory_usage),
|
||||
TYPE_MODE (integer_type_node));
|
||||
in_check_memory_usage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* In cases where an aligned union has an unaligned object
|
||||
as a field, we might be extracting a BLKmode value from
|
||||
an integer-mode (e.g., SImode) object. Handle this case
|
||||
|
@ -7416,7 +7132,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
if (WITH_CLEANUP_EXPR_RTL (exp) == 0)
|
||||
{
|
||||
WITH_CLEANUP_EXPR_RTL (exp)
|
||||
= expand_expr (TREE_OPERAND (exp, 0), target, tmode, ro_modifier);
|
||||
= expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
|
||||
expand_decl_cleanup (NULL_TREE, TREE_OPERAND (exp, 1));
|
||||
|
||||
/* That's it for this cleanup. */
|
||||
|
@ -7432,7 +7148,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
|
||||
target_temp_slot_level = temp_slot_level;
|
||||
|
||||
op0 = expand_expr (TREE_OPERAND (exp, 0), target, tmode, ro_modifier);
|
||||
op0 = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
|
||||
/* If we're going to use this value, load it up now. */
|
||||
if (! ignore)
|
||||
op0 = force_not_mem (op0);
|
||||
|
@ -7507,7 +7223,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
if (mode == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
|
||||
{
|
||||
op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode,
|
||||
ro_modifier);
|
||||
modifier);
|
||||
|
||||
/* If the signedness of the conversion differs and OP0 is
|
||||
a promoted SUBREG, clear that indication since we now
|
||||
|
@ -7542,7 +7258,7 @@ expand_expr (exp, target, tmode, modifier)
|
|||
return target;
|
||||
|
||||
case VIEW_CONVERT_EXPR:
|
||||
op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, ro_modifier);
|
||||
op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, modifier);
|
||||
|
||||
/* If the input and output modes are both the same, we are done.
|
||||
Otherwise, if neither mode is BLKmode and both are within a word, we
|
||||
|
@ -7722,8 +7438,8 @@ expand_expr (exp, target, tmode, modifier)
|
|||
if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
|
||||
subtarget = 0;
|
||||
|
||||
op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, ro_modifier);
|
||||
op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, ro_modifier);
|
||||
op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, modifier);
|
||||
op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, modifier);
|
||||
|
||||
both_summands:
|
||||
/* Make sure any term that's a sum with a constant comes last. */
|
||||
|
@ -7782,10 +7498,10 @@ expand_expr (exp, target, tmode, modifier)
|
|||
&& really_constant_p (TREE_OPERAND (exp, 0))
|
||||
&& really_constant_p (TREE_OPERAND (exp, 1)))
|
||||
{
|
||||
rtx op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX,
|
||||
VOIDmode, ro_modifier);
|
||||
rtx op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX,
|
||||
VOIDmode, ro_modifier);
|
||||
rtx op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode,
|
||||
modifier);
|
||||
rtx op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode,
|
||||
modifier);
|
||||
|
||||
/* If the last operand is a CONST_INT, use plus_constant of
|
||||
the negated constant. Else make the MINUS. */
|
||||
|
@ -8267,11 +7983,11 @@ expand_expr (exp, target, tmode, modifier)
|
|||
if (ignore)
|
||||
{
|
||||
expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode,
|
||||
ro_modifier);
|
||||
modifier);
|
||||
return const0_rtx;
|
||||
}
|
||||
|
||||
op0 = expand_expr (TREE_OPERAND (exp, 0), target, mode, ro_modifier);
|
||||
op0 = expand_expr (TREE_OPERAND (exp, 0), target, mode, modifier);
|
||||
if (GET_MODE (op0) == mode)
|
||||
return op0;
|
||||
|
||||
|
@ -9076,7 +8792,7 @@ expand_increment (exp, post, ignore)
|
|||
and insns were generated in computing it. */
|
||||
|
||||
temp = get_last_insn ();
|
||||
op0 = expand_expr (incremented, NULL_RTX, VOIDmode, EXPAND_MEMORY_USE_RW);
|
||||
op0 = expand_expr (incremented, NULL_RTX, VOIDmode, 0);
|
||||
|
||||
/* If OP0 is a SUBREG made for a promoted variable, we cannot increment
|
||||
in place but instead must do sign- or zero-extension during assignment,
|
||||
|
@ -9107,8 +8823,7 @@ expand_increment (exp, post, ignore)
|
|||
|
||||
op0_is_copy = ((GET_CODE (op0) == SUBREG || GET_CODE (op0) == REG)
|
||||
&& temp != get_last_insn ());
|
||||
op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode,
|
||||
EXPAND_MEMORY_USE_BAD);
|
||||
op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
|
||||
|
||||
/* Decide whether incrementing or decrementing. */
|
||||
if (TREE_CODE (exp) == POSTDECREMENT_EXPR
|
||||
|
@ -9229,9 +8944,9 @@ expand_increment (exp, post, ignore)
|
|||
temp = copy_rtx (value = op0);
|
||||
|
||||
/* Increment however we can. */
|
||||
op1 = expand_binop (mode, this_optab, value, op1,
|
||||
current_function_check_memory_usage ? NULL_RTX : op0,
|
||||
op1 = expand_binop (mode, this_optab, value, op1, op0,
|
||||
TREE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
|
||||
|
||||
/* Make sure the value is stored into OP0. */
|
||||
if (op1 != op0)
|
||||
emit_move_insn (op0, op1);
|
||||
|
|
26
gcc/expr.h
26
gcc/expr.h
|
@ -48,26 +48,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||
EXPAND_INITIALIZER is similar but also record any labels on forced_labels.
|
||||
EXPAND_CONST_ADDRESS means it is ok to return a MEM whose address
|
||||
is a constant that is not a legitimate address.
|
||||
EXPAND_MEMORY_USE_* are explained below. */
|
||||
enum expand_modifier {EXPAND_NORMAL, EXPAND_SUM,
|
||||
EXPAND_CONST_ADDRESS, EXPAND_INITIALIZER,
|
||||
EXPAND_MEMORY_USE_WO, EXPAND_MEMORY_USE_RW,
|
||||
EXPAND_MEMORY_USE_BAD, EXPAND_MEMORY_USE_DONT};
|
||||
|
||||
/* Argument for chkr_* functions.
|
||||
MEMORY_USE_RO: the pointer reads memory.
|
||||
MEMORY_USE_WO: the pointer writes to memory.
|
||||
MEMORY_USE_RW: the pointer modifies memory (ie it reads and writes). An
|
||||
example is (*ptr)++
|
||||
MEMORY_USE_BAD: use this if you don't know the behavior of the pointer, or
|
||||
if you know there are no pointers. Using an INDIRECT_REF
|
||||
with MEMORY_USE_BAD will abort.
|
||||
MEMORY_USE_TW: just test for writing, without update. Special.
|
||||
MEMORY_USE_DONT: the memory is neither read nor written. This is used by
|
||||
'->' and '.'. */
|
||||
enum memory_use_mode {MEMORY_USE_BAD = 0, MEMORY_USE_RO = 1,
|
||||
MEMORY_USE_WO = 2, MEMORY_USE_RW = 3,
|
||||
MEMORY_USE_TW = 6, MEMORY_USE_DONT = 99};
|
||||
EXPAND_WRITE means we are only going to write to the resulting rtx. */
|
||||
enum expand_modifier {EXPAND_NORMAL, EXPAND_SUM, EXPAND_CONST_ADDRESS,
|
||||
EXPAND_INITIALIZER, EXPAND_WRITE};
|
||||
|
||||
/* Prevent the compiler from deferring stack pops. See
|
||||
inhibit_defer_pop for more information. */
|
||||
|
@ -119,8 +102,7 @@ struct args_size
|
|||
/* Convert the implicit sum in a `struct args_size' into an rtx. */
|
||||
#define ARGS_SIZE_RTX(SIZE) \
|
||||
((SIZE).var == 0 ? GEN_INT ((SIZE).constant) \
|
||||
: expand_expr (ARGS_SIZE_TREE (SIZE), NULL_RTX, VOIDmode, \
|
||||
EXPAND_MEMORY_USE_BAD))
|
||||
: expand_expr (ARGS_SIZE_TREE (SIZE), NULL_RTX, VOIDmode, 0))
|
||||
|
||||
/* Supply a default definition for FUNCTION_ARG_PADDING:
|
||||
usually pad upward, but pad short args downward on
|
||||
|
|
|
@ -569,19 +569,10 @@ extern int flag_renumber_insns;
|
|||
|
||||
extern int frame_pointer_needed;
|
||||
|
||||
/* Nonzero if GCC must add code to check memory access (used by Checker). */
|
||||
|
||||
extern int flag_check_memory_usage;
|
||||
|
||||
/* Nonzero if the generated code should trap on signed overflow
|
||||
for PLUS / SUB / MULT. */
|
||||
extern int flag_trapv;
|
||||
|
||||
/* Nonzero if GCC must prefix function names (used with
|
||||
flag_check_memory_usage). */
|
||||
|
||||
extern int flag_prefix_function_name;
|
||||
|
||||
/* Value of the -G xx switch, and whether it was passed or not. */
|
||||
extern int g_switch_value;
|
||||
extern int g_switch_set;
|
||||
|
|
|
@ -1432,14 +1432,6 @@ put_var_into_stack (decl)
|
|||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (current_function_check_memory_usage)
|
||||
emit_library_call (chkr_set_right_libfunc, LCT_CONST_MAKE_BLOCK, VOIDmode,
|
||||
3, XEXP (reg, 0), Pmode,
|
||||
GEN_INT (GET_MODE_SIZE (GET_MODE (reg))),
|
||||
TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_RW),
|
||||
TYPE_MODE (integer_type_node));
|
||||
}
|
||||
|
||||
/* Subroutine of put_var_into_stack. This puts a single pseudo reg REG
|
||||
|
@ -4824,14 +4816,6 @@ assign_parms (fndecl)
|
|||
|
||||
store_expr (parm, copy, 0);
|
||||
emit_move_insn (parmreg, XEXP (copy, 0));
|
||||
if (current_function_check_memory_usage)
|
||||
emit_library_call (chkr_set_right_libfunc,
|
||||
LCT_CONST_MAKE_BLOCK, VOIDmode, 3,
|
||||
XEXP (copy, 0), Pmode,
|
||||
GEN_INT (int_size_in_bytes (type)),
|
||||
TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_RW),
|
||||
TYPE_MODE (integer_type_node));
|
||||
conversion_insns = get_insns ();
|
||||
did_conversion = 1;
|
||||
end_sequence ();
|
||||
|
@ -5000,20 +4984,7 @@ assign_parms (fndecl)
|
|||
emit_move_insn (validize_mem (stack_parm),
|
||||
validize_mem (entry_parm));
|
||||
}
|
||||
if (current_function_check_memory_usage)
|
||||
{
|
||||
push_to_sequence (conversion_insns);
|
||||
emit_library_call (chkr_set_right_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 3, XEXP (stack_parm, 0), Pmode,
|
||||
GEN_INT (GET_MODE_SIZE (GET_MODE
|
||||
(entry_parm))),
|
||||
TYPE_MODE (sizetype),
|
||||
GEN_INT (MEMORY_USE_RW),
|
||||
TYPE_MODE (integer_type_node));
|
||||
|
||||
conversion_insns = get_insns ();
|
||||
end_sequence ();
|
||||
}
|
||||
SET_DECL_RTL (parm, stack_parm);
|
||||
}
|
||||
|
||||
|
@ -5074,7 +5045,7 @@ assign_parms (fndecl)
|
|||
= (stack_args_size.var == 0 ? GEN_INT (-stack_args_size.constant)
|
||||
: expand_expr (size_diffop (stack_args_size.var,
|
||||
size_int (-stack_args_size.constant)),
|
||||
NULL_RTX, VOIDmode, EXPAND_MEMORY_USE_BAD));
|
||||
NULL_RTX, VOIDmode, 0);
|
||||
#else
|
||||
current_function_arg_offset_rtx = ARGS_SIZE_RTX (stack_args_size);
|
||||
#endif
|
||||
|
@ -6352,8 +6323,7 @@ expand_pending_sizes (pending_sizes)
|
|||
/* Evaluate now the sizes of any types declared among the arguments. */
|
||||
for (tem = pending_sizes; tem; tem = TREE_CHAIN (tem))
|
||||
{
|
||||
expand_expr (TREE_VALUE (tem), const0_rtx, VOIDmode,
|
||||
EXPAND_MEMORY_USE_BAD);
|
||||
expand_expr (TREE_VALUE (tem), const0_rtx, VOIDmode, 0);
|
||||
/* Flush the queue in case this parameter declaration has
|
||||
side-effects. */
|
||||
emit_queue ();
|
||||
|
@ -6378,11 +6348,6 @@ expand_function_start (subr, parms_have_cleanups)
|
|||
valid operands of arithmetic insns. */
|
||||
init_recog_no_volatile ();
|
||||
|
||||
/* Set this before generating any memory accesses. */
|
||||
current_function_check_memory_usage
|
||||
= (flag_check_memory_usage
|
||||
&& ! DECL_NO_CHECK_MEMORY_USAGE (current_function_decl));
|
||||
|
||||
current_function_instrument_entry_exit
|
||||
= (flag_instrument_function_entry_exit
|
||||
&& ! DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (subr));
|
||||
|
|
|
@ -434,9 +434,6 @@ struct function
|
|||
generated. */
|
||||
unsigned int instrument_entry_exit : 1;
|
||||
|
||||
/* Nonzero if memory access checking be enabled in the current function. */
|
||||
unsigned int check_memory_usage : 1;
|
||||
|
||||
/* Nonzero if stack limit checking should be enabled in the current
|
||||
function. */
|
||||
unsigned int limit_stack : 1;
|
||||
|
@ -507,7 +504,6 @@ extern int virtuals_instantiated;
|
|||
#define current_function_internal_arg_pointer (cfun->internal_arg_pointer)
|
||||
#define current_function_return_rtx (cfun->return_rtx)
|
||||
#define current_function_instrument_entry_exit (cfun->instrument_entry_exit)
|
||||
#define current_function_check_memory_usage (cfun->check_memory_usage)
|
||||
#define current_function_limit_stack (cfun->limit_stack)
|
||||
#define current_function_uses_pic_offset_table (cfun->uses_pic_offset_table)
|
||||
#define current_function_uses_const_pool (cfun->uses_const_pool)
|
||||
|
|
|
@ -139,12 +139,6 @@ enum libfunc_index
|
|||
LTI_fixunstfdi,
|
||||
LTI_fixunstfti,
|
||||
|
||||
LTI_chkr_check_addr,
|
||||
LTI_chkr_set_right,
|
||||
LTI_chkr_copy_bitmap,
|
||||
LTI_chkr_check_exec,
|
||||
LTI_chkr_check_str,
|
||||
|
||||
LTI_profile_function_entry,
|
||||
LTI_profile_function_exit,
|
||||
|
||||
|
@ -272,12 +266,6 @@ extern rtx libfunc_table[LTI_MAX];
|
|||
#define fixunstfdi_libfunc (libfunc_table[LTI_fixunstfdi])
|
||||
#define fixunstfti_libfunc (libfunc_table[LTI_fixunstfti])
|
||||
|
||||
#define chkr_check_addr_libfunc (libfunc_table[LTI_chkr_check_addr])
|
||||
#define chkr_set_right_libfunc (libfunc_table[LTI_chkr_set_right])
|
||||
#define chkr_copy_bitmap_libfunc (libfunc_table[LTI_chkr_copy_bitmap])
|
||||
#define chkr_check_exec_libfunc (libfunc_table[LTI_chkr_check_exec])
|
||||
#define chkr_check_str_libfunc (libfunc_table[LTI_chkr_check_str])
|
||||
|
||||
#define profile_function_entry_libfunc (libfunc_table[LTI_profile_function_entry])
|
||||
#define profile_function_exit_libfunc (libfunc_table[LTI_profile_function_exit])
|
||||
|
||||
|
|
23
gcc/stmt.c
23
gcc/stmt.c
|
@ -712,11 +712,6 @@ expand_computed_goto (exp)
|
|||
#endif
|
||||
|
||||
emit_queue ();
|
||||
/* Be sure the function is executable. */
|
||||
if (current_function_check_memory_usage)
|
||||
emit_library_call (chkr_check_exec_libfunc, LCT_CONST_MAKE_BLOCK,
|
||||
VOIDmode, 1, x, ptr_mode);
|
||||
|
||||
do_pending_stack_adjust ();
|
||||
emit_indirect_jump (x);
|
||||
|
||||
|
@ -1290,12 +1285,6 @@ void
|
|||
expand_asm (body)
|
||||
tree body;
|
||||
{
|
||||
if (current_function_check_memory_usage)
|
||||
{
|
||||
error ("`asm' cannot be used in function where memory usage is checked");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TREE_CODE (body) == ADDR_EXPR)
|
||||
body = TREE_OPERAND (body, 0);
|
||||
|
||||
|
@ -1503,12 +1492,6 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
|
|||
if (noutputs == 0)
|
||||
vol = 1;
|
||||
|
||||
if (current_function_check_memory_usage)
|
||||
{
|
||||
error ("`asm' cannot be used in function where memory usage is checked");
|
||||
return;
|
||||
}
|
||||
|
||||
if (! check_operand_nalternatives (outputs, inputs))
|
||||
return;
|
||||
|
||||
|
@ -1591,7 +1574,7 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
|
|||
|
||||
output_rtx[i]
|
||||
= expand_expr (TREE_VALUE (tail), NULL_RTX, VOIDmode,
|
||||
EXPAND_MEMORY_USE_WO);
|
||||
EXPAND_WRITE);
|
||||
|
||||
if (! allows_reg && GET_CODE (output_rtx[i]) != MEM)
|
||||
error ("output number %d not directly addressable", i);
|
||||
|
@ -3987,9 +3970,7 @@ expand_decl (decl)
|
|||
&& !(flag_float_store
|
||||
&& TREE_CODE (type) == REAL_TYPE)
|
||||
&& ! TREE_THIS_VOLATILE (decl)
|
||||
&& (DECL_REGISTER (decl) || optimize)
|
||||
/* if -fcheck-memory-usage, check all variables. */
|
||||
&& ! current_function_check_memory_usage)
|
||||
&& (DECL_REGISTER (decl) || optimize))
|
||||
{
|
||||
/* Automatic variable that can go in a register. */
|
||||
int unsignedp = TREE_UNSIGNED (type);
|
||||
|
|
18
gcc/toplev.c
18
gcc/toplev.c
|
@ -828,16 +828,6 @@ int flag_stack_check;
|
|||
the support provided depends on the backend. */
|
||||
rtx stack_limit_rtx;
|
||||
|
||||
/* -fcheck-memory-usage causes extra code to be generated in order to check
|
||||
memory accesses. This is used by a detector of bad memory accesses such
|
||||
as Checker. */
|
||||
int flag_check_memory_usage = 0;
|
||||
|
||||
/* -fprefix-function-name causes function name to be prefixed. This
|
||||
can be used with -fcheck-memory-usage to isolate code compiled with
|
||||
-fcheck-memory-usage. */
|
||||
int flag_prefix_function_name = 0;
|
||||
|
||||
/* 0 if pointer arguments may alias each other. True in C.
|
||||
1 if pointer arguments may not alias each other but may alias
|
||||
global variables.
|
||||
|
@ -1137,10 +1127,6 @@ lang_independent_options f_options[] =
|
|||
N_("Attempt to merge identical constants accross compilation units") },
|
||||
{"merge-all-constants", &flag_merge_constants, 2,
|
||||
N_("Attempt to merge identical constants and constant variables") },
|
||||
{"check-memory-usage", &flag_check_memory_usage, 1,
|
||||
N_("Generate code to check every memory access") },
|
||||
{"prefix-function-name", &flag_prefix_function_name, 1,
|
||||
N_("Add a prefix to all function names") },
|
||||
{"dump-unnumbered", &flag_dump_unnumbered, 1,
|
||||
N_("Suppress output of instruction numbers and line number notes in debugging dumps") },
|
||||
{"instrument-functions", &flag_instrument_function_entry_exit, 1,
|
||||
|
@ -4815,10 +4801,6 @@ parse_options_and_default_flags (argc, argv)
|
|||
static void
|
||||
process_options ()
|
||||
{
|
||||
/* Checker uses the frame pointer. */
|
||||
if (flag_check_memory_usage)
|
||||
flag_omit_frame_pointer = 0;
|
||||
|
||||
if (optimize == 0)
|
||||
{
|
||||
/* Inlining does not work if not optimizing,
|
||||
|
|
10
gcc/tree.h
10
gcc/tree.h
|
@ -1676,11 +1676,6 @@ struct tree_type
|
|||
#define DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT(NODE) \
|
||||
(FUNCTION_DECL_CHECK (NODE)->decl.no_instrument_function_entry_exit)
|
||||
|
||||
/* Used in FUNCTION_DECLs to indicate that check-memory-usage should be
|
||||
disabled in this function. */
|
||||
#define DECL_NO_CHECK_MEMORY_USAGE(NODE) \
|
||||
(FUNCTION_DECL_CHECK (NODE)->decl.no_check_memory_usage)
|
||||
|
||||
/* Used in FUNCTION_DECLs to indicate that limit-stack-* should be
|
||||
disabled in this function. */
|
||||
#define DECL_NO_LIMIT_STACK(NODE) \
|
||||
|
@ -1756,18 +1751,17 @@ struct tree_decl
|
|||
|
||||
unsigned non_addr_const_p : 1;
|
||||
unsigned no_instrument_function_entry_exit : 1;
|
||||
unsigned no_check_memory_usage : 1;
|
||||
unsigned comdat_flag : 1;
|
||||
unsigned malloc_flag : 1;
|
||||
unsigned no_limit_stack : 1;
|
||||
ENUM_BITFIELD(built_in_class) built_in_class : 2;
|
||||
|
||||
unsigned pure_flag : 1;
|
||||
|
||||
unsigned pointer_depth : 2;
|
||||
unsigned non_addressable : 1;
|
||||
unsigned user_align : 1;
|
||||
unsigned uninlinable : 1;
|
||||
/* Two unused bits. */
|
||||
/* Three unused bits. */
|
||||
|
||||
unsigned lang_flag_0 : 1;
|
||||
unsigned lang_flag_1 : 1;
|
||||
|
|
22
gcc/varasm.c
22
gcc/varasm.c
|
@ -61,10 +61,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||
#define ASM_STABS_OP "\t.stabs\t"
|
||||
#endif
|
||||
|
||||
/* Define the prefix to use when check_memory_usage_flag is enable. */
|
||||
#define CHKR_PREFIX "_CHKR_"
|
||||
#define CHKR_PREFIX_SIZE (sizeof (CHKR_PREFIX) - 1)
|
||||
|
||||
/* The (assembler) name of the first globally-visible object output. */
|
||||
const char *first_global_object_name;
|
||||
const char *weak_global_object_name;
|
||||
|
@ -957,25 +953,12 @@ make_decl_rtl (decl, asmspec)
|
|||
&& name == IDENTIFIER_POINTER (DECL_NAME (decl)))
|
||||
{
|
||||
char *label;
|
||||
|
||||
ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno);
|
||||
var_labelno++;
|
||||
new_name = label;
|
||||
}
|
||||
|
||||
/* When -fprefix-function-name is used, the functions
|
||||
names are prefixed. Only nested function names are not
|
||||
prefixed. */
|
||||
else if (flag_prefix_function_name && TREE_CODE (decl) == FUNCTION_DECL)
|
||||
{
|
||||
size_t name_len = IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl));
|
||||
char *pname;
|
||||
|
||||
pname = alloca (name_len + CHKR_PREFIX_SIZE + 1);
|
||||
memcpy (pname, CHKR_PREFIX, CHKR_PREFIX_SIZE);
|
||||
memcpy (pname + CHKR_PREFIX_SIZE, name, name_len + 1);
|
||||
new_name = pname;
|
||||
}
|
||||
|
||||
if (name != new_name)
|
||||
{
|
||||
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (new_name));
|
||||
|
@ -1837,9 +1820,6 @@ assemble_name (file, name)
|
|||
tree id;
|
||||
|
||||
STRIP_NAME_ENCODING (real_name, name);
|
||||
if (flag_prefix_function_name
|
||||
&& ! memcmp (real_name, CHKR_PREFIX, CHKR_PREFIX_SIZE))
|
||||
real_name = real_name + CHKR_PREFIX_SIZE;
|
||||
|
||||
id = maybe_get_identifier (real_name);
|
||||
if (id)
|
||||
|
|
Loading…
Reference in New Issue