PR sanitizer/85029
[official-gcc.git] / gcc / tree-chkp.h
blob5cfae3d82ce19a174697cc2ee6332459e4af8031
1 /* Declaration of interface functions of Pointer Bounds Checker.
2 Copyright (C) 2014-2018 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_TREE_CHKP_H
21 #define GCC_TREE_CHKP_H
23 #define DECL_BOUNDS(NODE) (chkp_get_bounds (DECL_WRTL_CHECK (NODE)))
25 #define SET_DECL_BOUNDS(NODE, VAL) \
26 (chkp_set_bounds (DECL_WRTL_CHECK (NODE), VAL))
28 extern tree chkp_get_bounds (tree node);
29 extern void chkp_set_bounds (tree node, tree val);
30 extern bool chkp_register_var_initializer (tree var);
31 extern void chkp_finish_file (void);
32 extern bool chkp_type_has_pointer (const_tree type);
33 extern unsigned chkp_type_bounds_count (const_tree type);
34 extern tree chkp_make_bounds_for_struct_addr (tree ptr);
35 extern tree chkp_get_zero_bounds_var (void);
36 extern tree chkp_get_none_bounds_var (void);
37 extern void chkp_check_mem_access (tree first, tree last, tree bounds,
38 gimple_stmt_iterator iter,
39 location_t location,
40 tree dirflag);
41 extern void chkp_fix_cfg (void);
42 extern bool chkp_variable_size_type (tree type);
43 extern tree chkp_build_make_bounds_call (tree lb, tree size);
44 extern tree chkp_build_bndldx_call (tree addr, tree ptr);
45 extern tree chkp_build_bndstx_call (tree addr, tree ptr, tree bounds);
46 extern void chkp_find_bound_slots (const_tree type, bitmap res);
47 extern void chkp_build_bndstx (tree addr, tree ptr, tree bounds,
48 gimple_stmt_iterator *gsi);
49 extern gcall *chkp_retbnd_call_by_val (tree val);
50 extern bool chkp_function_instrumented_p (tree fndecl);
51 extern void chkp_function_mark_instrumented (tree fndecl);
52 extern void chkp_copy_bounds_for_assign (gimple *assign,
53 struct cgraph_edge *edge);
54 extern bool chkp_gimple_call_builtin_p (gimple *call,
55 enum built_in_function code);
56 extern rtx chkp_expand_zero_bounds (void);
57 extern void chkp_expand_bounds_reset_for_mem (tree mem, tree ptr);
58 extern tree chkp_insert_retbnd_call (tree bndval, tree retval,
59 gimple_stmt_iterator *gsi);
60 extern gcall *chkp_copy_call_skip_bounds (gcall *call);
61 extern bool chkp_redirect_edge (cgraph_edge *e);
62 extern void chkp_fixup_inlined_call (tree lhs, tree rhs);
64 #endif /* GCC_TREE_CHKP_H */