LLVM 22.0.0git
llvm::AA::RangeTy Struct Reference

Helper to represent an access offset and size, with logic to deal with uncertainty and check for overlapping accesses. More...

#include "llvm/Transforms/IPO/Attributor.h"

Public Member Functions

 RangeTy (int64_t Offset, int64_t Size)
 RangeTy ()=default
bool offsetOrSizeAreUnknown () const
 Return true if offset or size are unknown.
bool offsetAndSizeAreUnknown () const
 Return true if offset and size are unknown, thus this is the default unknown object.
bool isUnassigned () const
 Return true if the offset and size are unassigned.
bool mayOverlap (const RangeTy &Range) const
 Return true if this offset and size pair might describe an address that overlaps with Range.
RangeTyoperator&= (const RangeTy &R)

Static Public Member Functions

static RangeTy getUnknown ()
static bool LessThan (const RangeTy &L, const RangeTy &R)
 Comparison for sorting ranges.

Public Attributes

int64_t Offset = Unassigned
int64_t Size = Unassigned

Static Public Attributes

static constexpr int64_t Unassigned = std::numeric_limits<int32_t>::min()
 Constants used to represent special offsets or sizes.
static constexpr int64_t Unknown = std::numeric_limits<int32_t>::max()

Detailed Description

Helper to represent an access offset and size, with logic to deal with uncertainty and check for overlapping accesses.

Definition at line 241 of file Attributor.h.

Constructor & Destructor Documentation

◆ RangeTy() [1/2]

llvm::AA::RangeTy::RangeTy ( int64_t Offset,
int64_t Size )
inline

Definition at line 245 of file Attributor.h.

References Offset, and Size.

Referenced by getUnknown(), LessThan(), mayOverlap(), and operator&=().

◆ RangeTy() [2/2]

llvm::AA::RangeTy::RangeTy ( )
default

Member Function Documentation

◆ getUnknown()

RangeTy llvm::AA::RangeTy::getUnknown ( )
inlinestatic

Definition at line 247 of file Attributor.h.

References RangeTy(), and Unknown.

Referenced by llvm::AAPointerInfo::RangeList::setUnknown().

◆ isUnassigned()

bool llvm::AA::RangeTy::isUnassigned ( ) const
inline

Return true if the offset and size are unassigned.

Definition at line 261 of file Attributor.h.

References assert(), Offset, Size, and Unassigned.

Referenced by operator&=().

◆ LessThan()

bool llvm::AA::RangeTy::LessThan ( const RangeTy & L,
const RangeTy & R )
inlinestatic

Comparison for sorting ranges.

Returns true if the offset of L is less than that of R. If the two offsets are same, compare the sizes instead.

Definition at line 305 of file Attributor.h.

References RangeTy().

Referenced by llvm::AAPointerInfo::RangeList::insert(), llvm::AAPointerInfo::RangeList::push_back(), and llvm::AAPointerInfo::RangeList::set_difference().

◆ mayOverlap()

bool llvm::AA::RangeTy::mayOverlap ( const RangeTy & Range) const
inline

Return true if this offset and size pair might describe an address that overlaps with Range.

Definition at line 269 of file Attributor.h.

References Offset, offsetOrSizeAreUnknown(), Range, RangeTy(), and Size.

◆ offsetAndSizeAreUnknown()

bool llvm::AA::RangeTy::offsetAndSizeAreUnknown ( ) const
inline

Return true if offset and size are unknown, thus this is the default unknown object.

Definition at line 256 of file Attributor.h.

References Offset, Size, and Unknown.

Referenced by operator&=().

◆ offsetOrSizeAreUnknown()

bool llvm::AA::RangeTy::offsetOrSizeAreUnknown ( ) const
inline

Return true if offset or size are unknown.

Definition at line 250 of file Attributor.h.

References Offset, Size, and Unknown.

Referenced by llvm::AA::getInitialValueForObj(), and mayOverlap().

◆ operator&=()

RangeTy & llvm::AA::RangeTy::operator&= ( const RangeTy & R)
inline

Definition at line 279 of file Attributor.h.

References isUnassigned(), Offset, offsetAndSizeAreUnknown(), RangeTy(), Size, and Unknown.

Member Data Documentation

◆ Offset

◆ Size

int64_t llvm::AA::RangeTy::Size = Unassigned

◆ Unassigned

int64_t llvm::AA::RangeTy::Unassigned = std::numeric_limits<int32_t>::min()
staticconstexpr

Constants used to represent special offsets or sizes.

  • We cannot assume that Offsets and Size are non-negative.
  • The constants should not clash with DenseMapInfo, such as EmptyKey (INT64_MAX) and TombstoneKey (INT64_MIN). We use values "in the middle" of the 64 bit range to represent these special cases.

Definition at line 319 of file Attributor.h.

Referenced by isUnassigned().

◆ Unknown

int64_t llvm::AA::RangeTy::Unknown = std::numeric_limits<int32_t>::max()
staticconstexpr

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