LLVM 20.0.0git
|
#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 LiveRange * | getLiveRange (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). | |
|
static |
Definition at line 380 of file RegisterPressure.cpp.
References llvm::LaneBitmask::any(), assert(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::find_if(), I, llvm::RegisterMaskPair::LaneMask, llvm::Other, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::RegisterMaskPair::RegUnit.
Referenced by llvm::RegPressureTracker::recede().
|
static |
Find the max change in excess pressure across all sets.
Definition at line 951 of file RegisterPressure.cpp.
References llvm::ArrayRef< T >::empty(), llvm::RegPressureDelta::Excess, llvm::RegisterClassInfo::getRegPressureSetLimit(), llvm::PressureChange::setUnitInc(), and llvm::ArrayRef< T >::size().
Referenced by llvm::RegPressureTracker::getMaxDownwardPressureDelta(), and llvm::RegPressureTracker::getMaxUpwardPressureDelta().
|
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().
|
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().
|
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().
|
static |
Definition at line 421 of file RegisterPressure.cpp.
References llvm::LaneBitmask::getAll(), llvm::LiveIntervals::getCachedRegUnit(), llvm::LiveIntervals::getInterval(), llvm::LaneBitmask::getNone(), llvm::LiveInterval::hasSubRanges(), llvm::Register::isVirtual(), MRI, and llvm::LiveInterval::subranges().
Referenced by llvm::RegPressureTracker::getLastUsedLanes(), getLiveLanesAt(), llvm::RegPressureTracker::getLiveLanesAt(), and llvm::RegPressureTracker::getLiveThroughAt().
|
static |
Definition at line 449 of file RegisterPressure.cpp.
References llvm::LaneBitmask::getAll(), getLanesWithProperty(), llvm::LiveRange::liveAt(), and MRI.
Referenced by llvm::RegisterOperands::adjustLaneLiveness().
|
static |
Definition at line 237 of file RegisterPressure.cpp.
References llvm::LiveIntervals::getCachedRegUnit(), llvm::LiveIntervals::getInterval(), and llvm::Register::isVirtualRegister().
Referenced by llvm::RegisterOperands::detectDeadDefs().
|
static |
Definition at line 370 of file RegisterPressure.cpp.
References llvm::ArrayRef< T >::end(), llvm::find_if(), llvm::LaneBitmask::getNone(), I, and llvm::Other.
Referenced by llvm::RegPressureTracker::bumpUpwardPressure().
|
static |
Increase pressure for each pressure set provided by TargetRegisterInfo.
Definition at line 50 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::discoverLiveInOrOut(), llvm::RegPressureTracker::initLiveThru(), and llvm::RegPressureTracker::recede().
|
static |
Definition at line 406 of file RegisterPressure.cpp.
References llvm::LaneBitmask::any(), assert(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::SmallVectorImpl< T >::erase(), llvm::find_if(), I, llvm::RegisterMaskPair::LaneMask, llvm::Other, and llvm::RegisterMaskPair::RegUnit.
Referenced by llvm::RegPressureTracker::recede().
|
static |
Definition at line 394 of file RegisterPressure.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::find_if(), llvm::LaneBitmask::getNone(), I, llvm::Other, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::RegPressureTracker::recede().