ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
gcse.cpp File Reference
#include <goto-programs/goto_program.h>
#include <irep2/irep2_expr.h>
#include <irep2/irep2_type.h>
#include <pointer-analysis/value_sets.h>
#include <util/irep/std_code.h>
#include <util/irep/std_expr.h>
#include <goto-programs/abstract-interpretation/gcse.h>
#include <ostream>
#include <sstream>
#include <util/base/prefix.h>
#include <fmt/format.h>
Include dependency graph for gcse.cpp:

Functions

static void collect_reallocs (const expr2tc &e, std::vector< expr2tc > &dest)
static void collect_dereferences (const expr2tc &e, std::vector< expr2tc > &dest)
static void collect_written_objects (const expr2tc &lhs, std::vector< expr2tc > &dest)
 The objects a store to lhs may write: variables, and the heap objects the points-to analysis names.
static bool referenced_objects (const expr2tc &deref, const goto_programt::const_targett &i_it, std::vector< expr2tc > &dest)
 Adds the objects deref may refer to into dest.
static bool same_object (const expr2tc &a, const expr2tc &b)
static bool may_read_through_pointer (const expr2tc &e, const std::vector< expr2tc > &written, const goto_programt::const_targett &i_it)
 Whether a dereference in e may read one of the written objects.
static void forget_stale_symbols (std::unordered_set< expr2tc, irep2_hash > &initialized, const cse_domaint &state, bool restart)
 initialized follows program order, so it says nothing at a join or after a call (restart).

Function Documentation

◆ collect_dereferences()

void collect_dereferences ( const expr2tc & e,
std::vector< expr2tc > & dest )
static

◆ collect_reallocs()

void collect_reallocs ( const expr2tc & e,
std::vector< expr2tc > & dest )
static

◆ collect_written_objects()

void collect_written_objects ( const expr2tc & lhs,
std::vector< expr2tc > & dest )
static

The objects a store to lhs may write: variables, and the heap objects the points-to analysis names.

c ? x : y over-approximates to both arms; stores through a pointer are resolved with referenced_objects instead.

◆ forget_stale_symbols()

void forget_stale_symbols ( std::unordered_set< expr2tc, irep2_hash > & initialized,
const cse_domaint & state,
bool restart )
static

initialized follows program order, so it says nothing at a join or after a call (restart).

Elsewhere a symbol holds its expression only until the expression is killed: a guard or a call target may make it available again without assigning the symbol (#7992).

◆ may_read_through_pointer()

bool may_read_through_pointer ( const expr2tc & e,
const std::vector< expr2tc > & written,
const goto_programt::const_targett & i_it )
static

Whether a dereference in e may read one of the written objects.

◆ referenced_objects()

bool referenced_objects ( const expr2tc & deref,
const goto_programt::const_targett & i_it,
std::vector< expr2tc > & dest )
static

Adds the objects deref may refer to into dest.

Returns false when the points-to analysis cannot name them, i.e. it may refer to anything.

◆ same_object()

bool same_object ( const expr2tc & a,
const expr2tc & b )
static