35 for(std::size_t i=0; i<count; i++)
55 sym.
is_weak = (flags &(1 << 16))!=0;
56 sym.
is_type = (flags &(1 << 15))!=0;
58 sym.
is_macro = (flags &(1 << 13))!=0;
60 sym.
is_input = (flags &(1 << 11))!=0;
80 symbol_table.
add(sym);
85 for(std::size_t fct_index = 0; fct_index < count; ++fct_index)
90 typedef std::map<goto_programt::targett, std::list<unsigned> > target_mapt;
91 target_mapt target_map;
92 typedef std::map<unsigned, goto_programt::targett> rev_target_mapt;
93 rev_target_mapt rev_target_map;
98 for(std::size_t ins_index = 0; ins_index < ins_count; ++ins_index)
113 rev_target_map.insert(
114 rev_target_map.end(),
115 std::make_pair(instruction.
target_number, itarget))->second!=itarget)
119 for(std::size_t i=0; i<t_count; i++)
121 target_map[itarget].push_back(irepconverter.
read_gb_word(in));
125 for(std::size_t i=0; i<l_count; i++)
128 instruction.
labels.push_back(label);
137 for(target_mapt::iterator tit = target_map.begin();
138 tit!=target_map.end();
143 for(std::list<unsigned>::iterator nit = tit->second.begin();
144 nit!=tit->second.end();
148 rev_target_mapt::const_iterator entry=rev_target_map.find(n);
150 entry != rev_target_map.end(),
151 "something from the target map should also be in the reverse target "
153 ins->targets.push_back(entry->second);
173 const std::string &filename,
182 hdr[0]=
static_cast<char>(in.get());
183 hdr[1]=
static_cast<char>(in.get());
184 hdr[2]=
static_cast<char>(in.get());
186 if(hdr[0]==
'G' && hdr[1]==
'B' && hdr[2]==
'F')
192 hdr[3]=
static_cast<char>(in.get());
193 if(hdr[0]==0x7f && hdr[1]==
'G' && hdr[2]==
'B' && hdr[3]==
'F')
197 else if(hdr[0]==0x7f && hdr[1]==
'E' && hdr[2]==
'L' && hdr[3]==
'F')
199 if(!filename.empty())
200 message.error() <<
"Sorry, but I can't read ELF binary '" << filename
203 message.error() <<
"Sorry, but I can't read ELF binaries"
210 message.error() <<
"'" << filename <<
"' is not a goto-binary"
227 "The input was compiled with an old version of "
238 "The input was compiled with an unsupported version of "
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.
unsigned target_number
A number to identify branch targets.
bool is_target() const
Is this node a branch target?
codet code
Do not read or modify directly – use get_X() instead.
source_locationt source_location
The location of the instruction in the source file.
goto_program_instruction_typet type
What kind of instruction?
exprt guard
Guard for gotos, assume, assert Use get_condition() to read, and set_condition(c) to write.
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
const irep_idt & id() const
Class that provides messages with a built-in verbosity 'level'.
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 bool read_bin_goto_object(std::istream &in, symbol_tablet &symbol_table, goto_functionst &functions, irep_serializationt &irepconverter)
read goto binary format
#define UNREACHABLE
This should be used to mark dead code.
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
static const char * message(const statust &status)
Makes a status message string from a status.
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
#define GOTO_BINARY_VERSION