|
GCC Middle and Back End API Reference
|
#include <region.h>


Public Types | |
| using | symbolic_bit_count = symbolic::scalar<integer_with_unit<units::bit>> |
| using | symbolic_byte_count = symbolic::scalar<integer_with_unit<units::byte>> |
| using | id_t = unsigned |
Static Public Member Functions | |
| static int | cmp_ptr_ptr (const void *, const void *) |
| static int | cmp_ids (const symbolic::node *s1, const symbolic::node *s2) |
| static int | cmp (const symbolic::node &s1, const symbolic::node &s2) |
Protected Member Functions | |
| region (complexity c, symbolic::node::id_t id, const region *parent, const cluster_region *cluster_reg, memory_space mem_space, tree type) | |
| std::unique_ptr< json::object > | make_json_obj (const char *type_name) const |
Private Member Functions | |
| symbolic::memory_offset | calc_memory_offset (symbolic::node_manager &mgr) const |
| symbolic::memory_range | calc_memory_range (symbolic::node_manager &mgr) const |
| symbolic::pointer | calc_pointer (symbolic::node_manager &mgr) const |
| const svalue * | calc_initial_value_at_main (region_model_manager *mgr) const |
| virtual void | add_dump_widget_children_for_region (text_art::tree_widget &, symbolic::node_dump_state &nds) const |
Private Attributes | |
| const region * | m_parent |
| const cluster_region * | m_cluster_reg |
| memory_space | m_mem_space |
| tree | m_type |
| std::unique_ptr< symbolic::memory_offset > | m_cached_memory_offset |
| std::unique_ptr< symbolic::memory_range > | m_cached_memory_range |
| std::unique_ptr< symbolic::pointer > | m_cached_pointer |
| const svalue * | m_cached_init_sval_at_main |
| complexity | m_complexity |
| id_t | m_id |
Region and its subclasses.
The class hierarchy looks like this (using indentation to show
inheritance, and with region_kinds shown for the concrete subclasses):
region
frame_region (RK_FRAME): a function frame on the stack
memory_space_region (RK_MEMORY_SPACE): a region for a particular
memory_space
root_region (RK_ROOT): the top-level region
cluster_region
alloca_region (RK_ALLOCA): an untyped region dynamically allocated on the
stack via "alloca"
decl_region (RK_DECL): the memory occupied by a particular global, local,
or SSA name
errno_region (RK_ERRNO): a region for holding "errno"
function_region (RK_FUNCTION): the code for a particular function
heap_allocated_region (RK_HEAP_ALLOCATED): an untyped region dynamically
allocated on the heap via
"malloc" or similar
label_region (RK_LABEL): a particular label within a function
private_region (RK_PRIVATE): a region for internal state of an API
string_region (RK_STRING): a region for a STRING_CST
symbolic_region (RK_SYMBOLIC): dereferencing a symbolic pointer
var_arg_region (RK_VAR_ARG): a region for the N-th vararg within a
frame_region for a variadic call
unknown_region (RK_UNKNOWN): for handling unimplemented tree codes.
field_region (RK_FIELD): the memory occupied by a field within a struct
or union
element_region (RK_ELEMENT): an element within an array
offset_region (RK_OFFSET): a byte-offset within another region, for
handling pointer arithmetic as a region
sized_region (RK_SIZED): a subregion of symbolic size (in bytes)
within its parent
cast_region (RK_CAST): a region that views another region using a
different type
bit_range_region (RK_BIT_RANGE): a region for a specific range of bits
within another region.
For this example code:
. extern int arr[10];
. void foo ()
. {
. int .p = (int .)malloc (sizeof (int));
. [...etc...].
the *object* hierarchy, in terms of the ancestry expressed by the
get_parent () pointers of region *instances*, might look something like
this:
. root (RK_ROOT)
. +- memory_space_region for memory_space::globals (RK_MEMORY_SPACE)
. | | (all descendents have m_mem_space == memory_space::globals)
. | `- [C] decl_region for 'arr[10]' (RK_DECL)
. | `- element_region for 'arr[3]' (RK_ELEMENT)
. +- memory_space_region for memory_space::heap (RK_MEMORY_SPACE)
. | | (all descendents have m_mem_space == memory_space::heap)
. | `- [C] heap_allocated_region for '*p'
. +- memory_space_region for memory_space::stack (RK_MEMORY_SPACE)
. | | (all descendents have m_mem_space == memory_space::stack)
. | +- frame_region (RK_FRAME)
. | +- frame_region (RK_FRAME)
. | `- frame_region (RK_FRAME)
. | `- [C] decl_region for 'p' (RK_DECL)
where [C] denotes a cluster region. Abstract base class for representing ways of accessing chunks of memory. Regions form a tree-like hierarchy, with a root region at the base, with memory space regions within it, representing the stack and globals, with frames within the stack, and regions for variables within the frames and the "globals" region. Regions for structs can have subregions for fields.
|
inherited |
|
virtual |
|
protected |
References region().
Referenced by ana::bit_range_region::bit_range_region(), ana::cast_region::cast_region(), ana::cluster_region::cluster_region(), descendent_of_p(), ana::element_region::element_region(), ana::field_region::field_region(), ana::frame_region::frame_region(), get_parent_region(), ana::bit_range_region::key_t::is_deleted(), ana::cast_region::key_t::is_deleted(), ana::bit_range_region::key_t::key_t(), ana::cast_region::key_t::key_t(), ana::element_region::key_t::key_t(), ana::field_region::key_t::key_t(), ana::offset_region::key_t::key_t(), ana::sized_region::key_t::key_t(), ana::bit_range_region::key_t::mark_deleted(), ana::cast_region::key_t::mark_deleted(), ana::memory_space_region::memory_space_region(), ana::offset_region::offset_region(), region(), and ana::sized_region::sized_region().
|
virtual |
Reimplemented in ana::element_region, ana::frame_region, ana::offset_region, ana::sized_region, and ana::symbolic_region.
|
pure virtualinherited |
Implemented in ana::alloca_region, ana::asm_output_svalue, ana::binop_svalue, ana::bit_range_region, ana::cast_region, ana::const_fn_result_svalue, ana::constant_svalue, ana::decl_region, ana::element_region, ana::errno_region, ana::field_region, ana::frame_region, ana::function_region, ana::heap_allocated_region, ana::initial_svalue, ana::label_region, ana::memory_space_region, ana::offset_region, ana::placeholder_svalue, ana::pointer_svalue, ana::poisoned_svalue, ana::private_region, ana::root_region, ana::setjmp_svalue, ana::sized_region, ana::string_region, ana::svalue_from_bit_vector, ana::symbolic::baseline_bit_contents, ana::symbolic::bit_vector_from_svalue, ana::symbolic::bit_vector_from_ubc, ana::symbolic::bits_from_bytes_scalar, ana::symbolic::concat_bit_vector, ana::symbolic::concrete_bit_overlay, ana::symbolic::concrete_scalar< ConcreteValueType >, ana::symbolic::conjured_bit_contents, ana::symbolic::conjured_bit_vector, ana::symbolic::cropped_bit_vector, ana::symbolic::empty_bit_vector, ana::symbolic::offset_bit_contents, ana::symbolic::poisoned_bit_vector, ana::symbolic::product< ConcreteValueType >, ana::symbolic::repeated_bit_vector, ana::symbolic::scalar_from_svalue< ConcreteValueType >, ana::symbolic::sum< ConcreteValueType >, ana::symbolic::symbolic_bit_overlay, ana::symbolic::tristate_bit_vector, ana::symbolic::uninit_contents, ana::symbolic::untracked_bit_contents, ana::symbolic::zero_contents, ana::symbolic_region, ana::unaryop_svalue, ana::unknown_region, ana::unknown_svalue, ana::unmergeable_svalue, ana::var_arg_region, and ana::widening_svalue.
Referenced by infinite_recursion_diagnostic::expr_uses_conjured_value_p().
|
finaloverridevirtual |
Implements ana::symbolic::node.
|
privatevirtual |
Reimplemented in ana::element_region, ana::offset_region, ana::sized_region, and ana::symbolic_region.
|
inline |
References m_cluster_reg.
|
private |
|
private |
|
private |
|
private |
| bool ana::region::can_have_initial_svalue_p | ( | ) | const |
|
inlinestaticinherited |
References get_id().
|
staticinherited |
|
static |
| void ana::region::dump | ( | ) | const |
| void ana::region::dump | ( | bool | simple | ) | const |
|
inherited |
|
pure virtual |
Implemented in ana::alloca_region, ana::bit_range_region, ana::cast_region, ana::decl_region, ana::element_region, ana::errno_region, ana::field_region, ana::frame_region, ana::function_region, ana::heap_allocated_region, ana::label_region, ana::memory_space_region, ana::offset_region, ana::private_region, ana::root_region, ana::sized_region, ana::string_region, ana::symbolic_region, ana::unknown_region, and ana::var_arg_region.
|
inherited |
|
inlinevirtual |
Reimplemented in ana::bit_range_region.
|
inlinevirtual |
Reimplemented in ana::cast_region.
|
inlinevirtual |
Reimplemented in ana::decl_region.
|
inlinevirtual |
Reimplemented in ana::element_region.
|
inlinevirtual |
Reimplemented in ana::field_region.
|
inlinevirtual |
Reimplemented in ana::frame_region.
|
inlinevirtual |
Reimplemented in ana::function_region.
|
inlinevirtual |
Reimplemented in ana::offset_region.
|
inlinevirtual |
Reimplemented in ana::sized_region.
|
inlinevirtual |
Reimplemented in ana::string_region.
|
inlinevirtual |
Reimplemented in ana::symbolic_region.
|
inlinevirtual |
Reimplemented in ana::var_arg_region.
| bool ana::region::empty_p | ( | region_model_manager & | mgr | ) | const |
|
inherited |
|
inlineoverridevirtual |
Reimplemented from ana::symbolic::node.
|
inline |
References m_cluster_reg.
| const svalue * ana::region::get_byte_size_sval | ( | region_model_manager * | mgr | ) | const |
|
inline |
|
inlineinherited |
References m_complexity.
Referenced by ana::binop_svalue::binop_svalue(), ana::pointer_svalue::pointer_svalue(), and ana::widening_svalue::widening_svalue().
| const svalue * ana::region::get_initial_value_at_main | ( | region_model_manager * | mgr | ) | const |
|
pure virtual |
Implemented in ana::alloca_region, ana::bit_range_region, ana::cast_region, ana::decl_region, ana::element_region, ana::errno_region, ana::field_region, ana::frame_region, ana::function_region, ana::heap_allocated_region, ana::label_region, ana::memory_space_region, ana::offset_region, ana::private_region, ana::root_region, ana::sized_region, ana::string_region, ana::symbolic_region, ana::unknown_region, and ana::var_arg_region.
Referenced by remap_enclosing_frame().
| symbolic::memory_offset ana::region::get_memory_offset | ( | region_model_manager & | mgr | ) | const |
| symbolic::memory_range ana::region::get_memory_range | ( | region_model_manager & | mgr | ) | const |
|
inline |
References m_mem_space.
Referenced by ana::bit_range_region::bit_range_region(), ana::cast_region::cast_region(), ana::cluster_region::cluster_region(), ana::element_region::element_region(), ana::field_region::field_region(), ana::frame_region::frame_region(), ana::offset_region::offset_region(), and ana::sized_region::sized_region().
|
inline |
References m_parent, and region().
Referenced by remap_enclosing_frame().
| symbolic::pointer ana::region::get_pointer | ( | region_model_manager & | mgr | ) | const |
| void ana::region::get_subregions_for_bit_range | ( | region_model_manager * | mgr, |
| concrete_bit_range | relative_bit_range, | ||
| tree | type, | ||
| auto_vec< const region * > * | out ) const |
|
inherited |
|
inherited |
| bool ana::region::is_named_decl_p | ( | const char * | decl_name | ) | const |
|
inherited |
|
protected |
|
pure virtualinherited |
Implemented in ana::alloca_region, ana::asm_output_svalue, ana::binop_svalue, ana::bit_range_region, ana::cast_region, ana::const_fn_result_svalue, ana::constant_svalue, ana::decl_region, ana::element_region, ana::errno_region, ana::field_region, ana::frame_region, ana::function_region, ana::heap_allocated_region, ana::initial_svalue, ana::label_region, ana::memory_space_region, ana::offset_region, ana::placeholder_svalue, ana::pointer_svalue, ana::poisoned_svalue, ana::private_region, ana::root_region, ana::setjmp_svalue, ana::sized_region, ana::string_region, ana::svalue_from_bit_vector, ana::symbolic::baseline_bit_contents, ana::symbolic::bit_vector_from_svalue, ana::symbolic::bit_vector_from_ubc, ana::symbolic::bits_from_bytes_scalar, ana::symbolic::concat_bit_vector, ana::symbolic::concrete_bit_overlay, ana::symbolic::concrete_scalar< ConcreteValueType >, ana::symbolic::conjured_bit_contents, ana::symbolic::conjured_bit_vector, ana::symbolic::cropped_bit_vector, ana::symbolic::empty_bit_vector, ana::symbolic::offset_bit_contents, ana::symbolic::poisoned_bit_vector, ana::symbolic::product< ConcreteValueType >, ana::symbolic::repeated_bit_vector, ana::symbolic::scalar_from_svalue< ConcreteValueType >, ana::symbolic::sum< ConcreteValueType >, ana::symbolic::symbolic_bit_overlay, ana::symbolic::tristate_bit_vector, ana::symbolic::uninit_contents, ana::symbolic::untracked_bit_contents, ana::symbolic::zero_contents, ana::symbolic_region, ana::unaryop_svalue, ana::unknown_region, ana::unknown_svalue, ana::unmergeable_svalue, ana::var_arg_region, and ana::widening_svalue.
|
virtual |
Reimplemented in ana::bit_range_region, ana::cast_region, ana::element_region, ana::field_region, and ana::offset_region.
|
virtual |
Reimplemented in ana::bit_range_region, and ana::sized_region.
|
virtual |
Reimplemented in ana::bit_range_region, ana::cast_region, ana::element_region, ana::field_region, and ana::offset_region.
|
virtual |
Reimplemented in ana::bit_range_region, and ana::sized_region.
| tree ana::region::maybe_get_decl | ( | ) | const |
| const frame_region * ana::region::maybe_get_frame_region | ( | ) | const |
Referenced by sufficiently_different_region_binding_p().
| bool ana::region::maybe_print_for_user | ( | pretty_printer * | pp, |
| const region_model & | model ) const |
| bool ana::region::non_null_p | ( | ) | const |
| void ana::region::print | ( | const region_model & | model, |
| pretty_printer * | pp ) const |
|
finaloverridevirtual |
Implements ana::symbolic::node.
|
pure virtual |
Implemented in ana::alloca_region, ana::bit_range_region, ana::cast_region, ana::decl_region, ana::element_region, ana::errno_region, ana::field_region, ana::frame_region, ana::function_region, ana::heap_allocated_region, ana::label_region, ana::memory_space_region, ana::offset_region, ana::private_region, ana::root_region, ana::sized_region, ana::string_region, ana::symbolic_region, ana::unknown_region, and ana::var_arg_region.
|
inherited |
| bool ana::region::symbolic_for_unknown_ptr_p | ( | ) | const |
| bool ana::region::symbolic_p | ( | ) | const |
|
pure virtualinherited |
Implemented in ana::alloca_region, ana::asm_output_svalue, ana::binop_svalue, ana::bit_range_region, ana::cast_region, ana::const_fn_result_svalue, ana::constant_svalue, ana::decl_region, ana::element_region, ana::errno_region, ana::field_region, ana::frame_region, ana::function_region, ana::heap_allocated_region, ana::initial_svalue, ana::label_region, ana::memory_space_region, ana::offset_region, ana::placeholder_svalue, ana::pointer_svalue, ana::poisoned_svalue, ana::private_region, ana::root_region, ana::setjmp_svalue, ana::sized_region, ana::string_region, ana::svalue_from_bit_vector, ana::symbolic::baseline_bit_contents, ana::symbolic::bit_vector_from_svalue, ana::symbolic::bit_vector_from_ubc, ana::symbolic::bits_from_bytes_scalar, ana::symbolic::concat_bit_vector, ana::symbolic::concrete_bit_overlay, ana::symbolic::concrete_scalar< ConcreteValueType >, ana::symbolic::conjured_bit_contents, ana::symbolic::conjured_bit_vector, ana::symbolic::cropped_bit_vector, ana::symbolic::empty_bit_vector, ana::symbolic::offset_bit_contents, ana::symbolic::poisoned_bit_vector, ana::symbolic::product< ConcreteValueType >, ana::symbolic::repeated_bit_vector, ana::symbolic::scalar_from_svalue< ConcreteValueType >, ana::symbolic::sum< ConcreteValueType >, ana::symbolic::symbolic_bit_overlay, ana::symbolic::tristate_bit_vector, ana::symbolic::uninit_contents, ana::symbolic::untracked_bit_contents, ana::symbolic::zero_contents, ana::symbolic_region, ana::unaryop_svalue, ana::unknown_region, ana::unknown_svalue, ana::unmergeable_svalue, ana::var_arg_region, and ana::widening_svalue.
|
inlinevirtual |
Reimplemented in ana::decl_region, and ana::string_region.
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
private |
Referenced by base_region_p(), get_base_region(), and get_cluster_region().
|
privateinherited |
Referenced by get_complexity(), and node().
|
private |
Referenced by get_memory_space().
|
private |
Referenced by get_parent_region().
|
private |
Referenced by get_type().