MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / sym_exec_init

Function sym_exec_init

util/symexec.cpp:29–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace util {
28
29void sym_exec_init(State &s) {
30 Function &f = const_cast<Function&>(s.getFn());
31
32 // global constants need to be created in the right order so they get the
33 // first bids in source, and the last in target
34 set<const Value*> seen_inits;
35 for (const auto &v : f.getConstants()) {
36 if (auto gv = dynamic_cast<const GlobalVariable*>(&v)) {
37 if (gv->isConst() == s.isSource()) {
38 s.exec(v);
39 seen_inits.emplace(&v);
40 }
41 }
42 }
43
44 // add constants & inputs to State table first of all
45 for (auto &l : { f.getConstants(), f.getInputs(), f.getUndefs() }) {
46 for (const auto &v : l) {
47 if (!seen_inits.count(&v))
48 s.exec(v);
49 }
50 }
51
52 if (f.getFirstBB().getName() == "#init") {
53 s.startBB(f.getFirstBB());
54 for (auto &i : f.getFirstBB().instrs()) {
55 sym_exec_instr(s, i);
56 }
57 }
58 s.finishInitializer();
59
60 s.exec(Value::voidVal);
61}
62
63void sym_exec(State &s) {
64 sym_exec_init(s);

Callers 2

execFunction · 0.85
sym_execFunction · 0.85

Calls 10

sym_exec_instrFunction · 0.85
getConstantsMethod · 0.80
isSourceMethod · 0.80
getInputsMethod · 0.80
getUndefsMethod · 0.80
startBBMethod · 0.80
finishInitializerMethod · 0.80
isConstMethod · 0.45
execMethod · 0.45
instrsMethod · 0.45

Tested by

no test coverage detected