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

Function eq_except_padding

ir/state.cpp:345–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345static expr eq_except_padding(const Memory &m, const Type &ty, const expr &e1,
346 const expr &e2, bool ptr_compare) {
347 if (ptr_compare && ty.isPtrType())
348 return Pointer(m, e1) == Pointer(m, e2);
349
350 const auto *aty = ty.getAsAggregateType();
351 if (!aty)
352 return e1 == e2;
353
354 StateValue sv1{expr(e1), expr()};
355 StateValue sv2{expr(e2), expr()};
356 expr result = true;
357
358 for (unsigned i = 0; i < aty->numElementsConst(); ++i) {
359 if (aty->isPadding(i))
360 continue;
361
362 result &= eq_except_padding(m, aty->getChild(i), aty->extract(sv1, i).value,
363 aty->extract(sv2, i).value, ptr_compare);
364 }
365 return result;
366}
367
368expr State::strip_undef_and_add_ub(const Value &val, const expr &e,
369 bool ptr_compare) {

Callers 1

Calls 7

PointerClass · 0.85
isPtrTypeMethod · 0.80
getAsAggregateTypeMethod · 0.80
numElementsConstMethod · 0.80
isPaddingMethod · 0.80
exprClass · 0.70
extractMethod · 0.45

Tested by

no test coverage detected