LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::DemandedBits Class Reference

#include "llvm/Analysis/DemandedBits.h"

Public Member Functions

 DemandedBits (Function &F, AssumptionCache &AC, DominatorTree &DT)
 
APInt getDemandedBits (Instruction *I)
 Return the bits demanded from instruction I.
 
APInt getDemandedBits (Use *U)
 Return the bits demanded from use U.
 
bool isInstructionDead (Instruction *I)
 Return true if, during analysis, I could not be reached.
 
bool isUseDead (Use *U)
 Return whether this use is dead by means of not having any demanded bits.
 
void print (raw_ostream &OS)
 

Static Public Member Functions

static APInt determineLiveOperandBitsAdd (unsigned OperandNo, const APInt &AOut, const KnownBits &LHS, const KnownBits &RHS)
 Compute alive bits of one addition operand from alive output and known operand bits.
 
static APInt determineLiveOperandBitsSub (unsigned OperandNo, const APInt &AOut, const KnownBits &LHS, const KnownBits &RHS)
 Compute alive bits of one subtraction operand from alive output and known operand bits.
 

Detailed Description

Definition at line 40 of file DemandedBits.h.

Constructor & Destructor Documentation

◆ DemandedBits()

llvm::DemandedBits::DemandedBits ( Function F,
AssumptionCache AC,
DominatorTree DT 
)
inline

Definition at line 42 of file DemandedBits.h.

References F.

Member Function Documentation

◆ determineLiveOperandBitsAdd()

APInt DemandedBits::determineLiveOperandBitsAdd ( unsigned  OperandNo,
const APInt AOut,
const KnownBits LHS,
const KnownBits RHS 
)
static

Compute alive bits of one addition operand from alive output and known operand bits.

Definition at line 553 of file DemandedBits.cpp.

References determineLiveOperandBitsAddCarry(), LHS, and RHS.

◆ determineLiveOperandBitsSub()

APInt DemandedBits::determineLiveOperandBitsSub ( unsigned  OperandNo,
const APInt AOut,
const KnownBits LHS,
const KnownBits RHS 
)
static

Compute alive bits of one subtraction operand from alive output and known operand bits.

Definition at line 561 of file DemandedBits.cpp.

References determineLiveOperandBitsAddCarry(), LHS, llvm::KnownBits::One, RHS, and llvm::KnownBits::Zero.

◆ getDemandedBits() [1/2]

APInt DemandedBits::getDemandedBits ( Instruction I)

Return the bits demanded from instruction I.

For vector instructions individual vector elements are not distinguished: A bit is demanded if it is demanded for any of the vector elements. The size of the return value corresponds to the type size in bits of the scalar type.

Instructions that do not have integer or vector of integer type are accepted, but will always produce a mask with all bits set.

Definition at line 400 of file DemandedBits.cpp.

References DL, llvm::APInt::getAllOnes(), and I.

Referenced by llvm::slpvectorizer::BoUpSLP::computeMinimumValueSizes(), getDemandedBits(), and print().

◆ getDemandedBits() [2/2]

APInt DemandedBits::getDemandedBits ( Use U)

Return the bits demanded from use U.

Definition at line 411 of file DemandedBits.cpp.

References llvm::BitWidth, DL, llvm::APInt::getAllOnes(), llvm::Instruction::getDataLayout(), getDemandedBits(), and isUseDead().

◆ isInstructionDead()

bool DemandedBits::isInstructionDead ( Instruction I)

Return true if, during analysis, I could not be reached.

Definition at line 438 of file DemandedBits.cpp.

References I, and isAlwaysLive().

◆ isUseDead()

bool DemandedBits::isUseDead ( Use U)

Return whether this use is dead by means of not having any demanded bits.

Definition at line 444 of file DemandedBits.cpp.

References llvm::Value::getType(), isAlwaysLive(), and llvm::Type::isIntOrIntVectorTy().

Referenced by getDemandedBits().

◆ print()

void DemandedBits::print ( raw_ostream OS)

Definition at line 469 of file DemandedBits.cpp.

References A, getDemandedBits(), llvm::Value::getName(), I, OS, and llvm::Twine::utohexstr().


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