LLVM  14.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]
Collaboration diagram for llvm::GISelKnownBits:
Collaboration 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. More...
 
void createdInstr (MachineInstr &MI) override
 An instruction has been created and inserted into the function. More...
 
void changingInstr (MachineInstr &MI) override
 This instruction is about to be mutated in some way. More...
 
void changedInstr (MachineInstr &MI) override
 This instruction was mutated in some way. More...
 
- Public Member Functions inherited from llvm::GISelChangeObserver
virtual ~GISelChangeObserver ()
 
void changingAllUsesOfReg (const MachineRegisterInfo &MRI, Register Reg)
 All the instructions using the given register are being changed. More...
 
void finishedChangingAllUsesOfReg ()
 All instructions reported as changing by changingAllUsesOfReg() have finished being changed. More...
 

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 131 of file GISelKnownBits.cpp.

References llvm::KnownBits::anyext(), llvm::KnownBits::ashr(), assert(), llvm::BitWidth, llvm::KnownBits::byteSwap(), llvm::KnownBits::commonBits(), llvm::KnownBits::computeForAddSub(), llvm::TargetLowering::computeKnownBitsForFrameIndex(), llvm::TargetLowering::computeKnownBitsForTargetInstr(), llvm::computeKnownBitsFromRangeMetadata(), llvm::KnownBits::countMaxPopulation(), llvm::dbgs(), llvm::Depth, dumpResult(), llvm::numbers::e, 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, I, llvm::KnownBits::insertBits(), llvm::DataLayout::isNonIntegralAddressSpace(), llvm::LLT::isPointer(), llvm::KnownBits::isUnknown(), llvm::LLT::isValid(), llvm::LLT::isVector(), llvm::Register::isVirtual(), LLVM_DEBUG, LLVM_FALLTHROUGH, llvm::Log2_32(), llvm::KnownBits::lshr(), llvm::KnownBits::makeConstant(), MI, llvm::KnownBits::mul(), llvm::KnownBits::One, llvm::KnownBits::reverseBits(), llvm::APInt::setAllBits(), llvm::APInt::setBitsFrom(), 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 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 51 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 64 of file GISelKnownBits.cpp.

References assert(), and computeKnownBitsImpl().

◆ getKnownOnes()

APInt GISelKnownBits::getKnownOnes ( Register  R)

Definition at line 85 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(), and llvm::BitmaskEnumDetail::Mask().

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 75 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: