* 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
+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
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,
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,
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. */
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,
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
{
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
{
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
{
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
{
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,
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);
{
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);
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)
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;
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;
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;
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
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;
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
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
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
}
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
{
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,
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;
/* 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;
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);
}
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;
+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.
{
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);
}
@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
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
-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
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
&& 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);
+
}
\f
/* Return a copy of X in which all memory references
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;
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,
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));
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. */
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 */
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)
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:
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);
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. */
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. */
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
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,
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
}
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);
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 ();
- }
-}
\f
/* Given an rtx VALUE that may contain additions and multiplications, return
an equivalent value that just refers to a register, memory, or constant.
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)
|| 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
&& 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;
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;
}
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 ... */
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
}
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);
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;
}
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;
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);
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;
}
&& 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;
;
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
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,
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
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. */
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);
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
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
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. */
&& 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. */
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;
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,
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
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);
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. */
/* 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
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;
}
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
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 ();
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);
}
= (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
/* 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 ();
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));
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;
#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)
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,
#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])
#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);
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);
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;
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);
&& !(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);
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.
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,
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,
#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) \
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;
#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;
&& 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));
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)