LLVM  14.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. More...
 
APInt getDemandedBits (Use *U)
 Return the bits demanded from use U. More...
 
bool isInstructionDead (Instruction *I)
 Return true if, during analysis, I could not be reached. More...
 
bool isUseDead (Use *U)
 Return whether this use is dead by means of not having any demanded bits. More...
 
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. More...
 
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. More...
 

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 596 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 604 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 443 of file DemandedBits.cpp.

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

Referenced by bitTrackingDCE(), clearAssumptionsOfUsers(), llvm::computeMinimumValueSizes(), and computeRecurrenceType().

◆ getDemandedBits() [2/2]

APInt DemandedBits::getDemandedBits ( Use U)

Return the bits demanded from use U.

Definition at line 454 of file DemandedBits.cpp.

References llvm::BitWidth, DL, llvm::APInt::getAllOnes(), llvm::Module::getDataLayout(), and llvm::Instruction::getModule().

◆ isInstructionDead()

bool DemandedBits::isInstructionDead ( Instruction I)

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

Definition at line 481 of file DemandedBits.cpp.

References I, and isAlwaysLive().

Referenced by bitTrackingDCE().

◆ isUseDead()

bool DemandedBits::isUseDead ( Use U)

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

Definition at line 488 of file DemandedBits.cpp.

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

Referenced by bitTrackingDCE().

◆ print()

void DemandedBits::print ( raw_ostream OS)

Definition at line 513 of file DemandedBits.cpp.

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


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