aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@cygnus.com>1998-10-11 02:21:54 +0000
committerKen Raeburn <raeburn@gcc.gnu.org>1998-10-11 02:21:54 +0000
commit7d384cc0b300cace24c008fec600219e4377923c (patch)
tree7d04180ff0e97d1e5bb80e16c8389a2a43d9e018 /gcc/function.c
parente41887f1fc521f4dde6c0a56ebe3fa1cc1c108aa (diff)
downloadgcc-7d384cc0b300cace24c008fec600219e4377923c.zip
gcc-7d384cc0b300cace24c008fec600219e4377923c.tar.gz
gcc-7d384cc0b300cace24c008fec600219e4377923c.tar.bz2
Fine-grained control of -fcheck-memory-usage with new no_check_memory_usage attribute.
Fine-grained control of -fcheck-memory-usage with new no_check_memory_usage attribute. Misc minor bugfixes and tests for it too. From-SVN: r22983
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 5ad113c..4645f5af 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -221,6 +221,9 @@ char *current_function_cannot_inline;
generated. */
int current_function_instrument_entry_exit;
+/* Nonzero if memory access checking be enabled in the current function. */
+int current_function_check_memory_usage;
+
/* The FUNCTION_DECL for an inline function currently being expanded. */
tree inline_function_decl;
@@ -543,6 +546,7 @@ push_function_context_to (context)
p->fixup_var_refs_queue = 0;
p->epilogue_delay_list = current_function_epilogue_delay_list;
p->args_info = current_function_args_info;
+ p->check_memory_usage = current_function_check_memory_usage;
p->instrument_entry_exit = current_function_instrument_entry_exit;
save_tree_status (p, context);
@@ -626,6 +630,7 @@ pop_function_context_from (context)
current_function_epilogue_delay_list = p->epilogue_delay_list;
reg_renumber = 0;
current_function_args_info = p->args_info;
+ current_function_check_memory_usage = p->check_memory_usage;
current_function_instrument_entry_exit = p->instrument_entry_exit;
restore_tree_status (p, context);
@@ -1484,7 +1489,7 @@ put_var_into_stack (decl)
else
return;
- if (flag_check_memory_usage)
+ if (current_function_check_memory_usage)
emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3,
XEXP (reg, 0), ptr_mode,
GEN_INT (GET_MODE_SIZE (GET_MODE (reg))),
@@ -4364,7 +4369,7 @@ assign_parms (fndecl, second_time)
store_expr (parm, copy, 0);
emit_move_insn (parmreg, XEXP (copy, 0));
- if (flag_check_memory_usage)
+ if (current_function_check_memory_usage)
emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3,
XEXP (copy, 0), ptr_mode,
GEN_INT (int_size_in_bytes (type)),
@@ -4529,7 +4534,7 @@ assign_parms (fndecl, second_time)
emit_move_insn (validize_mem (stack_parm),
validize_mem (entry_parm));
}
- if (flag_check_memory_usage)
+ if (current_function_check_memory_usage)
{
push_to_sequence (conversion_insns);
emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3,
@@ -5550,6 +5555,11 @@ 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));