LLVM 24.0.0git
llvm::ubi::Byte Struct Reference

Representation of a byte in memory. More...

#include "llvm/UBAwareInterpreter/Value.h"

Public Member Functions

void zeroBits (uint8_t Mask)
void poisonBits (uint8_t Mask)
void undefBits (uint8_t Mask)
void writeBits (uint8_t Mask, uint8_t Val)
void writeTagBits (uint8_t Mask, uint8_t Tag)
void writeByte (uint8_t Mask, const Byte &RHS)
Byte lshr (uint8_t Shift) const
Byte shl (uint8_t Shift) const
bool isCanonicalPaddingByte (uint8_t PaddingMask) const
 Padding bits may carry pointer provenance.

Static Public Member Functions

static Byte poison ()
static Byte undef ()
static Byte concrete (uint8_t Val)
static Byte fshr (const Byte &Low, const Byte &High, uint32_t ShAmt)
 Returns a logical byte that is part of two adjacent bytes.

Public Attributes

uint8_t ConcreteMask
uint8_t Value
uint8_t TagMask
uint8_t TagValue

Detailed Description

Representation of a byte in memory.

How to interpret the byte per bit:

  • If the concrete mask bit is 0, the bit is either undef or poison. The value bit indicates whether it is undef.
  • If the concrete mask bit is 1, the bit is a concrete value. The value bit stores the concrete bit value. The tag mask bit indicates whether it is a pointer bit, and the tag value bit is used for provenance tracking of pointers.

Note that the idealized interpreter would store a full pointer tag for every single pointer bit, as well as the position of that bit in the pointer. The provenance is preserved as the bit is copied around, and when a sequence of bytes is eventually converted back to a pointer, all bits must be in the original order and have the same provenance. However, that would be prohibitively expensive. So instead, we rely on randomized ptr-sized tags. This means that if bits get reordered, or if bits from different pointers get mixed, then the result is unlikely to be a valid tag.

Definition at line 43 of file Value.h.

Member Function Documentation

◆ concrete()

◆ fshr()

Byte llvm::ubi::Byte::fshr ( const Byte & Low,
const Byte & High,
uint32_t ShAmt )
inlinestatic

Returns a logical byte that is part of two adjacent bytes.

Example with ShAmt = 5: | Low | High | LSB | 0 1 0 1 0 1 0 1 | 0 0 0 0 1 1 1 1 | MSB Result = | 1 0 1 0 0 0 0 1 |

Definition at line 98 of file Value.h.

References High, and llvm::Low.

◆ isCanonicalPaddingByte()

bool llvm::ubi::Byte::isCanonicalPaddingByte ( uint8_t PaddingMask) const
inline

Padding bits may carry pointer provenance.

Only require their value bits to be concrete zero, or non-concrete for poison.

Definition at line 123 of file Value.h.

References ConcreteMask, and Value.

Referenced by llvm::ubi::ByteValue::canonicalize(), llvm::ubi::Context::fromBytes(), and llvm::ubi::ByteValue::isValid().

◆ lshr()

Byte llvm::ubi::Byte::lshr ( uint8_t Shift) const
inline

Definition at line 107 of file Value.h.

References ConcreteMask, TagMask, TagValue, and Value.

◆ poison()

◆ poisonBits()

void llvm::ubi::Byte::poisonBits ( uint8_t Mask)
inline

Definition at line 60 of file Value.h.

References ConcreteMask, TagMask, and Value.

Referenced by llvm::ubi::ByteValue::canonicalize(), and llvm::ubi::Context::toBytes().

◆ shl()

Byte llvm::ubi::Byte::shl ( uint8_t Shift) const
inline

Definition at line 114 of file Value.h.

References ConcreteMask, TagMask, TagValue, and Value.

◆ undef()

Byte llvm::ubi::Byte::undef ( )
inlinestatic

◆ undefBits()

void llvm::ubi::Byte::undefBits ( uint8_t Mask)
inline

Definition at line 66 of file Value.h.

References ConcreteMask, TagMask, and Value.

◆ writeBits()

void llvm::ubi::Byte::writeBits ( uint8_t Mask,
uint8_t Val )
inline

Definition at line 72 of file Value.h.

References ConcreteMask, TagMask, and Value.

◆ writeByte()

void llvm::ubi::Byte::writeByte ( uint8_t Mask,
const Byte & RHS )
inline

Definition at line 86 of file Value.h.

References ConcreteMask, RHS, TagMask, TagValue, and Value.

◆ writeTagBits()

void llvm::ubi::Byte::writeTagBits ( uint8_t Mask,
uint8_t Tag )
inline

Definition at line 78 of file Value.h.

References assert(), ConcreteMask, llvm::Tag, TagMask, and TagValue.

◆ zeroBits()

void llvm::ubi::Byte::zeroBits ( uint8_t Mask)
inline

Definition at line 54 of file Value.h.

References ConcreteMask, TagMask, and Value.

Referenced by llvm::ubi::ByteValue::canonicalize(), and llvm::ubi::Context::toBytes().

Member Data Documentation

◆ ConcreteMask

◆ TagMask

uint8_t llvm::ubi::Byte::TagMask

Definition at line 46 of file Value.h.

Referenced by lshr(), poisonBits(), shl(), undefBits(), writeBits(), writeByte(), writeTagBits(), and zeroBits().

◆ TagValue

uint8_t llvm::ubi::Byte::TagValue

Definition at line 47 of file Value.h.

Referenced by lshr(), shl(), writeByte(), and writeTagBits().

◆ Value

uint8_t llvm::ubi::Byte::Value

The documentation for this struct was generated from the following file: