LLVM 24.0.0git
llvm::sandboxir::Utils Class Reference

#include "llvm/SandboxIR/Utils.h"

Static Public Member Functions

static Type * getExpectedType (const Value *V)
 \Returns the expected type of Value V.
static Value * getExpectedValue (const Instruction *I)
 \Returns the expected Value for this instruction.
template<typename LoadOrStoreT>
static Value * getMemInstructionBase (const LoadOrStoreT *LSI)
 \Returns the base Value for load or store instruction LSI.
static unsigned getNumBits (Type *Ty, const DataLayout &DL)
 \Returns the number of bits of Ty.
static unsigned getNumBits (Value *V, const DataLayout &DL)
 \Returns the number of bits required to represent the operands or return value of V in DL.
static unsigned getNumBits (Instruction *I)
 \Returns the number of bits required to represent the operands or return value of I.
static std::optional< llvm::MemoryLocation > memoryLocationGetOrNone (const Instruction *I)
 Equivalent to MemoryLocation::getOrNone(I).
template<typename LoadOrStoreT>
static std::optional< int > getPointerDiffInBytes (LoadOrStoreT *I0, LoadOrStoreT *I1, ScalarEvolution &SE)
 \Returns the gap between the memory locations accessed by I0 and I1 in bytes.
template<typename LoadOrStoreT>
static std::optional< bool > atLowerAddress (LoadOrStoreT *I0, LoadOrStoreT *I1, ScalarEvolution &SE)
 \Returns true if I0 accesses a memory location lower than I1.
static ModRefInfo aliasAnalysisGetModRefInfo (BatchAAResults &BatchAA, const Instruction *I, const std::optional< MemoryLocation > &OptLoc)
 Equivalent to BatchAA::getModRefInfo().
static bool verifyFunction (const Function *F, raw_ostream &OS)
 Equivalent to llvm::verifyFunction().
static bool TTIAllowsMisalignedMemoryAccesses (TargetTransformInfo &TTI, Context &Ctx, unsigned BitWidth, unsigned AddressSpace=0, Align Alignment=Align(1), unsigned *Fast=nullptr)

Detailed Description

Definition at line 28 of file Utils.h.

Member Function Documentation

◆ aliasAnalysisGetModRefInfo()

ModRefInfo llvm::sandboxir::Utils::aliasAnalysisGetModRefInfo ( BatchAAResults & BatchAA,
const Instruction * I,
const std::optional< MemoryLocation > & OptLoc )
inlinestatic

Equivalent to BatchAA::getModRefInfo().

Definition at line 125 of file Utils.h.

References llvm::cast(), llvm::BatchAAResults::getModRefInfo(), and I.

◆ atLowerAddress()

template<typename LoadOrStoreT>
std::optional< bool > llvm::sandboxir::Utils::atLowerAddress ( LoadOrStoreT * I0,
LoadOrStoreT * I1,
ScalarEvolution & SE )
inlinestatic

\Returns true if I0 accesses a memory location lower than I1.

Returns false if the memory locations are equal, or if I1 accesses a memory location greater than I0. Returns nullopt if the difference cannot be determined.

Definition at line 115 of file Utils.h.

References getPointerDiffInBytes().

Referenced by llvm::sandboxir::MemSeedBundle< sandboxir::StoreInst >::MemSeedBundle(), and llvm::sandboxir::MemSeedBundle< sandboxir::StoreInst >::tryInsert().

◆ getExpectedType()

◆ getExpectedValue()

Value * llvm::sandboxir::Utils::getExpectedValue ( const Instruction * I)
inlinestatic

\Returns the expected Value for this instruction.

For most instructions, this is the instruction itself, but for stores returns the stored operand, and for ReturnInstructions returns the returned value.

Definition at line 48 of file Utils.h.

References llvm::dyn_cast(), and I.

Referenced by getExpectedType().

◆ getMemInstructionBase()

template<typename LoadOrStoreT>
Value * llvm::sandboxir::Utils::getMemInstructionBase ( const LoadOrStoreT * LSI)
inlinestatic

\Returns the base Value for load or store instruction LSI.

Definition at line 58 of file Utils.h.

References llvm::sandboxir::Value::Ctx, llvm::sandboxir::Context::getOrCreateValue(), and llvm::getUnderlyingObject().

◆ getNumBits() [1/3]

unsigned llvm::sandboxir::Utils::getNumBits ( Instruction * I)
inlinestatic

\Returns the number of bits required to represent the operands or return value of I.

Definition at line 80 of file Utils.h.

References getExpectedType(), and I.

◆ getNumBits() [2/3]

◆ getNumBits() [3/3]

unsigned llvm::sandboxir::Utils::getNumBits ( Value * V,
const DataLayout & DL )
inlinestatic

\Returns the number of bits required to represent the operands or return value of V in DL.

Definition at line 73 of file Utils.h.

References DL, getExpectedType(), and getNumBits().

◆ getPointerDiffInBytes()

template<typename LoadOrStoreT>
std::optional< int > llvm::sandboxir::Utils::getPointerDiffInBytes ( LoadOrStoreT * I0,
LoadOrStoreT * I1,
ScalarEvolution & SE )
inlinestatic

\Returns the gap between the memory locations accessed by I0 and I1 in bytes.

Returns nullopt if the gap can't be determined.

Definition at line 93 of file Utils.h.

References llvm::ScalarEvolution::getContext(), llvm::Type::getInt8Ty(), llvm::getPointersDiff(), and llvm::getUnderlyingObject().

Referenced by llvm::sandboxir::VecUtils::areConsecutive(), atLowerAddress(), and llvm::sandboxir::MemSeedBundle< sandboxir::StoreInst >::tryInsert().

◆ memoryLocationGetOrNone()

std::optional< llvm::MemoryLocation > llvm::sandboxir::Utils::memoryLocationGetOrNone ( const Instruction * I)
inlinestatic

Equivalent to MemoryLocation::getOrNone(I).

Definition at line 86 of file Utils.h.

References llvm::cast(), llvm::MemoryLocation::getOrNone(), and I.

◆ TTIAllowsMisalignedMemoryAccesses()

bool llvm::sandboxir::Utils::TTIAllowsMisalignedMemoryAccesses ( TargetTransformInfo & TTI,
Context & Ctx,
unsigned BitWidth,
unsigned AddressSpace = 0,
Align Alignment = Align(1),
unsigned * Fast = nullptr )
inlinestatic

Definition at line 137 of file Utils.h.

References llvm::BitWidth, and llvm::Fast.

Referenced by llvm::sandboxir::LegalityAnalysis::isAlignmentSupported().

◆ verifyFunction()

bool llvm::sandboxir::Utils::verifyFunction ( const Function * F,
raw_ostream & OS )
inlinestatic

Equivalent to llvm::verifyFunction().

\Returns true if the IR is broken.

Definition at line 132 of file Utils.h.

References llvm::cast(), F, and llvm::verifyFunction().


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