LLVM 24.0.0git
Value.h
Go to the documentation of this file.
1//===--- Value.h - Value Representation for llubi ---------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_TOOLS_LLUBI_VALUE_H
10#define LLVM_TOOLS_LLUBI_VALUE_H
11
12#include "llvm/ADT/APFloat.h"
13#include "llvm/ADT/APInt.h"
15#include "llvm/IR/DataLayout.h"
16#include "llvm/IR/Type.h"
19
20namespace llvm::ubi {
21
22class MemoryObject;
23class Context;
24class AnyValue;
25
26/// Representation of a byte in memory.
27/// How to interpret the byte per bit:
28/// - If the concrete mask bit is 0, the bit is either undef or poison. The
29/// value bit indicates whether it is undef.
30/// - If the concrete mask bit is 1, the bit is a concrete value. The value bit
31/// stores the concrete bit value. The tag mask bit indicates whether it is a
32/// pointer bit, and the tag value bit is used for provenance tracking of
33/// pointers.
34///
35/// Note that the idealized interpreter would store a full pointer tag for every
36/// single pointer bit, as well as the position of that bit in the pointer. The
37/// provenance is preserved as the bit is copied around, and when a sequence of
38/// bytes is eventually converted back to a pointer, all bits must be in the
39/// original order and have the same provenance. However, that would be
40/// prohibitively expensive. So instead, we rely on randomized ptr-sized tags.
41/// This means that if bits get reordered, or if bits from different pointers
42/// get mixed, then the result is unlikely to be a valid tag.
43struct Byte {
46 uint8_t TagMask; // A mask to indicate which bits are pointer bits.
47 uint8_t TagValue; // For each pointer bit, the corresponding bit of the tag
48 // for provenance tracking.
49
50 static Byte poison() { return Byte{0, 0, 0, 0}; }
51 static Byte undef() { return Byte{0, 255, 0, 0}; }
52 static Byte concrete(uint8_t Val) { return Byte{255, Val, 0, 0}; }
53
54 void zeroBits(uint8_t Mask) {
55 ConcreteMask |= Mask;
56 Value &= ~Mask;
57 TagMask &= ~Mask;
58 }
59
60 void poisonBits(uint8_t Mask) {
61 ConcreteMask &= ~Mask;
62 Value &= ~Mask;
63 TagMask &= ~Mask;
64 }
65
66 void undefBits(uint8_t Mask) {
67 ConcreteMask &= ~Mask;
68 Value |= Mask;
69 TagMask &= ~Mask;
70 }
71
72 void writeBits(uint8_t Mask, uint8_t Val) {
73 ConcreteMask |= Mask;
74 Value = (Value & ~Mask) | (Val & Mask);
75 TagMask &= ~Mask;
76 }
77
79 assert(
80 (ConcreteMask & Mask) == Mask &&
81 "Please ensure pointer bits are concrete before calling writeTagBits.");
82 TagMask |= Mask;
83 TagValue = (TagValue & ~Mask) | (Tag & Mask);
84 }
85
86 void writeByte(uint8_t Mask, const Byte &RHS) {
87 ConcreteMask = (ConcreteMask & ~Mask) | (RHS.ConcreteMask & Mask);
88 Value = (Value & ~Mask) | (RHS.Value & Mask);
89 TagMask = (TagMask & ~Mask) | (RHS.TagMask & Mask);
90 TagValue = (TagValue & ~Mask) | (RHS.TagValue & Mask);
91 }
92
93 /// Returns a logical byte that is part of two adjacent bytes.
94 /// Example with ShAmt = 5:
95 /// | Low | High |
96 /// LSB | 0 1 0 1 0 1 0 1 | 0 0 0 0 1 1 1 1 | MSB
97 /// Result = | 1 0 1 0 0 0 0 1 |
98 static Byte fshr(const Byte &Low, const Byte &High, uint32_t ShAmt) {
99 return Byte{
100 static_cast<uint8_t>((Low.ConcreteMask | (High.ConcreteMask << 8)) >>
101 ShAmt),
102 static_cast<uint8_t>((Low.Value | (High.Value << 8)) >> ShAmt),
103 static_cast<uint8_t>((Low.TagMask | (High.TagMask << 8)) >> ShAmt),
104 static_cast<uint8_t>((Low.TagValue | (High.TagValue << 8)) >> ShAmt)};
105 }
106
107 Byte lshr(uint8_t Shift) const {
108 return Byte{static_cast<uint8_t>(ConcreteMask >> Shift),
109 static_cast<uint8_t>(Value >> Shift),
110 static_cast<uint8_t>(TagMask >> Shift),
111 static_cast<uint8_t>(TagValue >> Shift)};
112 }
113
114 Byte shl(uint8_t Shift) const {
115 return Byte{static_cast<uint8_t>(ConcreteMask << Shift),
116 static_cast<uint8_t>(Value << Shift),
117 static_cast<uint8_t>(TagMask << Shift),
118 static_cast<uint8_t>(TagValue << Shift)};
119 }
120
121 /// Padding bits may carry pointer provenance. Only require their value bits
122 /// to be concrete zero, or non-concrete for poison.
123 bool isCanonicalPaddingByte(uint8_t PaddingMask) const {
124 bool AreAllValueBitsPoison = (ConcreteMask & ~PaddingMask) == 0;
125 return (ConcreteMask & PaddingMask) ==
126 (AreAllValueBitsPoison ? 0 : PaddingMask) &&
127 (Value & PaddingMask) == 0;
128 }
129};
130
131enum class StorageKind {
137 None, // Placeholder for void type
138 Aggregate, // Struct, Array or Vector
139};
140
141/// Tri-state boolean value.
142enum class BooleanKind { False, True, Poison };
143
144/// A set of previously exposed provenances. It is originally yielded by
145/// inttoptr, and shared by pointers derived from the result.
146///
147/// Each capability check may invalidate some provenances. If we cannot
148/// pick one, it is UB. That is, from the angelic non-determinism view,
149/// we cannot pick a provenance to make the program reach this point.
150///
151/// For efficiency, this class has different forms in two stages:
152/// 1. Before any memory access is performed, ActiveMask is set to zero and
153/// Generation represents the global generation number of the snapshot.
154/// 2. After a memory access is performed, we can determine exactly one memory
155/// object to be accessed (address ranges are distinct). In this case,
156/// BaseAddress is set and ActiveMask is non-zero. ActiveMask represents the
157/// validity of the first N exposed provenances associated with the memory
158/// object. The bitwidth N is the number of provenances in the list with
159/// List[I].Generation <= WildcardProvenance::Generation (The generation field
160/// in the list is monotonically increasing). That is, we can only access
161/// through exposed provenances before inttoptr executes. Note that if
162/// ActiveMask becomes zero again, UB must be triggered.
163class WildcardProvenance : public RefCountedBase<WildcardProvenance> {
164 APInt ActiveMask;
165 union {
168 };
169
170 friend class Context;
171
172public:
174 : ActiveMask(), Generation(Generation) {}
175};
176
177/// Components of a pointer excluding address. They are shared between pointer
178/// values, as most of operations don't change the provenance.
179/// Each node will be assigned a unique, pointer-sized tag, which is used to
180/// represent the pointer in the memory.
181/// The provenance can be either concrete or wildcard, as determined by the
182/// cases below:
183/// Obj Wildcard State
184/// Null Null Invalid
185/// Null NonNull Wildcard
186/// NonNull Null Concrete
187/// NonNull NonNull Wildcard (associated with a specific MO)
188class Provenance : public RefCountedBase<Provenance> {
189 // TODO: store reference to the provenance of the pointer it is derived from
190
191 // The underlying memory object. It can be null for invalid or dangling
192 // pointers. Besides, for pointers with wildcard provenance, it can be null
193 // until the memory object is resolved by gep inbounds.
195
196 // A tag is a randomly generated unique identifier to recover the provenance
197 // of a pointer. The length of tag is equal to the store size of the pointer
198 // type, in bits. It may produce false negatives in some corner cases. But in
199 // real practice the false negative rate should be negligible.
200 // A zero tag is invalid.
201 APInt Tag;
202
203 // Null if it is concrete.
205
206 // TODO: modeling nofree
207 // TODO: modeling captures
208 // TODO: modeling inrange(Start, End) attribute
209
210 const APInt &getTag() const { return Tag; }
211 void setTag(const APInt &T) { Tag = T; }
212
213 friend class Context;
214
215public:
220 MemoryObject *getMemoryObject() const { return Obj.get(); }
221 bool isWildcard() const { return Wildcard != nullptr; }
222};
223
224class Pointer {
225 // The provenance of the pointer.
227 // The address of the pointer. The bit width is determined by
228 // DataLayout::getPointerSizeInBits.
229 APInt Address;
230
231public:
232 explicit Pointer(const APInt &Address)
233 : Prov(Provenance::nullary()), Address(Address) {}
234 explicit Pointer(IntrusiveRefCntPtr<Provenance> Prov, const APInt &Address)
235 : Prov(std::move(Prov)), Address(Address) {
236 assert(this->Prov && "Invalid provenance.");
237 }
238 Pointer getWithNewAddr(const APInt &NewAddr) const {
239 return Pointer(Prov, NewAddr);
240 }
242 return Pointer(NewProv, Address);
243 }
244 LLVM_ABI static AnyValue null(unsigned AS, const DataLayout &DL);
245 LLVM_ABI bool isNullPtr(unsigned AS, const DataLayout &DL) const;
246 LLVM_ABI void print(raw_ostream &OS) const;
247 const APInt &address() const { return Address; }
248 Provenance &provenance() const { return *Prov; }
249};
250
251/// Represents a scalar byte value. If the value is not byte-sized, the padding
252/// bits are guaranteed to be filled by either poison/zero bits.
253///
254/// Byte values do not contain undef bits. The only exception is
255/// Context::fromBytes, which converts undef bits into poison bits after
256/// constructor.
258 // The byte order is endianness-dependent.
259 std::vector<Byte> Val;
260 uint32_t BitWidth : 31;
261 uint32_t IsLittleEndian : 1;
262
263public:
264 /// Specify how to treat the input.
265 enum class CanonicalizeMode {
266 // The padding byte is already canonical.
268 // Determine the padding bits from the non-padding bits in the padding
269 // byte.
271 // Set the padding byte to poison when it is non-canonical.
273 };
274
275 LLVM_ABI ByteValue(const APInt &V, bool IsLittleEndian);
276 ByteValue(uint32_t BitWidth, ArrayRef<Byte> Val, bool IsLittleEndian,
278 : ByteValue(BitWidth, std::vector<Byte>(Val), IsLittleEndian, Mode) {}
279 ByteValue(uint32_t BitWidth, std::vector<Byte> Val, bool IsLittleEndian,
281 : Val(std::move(Val)), BitWidth(BitWidth),
282 IsLittleEndian(IsLittleEndian) {
284 assert(isValid() && "Input padding bits must be canonical.");
285 else
287 }
288 ByteValue(const ByteValue &) = default;
289 ByteValue(ByteValue &&) = default;
290 ByteValue &operator=(const ByteValue &) = default;
292 ~ByteValue() = default;
293
294 LLVM_ABI static ByteValue zero(uint32_t BitWidth, bool IsLittleEndian);
295 LLVM_ABI static ByteValue poison(uint32_t BitWidth, bool IsLittleEndian);
296
297 uint32_t getBitWidth() const { return BitWidth; }
298 ArrayRef<Byte> bytes() const { return Val; }
299 /// The caller should call canonicalize after mutation.
301
302 /// Make sure the padding byte is canonical.
305 "Canonical padding bits should not be canonicalized.");
306 if ((BitWidth & 7) == 0)
307 return;
308 uint8_t Mask = static_cast<uint8_t>((~0U) << (BitWidth & 7));
309 Byte &MSB = (IsLittleEndian ? this->Val.back() : this->Val.front());
311 if (!MSB.isCanonicalPaddingByte(Mask))
312 MSB = Byte::poison();
313 } else {
314 if ((MSB.ConcreteMask & ~Mask) == 0)
315 MSB.poisonBits(Mask);
316 else
317 MSB.zeroBits(Mask);
318 }
319 assert(isValid() && "Padding bits must be canonical.");
320 }
321
322 bool isValid() const {
323 if ((BitWidth & 7) == 0)
324 return true;
325 uint8_t Mask = static_cast<uint8_t>((~0U) << (BitWidth & 7));
326 const Byte &MSB = (IsLittleEndian ? this->Val.back() : this->Val.front());
327 return MSB.isCanonicalPaddingByte(Mask);
328 }
329
330 LLVM_ABI void print(Context &Ctx, raw_ostream &OS) const;
331};
332
333// Value representation for actual values of LLVM values.
334// We don't model undef values here (except for byte types).
335class [[nodiscard]] AnyValue {
336 StorageKind Kind;
337 union {
342 std::vector<AnyValue> AggVal;
343 };
344
345 struct PoisonTag {};
346 LLVM_ABI void destroy();
347
348public:
350 explicit AnyValue(PoisonTag) : Kind(StorageKind::Poison) {}
351 AnyValue(APInt Val) : Kind(StorageKind::Integer), IntVal(std::move(Val)) {}
355 AnyValue(std::vector<AnyValue> Val)
356 : Kind(StorageKind::Aggregate), AggVal(std::move(Val)) {}
359 LLVM_ABI AnyValue &operator=(const AnyValue &);
360 LLVM_ABI AnyValue &operator=(AnyValue &&);
361 ~AnyValue() { destroy(); }
362
363 LLVM_ABI void print(Context &Ctx, raw_ostream &OS) const;
364
365 /// Use getPoisonValue unless you know the scalar type is integer/fp/ptr!
366 static AnyValue poison() { return AnyValue(PoisonTag{}); }
367 static AnyValue boolean(bool Val) { return AnyValue(APInt(1, Val)); }
368 LLVM_ABI static AnyValue getPoisonValue(Context &Ctx, Type *Ty);
369 LLVM_ABI static AnyValue getNullValue(Context &Ctx, Type *Ty);
370 LLVM_ABI static AnyValue getVectorSplat(const AnyValue &Scalar,
371 size_t NumElements);
372
373 bool isNone() const { return Kind == StorageKind::None; }
374 bool isPoison() const { return Kind == StorageKind::Poison; }
375 bool isInteger() const { return Kind == StorageKind::Integer; }
376 bool isFloat() const { return Kind == StorageKind::Float; }
377 bool isPointer() const { return Kind == StorageKind::Pointer; }
378 bool isByte() const { return Kind == StorageKind::Byte; }
379 bool isAggregate() const { return Kind == StorageKind::Aggregate; }
380
381 bool isCompatibleWith(Type *Ty) const {
382 switch (Kind) {
384 return Ty->isVoidTy();
386 return Ty->isFloatingPointTy() || Ty->isIntegerTy() || Ty->isPointerTy();
388 return Ty->isIntegerTy();
390 return Ty->isFloatingPointTy();
392 return Ty->isPointerTy();
394 return Ty->isByteTy();
395 // We don't check elements recursively.
397 return Ty->isAggregateType() || Ty->isVectorTy();
398 }
399 llvm_unreachable("Unhandled storage kind.");
400 }
401
402 const APInt &asInteger() const {
403 assert(Kind == StorageKind::Integer && "Expect an integer value");
404 return IntVal;
405 }
406
407 const APFloat &asFloat() const {
408 assert(Kind == StorageKind::Float && "Expect a float value");
409 return FloatVal;
410 }
411
412 const Pointer &asPointer() const {
413 assert(Kind == StorageKind::Pointer && "Expect a pointer value");
414 return PtrVal;
415 }
416
417 const ByteValue &asByte() const {
418 assert(Kind == StorageKind::Byte && "Expect a byte value");
419 return ByteVal;
420 }
421
423 assert(Kind == StorageKind::Byte && "Expect a byte value");
424 return ByteVal;
425 }
426
427 const std::vector<AnyValue> &asAggregate() const {
429 "Expect an aggregate/vector value");
430 return AggVal;
431 }
432
433 std::vector<AnyValue> &asAggregate() {
435 "Expect an aggregate/vector value");
436 return AggVal;
437 }
438
439 // Helper function for C++ 17 structured bindings.
440 template <size_t I> const AnyValue &get() const {
442 "Expect an aggregate/vector value");
443 assert(I < AggVal.size() && "Index out of bounds");
444 return AggVal[I];
445 }
446
448 if (isPoison())
449 return BooleanKind::Poison;
450 return asInteger().isZero() ? BooleanKind::False : BooleanKind::True;
451 }
452};
453
455 Context &Ctx;
456 raw_ostream &OS;
457
458public:
459 AnyValuePrinter(Context &Ctx, raw_ostream &OS) : Ctx(Ctx), OS(OS) {}
461 V.print(Ctx, OS);
462 return *this;
463 }
464 template <typename T> AnyValuePrinter &operator<<(const T &Val) {
465 OS << Val;
466 return *this;
467 }
468 operator raw_ostream &() { return OS; }
469};
470
472 P.print(OS);
473 return OS;
474}
475
476inline AnyValue addNoWrap(const APInt &LHS, const APInt &RHS, bool HasNSW,
477 bool HasNUW) {
478 APInt Res = LHS + RHS;
479 if (HasNUW && Res.ult(RHS))
480 return AnyValue::poison();
481 if (HasNSW && LHS.isNonNegative() == RHS.isNonNegative() &&
482 LHS.isNonNegative() != Res.isNonNegative())
483 return AnyValue::poison();
484 return Res;
485}
486
487inline AnyValue subNoWrap(const APInt &LHS, const APInt &RHS, bool HasNSW,
488 bool HasNUW) {
489 APInt Res = LHS - RHS;
490 if (HasNUW && Res.ugt(LHS))
491 return AnyValue::poison();
492 if (HasNSW && LHS.isNonNegative() != RHS.isNonNegative() &&
493 LHS.isNonNegative() != Res.isNonNegative())
494 return AnyValue::poison();
495 return Res;
496}
497
498inline AnyValue mulNoWrap(const APInt &LHS, const APInt &RHS, bool HasNSW,
499 bool HasNUW) {
500 bool Overflow = false;
501 APInt Res = LHS.smul_ov(RHS, Overflow);
502 if (HasNSW && Overflow)
503 return AnyValue::poison();
504 if (HasNUW) {
505 (void)LHS.umul_ov(RHS, Overflow);
506 if (Overflow)
507 return AnyValue::poison();
508 }
509 return Res;
510}
511
512} // namespace llvm::ubi
513
514#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t uint64_t
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements a class to represent arbitrary precision integral constant values and operations...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
#define LLVM_ABI
Definition Compiler.h:211
This file defines the RefCountedBase, ThreadSafeRefCountedBase, and IntrusiveRefCntPtr classes.
#define I(x, y, z)
Definition MD5.cpp:57
#define T
uint64_t High
#define P(N)
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
Value * RHS
Value * LHS
Class for arbitrary precision integers.
Definition APInt.h:78
bool ugt(const APInt &RHS) const
Unsigned greater than comparison.
Definition APInt.h:1186
bool ult(const APInt &RHS) const
Unsigned less than comparison.
Definition APInt.h:1115
bool isNonNegative() const
Determine if this APInt Value is non-negative (>= 0)
Definition APInt.h:330
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:294
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
AnyValuePrinter & operator<<(const AnyValue &V)
Definition Value.h:460
AnyValuePrinter(Context &Ctx, raw_ostream &OS)
Definition Value.h:459
AnyValuePrinter & operator<<(const T &Val)
Definition Value.h:464
const AnyValue & get() const
Definition Value.h:440
bool isPointer() const
Definition Value.h:377
AnyValue(APFloat Val)
Definition Value.h:352
bool isAggregate() const
Definition Value.h:379
static AnyValue poison()
Use getPoisonValue unless you know the scalar type is integer/fp/ptr!
Definition Value.h:366
AnyValue(Pointer Val)
Definition Value.h:353
AnyValue(APInt Val)
Definition Value.h:351
std::vector< AnyValue > & asAggregate()
Definition Value.h:433
static AnyValue boolean(bool Val)
Definition Value.h:367
bool isByte() const
Definition Value.h:378
std::vector< AnyValue > AggVal
Definition Value.h:342
AnyValue(PoisonTag)
Definition Value.h:350
bool isInteger() const
Definition Value.h:375
const Pointer & asPointer() const
Definition Value.h:412
bool isFloat() const
Definition Value.h:376
BooleanKind asBoolean() const
Definition Value.h:447
bool isNone() const
Definition Value.h:373
AnyValue(std::vector< AnyValue > Val)
Definition Value.h:355
const ByteValue & asByte() const
Definition Value.h:417
APFloat FloatVal
Definition Value.h:339
ByteValue & asMutableByte()
Definition Value.h:422
const APInt & asInteger() const
Definition Value.h:402
bool isCompatibleWith(Type *Ty) const
Definition Value.h:381
const APFloat & asFloat() const
Definition Value.h:407
ByteValue ByteVal
Definition Value.h:341
AnyValue(ByteValue Val)
Definition Value.h:354
bool isPoison() const
Definition Value.h:374
const std::vector< AnyValue > & asAggregate() const
Definition Value.h:427
Represents a scalar byte value.
Definition Value.h:257
static LLVM_ABI ByteValue poison(uint32_t BitWidth, bool IsLittleEndian)
Definition Value.cpp:344
ByteValue & operator=(const ByteValue &)=default
LLVM_ABI void print(Context &Ctx, raw_ostream &OS) const
Definition Value.cpp:350
ByteValue(ByteValue &&)=default
static LLVM_ABI ByteValue zero(uint32_t BitWidth, bool IsLittleEndian)
Definition Value.cpp:338
ByteValue(uint32_t BitWidth, std::vector< Byte > Val, bool IsLittleEndian, CanonicalizeMode Mode=CanonicalizeMode::Canonical)
Definition Value.h:279
MutableArrayRef< Byte > mutableBytes()
The caller should call canonicalize after mutation.
Definition Value.h:300
bool isValid() const
Definition Value.h:322
LLVM_ABI ByteValue(const APInt &V, bool IsLittleEndian)
Definition Value.cpp:330
uint32_t getBitWidth() const
Definition Value.h:297
ByteValue(uint32_t BitWidth, ArrayRef< Byte > Val, bool IsLittleEndian, CanonicalizeMode Mode=CanonicalizeMode::Canonical)
Definition Value.h:276
ByteValue(const ByteValue &)=default
ArrayRef< Byte > bytes() const
Definition Value.h:298
CanonicalizeMode
Specify how to treat the input.
Definition Value.h:265
void canonicalize(CanonicalizeMode Mode)
Make sure the padding byte is canonical.
Definition Value.h:303
ByteValue & operator=(ByteValue &&)=default
The global context for the interpreter.
Definition Context.h:227
const APInt & address() const
Definition Value.h:247
Pointer getWithNewAddr(const APInt &NewAddr) const
Definition Value.h:238
static LLVM_ABI AnyValue null(unsigned AS, const DataLayout &DL)
Definition Value.cpp:56
Pointer(const APInt &Address)
Definition Value.h:232
Provenance & provenance() const
Definition Value.h:248
Pointer getWithNewProvenance(IntrusiveRefCntPtr< Provenance > NewProv) const
Definition Value.h:241
Pointer(IntrusiveRefCntPtr< Provenance > Prov, const APInt &Address)
Definition Value.h:234
LLVM_ABI bool isNullPtr(unsigned AS, const DataLayout &DL) const
Definition Value.cpp:60
LLVM_ABI void print(raw_ostream &OS) const
Definition Value.cpp:34
Components of a pointer excluding address.
Definition Value.h:188
MemoryObject * getMemoryObject() const
Definition Value.h:220
Provenance(IntrusiveRefCntPtr< MemoryObject > Obj)
Definition Value.h:216
static LLVM_ABI IntrusiveRefCntPtr< Provenance > nullary()
Definition Value.cpp:19
LLVM_ABI IntrusiveRefCntPtr< Provenance > getWithKnownMemoryObject(MemoryObject &Obj)
Definition Value.cpp:26
bool isWildcard() const
Definition Value.h:221
friend class Context
Definition Value.h:213
WildcardProvenance(uint64_t Generation)
Definition Value.h:173
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
BooleanKind
Tri-state boolean value.
Definition Value.h:142
AnyValue addNoWrap(const APInt &LHS, const APInt &RHS, bool HasNSW, bool HasNUW)
Definition Value.h:476
StorageKind
Definition Value.h:131
AnyValue subNoWrap(const APInt &LHS, const APInt &RHS, bool HasNSW, bool HasNUW)
Definition Value.h:487
raw_ostream & operator<<(raw_ostream &OS, const Pointer &P)
Definition Value.h:471
AnyValue mulNoWrap(const APInt &LHS, const APInt &RHS, bool HasNSW, bool HasNUW)
Definition Value.h:498
@ Low
Lower the current thread's priority such that it does not affect foreground tasks significantly.
Definition Threading.h:280
@ Other
Any other memory.
Definition ModRef.h:68
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1933
LLVM_ABI std::optional< Register > getVectorSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI)
Definition Utils.cpp:1605
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:879
Representation of a byte in memory.
Definition Value.h:43
void writeBits(uint8_t Mask, uint8_t Val)
Definition Value.h:72
uint8_t Value
Definition Value.h:45
void writeTagBits(uint8_t Mask, uint8_t Tag)
Definition Value.h:78
void writeByte(uint8_t Mask, const Byte &RHS)
Definition Value.h:86
void undefBits(uint8_t Mask)
Definition Value.h:66
void poisonBits(uint8_t Mask)
Definition Value.h:60
static Byte undef()
Definition Value.h:51
static Byte poison()
Definition Value.h:50
static Byte concrete(uint8_t Val)
Definition Value.h:52
uint8_t ConcreteMask
Definition Value.h:44
Byte lshr(uint8_t Shift) const
Definition Value.h:107
Byte shl(uint8_t Shift) const
Definition Value.h:114
static Byte fshr(const Byte &Low, const Byte &High, uint32_t ShAmt)
Returns a logical byte that is part of two adjacent bytes.
Definition Value.h:98
void zeroBits(uint8_t Mask)
Definition Value.h:54
uint8_t TagValue
Definition Value.h:47
bool isCanonicalPaddingByte(uint8_t PaddingMask) const
Padding bits may carry pointer provenance.
Definition Value.h:123
uint8_t TagMask
Definition Value.h:46