ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
goto_loopst Class Reference

#include <goto_loops.h>

Inheritance diagram for goto_loopst:
[legend]

Classes

struct  function_summaryt
 Per-callee summary: the leaf symbols (post check_var_name filtering) that walking the callee's body would contribute to the current loop. More...

Public Member Functions

 goto_loopst (const irep_idt &_function_name, goto_functionst &_goto_functions, goto_functiont &_goto_function)
void find_function_loops ()
void dump () const
const function_loopst & get_loops () const
function_loopst & get_loops ()

Protected Types

typedef std::list< loopst > function_loopst

Protected Member Functions

void create_function_loop (goto_programt::instructionst::iterator loop_head, goto_programt::instructionst::iterator loop_exit)
void get_modified_variables (goto_programt::instructionst::iterator instruction, function_loopst::iterator loop, std::vector< irep_idt > &function_name)
bool compute_function_summary (const irep_idt &fname, std::vector< irep_idt > &in_progress, function_summaryt &out)
 Compute (or fetch the cached) summary of fname.
bool summarise_call (const code_function_call2t &call, std::vector< irep_idt > &in_progress, function_summaryt &local, std::vector< expr2tc > &written_ptrs)
 Fold a call inside a callee into that callee's summary.
void collect_address_taken (const expr2tc &expr, function_summaryt &out) const
 A variable whose address the callee takes can be reassigned through that address, which collect_lhs_symbols does not see.
void collect_loop_symbols (const expr2tc &expr, loopst::loop_varst &out) const
 Collect the leaf symbols of expr into out, applying check_var_name.
void collect_lhs_symbols (const expr2tc &expr, function_summaryt &out) const
 Walk an assignment LHS, classifying each leaf symbol: storage that is actually written goes to modified, sub-expressions used to locate that storage (pointer in *p, index in arr[i]) go to unmodified.
void add_modified_var (loopst &loop, const expr2tc &expr)
void add_unmodified_var (loopst &loop, const expr2tc &expr)
void add_loop_var (loopst &loop, const expr2tc &expr, bool is_modified)

Static Protected Member Functions

static void merge_summary (const function_summaryt &from, function_summaryt &out)
static void note_pointer_write (const expr2tc &target, function_summaryt &local, std::vector< expr2tc > &written_ptrs)
static void apply_callee_summary (loopst &loop, const function_summaryt &summary, const code_function_call2t &call)

Protected Attributes

irep_idt function_name
goto_functionst & goto_functions
goto_functiont & goto_function
function_loopst function_loops
std::unordered_map< irep_idt, function_summaryt, irep_id_hash > function_summary_cache

Member Typedef Documentation

◆ function_loopst

typedef std::list<loopst> goto_loopst::function_loopst
protected

Constructor & Destructor Documentation

◆ goto_loopst()

goto_loopst::goto_loopst ( const irep_idt & _function_name,
goto_functionst & _goto_functions,
goto_functiont & _goto_function )
inline

Member Function Documentation

◆ add_loop_var()

void goto_loopst::add_loop_var ( loopst & loop,
const expr2tc & expr,
bool is_modified )
protected

◆ add_modified_var()

void goto_loopst::add_modified_var ( loopst & loop,
const expr2tc & expr )
protected

◆ add_unmodified_var()

void goto_loopst::add_unmodified_var ( loopst & loop,
const expr2tc & expr )
protected

◆ apply_callee_summary()

void goto_loopst::apply_callee_summary ( loopst & loop,
const function_summaryt & summary,
const code_function_call2t & call )
staticprotected

◆ collect_address_taken()

void goto_loopst::collect_address_taken ( const expr2tc & expr,
function_summaryt & out ) const
protected

A variable whose address the callee takes can be reassigned through that address, which collect_lhs_symbols does not see.

◆ collect_lhs_symbols()

void goto_loopst::collect_lhs_symbols ( const expr2tc & expr,
function_summaryt & out ) const
protected

Walk an assignment LHS, classifying each leaf symbol: storage that is actually written goes to modified, sub-expressions used to locate that storage (pointer in *p, index in arr[i]) go to unmodified.

Sets modifies_pointer_array when the write is to an array element reached through a pointer (issue #5224).

◆ collect_loop_symbols()

void goto_loopst::collect_loop_symbols ( const expr2tc & expr,
loopst::loop_varst & out ) const
protected

Collect the leaf symbols of expr into out, applying check_var_name.

◆ compute_function_summary()

bool goto_loopst::compute_function_summary ( const irep_idt & fname,
std::vector< irep_idt > & in_progress,
function_summaryt & out )
protected

Compute (or fetch the cached) summary of fname.

in_progress is the stack of callees currently being expanded; if a re-entry is detected the walk is cut (matches the legacy in-place behaviour). Returns true when the resulting summary is complete (no cycle-cut along the way); only complete summaries are cached.

◆ create_function_loop()

void goto_loopst::create_function_loop ( goto_programt::instructionst::iterator loop_head,
goto_programt::instructionst::iterator loop_exit )
protected

◆ dump()

void goto_loopst::dump ( ) const

◆ find_function_loops()

void goto_loopst::find_function_loops ( )

◆ get_loops() [1/2]

function_loopst & goto_loopst::get_loops ( )
inline

◆ get_loops() [2/2]

const function_loopst & goto_loopst::get_loops ( ) const
inline

◆ get_modified_variables()

void goto_loopst::get_modified_variables ( goto_programt::instructionst::iterator instruction,
function_loopst::iterator loop,
std::vector< irep_idt > & function_name )
protected

◆ merge_summary()

void goto_loopst::merge_summary ( const function_summaryt & from,
function_summaryt & out )
staticprotected

◆ note_pointer_write()

void goto_loopst::note_pointer_write ( const expr2tc & target,
function_summaryt & local,
std::vector< expr2tc > & written_ptrs )
staticprotected

◆ summarise_call()

bool goto_loopst::summarise_call ( const code_function_call2t & call,
std::vector< irep_idt > & in_progress,
function_summaryt & local,
std::vector< expr2tc > & written_ptrs )
protected

Fold a call inside a callee into that callee's summary.

Returns false when the summary is incomplete, as compute_function_summary does.

Member Data Documentation

◆ function_loops

function_loopst goto_loopst::function_loops
protected

◆ function_name

irep_idt goto_loopst::function_name
protected

◆ function_summary_cache

std::unordered_map<irep_idt, function_summaryt, irep_id_hash> goto_loopst::function_summary_cache
protected

◆ goto_function

goto_functiont& goto_loopst::goto_function
protected

◆ goto_functions

goto_functionst& goto_loopst::goto_functions
protected

The documentation for this class was generated from the following files: