| 193 | } |
| 194 | |
| 195 | expr 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 | |
| 221 | expr Pointer::isConstGlobal() const { |
| 222 | auto bid = getShortBid(); |
no test coverage detected