28 const std::size_t count = irepconverter.
read_gb_word(in);
30 for(std::size_t i=0; i<count; i++)
50 sym.
is_weak = (flags &(1 << 16))!=0;
51 sym.
is_type = (flags &(1 << 15))!=0;
53 sym.
is_macro = (flags &(1 << 13))!=0;
55 sym.
is_input = (flags &(1 << 11))!=0;
68 symbol_table.
add(sym);
81 for(
const auto &name_symbol : symbol_table)
83 const auto &symbol = name_symbol.second;
87 const auto code_type = type_try_dynamic_cast<code_typet>(symbol.type);
94 emplaced.first->second.set_parameter_identifiers(*code_type);
103 const std::size_t count = irepconverter.
read_gb_word(in);
105 for(std::size_t fct_index = 0; fct_index < count; ++fct_index)
115 target_mapt target_map;
116 typedef std::map<unsigned, goto_programt::targett> rev_target_mapt;
117 rev_target_mapt rev_target_map;
122 for(std::size_t ins_index = 0; ins_index < ins_count; ++ins_index)
137 code, source_location, instruction_type,
guard, {}};
139 instruction.target_number = irepconverter.
read_gb_word(in);
140 if(instruction.is_target() &&
141 rev_target_map.insert(
142 rev_target_map.end(),
143 std::make_pair(instruction.target_number, itarget))->second!=itarget)
147 for(std::size_t i=0; i<t_count; i++)
149 target_map[itarget].push_back(irepconverter.
read_gb_word(in));
153 for(std::size_t i=0; i<l_count; i++)
156 instruction.labels.push_back(label);
163 itarget->
swap(instruction);
167 for(target_mapt::iterator tit = target_map.begin();
168 tit!=target_map.end();
173 for(std::list<unsigned>::iterator nit = tit->second.begin();
174 nit!=tit->second.end();
178 rev_target_mapt::const_iterator entry=rev_target_map.find(n);
180 entry != rev_target_map.end(),
181 "something from the target map should also be in the reverse target "
183 ins->targets.push_back(entry->second);
214 const std::string &filename,
222 hdr[0] =
static_cast<char>(in.get());
223 hdr[1] =
static_cast<char>(in.get());
224 hdr[2] =
static_cast<char>(in.get());
226 if(hdr[0] ==
'G' && hdr[1] ==
'B' && hdr[2] ==
'F')
232 hdr[3] =
static_cast<char>(in.get());
233 if(hdr[0] == 0x7f && hdr[1] ==
'G' && hdr[2] ==
'B' && hdr[3] ==
'F')
237 else if(hdr[0] == 0x7f && hdr[1] ==
'E' && hdr[2] ==
'L' && hdr[3] ==
'F')
239 if(!filename.empty())
240 message.
error() <<
"Sorry, but I can't read ELF binary '" << filename
243 message.
error() <<
"Sorry, but I can't read ELF binaries"
250 message.
error() <<
"'" << filename <<
"' is not a goto-binary"
259 const std::size_t version = irepconverter.
read_gb_word(in);
263 message.
error() <<
"The input was compiled with an old version of "
264 "goto-cc; please recompile"
275 message.
error() <<
"The input was compiled with an unsupported version of "
276 "goto-cc; please recompile"
static exprt guard(const exprt::operandst &guards, exprt cond)
Data structure for representing an arbitrary statement in a program.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
A collection of goto functions.
function_mapt function_map
::goto_functiont goto_functiont
void compute_location_numbers()
A goto function, consisting of function body (see body) and parameter identifiers (see parameter_iden...
This class represents an instruction in the GOTO intermediate representation.
instructionst::iterator targett
static std::size_t read_gb_word(std::istream &)
Interpret a stream of byte as a 7-bit encoded unsigned number.
const irept & reference_convert(std::istream &)
irep_idt read_string_ref(std::istream &)
Read a string reference from the stream.
irep_idt read_gb_string(std::istream &)
reads a string from the stream
Class that provides messages with a built-in verbosity 'level'.
The symbol table base class interface.
bool add(const symbolt &symbol)
Add a new symbol to the symbol table.
irep_idt base_name
Base (non-scoped) name.
irep_idt module
Name of module the symbol belongs to.
source_locationt location
Source code location of definition of symbol.
typet type
Type of symbol.
irep_idt name
The unique identifier.
irep_idt pretty_name
Language-specific display name.
exprt value
Initial value of symbol.
irep_idt mode
Language mode.
The type of an expression, extends irept.
Goto Programs with Functions.
goto_program_instruction_typet
The type of an instruction in a GOTO program.
binary irep conversions with hashing
static void copy_parameter_identifiers(const symbol_table_baset &symbol_table, goto_functionst &functions)
The serialised form of the goto-model currently includes the parameter identifiers in the symbol tabl...
static void read_bin_goto_object(std::istream &in, symbol_table_baset &symbol_table, goto_functionst &functions, irep_serializationt &irepconverter)
read goto binary format
static void read_bin_functions_object(std::istream &in, goto_functionst &functions, irep_serializationt &irepconverter)
static void read_bin_symbol_table_object(std::istream &in, symbol_table_baset &symbol_table, irep_serializationt &irepconverter)
#define UNREACHABLE
This should be used to mark dead code.
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
A total order over targett and const_targett.
#define GOTO_BINARY_VERSION