aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/include/llvm/Analysis/MemoryLocation.h
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/include/llvm/Analysis/MemoryLocation.h
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/Analysis/MemoryLocation.h')
-rw-r--r--contrib/libs/llvm12/include/llvm/Analysis/MemoryLocation.h104
1 files changed, 52 insertions, 52 deletions
diff --git a/contrib/libs/llvm12/include/llvm/Analysis/MemoryLocation.h b/contrib/libs/llvm12/include/llvm/Analysis/MemoryLocation.h
index 331bbb7515..b4cc30b572 100644
--- a/contrib/libs/llvm12/include/llvm/Analysis/MemoryLocation.h
+++ b/contrib/libs/llvm12/include/llvm/Analysis/MemoryLocation.h
@@ -71,10 +71,10 @@ class VAArgInst;
// None.
class LocationSize {
enum : uint64_t {
- BeforeOrAfterPointer = ~uint64_t(0),
- AfterPointer = BeforeOrAfterPointer - 1,
- MapEmpty = BeforeOrAfterPointer - 2,
- MapTombstone = BeforeOrAfterPointer - 3,
+ BeforeOrAfterPointer = ~uint64_t(0),
+ AfterPointer = BeforeOrAfterPointer - 1,
+ MapEmpty = BeforeOrAfterPointer - 2,
+ MapTombstone = BeforeOrAfterPointer - 3,
ImpreciseBit = uint64_t(1) << 63,
// The maximum value we can represent without falling back to 'unknown'.
@@ -89,11 +89,11 @@ class LocationSize {
constexpr LocationSize(uint64_t Raw, DirectConstruction): Value(Raw) {}
- static_assert(AfterPointer & ImpreciseBit,
- "AfterPointer is imprecise by definition.");
- static_assert(BeforeOrAfterPointer & ImpreciseBit,
- "BeforeOrAfterPointer is imprecise by definition.");
-
+ static_assert(AfterPointer & ImpreciseBit,
+ "AfterPointer is imprecise by definition.");
+ static_assert(BeforeOrAfterPointer & ImpreciseBit,
+ "BeforeOrAfterPointer is imprecise by definition.");
+
public:
// FIXME: Migrate all users to construct via either `precise` or `upperBound`,
// to make it more obvious at the callsite the kind of size that they're
@@ -102,12 +102,12 @@ public:
// Since the overwhelming majority of users of this provide precise values,
// this assumes the provided value is precise.
constexpr LocationSize(uint64_t Raw)
- : Value(Raw > MaxValue ? AfterPointer : Raw) {}
+ : Value(Raw > MaxValue ? AfterPointer : Raw) {}
static LocationSize precise(uint64_t Value) { return LocationSize(Value); }
static LocationSize precise(TypeSize Value) {
if (Value.isScalable())
- return afterPointer();
+ return afterPointer();
return precise(Value.getFixedSize());
}
@@ -116,27 +116,27 @@ public:
if (LLVM_UNLIKELY(Value == 0))
return precise(0);
if (LLVM_UNLIKELY(Value > MaxValue))
- return afterPointer();
+ return afterPointer();
return LocationSize(Value | ImpreciseBit, Direct);
}
static LocationSize upperBound(TypeSize Value) {
if (Value.isScalable())
- return afterPointer();
+ return afterPointer();
return upperBound(Value.getFixedSize());
}
- /// Any location after the base pointer (but still within the underlying
- /// object).
- constexpr static LocationSize afterPointer() {
- return LocationSize(AfterPointer, Direct);
- }
-
- /// Any location before or after the base pointer (but still within the
- /// underlying object).
- constexpr static LocationSize beforeOrAfterPointer() {
- return LocationSize(BeforeOrAfterPointer, Direct);
+ /// Any location after the base pointer (but still within the underlying
+ /// object).
+ constexpr static LocationSize afterPointer() {
+ return LocationSize(AfterPointer, Direct);
}
+ /// Any location before or after the base pointer (but still within the
+ /// underlying object).
+ constexpr static LocationSize beforeOrAfterPointer() {
+ return LocationSize(BeforeOrAfterPointer, Direct);
+ }
+
// Sentinel values, generally used for maps.
constexpr static LocationSize mapTombstone() {
return LocationSize(MapTombstone, Direct);
@@ -151,24 +151,24 @@ public:
if (Other == *this)
return *this;
- if (Value == BeforeOrAfterPointer || Other.Value == BeforeOrAfterPointer)
- return beforeOrAfterPointer();
- if (Value == AfterPointer || Other.Value == AfterPointer)
- return afterPointer();
+ if (Value == BeforeOrAfterPointer || Other.Value == BeforeOrAfterPointer)
+ return beforeOrAfterPointer();
+ if (Value == AfterPointer || Other.Value == AfterPointer)
+ return afterPointer();
return upperBound(std::max(getValue(), Other.getValue()));
}
- bool hasValue() const {
- return Value != AfterPointer && Value != BeforeOrAfterPointer;
- }
+ bool hasValue() const {
+ return Value != AfterPointer && Value != BeforeOrAfterPointer;
+ }
uint64_t getValue() const {
assert(hasValue() && "Getting value from an unknown LocationSize!");
return Value & ~ImpreciseBit;
}
// Returns whether or not this value is precise. Note that if a value is
- // precise, it's guaranteed to not be unknown.
+ // precise, it's guaranteed to not be unknown.
bool isPrecise() const {
return (Value & ImpreciseBit) == 0;
}
@@ -176,9 +176,9 @@ public:
// Convenience method to check if this LocationSize's value is 0.
bool isZero() const { return hasValue() && getValue() == 0; }
- /// Whether accesses before the base pointer are possible.
- bool mayBeBeforePointer() const { return Value == BeforeOrAfterPointer; }
-
+ /// Whether accesses before the base pointer are possible.
+ bool mayBeBeforePointer() const { return Value == BeforeOrAfterPointer; }
+
bool operator==(const LocationSize &Other) const {
return Value == Other.Value;
}
@@ -269,30 +269,30 @@ public:
return getForArgument(Call, ArgIdx, &TLI);
}
- /// Return a location that may access any location after Ptr, while remaining
- /// within the underlying object.
- static MemoryLocation getAfter(const Value *Ptr,
- const AAMDNodes &AATags = AAMDNodes()) {
- return MemoryLocation(Ptr, LocationSize::afterPointer(), AATags);
- }
-
- /// Return a location that may access any location before or after Ptr, while
- /// remaining within the underlying object.
- static MemoryLocation
- getBeforeOrAfter(const Value *Ptr, const AAMDNodes &AATags = AAMDNodes()) {
- return MemoryLocation(Ptr, LocationSize::beforeOrAfterPointer(), AATags);
- }
-
+ /// Return a location that may access any location after Ptr, while remaining
+ /// within the underlying object.
+ static MemoryLocation getAfter(const Value *Ptr,
+ const AAMDNodes &AATags = AAMDNodes()) {
+ return MemoryLocation(Ptr, LocationSize::afterPointer(), AATags);
+ }
+
+ /// Return a location that may access any location before or after Ptr, while
+ /// remaining within the underlying object.
+ static MemoryLocation
+ getBeforeOrAfter(const Value *Ptr, const AAMDNodes &AATags = AAMDNodes()) {
+ return MemoryLocation(Ptr, LocationSize::beforeOrAfterPointer(), AATags);
+ }
+
// Return the exact size if the exact size is known at compiletime,
// otherwise return MemoryLocation::UnknownSize.
static uint64_t getSizeOrUnknown(const TypeSize &T) {
return T.isScalable() ? UnknownSize : T.getFixedSize();
}
- MemoryLocation()
- : Ptr(nullptr), Size(LocationSize::beforeOrAfterPointer()), AATags() {}
-
- explicit MemoryLocation(const Value *Ptr, LocationSize Size,
+ MemoryLocation()
+ : Ptr(nullptr), Size(LocationSize::beforeOrAfterPointer()), AATags() {}
+
+ explicit MemoryLocation(const Value *Ptr, LocationSize Size,
const AAMDNodes &AATags = AAMDNodes())
: Ptr(Ptr), Size(Size), AATags(AATags) {}