LLVM  6.0.0svn
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/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>
Include dependency graph for RegisterPressure.cpp:

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 LiveRangegetLiveRange (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...
 

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 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().

◆ decreaseSetPressure()

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

◆ 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 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(), and llvm::MachineRegisterInfo::use_nodbg_operands().

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

◆ getLanesWithProperty()

static LaneBitmask getLanesWithProperty ( const LiveIntervals LIS,
const MachineRegisterInfo MRI,
bool  TrackLaneMasks,
unsigned  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,
unsigned  RegUnit,
SlotIndex  Pos 
)
static

◆ getLiveRange()

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

◆ getRegLanes()

static LaneBitmask getRegLanes ( ArrayRef< RegisterMaskPair RegUnits,
unsigned  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,
unsigned  RegUnit 
)
static