Represents the size of a MemoryLocation.

Synopsis

Declared in <llvm/Analysis/MemoryLocation.h>

class LocationSize;

Description

Logically, this is an std::optional<uint63_t> that also records whether the stored size N is precise. A precise size means the referenced storage is exactly N bytes. An imprecise size is an upper bound formed by unioning precise sizes and may conservatively over‐approximate the accessed range.

For example, (%p, 4) is precise for store i32 0, i32* %p because %p must refer to at least four bytes. The same size is imprecise at a memcpy whose length is select i1 %foo, i64 1, i64 4 because at most four bytes are copied but the actual amount is unknown.

Pathologically large values degrade to std::nullopt. Bit 62 of the internal representation records scalable size information needed for alias analysis on scalable quantities.

Member Functions

Name

Description

getValue

Return the stored size as a TypeSize.

hasValue

Return true if this size has a known numeric value.

isPrecise

Return true if this size is precise (and therefore not unknown).

isScalable

Return true if this size is scalable.

isZero

Return true if this LocationSize's value is zero.

mayBeBeforePointer

Whether accesses before the base pointer are possible.

print

Print a human‐readable representation of this size to OS.

toRaw

Return an opaque value that represents this LocationSize.

unionWith

Return a LocationSize that can correctly represent either *this or Other.

operator==

Equality operators

operator!=

Inequality operators

Static Member Functions

Name

Description

afterPointer

Any location after the base pointer (but still within the underlying object).

beforeOrAfterPointer

Any location before or after the base pointer (but still within the underlying object).

mapEmpty

Sentinel value used as the DenseMap empty key.

mapTombstone

Sentinel value used as the DenseMap tombstone key.

precise

precise overloads

upperBound

upperBound overloads

Created with MrDocs