Loading...
Searching...
No Matches
allocate_objectst Class Reference
#include <allocate_objects.h>
+ Collaboration diagram for allocate_objectst:
Allocates a new object, either by creating a local variable with automatic lifetime, a global variable with static lifetime, or by dynamically allocating memory via ALLOCATE().
Creates a local variable with automatic lifetime.
Creates a global variable with static lifetime.
Generates code for allocating a dynamic object.
Creates a local variable with automatic lifetime and returns it as a symbol expression.
Add a pointer to a symbol to the list of pointers to symbols created so far.
Adds declarations for all non-static symbols created.
Adds code to mark the created symbols as input.
Detailed Description
Constructor & Destructor Documentation
◆ allocate_objectst()
allocate_objectst::allocate_objectst
(
const irep_idt &
symbol_mode,
)
inline
Member Function Documentation
◆ add_created_symbol()
Add a pointer to a symbol to the list of pointers to symbols created so far.
- Parameters
-
symbol symbol in the symbol table
Definition at line 221 of file allocate_objects.cpp.
◆ allocate_automatic_local_object() [1/2]
exprt allocate_objectst::allocate_automatic_local_object
(
code_blockt &
assignments,
)
Creates a local variable with automatic lifetime.
Code is added to assignments which assigns a pointer to the variable to target_expr. The allocate_type may differ from target_expr.type(), e.g. for target_expr having type int* and allocate_type being an int[10]..
- Parameters
-
assignments The code block to add code to.
target_expr A pointer to the variable will be assigned to this lvalue expression
allocate_type Type of the new variable
basename_prefix prefix of the basename of the new variable
- Returns
- An expression denoting the variable
Definition at line 72 of file allocate_objects.cpp.
◆ allocate_automatic_local_object() [2/2]
Creates a local variable with automatic lifetime and returns it as a symbol expression.
- Parameters
-
allocate_type Type of the new variable
basename_prefix prefix of the basename of the new variable
- Returns
- A symbol expression denoting the variable
Definition at line 109 of file allocate_objects.cpp.
◆ allocate_dynamic_object()
◆ allocate_dynamic_object_symbol()
exprt allocate_objectst::allocate_dynamic_object_symbol
(
code_blockt &
output_code,
)
Generates code for allocating a dynamic object.
A new variable with basename prefix alloc_site is introduced to which the allocated memory is assigned. Then, the variable is assigned to target_expr. For example, with target_expr being *p the following code is generated:
alloc_site1ドル = ALLOCATE(object_size, FALSE); *p = alloc_site1ドル;
- Parameters
-
output_code Code block to which the necessary code is added
target_expr A pointer to the allocated memory will be assigned to this (lvalue) expression
allocate_type Type of the object allocated
- Returns
- The pointer to the allocated memory, or an empty expression when
allocate_type is void
Definition at line 126 of file allocate_objects.cpp.
◆ allocate_non_dynamic_object()
exprt allocate_objectst::allocate_non_dynamic_object
(
code_blockt &
assignments,
)
private
◆ allocate_object()
Allocates a new object, either by creating a local variable with automatic lifetime, a global variable with static lifetime, or by dynamically allocating memory via ALLOCATE().
Code is added to assignments which assigns a pointer to the allocated memory to target_expr. The allocate_type may differ from target_expr.type(), e.g. for target_expr having type int* and allocate_type being an int[10].
- Parameters
-
assignments The code block to add code to.
target_expr A pointer to the allocated memory will be assigned to this lvalue expression
allocate_type Type of the object allocated
lifetime Lifetime of the allocated object (AUTOMATIC_LOCAL, STATIC_GLOBAL, or DYNAMIC)
basename_prefix prefix of the basename of the new variable
- Returns
- An lvalue expression denoting the newly allocated object
Definition at line 34 of file allocate_objects.cpp.
◆ allocate_static_global_object()
exprt allocate_objectst::allocate_static_global_object
(
code_blockt &
assignments,
)
Creates a global variable with static lifetime.
Code is added to assignments which assigns a pointer to the variable to target_expr. The allocate_type may differ from target_expr.type(), e.g. for target_expr having type int* and allocate_type being an int[10].
- Parameters
-
assignments The code block to add code to.
target_expr A pointer to the variable will be assigned to this lvalue expression
allocate_type Type of the new variable
basename_prefix prefix of the basename of the new variable
- Returns
- An expression denoting the variable
Definition at line 93 of file allocate_objects.cpp.
◆ declare_created_symbols()
void allocate_objectst::declare_created_symbols
(
code_blockt &
init_code )
Adds declarations for all non-static symbols created.
- Parameters
-
init_code code block to which to add the declarations
Definition at line 229 of file allocate_objects.cpp.
◆ mark_created_symbols_as_input()
void allocate_objectst::mark_created_symbols_as_input
(
code_blockt &
init_code )
Adds code to mark the created symbols as input.
- Parameters
-
init_code code block to which to add the generated code
Definition at line 248 of file allocate_objects.cpp.
Member Data Documentation
◆ name_prefix
◆ ns
◆ source_location
◆ symbol_mode
◆ symbol_table
◆ symbols_created
std::vector<
irep_idt> allocate_objectst::symbols_created
private
The documentation for this class was generated from the following files: