LLVM 19.0.0git
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
llvm::GISelKnownBits Class Reference

#include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"

Inheritance diagram for llvm::GISelKnownBits:
Inheritance graph
[legend]

Public Member Functions

 GISelKnownBits (MachineFunction &MF, unsigned MaxDepth=6)
 
virtual ~GISelKnownBits ()=default
 
const MachineFunctiongetMachineFunction () const
 
const DataLayoutgetDataLayout () const
 
virtual void computeKnownBitsImpl (Register R, KnownBits &Known, const APInt &DemandedElts, unsigned Depth=0)
 
unsigned computeNumSignBits (Register R, const APInt &DemandedElts, unsigned Depth=0)
 
unsigned computeNumSignBits (Register R, unsigned Depth=0)
 
KnownBits getKnownBits (Register R)
 
KnownBits getKnownBits (Register R, const APInt &DemandedElts, unsigned Depth=0)
 
KnownBits getKnownBits (MachineInstr &MI)
 
APInt getKnownZeroes (Register R)
 
APInt getKnownOnes (Register R)
 
bool maskedValueIsZero (Register Val, const APInt &Mask)
 
bool signBitIsZero (Register Op)
 
Align computeKnownAlignment (Register R, unsigned Depth=0)
 
void erasingInstr (MachineInstr &MI) override
 An instruction is about to be erased.
 
void createdInstr (MachineInstr &MI) override
 An instruction has been created and inserted into the function.
 
void changingInstr (MachineInstr &MI) override
 This instruction is about to be mutated in some way.
 
void changedInstr (MachineInstr &MI) override
 This instruction was mutated in some way.
 
- Public Member Functions inherited from llvm::GISelChangeObserver
virtual ~GISelChangeObserver ()=default
 
virtual void erasingInstr (MachineInstr &MI)=0
 An instruction is about to be erased.
 
virtual void createdInstr (MachineInstr &MI)=0
 An instruction has been created and inserted into the function.
 
virtual void changingInstr (MachineInstr &MI)=0
 This instruction is about to be mutated in some way.
 
virtual void changedInstr (MachineInstr &MI)=0
 This instruction was mutated in some way.
 
void changingAllUsesOfReg (const MachineRegisterInfo &MRI, Register Reg)
 All the instructions using the given register are being changed.
 
void finishedChangingAllUsesOfReg ()
 All instructions reported as changing by changingAllUsesOfReg() have finished being changed.
 

Static Public Member Functions

static void computeKnownBitsForAlignment (KnownBits &Known, Align Alignment)
 

Protected Member Functions

unsigned getMaxDepth () const
 

Detailed Description

Definition at line 29 of file GISelKnownBits.h.

Constructor & Destructor Documentation

◆ GISelKnownBits()

llvm::GISelKnownBits::GISelKnownBits ( MachineFunction MF,
unsigned  MaxDepth = 6 
)

◆ ~GISelKnownBits()

virtual llvm::GISelKnownBits::~GISelKnownBits ( )
virtualdefault

Member Function Documentation

◆ changedInstr()

void llvm::GISelKnownBits::changedInstr ( MachineInstr MI)
inlineoverridevirtual

This instruction was mutated in some way.

Implements llvm::GISelChangeObserver.

Definition at line 99 of file GISelKnownBits.h.

◆ changingInstr()

void llvm::GISelKnownBits::changingInstr ( MachineInstr MI)
inlineoverridevirtual

This instruction is about to be mutated in some way.

Implements llvm::GISelChangeObserver.

Definition at line 98 of file GISelKnownBits.h.

◆ computeKnownAlignment()

Align GISelKnownBits::computeKnownAlignment ( Register  R,
unsigned  Depth = 0 
)

◆ computeKnownBitsForAlignment()

static void llvm::GISelKnownBits::computeKnownBitsForAlignment ( KnownBits Known,
Align  Alignment 
)
inlinestatic

Definition at line 86 of file GISelKnownBits.h.

References llvm::Log2(), llvm::APInt::setLowBits(), and llvm::KnownBits::Zero.

◆ computeKnownBitsImpl()

void GISelKnownBits::computeKnownBitsImpl ( Register  R,
KnownBits Known,
const APInt DemandedElts,
unsigned  Depth = 0 
)
virtual

Definition at line 139 of file GISelKnownBits.cpp.

References llvm::KnownBits::anyext(), llvm::KnownBits::ashr(), assert(), llvm::bit_width(), llvm::BitWidth, llvm::KnownBits::byteSwap(), llvm::APInt::clearLowBits(), llvm::KnownBits::computeForAddSub(), llvm::TargetLowering::computeKnownBitsForFrameIndex(), llvm::TargetLowering::computeKnownBitsForTargetInstr(), llvm::computeKnownBitsFromRangeMetadata(), computeKnownBitsImpl(), llvm::KnownBits::countMaxPopulation(), llvm::dbgs(), llvm::Depth, dumpResult(), extractBits(), llvm::KnownBits::extractBits(), llvm::LLT::getAddressSpace(), llvm::APInt::getAllOnes(), llvm::KnownBits::getBitWidth(), llvm::TargetLoweringBase::getBooleanContents(), llvm::getIConstantVRegVal(), llvm::DataLayout::getIndexSizeInBits(), getMaxDepth(), llvm::MachineMemOperand::getRanges(), getReg(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::MachineRegisterInfo::getVRegDef(), llvm::KnownBits::hasConflict(), I, Idx, llvm::KnownBits::insertBits(), llvm::KnownBits::intersectWith(), llvm::DataLayout::isNonIntegralAddressSpace(), llvm::LLT::isPointer(), llvm::KnownBits::isUnknown(), llvm::LLT::isValid(), llvm::LLT::isVector(), llvm::Register::isVirtual(), LLVM_DEBUG, llvm::Log2_64(), llvm::KnownBits::lshr(), llvm::KnownBits::makeConstant(), MI, llvm::KnownBits::mul(), llvm::KnownBits::One, llvm::KnownBits::reverseBits(), llvm::APInt::setAllBits(), llvm::APInt::setBitsFrom(), llvm::APInt::setLowBits(), llvm::KnownBits::sext(), llvm::KnownBits::sextInReg(), llvm::KnownBits::shl(), llvm::KnownBits::smax(), llvm::KnownBits::smin(), llvm::KnownBits::umax(), llvm::KnownBits::umin(), llvm::KnownBits::Zero, llvm::TargetLoweringBase::ZeroOrOneBooleanContent, and llvm::KnownBits::zextOrTrunc().

Referenced by llvm::SITargetLowering::computeKnownBitsForTargetInstr(), computeKnownBitsImpl(), and getKnownBits().

◆ computeNumSignBits() [1/2]

unsigned GISelKnownBits::computeNumSignBits ( Register  R,
const APInt DemandedElts,
unsigned  Depth = 0 
)

◆ computeNumSignBits() [2/2]

unsigned GISelKnownBits::computeNumSignBits ( Register  R,
unsigned  Depth = 0 
)

◆ createdInstr()

void llvm::GISelKnownBits::createdInstr ( MachineInstr MI)
inlineoverridevirtual

An instruction has been created and inserted into the function.

Note that the instruction might not be a fully fledged instruction at this point and won't be if the MachineFunction::Delegate is calling it. This is because the delegate only sees the construction of the MachineInstr before operands have been added.

Implements llvm::GISelChangeObserver.

Definition at line 97 of file GISelKnownBits.h.

◆ erasingInstr()

void llvm::GISelKnownBits::erasingInstr ( MachineInstr MI)
inlineoverridevirtual

An instruction is about to be erased.

Implements llvm::GISelChangeObserver.

Definition at line 96 of file GISelKnownBits.h.

◆ getDataLayout()

const DataLayout & llvm::GISelKnownBits::getDataLayout ( ) const
inline

Definition at line 53 of file GISelKnownBits.h.

References DL.

◆ getKnownBits() [1/3]

KnownBits GISelKnownBits::getKnownBits ( MachineInstr MI)

Definition at line 59 of file GISelKnownBits.cpp.

References assert(), getKnownBits(), and MI.

◆ getKnownBits() [2/3]

KnownBits GISelKnownBits::getKnownBits ( Register  R)

◆ getKnownBits() [3/3]

KnownBits GISelKnownBits::getKnownBits ( Register  R,
const APInt DemandedElts,
unsigned  Depth = 0 
)

Definition at line 72 of file GISelKnownBits.cpp.

References assert(), computeKnownBitsImpl(), and llvm::Depth.

◆ getKnownOnes()

APInt GISelKnownBits::getKnownOnes ( Register  R)

Definition at line 93 of file GISelKnownBits.cpp.

References getKnownBits(), and llvm::KnownBits::One.

◆ getKnownZeroes()

APInt GISelKnownBits::getKnownZeroes ( Register  R)

◆ getMachineFunction()

const MachineFunction & llvm::GISelKnownBits::getMachineFunction ( ) const
inline

◆ getMaxDepth()

unsigned llvm::GISelKnownBits::getMaxDepth ( ) const
inlineprotected

Definition at line 102 of file GISelKnownBits.h.

Referenced by computeKnownBitsImpl(), and computeNumSignBits().

◆ maskedValueIsZero()

bool llvm::GISelKnownBits::maskedValueIsZero ( Register  Val,
const APInt Mask 
)
inline
Returns
true if 'V & Mask' is known to be zero in DemandedElts. We use this predicate to simplify operations downstream. Mask is known to be zero for bits that V cannot have.

Definition at line 78 of file GISelKnownBits.h.

References getKnownBits().

Referenced by signBitIsZero().

◆ signBitIsZero()

bool GISelKnownBits::signBitIsZero ( Register  Op)
Returns
true if the sign bit of Op is known to be zero. We use this predicate to simplify operations downstream.

Definition at line 83 of file GISelKnownBits.cpp.

References llvm::BitWidth, llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSignMask(), llvm::MachineRegisterInfo::getType(), and maskedValueIsZero().


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