104 if(it->operands().size() == 2)
114 if(it->operands().size() == 2)
124 arguments.size() >=
n_args,
125 "insufficient number of arguments for calling " +
127 "required arguments: " + std::to_string(
n_args),
158 "types of function " +
id2string(function_identifier) +
" should match",
185 for(
const auto &op : operands)
214 "function types should match");
259 bool unknown =
false;
264 if(instruction.empty())
268 std::cout <<
"A ********************\n";
269 for(
const auto &
ins : instruction)
271 std::cout <<
"XX: " <<
ins.pretty() <<
'\n';
274 std::cout <<
"B ********************\n";
290 if(
pos == instruction.size())
299 if(command ==
"xchg" || command ==
"xchgl")
317 if(command ==
"fstcw" || command ==
"fnstcw" || command ==
"fldcw")
322 command ==
"mfence" || command ==
"lfence" || command ==
"sfence")
366 else if(command ==
"dmb" || command ==
"dsb")
382 else if(command ==
"isb")
430 bool unknown =
false;
435 if(instruction.empty())
439 std::cout <<
"A ********************\n";
440 for(
const auto &
ins : instruction)
442 std::cout <<
"XX: " <<
ins.pretty() <<
'\n';
445 std::cout <<
"B ********************\n";
461 if(
pos == instruction.size())
470 if(command ==
"xchg" || command ==
"xchgl")
488 if(command ==
"fstcw" || command ==
"fnstcw" || command ==
"fldcw")
516 command ==
"mfence" || command ==
"lfence" || command ==
"sfence")
552 if(it->is_other() && it->get_other().get_statement() ==
ID_asm)
556 it->turn_into_skip();
562 goto_function.body.destructive_insert(next,
tmp_dest);
580 remove_asmt rem(symbol_table, goto_functions, message_handler);
601 for(
auto &instruction : function_it.second.body.instructions)
603 instruction.is_other() &&
604 instruction.get_other().get_statement() ==
ID_asm)
pointer_typet pointer_type(const typet &subtype)
Operator to return the address of an object.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
codet representation of an inline assembler statement, for the gcc flavor.
codet representation of an inline assembler statement.
const irep_idt & get_flavor() const
goto_instruction_codet representation of a function call statement.
exprt::operandst argumentst
std::vector< parametert > parameterst
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.
std::vector< exprt > operandst
const source_locationt & source_location() const
A collection of goto functions.
function_mapt function_map
::goto_functiont goto_functiont
A goto function, consisting of function body (see body) and parameter identifiers (see parameter_iden...
symbol_tablet symbol_table
Symbol table.
goto_functionst goto_functions
GOTO functions.
This class represents an instruction in the GOTO intermediate representation.
const goto_instruction_codet & get_other() const
Get the statement for OTHER.
A generic container class for the GOTO intermediate representation of one function.
instructionst::iterator targett
void destructive_append(goto_programt &p)
Appends the given program p to *this. p is destroyed.
static instructiont make_atomic_end(const source_locationt &l=source_locationt::nil())
static instructiont make_function_call(const code_function_callt &_code, const source_locationt &l=source_locationt::nil())
Create a function call instruction.
static instructiont make_other(const goto_instruction_codet &_code, const source_locationt &l=source_locationt::nil())
static instructiont make_atomic_begin(const source_locationt &l=source_locationt::nil())
targett add(instructiont &&instruction)
Adds a given instruction at the end.
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
The null pointer constant.
remove_asmt(symbol_tablet &_symbol_table, goto_functionst &_goto_functions, message_handlert &message_handler)
goto_functionst & goto_functions
symbol_tablet & symbol_table
void process_function(const irep_idt &, goto_functionst::goto_functiont &)
Replaces inline assembly instructions in the goto function by non-assembly goto program instructions.
void process_instruction_msc(const irep_idt &, const code_asmt &, goto_programt &dest)
Translates the given inline assembly code (in msc style) to non-assembly goto program instructions.
void msc_asm_function_call(const irep_idt &function_base_name, const exprt::operandst &operands, const code_asmt &code, goto_programt &dest)
Adds a call to a library function that implements the given msc-style inline assembly statement.
void process_instruction_gcc(const code_asm_gcct &, goto_programt &dest)
Translates the given inline assembly code (in gcc style) to non-assembly goto program instructions.
message_handlert & message_handler
void gcc_asm_function_call(const irep_idt &function_base_name, const code_asm_gcct &code, std::size_t n_args, goto_programt &dest)
Adds a call to a library function that implements the given gcc-style inline assembly statement.
void process_instruction(const irep_idt &function_id, goto_programt::instructiont &instruction, goto_programt &dest)
Translates the given inline assembly code (which must be in either gcc or msc style) to non-assembly ...
Expression to hold a symbol (variable)
const symbol_base_mapt & symbol_base_map
Read-only field, used to look up symbol names given their base names.
bool has_symbol(const irep_idt &name) const
Check whether a symbol exists in the symbol table.
bool add(const symbolt &symbol)
Add a new symbol to the symbol table.
const symbolt & lookup_ref(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
Semantic type conversion.
static exprt conditional_cast(const exprt &expr, const typet &type)
The type of an expression, extends irept.
bool has_prefix(const std::string &s, const std::string &prefix)
#define forall_operands(it, expr)
#define Forall_goto_program_instructions(it, program)
const std::string & id2string(const irep_idt &d)
API to expression classes for Pointers.
Ranges: pair of begin and end iterators, which can be initialized from containers,...
ranget< typename multimapt::const_iterator > equal_range(const multimapt &multimap, const typename multimapt::key_type &key)
Utility function to make equal_range method of multimap easier to use by returning a ranget object.
void remove_asm(goto_functionst &goto_functions, symbol_tablet &symbol_table, message_handlert &message_handler)
Replaces inline assembly instructions in the goto program (i.e., instructions of kind OTHER with a co...
bool has_asm(const goto_functionst &goto_functions)
returns true iff the given goto functions use asm instructions
Remove 'asm' statements by compiling them into suitable standard goto program instructions.
void remove_skip(goto_programt &goto_program, goto_programt::targett begin, goto_programt::targett end)
remove unnecessary skip statements
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define DATA_INVARIANT_WITH_DIAGNOSTICS(CONDITION, REASON,...)
code_asm_gcct & to_code_asm_gcc(codet &code)
code_asmt & to_code_asm(codet &code)
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
const string_constantt & to_string_constant(const exprt &expr)