LLVM 22.0.0git
llvm::DemandedBits Class Reference

#include "llvm/Analysis/DemandedBits.h"

Public Member Functions

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

Static Public Member Functions

static LLVM_ABI 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 LLVM_ABI 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 41 of file DemandedBits.h.

Constructor & Destructor Documentation

◆ DemandedBits()

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

Definition at line 43 of file DemandedBits.h.

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 620 of file DemandedBits.cpp.

References determineLiveOperandBitsAddCarry().

◆ 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 628 of file DemandedBits.cpp.

References determineLiveOperandBitsAddCarry(), llvm::KnownBits::One, 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 467 of file DemandedBits.cpp.

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

Referenced by getDemandedBits(), and print().

◆ getDemandedBits() [2/2]

APInt DemandedBits::getDemandedBits ( Use * U)

Return the bits demanded from use U.

Definition at line 478 of file DemandedBits.cpp.

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

◆ isInstructionDead()

bool DemandedBits::isInstructionDead ( Instruction * I)

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

Definition at line 505 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 511 of file DemandedBits.cpp.

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

Referenced by getDemandedBits().

◆ print()

void DemandedBits::print ( raw_ostream & OS)

Definition at line 536 of file DemandedBits.cpp.

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


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