LLVM 20.0.0git
Functions
RegisterPressure.cpp File Reference
#include "llvm/CodeGen/RegisterPressure.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/MC/LaneBitmask.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <iterator>
#include <limits>
#include <utility>
#include <vector>

Go to the source code of this file.

Functions

static void increaseSetPressure (std::vector< unsigned > &CurrSetPressure, const MachineRegisterInfo &MRI, unsigned Reg, LaneBitmask PrevMask, LaneBitmask NewMask)
 Increase pressure for each pressure set provided by TargetRegisterInfo.
 
static void decreaseSetPressure (std::vector< unsigned > &CurrSetPressure, const MachineRegisterInfo &MRI, Register Reg, LaneBitmask PrevMask, LaneBitmask NewMask)
 Decrease pressure for each pressure set provided by TargetRegisterInfo.
 
static const LiveRangegetLiveRange (const LiveIntervals &LIS, unsigned Reg)
 
static LaneBitmask getRegLanes (ArrayRef< RegisterMaskPair > RegUnits, Register RegUnit)
 
static void addRegLanes (SmallVectorImpl< RegisterMaskPair > &RegUnits, RegisterMaskPair Pair)
 
static void setRegZero (SmallVectorImpl< RegisterMaskPair > &RegUnits, Register RegUnit)
 
static void removeRegLanes (SmallVectorImpl< RegisterMaskPair > &RegUnits, RegisterMaskPair Pair)
 
static LaneBitmask getLanesWithProperty (const LiveIntervals &LIS, const MachineRegisterInfo &MRI, bool TrackLaneMasks, Register RegUnit, SlotIndex Pos, LaneBitmask SafeDefault, bool(*Property)(const LiveRange &LR, SlotIndex Pos))
 
static LaneBitmask getLiveLanesAt (const LiveIntervals &LIS, const MachineRegisterInfo &MRI, bool TrackLaneMasks, Register RegUnit, SlotIndex Pos)
 
static void computeExcessPressureDelta (ArrayRef< unsigned > OldPressureVec, ArrayRef< unsigned > NewPressureVec, RegPressureDelta &Delta, const RegisterClassInfo *RCI, ArrayRef< unsigned > LiveThruPressureVec)
 Find the max change in excess pressure across all sets.
 
static void computeMaxPressureDelta (ArrayRef< unsigned > OldMaxPressureVec, ArrayRef< unsigned > NewMaxPressureVec, ArrayRef< PressureChange > CriticalPSets, ArrayRef< unsigned > MaxPressureLimit, RegPressureDelta &Delta)
 Find the max change in max pressure that either surpasses a critical PSet limit or exceeds the current MaxPressureLimit.
 
static LaneBitmask findUseBetween (unsigned Reg, LaneBitmask LastUseMask, SlotIndex PriorUseIdx, SlotIndex NextUseIdx, const MachineRegisterInfo &MRI, const LiveIntervals *LIS)
 Helper to find a vreg use between two indices [PriorUseIdx, NextUseIdx).
 

Function Documentation

◆ addRegLanes()

static void addRegLanes ( SmallVectorImpl< RegisterMaskPair > &  RegUnits,
RegisterMaskPair  Pair 
)
static

◆ computeExcessPressureDelta()

static void computeExcessPressureDelta ( ArrayRef< unsigned OldPressureVec,
ArrayRef< unsigned NewPressureVec,
RegPressureDelta Delta,
const RegisterClassInfo RCI,
ArrayRef< unsigned LiveThruPressureVec 
)
static

◆ computeMaxPressureDelta()

static void computeMaxPressureDelta ( ArrayRef< unsigned OldMaxPressureVec,
ArrayRef< unsigned NewMaxPressureVec,
ArrayRef< PressureChange CriticalPSets,
ArrayRef< unsigned MaxPressureLimit,
RegPressureDelta Delta 
)
static

Find the max change in max pressure that either surpasses a critical PSet limit or exceeds the current MaxPressureLimit.

FIXME: comparing each element of the old and new MaxPressure vectors here is silly. It's done now to demonstrate the concept but will go away with a RegPressureTracker API change to work with pressure differences.

Definition at line 990 of file RegisterPressure.cpp.

References llvm::RegPressureDelta::CriticalMax, llvm::RegPressureDelta::CurrentMax, llvm::PressureChange::isValid(), llvm::PressureChange::setUnitInc(), and llvm::ArrayRef< T >::size().

Referenced by llvm::RegPressureTracker::getMaxDownwardPressureDelta(), and llvm::RegPressureTracker::getMaxUpwardPressureDelta().

◆ decreaseSetPressure()

static void decreaseSetPressure ( std::vector< unsigned > &  CurrSetPressure,
const MachineRegisterInfo MRI,
Register  Reg,
LaneBitmask  PrevMask,
LaneBitmask  NewMask 
)
static

Decrease pressure for each pressure set provided by TargetRegisterInfo.

Definition at line 64 of file RegisterPressure.cpp.

References llvm::LaneBitmask::any(), assert(), llvm::PSetIterator::getWeight(), llvm::PSetIterator::isValid(), MRI, llvm::LaneBitmask::none(), and none.

Referenced by llvm::RegPressureTracker::decreaseRegPressure().

◆ findUseBetween()

static LaneBitmask findUseBetween ( unsigned  Reg,
LaneBitmask  LastUseMask,
SlotIndex  PriorUseIdx,
SlotIndex  NextUseIdx,
const MachineRegisterInfo MRI,
const LiveIntervals LIS 
)
static

Helper to find a vreg use between two indices [PriorUseIdx, NextUseIdx).

The query starts with a lane bitmask which gets lanes/bits removed for every use we find.

Definition at line 1224 of file RegisterPressure.cpp.

References llvm::LiveIntervals::getInstructionIndex(), llvm::LaneBitmask::getNone(), llvm::MachineOperand::getParent(), llvm::SlotIndex::getRegSlot(), llvm::MachineOperand::getSubReg(), llvm::MachineOperand::isUndef(), MI, MRI, llvm::LaneBitmask::none(), Reg, and TRI.

Referenced by llvm::RegPressureTracker::bumpDownwardPressure().

◆ getLanesWithProperty()

static LaneBitmask getLanesWithProperty ( const LiveIntervals LIS,
const MachineRegisterInfo MRI,
bool  TrackLaneMasks,
Register  RegUnit,
SlotIndex  Pos,
LaneBitmask  SafeDefault,
bool(*)(const LiveRange &LR, SlotIndex Pos)  Property 
)
static

◆ getLiveLanesAt()

static LaneBitmask getLiveLanesAt ( const LiveIntervals LIS,
const MachineRegisterInfo MRI,
bool  TrackLaneMasks,
Register  RegUnit,
SlotIndex  Pos 
)
static

◆ getLiveRange()

static const LiveRange * getLiveRange ( const LiveIntervals LIS,
unsigned  Reg 
)
static

◆ getRegLanes()

static LaneBitmask getRegLanes ( ArrayRef< RegisterMaskPair RegUnits,
Register  RegUnit 
)
static

◆ increaseSetPressure()

static void increaseSetPressure ( std::vector< unsigned > &  CurrSetPressure,
const MachineRegisterInfo MRI,
unsigned  Reg,
LaneBitmask  PrevMask,
LaneBitmask  NewMask 
)
static

◆ removeRegLanes()

static void removeRegLanes ( SmallVectorImpl< RegisterMaskPair > &  RegUnits,
RegisterMaskPair  Pair 
)
static

◆ setRegZero()

static void setRegZero ( SmallVectorImpl< RegisterMaskPair > &  RegUnits,
Register  RegUnit 
)
static