LLVM
8.0.1
|
#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. More... | |
static void | decreaseSetPressure (std::vector< unsigned > &CurrSetPressure, const MachineRegisterInfo &MRI, unsigned Reg, LaneBitmask PrevMask, LaneBitmask NewMask) |
Decrease pressure for each pressure set provided by TargetRegisterInfo. More... | |
static const LiveRange * | getLiveRange (const LiveIntervals &LIS, unsigned Reg) |
static LaneBitmask | getRegLanes (ArrayRef< RegisterMaskPair > RegUnits, unsigned RegUnit) |
static void | addRegLanes (SmallVectorImpl< RegisterMaskPair > &RegUnits, RegisterMaskPair Pair) |
static void | setRegZero (SmallVectorImpl< RegisterMaskPair > &RegUnits, unsigned RegUnit) |
static void | removeRegLanes (SmallVectorImpl< RegisterMaskPair > &RegUnits, RegisterMaskPair Pair) |
static LaneBitmask | getLanesWithProperty (const LiveIntervals &LIS, const MachineRegisterInfo &MRI, bool TrackLaneMasks, unsigned RegUnit, SlotIndex Pos, LaneBitmask SafeDefault, bool(*Property)(const LiveRange &LR, SlotIndex Pos)) |
static LaneBitmask | getLiveLanesAt (const LiveIntervals &LIS, const MachineRegisterInfo &MRI, bool TrackLaneMasks, unsigned 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. More... | |
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. More... | |
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). More... | |
|
static |
Definition at line 366 of file RegisterPressure.cpp.
References llvm::LaneBitmask::any(), assert(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::find_if(), I, llvm::RegisterMaskPair::LaneMask, Other, llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::RegisterMaskPair::RegUnit.
Referenced by getLiveLanesAt(), and llvm::RegPressureTracker::recede().
|
static |
Find the max change in excess pressure across all sets.
Definition at line 937 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 976 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 65 of file RegisterPressure.cpp.
References llvm::LaneBitmask::any(), assert(), llvm::MachineRegisterInfo::getPressureSets(), llvm::PSetIterator::getWeight(), llvm::PSetIterator::isValid(), LLVM_DUMP_METHOD, and llvm::LaneBitmask::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 1201 of file RegisterPressure.cpp.
References llvm::LiveIntervals::getInstructionIndex(), llvm::LaneBitmask::getNone(), llvm::SlotIndex::getRegSlot(), llvm::TargetRegisterInfo::getSubRegIndexLaneMask(), llvm::MachineRegisterInfo::getTargetRegisterInfo(), MI, llvm::LaneBitmask::none(), TRI, and llvm::MachineRegisterInfo::use_nodbg_operands().
Referenced by llvm::RegPressureTracker::bumpDownwardPressure().
|
static |
Definition at line 406 of file RegisterPressure.cpp.
References llvm::LaneBitmask::getAll(), llvm::LiveIntervals::getCachedRegUnit(), llvm::LiveIntervals::getInterval(), llvm::MachineRegisterInfo::getMaxLaneMaskForVReg(), llvm::LaneBitmask::getNone(), llvm::LiveInterval::hasSubRanges(), llvm::TargetRegisterInfo::isVirtualRegister(), and llvm::LiveInterval::subranges().
Referenced by llvm::RegPressureTracker::getLastUsedLanes(), getLiveLanesAt(), llvm::RegPressureTracker::getLiveLanesAt(), and llvm::RegPressureTracker::getLiveThroughAt().
|
static |
Definition at line 434 of file RegisterPressure.cpp.
References addRegLanes(), assert(), llvm::RegisterOperands::DeadDefs, llvm::RegisterOperands::Defs, llvm::LaneBitmask::getAll(), getLanesWithProperty(), llvm::MachineRegisterInfo::getMaxLaneMaskForVReg(), llvm::MachineOperand::getReg(), llvm::MachineOperand::getSubReg(), llvm::TargetRegisterInfo::getSubRegIndexLaneMask(), llvm::MachineRegisterInfo::isAllocatable(), llvm::MachineOperand::isDead(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isInternalRead(), llvm::MachineOperand::isReg(), llvm::MachineOperand::isUndef(), llvm::MachineOperand::isUse(), llvm::MachineOperandIteratorBase::isValid(), llvm::MCRegisterInfo::DiffListIterator::isValid(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::LiveRange::liveAt(), MI, MRI, P, llvm::MachineOperand::readsReg(), Reg, removeRegLanes(), TRI, and llvm::RegisterOperands::Uses.
Referenced by llvm::RegisterOperands::adjustLaneLiveness(), and llvm::RegPressureTracker::hasUntiedDef().
|
static |
Definition at line 222 of file RegisterPressure.cpp.
References llvm::LiveIntervals::getCachedRegUnit(), llvm::LiveIntervals::getInterval(), and llvm::TargetRegisterInfo::isVirtualRegister().
Referenced by llvm::RegisterOperands::detectDeadDefs().
|
static |
Definition at line 356 of file RegisterPressure.cpp.
References llvm::ArrayRef< T >::end(), llvm::find_if(), llvm::LaneBitmask::getNone(), I, Other, and llvm::RegisterMaskPair::RegUnit.
Referenced by llvm::RegPressureTracker::bumpUpwardPressure().
|
static |
Increase pressure for each pressure set provided by TargetRegisterInfo.
Definition at line 51 of file RegisterPressure.cpp.
References llvm::LaneBitmask::any(), assert(), llvm::MachineRegisterInfo::getPressureSets(), llvm::PSetIterator::getWeight(), llvm::PSetIterator::isValid(), and llvm::LaneBitmask::none().
Referenced by llvm::RegPressureTracker::discoverLiveInOrOut(), llvm::RegPressureTracker::initLiveThru(), and llvm::RegPressureTracker::recede().
|
static |
Definition at line 392 of file RegisterPressure.cpp.
References llvm::LaneBitmask::any(), assert(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), llvm::find_if(), I, llvm::RegisterMaskPair::LaneMask, Other, and llvm::RegisterMaskPair::RegUnit.
Referenced by getLiveLanesAt(), and llvm::RegPressureTracker::recede().
|
static |
Definition at line 380 of file RegisterPressure.cpp.
References llvm::SmallVectorTemplateCommon< T >::end(), llvm::find_if(), llvm::LaneBitmask::getNone(), I, Other, llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::RegisterMaskPair::RegUnit.
Referenced by llvm::RegPressureTracker::recede().