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