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

Method isLocal

ir/pointer.cpp:195–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195expr Pointer::isLocal(bool simplify) const {
196 if (m.numLocals() == 0)
197 return false;
198 if (m.numNonlocals() == 0)
199 return true;
200
201 auto bit = bits_for_bid - 1 + bits_for_offset + bits_for_ptrattrs;
202 expr local = p.extract(bit, bit);
203
204 if (simplify) {
205 switch (m.isInitialMemBlock(local, true)) {
206 case 0: break;
207 case 1: return false;
208 case 2:
209 // If no local escaped, pointers written to memory by a callee can't
210 // alias with a local pointer.
211 if (!m.hasEscapedLocals())
212 return false;
213 break;
214 default: UNREACHABLE();
215 }
216 }
217
218 return local == 1;
219}
220
221expr Pointer::isConstGlobal() const {
222 auto bid = getShortBid();

Callers 15

mkAxiomsMethod · 0.80
ensure_non_fncallmemFunction · 0.80
store_bvFunction · 0.80
valueToBytesFunction · 0.80
computeAliasingMethod · 0.80
accessMethod · 0.80
record_storeMethod · 0.80
mkNonlocalValAxiomsMethod · 0.80
mkFnRetMethod · 0.80
startLifetimeMethod · 0.80
loadMethod · 0.80

Calls 5

numLocalsMethod · 0.80
numNonlocalsMethod · 0.80
isInitialMemBlockMethod · 0.80
hasEscapedLocalsMethod · 0.80
extractMethod · 0.45

Tested by

no test coverage detected