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

Function update_repack

ir/instr.cpp:2237–2260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2235}
2236
2237static StateValue update_repack(Type *type,
2238 const StateValue &val,
2239 const StateValue &elem,
2240 vector<unsigned> &indices) {
2241 auto ty = type->getAsAggregateType();
2242 unsigned cur_idx = indices.back();
2243 indices.pop_back();
2244 vector<StateValue> vals;
2245 for (unsigned i = 0, e = ty->numElementsConst(); i < e; ++i) {
2246 if (ty->isPadding(i))
2247 continue;
2248
2249 auto v = ty->extract(val, i);
2250 if (i == cur_idx) {
2251 vals.emplace_back(indices.empty() ?
2252 elem :
2253 update_repack(&ty->getChild(i), v, elem, indices));
2254 } else {
2255 vals.emplace_back(std::move(v));
2256 }
2257 }
2258
2259 return ty->aggregateVals(vals);
2260}
2261
2262StateValue InsertValue::toSMT(State &s) const {
2263 auto &sv = s[*val];

Callers 1

toSMTMethod · 0.85

Calls 6

getAsAggregateTypeMethod · 0.80
numElementsConstMethod · 0.80
isPaddingMethod · 0.80
aggregateValsMethod · 0.80
extractMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected