mirror of git://gcc.gnu.org/git/gcc.git
target.def (builtin_chkp_function): New.
* target.def (builtin_chkp_function): New.
(chkp_bound_type): New.
(chkp_bound_mode): New.
(fn_abi_va_list_bounds_size): New.
(load_bounds_for_arg): New.
(store_bounds_for_arg): New.
* targhooks.h (default_load_bounds_for_arg): New.
(default_store_bounds_for_arg): New.
(default_fn_abi_va_list_bounds_size): New.
(default_chkp_bound_type): New.
(default_chkp_bound_mode): New.
(default_builtin_chkp_function): New.
* targhooks.c (default_load_bounds_for_arg): New.
(default_store_bounds_for_arg): New.
(default_fn_abi_va_list_bounds_size): New.
(default_chkp_bound_type): New.
(default_chkp_bound_mode); New.
(default_builtin_chkp_function): New.
* doc/tm.texi.in (TARGET_FN_ABI_VA_LIST_BOUNDS_SIZE): New.
(TARGET_LOAD_BOUNDS_FOR_ARG): New.
(TARGET_STORE_BOUNDS_FOR_ARG): New.
(TARGET_BUILTIN_CHKP_FUNCTION): New.
(TARGET_CHKP_BOUND_TYPE): New.
(TARGET_CHKP_BOUND_MODE): New.
* doc/tm.texi: Regenerated.
* langhooks.h (lang_hooks): Add chkp_supported field.
* langhooks-def.h (LANG_HOOKS_CHKP_SUPPORTED): New.
(LANG_HOOKS_INITIALIZER); Add LANG_HOOKS_CHKP_SUPPORTED.
From-SVN: r204195
This commit is contained in:
parent
5d2a9da9a7
commit
f481a2ce85
|
|
@ -1,3 +1,34 @@
|
||||||
|
2013-10-30 Ilya Enkovich <ilya.enkovich@intel.com>
|
||||||
|
|
||||||
|
* target.def (builtin_chkp_function): New.
|
||||||
|
(chkp_bound_type): New.
|
||||||
|
(chkp_bound_mode): New.
|
||||||
|
(fn_abi_va_list_bounds_size): New.
|
||||||
|
(load_bounds_for_arg): New.
|
||||||
|
(store_bounds_for_arg): New.
|
||||||
|
* targhooks.h (default_load_bounds_for_arg): New.
|
||||||
|
(default_store_bounds_for_arg): New.
|
||||||
|
(default_fn_abi_va_list_bounds_size): New.
|
||||||
|
(default_chkp_bound_type): New.
|
||||||
|
(default_chkp_bound_mode): New.
|
||||||
|
(default_builtin_chkp_function): New.
|
||||||
|
* targhooks.c (default_load_bounds_for_arg): New.
|
||||||
|
(default_store_bounds_for_arg): New.
|
||||||
|
(default_fn_abi_va_list_bounds_size): New.
|
||||||
|
(default_chkp_bound_type): New.
|
||||||
|
(default_chkp_bound_mode); New.
|
||||||
|
(default_builtin_chkp_function): New.
|
||||||
|
* doc/tm.texi.in (TARGET_FN_ABI_VA_LIST_BOUNDS_SIZE): New.
|
||||||
|
(TARGET_LOAD_BOUNDS_FOR_ARG): New.
|
||||||
|
(TARGET_STORE_BOUNDS_FOR_ARG): New.
|
||||||
|
(TARGET_BUILTIN_CHKP_FUNCTION): New.
|
||||||
|
(TARGET_CHKP_BOUND_TYPE): New.
|
||||||
|
(TARGET_CHKP_BOUND_MODE): New.
|
||||||
|
* doc/tm.texi: Regenerated.
|
||||||
|
* langhooks.h (lang_hooks): Add chkp_supported field.
|
||||||
|
* langhooks-def.h (LANG_HOOKS_CHKP_SUPPORTED): New.
|
||||||
|
(LANG_HOOKS_INITIALIZER); Add LANG_HOOKS_CHKP_SUPPORTED.
|
||||||
|
|
||||||
2013-10-29 Andrew Pinski <apinski@cavium.com>
|
2013-10-29 Andrew Pinski <apinski@cavium.com>
|
||||||
|
|
||||||
* tree-ssa-ifcombine.c: Include rtl.h and tm_p.h.
|
* tree-ssa-ifcombine.c: Include rtl.h and tm_p.h.
|
||||||
|
|
|
||||||
117
gcc/doc/tm.texi
117
gcc/doc/tm.texi
|
|
@ -4334,6 +4334,13 @@ This hook returns the va_list type of the calling convention specified by
|
||||||
The default version of this hook returns @code{va_list_type_node}.
|
The default version of this hook returns @code{va_list_type_node}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Target Hook} tree TARGET_FN_ABI_VA_LIST_BOUNDS_SIZE (tree @var{fndecl})
|
||||||
|
This hook returns size for @code{va_list} object in function specified
|
||||||
|
by @var{fndecl}. This hook is used by Pointer Bounds Checker to build bounds
|
||||||
|
for @code{va_list} object. Return @code{integer_zero_node} if no bounds
|
||||||
|
should be used (e.g. @code{va_list} is a scalar pointer to the stack).
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
@deftypefn {Target Hook} tree TARGET_CANONICAL_VA_LIST_TYPE (tree @var{type})
|
@deftypefn {Target Hook} tree TARGET_CANONICAL_VA_LIST_TYPE (tree @var{type})
|
||||||
This hook returns the va_list type of the calling convention specified by the
|
This hook returns the va_list type of the calling convention specified by the
|
||||||
type of @var{type}. If @var{type} is not a valid va_list type, it returns
|
type of @var{type}. If @var{type} is not a valid va_list type, it returns
|
||||||
|
|
@ -5151,6 +5158,26 @@ defined, then define this hook to return @code{true} if
|
||||||
Otherwise, you should not define this hook.
|
Otherwise, you should not define this hook.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Target Hook} rtx TARGET_LOAD_BOUNDS_FOR_ARG (rtx @var{slot}, rtx @var{arg}, rtx @var{slot_no})
|
||||||
|
This hook is used by expand pass to emit insn to load bounds of
|
||||||
|
@var{arg} passed in @var{slot}. Expand pass uses this hook in case
|
||||||
|
bounds of @var{arg} are not passed in register. If @var{slot} is a
|
||||||
|
memory, then bounds are loaded as for regular pointer loaded from
|
||||||
|
memory. If @var{slot} is not a memory then @var{slot_no} is an integer
|
||||||
|
constant holding number of the target dependent special slot which
|
||||||
|
should be used to obtain bounds. Hook returns RTX holding loaded bounds.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Target Hook} void TARGET_STORE_BOUNDS_FOR_ARG (rtx @var{arg}, rtx @var{slot}, rtx @var{bounds}, rtx @var{slot_no})
|
||||||
|
This hook is used by expand pass to emit insns to store @var{bounds} of
|
||||||
|
@var{arg} passed in @var{slot}. Expand pass uses this hook in case
|
||||||
|
@var{bounds} of @var{arg} are not passed in register. If @var{slot} is a
|
||||||
|
memory, then @var{bounds} are stored as for regular pointer stored in
|
||||||
|
memory. If @var{slot} is not a memory then @var{slot_no} is an integer
|
||||||
|
constant holding number of the target dependent special slot which
|
||||||
|
should be used to store @var{bounds}.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
@node Trampolines
|
@node Trampolines
|
||||||
@section Trampolines for Nested Functions
|
@section Trampolines for Nested Functions
|
||||||
@cindex trampolines for nested functions
|
@cindex trampolines for nested functions
|
||||||
|
|
@ -10907,6 +10934,96 @@ ignored. This function should return the result of the call to the
|
||||||
built-in function.
|
built-in function.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Target Hook} tree TARGET_BUILTIN_CHKP_FUNCTION (unsigned @var{fcode})
|
||||||
|
This hook allows target to redefine built-in functions used by
|
||||||
|
Pointer Bounds Checker for code instrumentation. Hook should return
|
||||||
|
fndecl of function implementing generic builtin whose code is
|
||||||
|
passed in @var{fcode}. Currently following built-in functions are
|
||||||
|
obtained using this hook:
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_bndmk (const void *@var{lb}, size_t @var{size})
|
||||||
|
Function code - BUILT_IN_CHKP_BNDMK. This built-in function is used
|
||||||
|
by Pointer Bounds Checker to create bound values. @var{lb} holds low
|
||||||
|
bound of the resulting bounds. @var{size} holds size of created bounds.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} void __chkp_bndstx (const void **@var{loc}, const void *@var{ptr}, bnd @var{b})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_BNDSTX}. This built-in function is used
|
||||||
|
by Pointer Bounds Checker to store bounds @var{b} for pointer @var{ptr}
|
||||||
|
stored by address @var{loc}.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_bndldx (const void **@var{loc}, const void *@var{ptr})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_BNDLDX}. This built-in function is used
|
||||||
|
by Pointer Bounds Checker to get bounds of pointer @var{ptr} loaded by
|
||||||
|
address @var{loc}.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} void __chkp_bndcl (bnd @var{b}, const void *@var{ptr})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_BNDCL}. This built-in function is used
|
||||||
|
by Pointer Bounds Checker to perform check for pointer @var{ptr} against
|
||||||
|
lower bound of bounds @var{b}.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} void __chkp_bndcu (bnd @var{b}, const void *@var{ptr})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_BNDCU}. This built-in function is used
|
||||||
|
by Pointer Bounds Checker to perform check for pointer @var{ptr} against
|
||||||
|
upper bound of bounds @var{b}.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_bndret (void *@var{ptr})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_BNDRET}. This built-in function is used
|
||||||
|
by Pointer Bounds Checker to obtain bounds returned by call statement.
|
||||||
|
@var{ptr} passed to buil-in is @code{SSA_NAME} returned by call.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_arg_bnd (void *@var{arg})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_ARG_BND}. This built-in function is
|
||||||
|
used by Pointer Bounds Checker to obtain bounds passed for input argument.
|
||||||
|
@var{arg} is default @code{SSA_NAME} of the @code{PARM_DECL} whose
|
||||||
|
bounds we want to obtain.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_intersect (bnd @var{b1}, bnd @var{b2})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_INTERSECT}. This built-in function
|
||||||
|
returns intersection of bounds @var{b1} and @var{b2}.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_narrow (const void *@var{ptr}, bnd @var{b}, size_t @var{s})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_NARROW}. This built-in function
|
||||||
|
returns intersection of bounds @var{b} and
|
||||||
|
[@var{ptr}, @var{ptr} + @var{s} - @code{1}].
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} void *__chkp_set_bounds (const void *@var{ptr}, size_t @var{s})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_SET_PTR_BOUNDS}. This built-in function
|
||||||
|
returns @var{ptr} with bounds [@var{ptr}, @var{ptr} + @var{s} - @code{1}].
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} size_t __chkp_sizeof (const void *@var{ptr})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_SIZEOF}. This built-in function
|
||||||
|
returns size of object referenced by @var{ptr}. @var{ptr} is always
|
||||||
|
@code{ADDR_EXPR} of @code{VAR_DECL}. This built-in is used by
|
||||||
|
Pointer Boudns Checker when bounds of object cannot be computed statically
|
||||||
|
(e.g. object has incomplete type).
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} const void *__chkp_extract_lower (bnd @var{b})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_EXTRACT_LOWER}. This built-in function
|
||||||
|
returns lower bound of bounds @var{b}.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@deftypefn {Built-in Function} const void *__chkp_extract_upper (bnd @var{b})
|
||||||
|
Function code - @code{BUILT_IN_CHKP_EXTRACT_UPPER}. This built-in function
|
||||||
|
returns upper bound of bounds @var{b}.
|
||||||
|
@end deftypefn
|
||||||
|
@end deftypefn
|
||||||
|
@deftypefn {Target Hook} tree TARGET_CHKP_BOUND_TYPE (void)
|
||||||
|
Return type to be used for bounds
|
||||||
|
@end deftypefn
|
||||||
|
@deftypefn {Target Hook} {enum machine_mode} TARGET_CHKP_BOUND_MODE (void)
|
||||||
|
Return mode to be used for bounds.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
@deftypefn {Target Hook} tree TARGET_RESOLVE_OVERLOADED_BUILTIN (unsigned int @var{loc}, tree @var{fndecl}, void *@var{arglist})
|
@deftypefn {Target Hook} tree TARGET_RESOLVE_OVERLOADED_BUILTIN (unsigned int @var{loc}, tree @var{fndecl}, void *@var{arglist})
|
||||||
Select a replacement for a machine specific built-in function that
|
Select a replacement for a machine specific built-in function that
|
||||||
was set up by @samp{TARGET_INIT_BUILTINS}. This is done
|
was set up by @samp{TARGET_INIT_BUILTINS}. This is done
|
||||||
|
|
|
||||||
|
|
@ -3694,6 +3694,8 @@ stack.
|
||||||
|
|
||||||
@hook TARGET_FN_ABI_VA_LIST
|
@hook TARGET_FN_ABI_VA_LIST
|
||||||
|
|
||||||
|
@hook TARGET_FN_ABI_VA_LIST_BOUNDS_SIZE
|
||||||
|
|
||||||
@hook TARGET_CANONICAL_VA_LIST_TYPE
|
@hook TARGET_CANONICAL_VA_LIST_TYPE
|
||||||
|
|
||||||
@hook TARGET_GIMPLIFY_VA_ARG_EXPR
|
@hook TARGET_GIMPLIFY_VA_ARG_EXPR
|
||||||
|
|
@ -4064,6 +4066,10 @@ These machine description macros help implement varargs:
|
||||||
|
|
||||||
@hook TARGET_PRETEND_OUTGOING_VARARGS_NAMED
|
@hook TARGET_PRETEND_OUTGOING_VARARGS_NAMED
|
||||||
|
|
||||||
|
@hook TARGET_LOAD_BOUNDS_FOR_ARG
|
||||||
|
|
||||||
|
@hook TARGET_STORE_BOUNDS_FOR_ARG
|
||||||
|
|
||||||
@node Trampolines
|
@node Trampolines
|
||||||
@section Trampolines for Nested Functions
|
@section Trampolines for Nested Functions
|
||||||
@cindex trampolines for nested functions
|
@cindex trampolines for nested functions
|
||||||
|
|
@ -8184,6 +8190,10 @@ to by @var{ce_info}.
|
||||||
|
|
||||||
@hook TARGET_EXPAND_BUILTIN
|
@hook TARGET_EXPAND_BUILTIN
|
||||||
|
|
||||||
|
@hook TARGET_BUILTIN_CHKP_FUNCTION
|
||||||
|
@hook TARGET_CHKP_BOUND_TYPE
|
||||||
|
@hook TARGET_CHKP_BOUND_MODE
|
||||||
|
|
||||||
@hook TARGET_RESOLVE_OVERLOADED_BUILTIN
|
@hook TARGET_RESOLVE_OVERLOADED_BUILTIN
|
||||||
|
|
||||||
@hook TARGET_FOLD_BUILTIN
|
@hook TARGET_FOLD_BUILTIN
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,7 @@ extern bool lhd_omp_mappable_type (tree);
|
||||||
#define LANG_HOOKS_BLOCK_MAY_FALLTHRU hook_bool_const_tree_true
|
#define LANG_HOOKS_BLOCK_MAY_FALLTHRU hook_bool_const_tree_true
|
||||||
#define LANG_HOOKS_EH_USE_CXA_END_CLEANUP false
|
#define LANG_HOOKS_EH_USE_CXA_END_CLEANUP false
|
||||||
#define LANG_HOOKS_DEEP_UNSHARING false
|
#define LANG_HOOKS_DEEP_UNSHARING false
|
||||||
|
#define LANG_HOOKS_CHKP_SUPPORTED false
|
||||||
|
|
||||||
/* Attribute hooks. */
|
/* Attribute hooks. */
|
||||||
#define LANG_HOOKS_ATTRIBUTE_TABLE NULL
|
#define LANG_HOOKS_ATTRIBUTE_TABLE NULL
|
||||||
|
|
@ -318,7 +319,8 @@ extern void lhd_end_section (void);
|
||||||
LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS, \
|
LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS, \
|
||||||
LANG_HOOKS_BLOCK_MAY_FALLTHRU, \
|
LANG_HOOKS_BLOCK_MAY_FALLTHRU, \
|
||||||
LANG_HOOKS_EH_USE_CXA_END_CLEANUP, \
|
LANG_HOOKS_EH_USE_CXA_END_CLEANUP, \
|
||||||
LANG_HOOKS_DEEP_UNSHARING \
|
LANG_HOOKS_DEEP_UNSHARING, \
|
||||||
|
LANG_HOOKS_CHKP_SUPPORTED \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* GCC_LANG_HOOKS_DEF_H */
|
#endif /* GCC_LANG_HOOKS_DEF_H */
|
||||||
|
|
|
||||||
|
|
@ -491,6 +491,9 @@ struct lang_hooks
|
||||||
gimplification. */
|
gimplification. */
|
||||||
bool deep_unsharing;
|
bool deep_unsharing;
|
||||||
|
|
||||||
|
/* True if this language allows pointers checker instrumentation. */
|
||||||
|
bool chkp_supported;
|
||||||
|
|
||||||
/* Whenever you add entries here, make sure you adjust langhooks-def.h
|
/* Whenever you add entries here, make sure you adjust langhooks-def.h
|
||||||
and langhooks.c accordingly. */
|
and langhooks.c accordingly. */
|
||||||
};
|
};
|
||||||
|
|
|
||||||
131
gcc/target.def
131
gcc/target.def
|
|
@ -2023,6 +2023,104 @@ built-in function.",
|
||||||
(tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore),
|
(tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore),
|
||||||
default_expand_builtin)
|
default_expand_builtin)
|
||||||
|
|
||||||
|
DEFHOOK
|
||||||
|
(builtin_chkp_function,
|
||||||
|
"This hook allows target to redefine built-in functions used by\n\
|
||||||
|
Pointer Bounds Checker for code instrumentation. Hook should return\n\
|
||||||
|
fndecl of function implementing generic builtin whose code is\n\
|
||||||
|
passed in @var{fcode}. Currently following built-in functions are\n\
|
||||||
|
obtained using this hook:\n\
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_bndmk (const void *@var{lb}, size_t @var{size})\n\
|
||||||
|
Function code - BUILT_IN_CHKP_BNDMK. This built-in function is used\n\
|
||||||
|
by Pointer Bounds Checker to create bound values. @var{lb} holds low\n\
|
||||||
|
bound of the resulting bounds. @var{size} holds size of created bounds.\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} void __chkp_bndstx (const void **@var{loc}, const void *@var{ptr}, bnd @var{b})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_BNDSTX}. This built-in function is used\n\
|
||||||
|
by Pointer Bounds Checker to store bounds @var{b} for pointer @var{ptr}\n\
|
||||||
|
stored by address @var{loc}.\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_bndldx (const void **@var{loc}, const void *@var{ptr})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_BNDLDX}. This built-in function is used\n\
|
||||||
|
by Pointer Bounds Checker to get bounds of pointer @var{ptr} loaded by\n\
|
||||||
|
address @var{loc}.\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} void __chkp_bndcl (bnd @var{b}, const void *@var{ptr})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_BNDCL}. This built-in function is used\n\
|
||||||
|
by Pointer Bounds Checker to perform check for pointer @var{ptr} against\n\
|
||||||
|
lower bound of bounds @var{b}.\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} void __chkp_bndcu (bnd @var{b}, const void *@var{ptr})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_BNDCU}. This built-in function is used\n\
|
||||||
|
by Pointer Bounds Checker to perform check for pointer @var{ptr} against\n\
|
||||||
|
upper bound of bounds @var{b}.\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_bndret (void *@var{ptr})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_BNDRET}. This built-in function is used\n\
|
||||||
|
by Pointer Bounds Checker to obtain bounds returned by call statement.\n\
|
||||||
|
@var{ptr} passed to buil-in is @code{SSA_NAME} returned by call.\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_arg_bnd (void *@var{arg})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_ARG_BND}. This built-in function is\n\
|
||||||
|
used by Pointer Bounds Checker to obtain bounds passed for input argument.\n\
|
||||||
|
@var{arg} is default @code{SSA_NAME} of the @code{PARM_DECL} whose\n\
|
||||||
|
bounds we want to obtain.\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_intersect (bnd @var{b1}, bnd @var{b2})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_INTERSECT}. This built-in function\n\
|
||||||
|
returns intersection of bounds @var{b1} and @var{b2}.\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} bnd __chkp_narrow (const void *@var{ptr}, bnd @var{b}, size_t @var{s})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_NARROW}. This built-in function\n\
|
||||||
|
returns intersection of bounds @var{b} and\n\
|
||||||
|
[@var{ptr}, @var{ptr} + @var{s} - @code{1}].\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} void *__chkp_set_bounds (const void *@var{ptr}, size_t @var{s})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_SET_PTR_BOUNDS}. This built-in function\n\
|
||||||
|
returns @var{ptr} with bounds [@var{ptr}, @var{ptr} + @var{s} - @code{1}].\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} size_t __chkp_sizeof (const void *@var{ptr})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_SIZEOF}. This built-in function\n\
|
||||||
|
returns size of object referenced by @var{ptr}. @var{ptr} is always\n\
|
||||||
|
@code{ADDR_EXPR} of @code{VAR_DECL}. This built-in is used by\n\
|
||||||
|
Pointer Boudns Checker when bounds of object cannot be computed statically\n\
|
||||||
|
(e.g. object has incomplete type).\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} const void *__chkp_extract_lower (bnd @var{b})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_EXTRACT_LOWER}. This built-in function\n\
|
||||||
|
returns lower bound of bounds @var{b}.\n\
|
||||||
|
@end deftypefn\n\
|
||||||
|
\n\
|
||||||
|
@deftypefn {Built-in Function} const void *__chkp_extract_upper (bnd @var{b})\n\
|
||||||
|
Function code - @code{BUILT_IN_CHKP_EXTRACT_UPPER}. This built-in function\n\
|
||||||
|
returns upper bound of bounds @var{b}.\n\
|
||||||
|
@end deftypefn",
|
||||||
|
tree, (unsigned fcode),
|
||||||
|
default_builtin_chkp_function)
|
||||||
|
|
||||||
|
DEFHOOK
|
||||||
|
(chkp_bound_type,
|
||||||
|
"Return type to be used for bounds",
|
||||||
|
tree, (void),
|
||||||
|
default_chkp_bound_type)
|
||||||
|
|
||||||
|
DEFHOOK
|
||||||
|
(chkp_bound_mode,
|
||||||
|
"Return mode to be used for bounds.",
|
||||||
|
enum machine_mode, (void),
|
||||||
|
default_chkp_bound_mode)
|
||||||
|
|
||||||
/* Select a replacement for a target-specific builtin. This is done
|
/* Select a replacement for a target-specific builtin. This is done
|
||||||
*before* regular type checking, and so allows the target to
|
*before* regular type checking, and so allows the target to
|
||||||
implement a crude form of function overloading. The result is a
|
implement a crude form of function overloading. The result is a
|
||||||
|
|
@ -3273,6 +3371,15 @@ The default version of this hook returns @code{va_list_type_node}.",
|
||||||
tree, (tree fndecl),
|
tree, (tree fndecl),
|
||||||
std_fn_abi_va_list)
|
std_fn_abi_va_list)
|
||||||
|
|
||||||
|
DEFHOOK
|
||||||
|
(fn_abi_va_list_bounds_size,
|
||||||
|
"This hook returns size for @code{va_list} object in function specified\n\
|
||||||
|
by @var{fndecl}. This hook is used by Pointer Bounds Checker to build bounds\n\
|
||||||
|
for @code{va_list} object. Return @code{integer_zero_node} if no bounds\n\
|
||||||
|
should be used (e.g. @code{va_list} is a scalar pointer to the stack).",
|
||||||
|
tree, (tree fndecl),
|
||||||
|
default_fn_abi_va_list_bounds_size)
|
||||||
|
|
||||||
/* Get the __builtin_va_list type dependent on input type. */
|
/* Get the __builtin_va_list type dependent on input type. */
|
||||||
DEFHOOK
|
DEFHOOK
|
||||||
(canonical_va_list_type,
|
(canonical_va_list_type,
|
||||||
|
|
@ -3703,6 +3810,30 @@ not generate any instructions in this case.",
|
||||||
int *pretend_args_size, int second_time),
|
int *pretend_args_size, int second_time),
|
||||||
default_setup_incoming_varargs)
|
default_setup_incoming_varargs)
|
||||||
|
|
||||||
|
DEFHOOK
|
||||||
|
(load_bounds_for_arg,
|
||||||
|
"This hook is used by expand pass to emit insn to load bounds of\n\
|
||||||
|
@var{arg} passed in @var{slot}. Expand pass uses this hook in case\n\
|
||||||
|
bounds of @var{arg} are not passed in register. If @var{slot} is a\n\
|
||||||
|
memory, then bounds are loaded as for regular pointer loaded from\n\
|
||||||
|
memory. If @var{slot} is not a memory then @var{slot_no} is an integer\n\
|
||||||
|
constant holding number of the target dependent special slot which\n\
|
||||||
|
should be used to obtain bounds. Hook returns RTX holding loaded bounds.",
|
||||||
|
rtx, (rtx slot, rtx arg, rtx slot_no),
|
||||||
|
default_load_bounds_for_arg)
|
||||||
|
|
||||||
|
DEFHOOK
|
||||||
|
(store_bounds_for_arg,
|
||||||
|
"This hook is used by expand pass to emit insns to store @var{bounds} of\n\
|
||||||
|
@var{arg} passed in @var{slot}. Expand pass uses this hook in case\n\
|
||||||
|
@var{bounds} of @var{arg} are not passed in register. If @var{slot} is a\n\
|
||||||
|
memory, then @var{bounds} are stored as for regular pointer stored in\n\
|
||||||
|
memory. If @var{slot} is not a memory then @var{slot_no} is an integer\n\
|
||||||
|
constant holding number of the target dependent special slot which\n\
|
||||||
|
should be used to store @var{bounds}.",
|
||||||
|
void, (rtx arg, rtx slot, rtx bounds, rtx slot_no),
|
||||||
|
default_store_bounds_for_arg)
|
||||||
|
|
||||||
DEFHOOK
|
DEFHOOK
|
||||||
(strict_argument_naming,
|
(strict_argument_naming,
|
||||||
"Define this hook to return @code{true} if the location where a function\n\
|
"Define this hook to return @code{true} if the location where a function\n\
|
||||||
|
|
|
||||||
|
|
@ -1557,6 +1557,28 @@ default_member_type_forces_blk (const_tree, enum machine_mode)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
rtx
|
||||||
|
default_load_bounds_for_arg (rtx addr ATTRIBUTE_UNUSED,
|
||||||
|
rtx ptr ATTRIBUTE_UNUSED,
|
||||||
|
rtx bnd ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
gcc_unreachable ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
default_store_bounds_for_arg (rtx val ATTRIBUTE_UNUSED,
|
||||||
|
rtx addr ATTRIBUTE_UNUSED,
|
||||||
|
rtx bounds ATTRIBUTE_UNUSED,
|
||||||
|
rtx to ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
gcc_unreachable ();
|
||||||
|
}
|
||||||
|
|
||||||
|
tree
|
||||||
|
default_fn_abi_va_list_bounds_size (tree fndecl ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return integer_zero_node;
|
||||||
|
}
|
||||||
|
|
||||||
/* Default version of canonicalize_comparison. */
|
/* Default version of canonicalize_comparison. */
|
||||||
|
|
||||||
|
|
@ -1675,5 +1697,26 @@ std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
|
||||||
return build_va_arg_indirect_ref (addr);
|
return build_va_arg_indirect_ref (addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tree
|
||||||
|
default_chkp_bound_type (void)
|
||||||
|
{
|
||||||
|
tree res = make_node (POINTER_BOUNDS_TYPE);
|
||||||
|
TYPE_PRECISION (res) = TYPE_PRECISION (size_type_node) * 2;
|
||||||
|
layout_type (res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum machine_mode
|
||||||
|
default_chkp_bound_mode (void)
|
||||||
|
{
|
||||||
|
return VOIDmode;
|
||||||
|
}
|
||||||
|
|
||||||
|
tree
|
||||||
|
default_builtin_chkp_function (unsigned int fcode ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return NULL_TREE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "gt-targhooks.h"
|
#include "gt-targhooks.h"
|
||||||
|
|
|
||||||
|
|
@ -204,3 +204,10 @@ extern enum machine_mode default_cstore_mode (enum insn_code);
|
||||||
extern bool default_member_type_forces_blk (const_tree, enum machine_mode);
|
extern bool default_member_type_forces_blk (const_tree, enum machine_mode);
|
||||||
extern tree build_va_arg_indirect_ref (tree);
|
extern tree build_va_arg_indirect_ref (tree);
|
||||||
extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
|
extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
|
||||||
|
|
||||||
|
extern rtx default_load_bounds_for_arg (rtx, rtx, rtx);
|
||||||
|
extern void default_store_bounds_for_arg (rtx, rtx, rtx, rtx);
|
||||||
|
extern tree default_fn_abi_va_list_bounds_size (tree);
|
||||||
|
extern tree default_chkp_bound_type (void);
|
||||||
|
extern enum machine_mode default_chkp_bound_mode (void);
|
||||||
|
extern tree default_builtin_chkp_function (unsigned int);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue