24 return a->location_number <
b->location_number;
31 auto &instruction = *it;
32 std::vector<goto_programt::targett>
backedges;
39 if(
predecessor->location_number > instruction.location_number)
105 natural_loops{goto_program};
106 std::set<goto_programt::targett, location_number_less_thant>
modified_loops;
108 for(
auto it1 = natural_loops.loop_map.begin();
109 it1 != natural_loops.loop_map.end();
115 (*std::prev(
it1->second.end()))->is_goto() &&
116 (*std::prev(
it1->second.end()))->get_target() ==
it1->first)
122 for(
auto it2 = natural_loops.loop_map.begin();
123 it2 != natural_loops.loop_map.end();
141 (!(*std::prev(
it2->second.end()))->is_goto() ||
142 (*std::prev(
it2->second.end()))->get_target() !=
it2->first))
145 *std::prev(
it2->second.end()),
147 it2->first, (*std::prev(
it2->second.end()))->source_location()));
154 *std::prev(
it1->second.end()),
156 it1->first, (*std::prev(
it1->second.end()))->source_location()));
184 goto_function.body.update();
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
function_mapt function_map
Interface providing access to a single function in a GOTO model, plus its associated symbol table.
goto_functionst goto_functions
GOTO functions.
A generic container class for the GOTO intermediate representation of one function.
instructionst instructions
The list of instructions in the goto program.
void update()
Update all indices.
instructionst::iterator targett
targett insert_after(const_targett target)
Insertion after the instruction pointed-to by the given instruction iterator target.
static instructiont make_goto(targett _target, const source_locationt &l=source_locationt::nil())
Main driver for working out if a class (normally goto_programt) has any natural loops.
static bool location_number_less_than(const goto_programt::targett &a, const goto_programt::targett &b)
bool ensure_one_backedge_per_target(goto_programt::targett &it, goto_programt &goto_program)
Ensure one backedge per target.
Compute natural loops in a goto_function.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
bool operator()(const goto_programt::targett &i1, const goto_programt::targett &i2) const