LLVM 24.0.0git
InlineSpiller.cpp File Reference
#include "InlineSpiller.h"
#include "AllocationOrder.h"
#include "SplitKit.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LiveDebugVariables.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveRangeEdit.h"
#include "llvm/CodeGen/LiveRegMatrix.h"
#include "llvm/CodeGen/LiveStacks.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/CodeGen/Spiller.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/BlockFrequency.h"
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <iterator>
#include <tuple>
#include <utility>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "regalloc"

Functions

 STATISTIC (NumSpilledRanges, "Number of spilled live ranges")
 STATISTIC (NumSnippets, "Number of spilled snippets")
 STATISTIC (NumSpills, "Number of spills inserted")
 STATISTIC (NumSpillsRemoved, "Number of spills removed")
 STATISTIC (NumReloads, "Number of reloads inserted")
 STATISTIC (NumReloadsRemoved, "Number of reloads removed")
 STATISTIC (NumFolded, "Number of folded stack accesses")
 STATISTIC (NumFoldedLoads, "Number of folded loads")
 STATISTIC (NumRemats, "Number of rematerialized defs for spilling")
static Register isCopyOf (const MachineInstr &MI, Register Reg, const TargetInstrInfo &TII)
 isFullCopyOf - If MI is a COPY to or from Reg, return the other register, otherwise return 0.
static Register isCopyOfBundle (const MachineInstr &FirstMI, Register Reg, const TargetInstrInfo &TII)
 Check for a copy bundle as formed by SplitKit.
static void getVDefInterval (const MachineInstr &MI, LiveIntervals &LIS)
static Register getAssignedReg (const VirtRegMap &VRM, Register Reg)
static bool readsPhysRegsOf (const MachineInstr &Other, const MachineInstr &MI, Register Ignore)
 Return true if Other reads every physical register that MI reads, except Ignore.
static LLVM_DUMP_METHOD void dumpMachineInstrRangeWithSlotIndex (MachineBasicBlock::iterator B, MachineBasicBlock::iterator E, LiveIntervals const &LIS, const char *const header, Register VReg=Register())
static bool isRealSpill (const MachineInstr &Def, Register Reg)
 Check if Def defines Reg with an undefined value.

Variables

static cl::opt< bool > RestrictStatepointRemat ("restrict-statepoint-remat", cl::init(false), cl::Hidden, cl::desc("Restrict remat for statepoint operands"))

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "regalloc"

Definition at line 64 of file InlineSpiller.cpp.

Function Documentation

◆ dumpMachineInstrRangeWithSlotIndex()

◆ getAssignedReg()

Register getAssignedReg ( const VirtRegMap & VRM,
Register Reg )
static

Definition at line 541 of file InlineSpiller.cpp.

References llvm::VirtRegMap::getPhys(), Reg, and Register.

◆ getVDefInterval()

void getVDefInterval ( const MachineInstr & MI,
LiveIntervals & LIS )
static

Definition at line 332 of file InlineSpiller.cpp.

References llvm::LiveIntervals::getInterval(), and MI.

◆ isCopyOf()

Register isCopyOf ( const MachineInstr & MI,
Register Reg,
const TargetInstrInfo & TII )
static

isFullCopyOf - If MI is a COPY to or from Reg, return the other register, otherwise return 0.

Definition at line 277 of file InlineSpiller.cpp.

References llvm::DstOp::getReg(), llvm::SrcOp::getReg(), MI, Reg, Register, and TII.

Referenced by isCopyOfBundle().

◆ isCopyOfBundle()

◆ isRealSpill()

bool isRealSpill ( const MachineInstr & Def,
Register Reg )
static

Check if Def defines Reg with an undefined value.

If that's the case, that means the value of Reg is actually not relevant.

Definition at line 1462 of file InlineSpiller.cpp.

References llvm::any_of(), and Reg.

◆ readsPhysRegsOf()

bool readsPhysRegsOf ( const MachineInstr & Other,
const MachineInstr & MI,
Register Ignore )
static

Return true if Other reads every physical register that MI reads, except Ignore.

Definition at line 547 of file InlineSpiller.cpp.

References llvm::all_of(), Ignore, MI, and llvm::Other.

◆ STATISTIC() [1/9]

STATISTIC ( NumFolded ,
"Number of folded stack accesses"  )

◆ STATISTIC() [2/9]

STATISTIC ( NumFoldedLoads ,
"Number of folded loads"  )

◆ STATISTIC() [3/9]

STATISTIC ( NumReloads ,
"Number of reloads inserted"  )

◆ STATISTIC() [4/9]

STATISTIC ( NumReloadsRemoved ,
"Number of reloads removed"  )

◆ STATISTIC() [5/9]

STATISTIC ( NumRemats ,
"Number of rematerialized defs for spilling"  )

◆ STATISTIC() [6/9]

STATISTIC ( NumSnippets ,
"Number of spilled snippets"  )

◆ STATISTIC() [7/9]

STATISTIC ( NumSpilledRanges ,
"Number of spilled live ranges"  )

◆ STATISTIC() [8/9]

STATISTIC ( NumSpills ,
"Number of spills inserted"  )

◆ STATISTIC() [9/9]

STATISTIC ( NumSpillsRemoved ,
"Number of spills removed"  )

Variable Documentation

◆ RestrictStatepointRemat

cl::opt< bool > RestrictStatepointRemat("restrict-statepoint-remat", cl::init(false), cl::Hidden, cl::desc("Restrict remat for statepoint operands")) ( "restrict-statepoint-remat" ,
cl::init(false) ,
cl::Hidden ,
cl::desc("Restrict remat for statepoint operands")  )
static