28 #define DB_ENTRY_POINT_POSTFIX "_entry_point"
31 #define CPROVER_HIDE CPROVER_PREFIX "HIDE"
48 for(
const std::pair<const irep_idt, symbolt> &pair : symbol_table)
50 if(pair.first == main_symbol_name && pair.second.type.id() == ID_code)
55 message.
error() <<
"main symbol `" << main_symbol_name
69 message.
error() <<
"main symbol `" << main_symbol_name <<
"' not found"
89 function_body.
add(call_init);
100 const symbolt &main_function_block)
110 instance_data_block.is_static_lifetime =
true;
111 symbol_table.
add(instance_data_block);
117 function_body.
add(call_main);
131 for(
const std::pair<const irep_idt, symbolt> &pair : symbol_table)
133 const symbolt &symbol = pair.second;
137 init.value = std::move(dest);
138 symbol_table.
add(init);
146 rounding_mode.is_thread_local =
true;
147 rounding_mode.is_static_lifetime =
true;
151 rounding_mode.value = rounding_val;
152 symbol_table.
add(rounding_mode);
179 start_symbol.value.swap(start_function_body);
181 if(!symbol_table.
insert(std::move(start_symbol)).second)
207 symbol_table, message_handler,
config.
main.value()))
217 symbol_table, message_handler, ID_statement_list_main_function))
219 main_symbol_name = ID_statement_list_main_function;
225 if(
main.value.is_nil())
236 main, symbol_table, message_handler);
irep_idt rounding_mode_identifier()
Return the identifier of the program symbol used to store the current rounding mode.
signedbv_typet signed_int_type()
Operator to return the address of an object.
A goto_instruction_codet representing an assignment in the program.
A codet representing sequential composition of program statements.
void add(const codet &code)
goto_instruction_codet representation of a function call statement.
exprt::operandst argumentst
codet representation of a label for branch targets.
A codet representing a skip statement.
const irep_idt & get_base_name() const
const parameterst & parameters() const
std::optional< std::string > main
A constant literal expression.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
source_locationt & add_source_location()
typet & type()
Return the type of the expression.
static irep_idt entry_point()
Get the identifier of the entry point to a goto model.
Class that provides messages with a built-in verbosity 'level'.
The symbol table base class interface.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
const symbolt & lookup_ref(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
bool add(const symbolt &symbol)
Add a new symbol to the symbol table.
virtual std::pair< symbolt &, bool > insert(symbolt symbol)=0
Move or copy a new symbol to the symbol table.
source_locationt location
Source code location of definition of symbol.
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
typet type
Type of symbol.
exprt value
Initial value of symbol.
const typet & subtype() const
int main(int argc, char *argv[])
Goto Programs with Functions.
const std::string & id2string(const irep_idt &d)
API to expression classes for Pointers.
#define PRECONDITION(CONDITION)
static void add_initialize_call(code_blockt &function_body, const symbol_table_baset &symbol_table, const source_locationt &main_symbol_location)
Creates a call to __CPROVER_initialize and adds it to the start function's body.
static bool is_main_symbol_invalid(const symbol_table_baset &symbol_table, message_handlert &message_handler, const irep_idt &main_symbol_name)
Searches for symbols with the given name (which is considered to be the name of the main symbol) and ...
bool statement_list_entry_point(symbol_table_baset &symbol_table, message_handlert &message_handler)
Creates a new entry point for the Statement List language.
static void add_main_function_block_call(code_blockt &function_body, symbol_table_baset &symbol_table, const symbolt &main_function_block)
Creates a call to the main function block and adds it to the start function's body.
#define CPROVER_HIDE
Name of the CPROVER-specific hide label.
#define DB_ENTRY_POINT_POSTFIX
Postfix for the artificial data block that is created when calling a main symbol that is a function b...
static void generate_rounding_mode(symbol_table_baset &symbol_table)
Creates __CPROVER_rounding_mode and adds it to the symbol table.
static void generate_statement_list_init_function(symbol_table_baset &symbol_table)
Creates __CPROVER_initialize and adds it to the symbol table.
bool generate_statement_list_start_function(const symbolt &main, symbol_table_baset &symbol_table, message_handlert &message_handler)
Creates a start function and adds it to the symbol table.
Statement List Language Entry Point.
#define INITIALIZE_FUNCTION
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
const type_with_subtypet & to_type_with_subtype(const typet &type)