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

Method getBlockBaseAddress

ir/pointer.cpp:289–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289expr Pointer::getBlockBaseAddress(bool simplify) const {
290 assert(Memory::observesAddresses());
291
292 auto bid = getShortBid();
293 auto zero = expr::mkUInt(0, bits_ptr_address - hasLocalBit());
294 // fast path for null ptrs
295 auto non_local
296 = simplify && bid.isZero() && has_null_block ?
297 zero : expr::mkUF("blk_addr", { bid }, zero);
298 // Non-local block area is the lower half
299 if (hasLocalBit())
300 non_local = expr::mkUInt(0, 1).concat(non_local);
301
302 if (auto local = m.local_blk_addr(bid)) {
303 // Local block area is the upper half of the memory
304 expr lc = hasLocalBit() ? expr::mkUInt(1, 1).concat(*local) : *local;
305 return expr::mkIf(isLocal(), lc, non_local);
306 } else
307 return non_local;
308}
309
310expr Pointer::getLogAddress(bool simplify) const {
311 return getBlockBaseAddress(simplify)

Callers

nothing calls this directly

Calls 2

isZeroMethod · 0.45
concatMethod · 0.45

Tested by

no test coverage detected