53 if(
const auto mm_io_r_symbol = symbol_table.
lookup(
id_r))
55 mm_io_r = mm_io_r_symbol->symbol_expr();
61 mm_io_r_symbol->location,
67 if(
const auto mm_io_w_symbol = symbol_table.
lookup(
id_w))
68 mm_io_w = mm_io_w_symbol->symbol_expr();
73 std::set<dereference_exprt> collected;
75 if(e.
id() == ID_dereference)
87 for(
auto it = goto_function.body.instructions.begin();
88 it != goto_function.body.instructions.end();
94 auto &a_lhs = it->assign_lhs();
95 auto &a_rhs = it->assign_rhs_nonconst();
100 if(deref_expr_r.size() == 1)
122 goto_function.body.insert_before_swap(it, call);
130 if(a_lhs.id() == ID_dereference)
145 goto_function.body.insert_before_swap(it);
159 mm_iot rewrite{symbol_table};
162 rewrite.mm_io(f.second);
164 if(rewrite.reads_replaced || rewrite.writes_replaced)
167 log.status() <<
"Replaced MMIO operations: " << rewrite.reads_replaced
168 <<
" read(s), " << rewrite.writes_replaced <<
" write(s)"
goto_instruction_codet representation of a function call statement.
const typet & return_type() const
const parameterst & parameters() const
Operator to dereference a pointer.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
void visit_pre(std::function< void(exprt &)>)
typet & type()
Return the type of the expression.
A collection of goto functions.
function_mapt function_map
::goto_functiont goto_functiont
symbol_tablet symbol_table
Symbol table.
goto_functionst goto_functions
GOTO functions.
static instructiont make_function_call(const code_function_callt &_code, const source_locationt &l=source_locationt::nil())
Create a function call instruction.
The trinary if-then-else operator.
const irep_idt & id() const
Class that provides messages with a built-in verbosity 'level'.
std::size_t reads_replaced
mm_iot(symbol_table_baset &symbol_table)
std::size_t writes_replaced
void mm_io(goto_functionst::goto_functiont &goto_function)
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
The symbol table base class interface.
const symbolt * lookup(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
Semantic type conversion.
static exprt conditional_cast(const exprt &expr, const typet &type)
The type of an expression, extends irept.
symbolt & get_fresh_aux_symbol(const typet &type, const std::string &name_prefix, const std::string &basename_prefix, const source_locationt &source_location, const irep_idt &symbol_mode, const namespacet &ns, symbol_table_baset &symbol_table)
Installs a fresh-named symbol with respect to the given namespace ns with the requested name pattern ...
Fresh auxiliary symbol creation.
const std::string & id2string(const irep_idt &d)
void mm_io(symbol_tablet &symbol_table, goto_functionst &goto_functions, message_handlert &message_handler)
static std::set< dereference_exprt > collect_deref_expr(const exprt &src)
Perform Memory-mapped I/O instrumentation.
API to expression classes for Pointers.
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
std::optional< exprt > size_of_expr(const typet &type, const namespacet &ns)
exprt integer_address(const exprt &pointer)
Various predicates over pointers in programs.
bool replace_expr(const exprt &what, const exprt &by, exprt &dest)
#define CHECK_RETURN(CONDITION)
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.