| 2235 | } |
| 2236 | |
| 2237 | static 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 | |
| 2262 | StateValue InsertValue::toSMT(State &s) const { |
| 2263 | auto &sv = s[*val]; |
no test coverage detected