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

Method data_type

ir/memory.cpp:1199–1225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1197}
1198
1199Memory::DataType Memory::data_type(const vector<pair<unsigned, expr>> &data,
1200 bool full_store) const {
1201 if (isAsmMode())
1202 return DATA_ANY;
1203
1204 unsigned ty = DATA_NONE;
1205 unsigned num_int_zeros = 0;
1206 for (auto &[idx, val] : data) {
1207 Byte byte(*this, expr(val));
1208 auto is_ptr = byte.isPtr();
1209 if (!is_ptr.isFalse())
1210 ty |= DATA_PTR;
1211 if (!is_ptr.isTrue()) {
1212 ty |= DATA_INT;
1213 num_int_zeros += !byte.isZero().isFalse();
1214 }
1215 if (ty == DATA_ANY)
1216 return DATA_ANY;
1217 }
1218
1219 // allow 0 -> nullptr conversion
1220 if ((full_store && num_int_zeros >= bits_program_pointer / bits_byte) ||
1221 (!full_store && num_int_zeros > 0)) {
1222 ty |= DATA_PTR;
1223 }
1224 return DataType(ty);
1225}
1226
1227void Memory::store(const Pointer &ptr,
1228 const vector<pair<unsigned, expr>> &data,

Callers

nothing calls this directly

Calls 6

DataTypeEnum · 0.85
isFalseMethod · 0.80
exprClass · 0.70
isPtrMethod · 0.45
isTrueMethod · 0.45
isZeroMethod · 0.45

Tested by

no test coverage detected