LLVM  13.0.0git
CalcSpillWeights.cpp
Go to the documentation of this file.
1 //===- CalcSpillWeights.cpp -----------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/SmallPtrSet.h"
22 #include "llvm/Support/Debug.h"
24 #include "llvm/CodeGen/StackMaps.h"
25 #include <cassert>
26 #include <tuple>
27 
28 using namespace llvm;
29 
30 #define DEBUG_TYPE "calcspillweights"
31 
33  LLVM_DEBUG(dbgs() << "********** Compute Spill Weights **********\n"
34  << "********** Function: " << MF.getName() << '\n');
35 
37  for (unsigned I = 0, E = MRI.getNumVirtRegs(); I != E; ++I) {
38  unsigned Reg = Register::index2VirtReg(I);
39  if (MRI.reg_nodbg_empty(Reg))
40  continue;
42  }
43 }
44 
45 // Return the preferred allocation register for reg, given a COPY instruction.
46 static Register copyHint(const MachineInstr *MI, unsigned Reg,
47  const TargetRegisterInfo &TRI,
48  const MachineRegisterInfo &MRI) {
49  unsigned Sub, HSub;
50  Register HReg;
51  if (MI->getOperand(0).getReg() == Reg) {
52  Sub = MI->getOperand(0).getSubReg();
53  HReg = MI->getOperand(1).getReg();
54  HSub = MI->getOperand(1).getSubReg();
55  } else {
56  Sub = MI->getOperand(1).getSubReg();
57  HReg = MI->getOperand(0).getReg();
58  HSub = MI->getOperand(0).getSubReg();
59  }
60 
61  if (!HReg)
62  return 0;
63 
65  return Sub == HSub ? HReg : Register();
66 
68  MCRegister CopiedPReg = HSub ? TRI.getSubReg(HReg, HSub) : HReg.asMCReg();
69  if (rc->contains(CopiedPReg))
70  return CopiedPReg;
71 
72  // Check if reg:sub matches so that a super register could be hinted.
73  if (Sub)
74  return TRI.getMatchingSuperReg(CopiedPReg, Sub, rc);
75 
76  return 0;
77 }
78 
79 // Check if all values in LI are rematerializable
80 static bool isRematerializable(const LiveInterval &LI, const LiveIntervals &LIS,
81  const VirtRegMap &VRM,
82  const TargetInstrInfo &TII) {
83  unsigned Reg = LI.reg();
84  unsigned Original = VRM.getOriginal(Reg);
86  I != E; ++I) {
87  const VNInfo *VNI = *I;
88  if (VNI->isUnused())
89  continue;
90  if (VNI->isPHIDef())
91  return false;
92 
94  assert(MI && "Dead valno in interval");
95 
96  // Trace copies introduced by live range splitting. The inline
97  // spiller can rematerialize through these copies, so the spill
98  // weight must reflect this.
99  while (MI->isFullCopy()) {
100  // The copy destination must match the interval register.
101  if (MI->getOperand(0).getReg() != Reg)
102  return false;
103 
104  // Get the source register.
105  Reg = MI->getOperand(1).getReg();
106 
107  // If the original (pre-splitting) registers match this
108  // copy came from a split.
109  if (!Register::isVirtualRegister(Reg) || VRM.getOriginal(Reg) != Original)
110  return false;
111 
112  // Follow the copy live-in value.
113  const LiveInterval &SrcLI = LIS.getInterval(Reg);
114  LiveQueryResult SrcQ = SrcLI.Query(VNI->def);
115  VNI = SrcQ.valueIn();
116  assert(VNI && "Copy from non-existing value");
117  if (VNI->isPHIDef())
118  return false;
119  MI = LIS.getInstructionFromIndex(VNI->def);
120  assert(MI && "Dead valno in interval");
121  }
122 
123  if (!TII.isTriviallyReMaterializable(*MI, LIS.getAliasAnalysis()))
124  return false;
125  }
126  return true;
127 }
128 
129 bool VirtRegAuxInfo::isLiveAtStatepointVarArg(LiveInterval &LI) {
130  return any_of(VRM.getRegInfo().reg_operands(LI.reg()),
131  [](MachineOperand &MO) {
132  MachineInstr *MI = MO.getParent();
133  if (MI->getOpcode() != TargetOpcode::STATEPOINT)
134  return false;
135  return StatepointOpers(MI).getVarIdx() <= MI->getOperandNo(&MO);
136  });
137 }
138 
140  float Weight = weightCalcHelper(LI);
141  // Check if unspillable.
142  if (Weight < 0)
143  return;
144  LI.setWeight(Weight);
145 }
146 
148  SlotIndex End) {
149  return weightCalcHelper(LI, &Start, &End);
150 }
151 
153  SlotIndex *End) {
156  const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
157  MachineBasicBlock *MBB = nullptr;
158  MachineLoop *Loop = nullptr;
159  bool IsExiting = false;
160  float TotalWeight = 0;
161  unsigned NumInstr = 0; // Number of instructions using LI
163 
164  std::pair<Register, Register> TargetHint = MRI.getRegAllocationHint(LI.reg());
165 
166  if (LI.isSpillable()) {
167  Register Reg = LI.reg();
168  Register Original = VRM.getOriginal(Reg);
169  const LiveInterval &OrigInt = LIS.getInterval(Original);
170  // li comes from a split of OrigInt. If OrigInt was marked
171  // as not spillable, make sure the new interval is marked
172  // as not spillable as well.
173  if (!OrigInt.isSpillable())
174  LI.markNotSpillable();
175  }
176 
177  // Don't recompute spill weight for an unspillable register.
178  bool IsSpillable = LI.isSpillable();
179 
180  bool IsLocalSplitArtifact = Start && End;
181 
182  // Do not update future local split artifacts.
183  bool ShouldUpdateLI = !IsLocalSplitArtifact;
184 
185  if (IsLocalSplitArtifact) {
186  MachineBasicBlock *localMBB = LIS.getMBBFromIndex(*End);
187  assert(localMBB == LIS.getMBBFromIndex(*Start) &&
188  "start and end are expected to be in the same basic block");
189 
190  // Local split artifact will have 2 additional copy instructions and they
191  // will be in the same BB.
192  // localLI = COPY other
193  // ...
194  // other = COPY localLI
195  TotalWeight += LiveIntervals::getSpillWeight(true, false, &MBFI, localMBB);
196  TotalWeight += LiveIntervals::getSpillWeight(false, true, &MBFI, localMBB);
197 
198  NumInstr += 2;
199  }
200 
201  // CopyHint is a sortable hint derived from a COPY instruction.
202  struct CopyHint {
203  const Register Reg;
204  const float Weight;
205  CopyHint(Register R, float W) : Reg(R), Weight(W) {}
206  bool operator<(const CopyHint &Rhs) const {
207  // Always prefer any physreg hint.
208  if (Reg.isPhysical() != Rhs.Reg.isPhysical())
209  return Reg.isPhysical();
210  if (Weight != Rhs.Weight)
211  return (Weight > Rhs.Weight);
212  return Reg.id() < Rhs.Reg.id(); // Tie-breaker.
213  }
214  };
215 
216  std::set<CopyHint> CopyHints;
219  I = MRI.reg_instr_nodbg_begin(LI.reg()),
221  I != E;) {
222  MachineInstr *MI = &*(I++);
223 
224  // For local split artifacts, we are interested only in instructions between
225  // the expected start and end of the range.
227  if (IsLocalSplitArtifact && ((SI < *Start) || (SI > *End)))
228  continue;
229 
230  NumInstr++;
231  if (MI->isIdentityCopy() || MI->isImplicitDef())
232  continue;
233  if (!Visited.insert(MI).second)
234  continue;
235 
236  // For terminators that produce values, ask the backend if the register is
237  // not spillable.
238  if (TII.isUnspillableTerminator(MI) && MI->definesRegister(LI.reg())) {
239  LI.markNotSpillable();
240  return -1.0f;
241  }
242 
243  float Weight = 1.0f;
244  if (IsSpillable) {
245  // Get loop info for mi.
246  if (MI->getParent() != MBB) {
247  MBB = MI->getParent();
248  Loop = Loops.getLoopFor(MBB);
249  IsExiting = Loop ? Loop->isLoopExiting(MBB) : false;
250  }
251 
252  // Calculate instr weight.
253  bool Reads, Writes;
254  std::tie(Reads, Writes) = MI->readsWritesVirtualRegister(LI.reg());
255  Weight = LiveIntervals::getSpillWeight(Writes, Reads, &MBFI, *MI);
256 
257  // Give extra weight to what looks like a loop induction variable update.
258  if (Writes && IsExiting && LIS.isLiveOutOfMBB(LI, MBB))
259  Weight *= 3;
260 
261  TotalWeight += Weight;
262  }
263 
264  // Get allocation hints from copies.
265  if (!MI->isCopy())
266  continue;
267  Register HintReg = copyHint(MI, LI.reg(), TRI, MRI);
268  if (!HintReg)
269  continue;
270  // Force hweight onto the stack so that x86 doesn't add hidden precision,
271  // making the comparison incorrectly pass (i.e., 1 > 1 == true??).
272  //
273  // FIXME: we probably shouldn't use floats at all.
274  volatile float HWeight = Hint[HintReg] += Weight;
275  if (HintReg.isVirtual() || MRI.isAllocatable(HintReg))
276  CopyHints.insert(CopyHint(HintReg, HWeight));
277  }
278 
279  // Pass all the sorted copy hints to mri.
280  if (ShouldUpdateLI && CopyHints.size()) {
281  // Remove a generic hint if previously added by target.
282  if (TargetHint.first == 0 && TargetHint.second)
283  MRI.clearSimpleHint(LI.reg());
284 
285  std::set<Register> HintedRegs;
286  for (auto &Hint : CopyHints) {
287  if (!HintedRegs.insert(Hint.Reg).second ||
288  (TargetHint.first != 0 && Hint.Reg == TargetHint.second))
289  // Don't add the same reg twice or the target-type hint again.
290  continue;
291  MRI.addRegAllocationHint(LI.reg(), Hint.Reg);
292  }
293 
294  // Weakly boost the spill weight of hinted registers.
295  TotalWeight *= 1.01F;
296  }
297 
298  // If the live interval was already unspillable, leave it that way.
299  if (!IsSpillable)
300  return -1.0;
301 
302  // Mark li as unspillable if all live ranges are tiny and the interval
303  // is not live at any reg mask. If the interval is live at a reg mask
304  // spilling may be required. If li is live as use in statepoint instruction
305  // spilling may be required due to if we mark interval with use in statepoint
306  // as not spillable we are risky to end up with no register to allocate.
307  // At the same time STATEPOINT instruction is perfectly fine to have this
308  // operand on stack, so spilling such interval and folding its load from stack
309  // into instruction itself makes perfect sense.
310  if (ShouldUpdateLI && LI.isZeroLength(LIS.getSlotIndexes()) &&
311  !LI.isLiveAtIndexes(LIS.getRegMaskSlots()) &&
312  !isLiveAtStatepointVarArg(LI)) {
313  LI.markNotSpillable();
314  return -1.0;
315  }
316 
317  // If all of the definitions of the interval are re-materializable,
318  // it is a preferred candidate for spilling.
319  // FIXME: this gets much more complicated once we support non-trivial
320  // re-materialization.
321  if (isRematerializable(LI, LIS, VRM, *MF.getSubtarget().getInstrInfo()))
322  TotalWeight *= 0.5F;
323 
324  if (IsLocalSplitArtifact)
325  return normalize(TotalWeight, Start->distance(*End), NumInstr);
326  return normalize(TotalWeight, LI.getSize(), NumInstr);
327 }
llvm::VirtRegAuxInfo::futureWeight
float futureWeight(LiveInterval &LI, SlotIndex Start, SlotIndex End)
Compute future expected spill weight of a split artifact of LI that will span between start and end s...
Definition: CalcSpillWeights.cpp:147
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:100
MachineInstr.h
llvm
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1566
llvm::LiveIntervals::getSlotIndexes
SlotIndexes * getSlotIndexes() const
Definition: LiveIntervals.h:211
llvm::MachineLoopInfo::getLoopFor
MachineLoop * getLoopFor(const MachineBasicBlock *BB) const
Return the innermost loop that BB lives in.
Definition: MachineLoopInfo.h:124
llvm::LiveRange::isZeroLength
bool isZeroLength(SlotIndexes *Indexes) const
Returns true if the live range is zero length, i.e.
Definition: LiveInterval.h:578
llvm::MachineRegisterInfo
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Definition: MachineRegisterInfo.h:52
llvm::Loop
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:530
llvm::TargetSubtargetInfo::getInstrInfo
virtual const TargetInstrInfo * getInstrInfo() const
Definition: TargetSubtargetInfo.h:92
llvm::LiveInterval::isSpillable
bool isSpillable() const
isSpillable - Can this interval be spilled?
Definition: LiveInterval.h:813
llvm::RISCVFenceField::W
@ W
Definition: RISCVBaseInfo.h:130
llvm::VirtRegMap::getOriginal
Register getOriginal(Register VirtReg) const
getOriginal - Return the original virtual register that VirtReg descends from through splitting.
Definition: VirtRegMap.h:170
llvm::LiveIntervals::getInstructionFromIndex
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
Definition: LiveIntervals.h:231
llvm::VirtRegMap
Definition: VirtRegMap.h:33
llvm::MachineRegisterInfo::defusechain_instr_iterator
defusechain_iterator - This class provides iterator support for machine operands in the function that...
Definition: MachineRegisterInfo.h:269
llvm::VirtRegAuxInfo::normalize
virtual float normalize(float UseDefFreq, unsigned Size, unsigned NumInstr)
Weight normalization function.
Definition: CalcSpillWeights.h:100
llvm::VirtRegAuxInfo::calculateSpillWeightsAndHints
void calculateSpillWeightsAndHints()
Compute spill weights and allocation hints for all virtual register live intervals.
Definition: CalcSpillWeights.cpp:32
llvm::TargetSubtargetInfo::getRegisterInfo
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
Definition: TargetSubtargetInfo.h:124
llvm::VNInfo::def
SlotIndex def
The index of the defining instruction.
Definition: LiveInterval.h:61
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:231
llvm::LiveIntervals::getRegMaskSlots
ArrayRef< SlotIndex > getRegMaskSlots() const
Returns a sorted array of slot indices of all instructions with register mask operands.
Definition: LiveIntervals.h:351
TargetInstrInfo.h
llvm::MachineRegisterInfo::getNumVirtRegs
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
Definition: MachineRegisterInfo.h:757
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:449
llvm::LiveRange::vni_begin
vni_iterator vni_begin()
Definition: LiveInterval.h:224
llvm::Register::index2VirtReg
static Register index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
Definition: Register.h:84
llvm::VirtRegAuxInfo::calculateSpillWeightAndHint
void calculateSpillWeightAndHint(LiveInterval &LI)
(re)compute li's spill weight and allocation hint.
Definition: CalcSpillWeights.cpp:139
llvm::LiveQueryResult
Result of a LiveRange query.
Definition: LiveInterval.h:90
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1567
llvm::LiveIntervals::getMBBFromIndex
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
Definition: LiveIntervals.h:255
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:122
llvm::LiveIntervals::getInstructionIndex
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
Definition: LiveIntervals.h:226
MachineRegisterInfo.h
llvm::LiveRange::isLiveAtIndexes
bool isLiveAtIndexes(ArrayRef< SlotIndex > Slots) const
Definition: LiveInterval.cpp:814
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
llvm::MachineFunction::getRegInfo
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Definition: MachineFunction.h:565
llvm::TargetInstrInfo
TargetInstrInfo - Interface to description of machine instruction set.
Definition: TargetInstrInfo.h:97
MachineLoopInfo.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::LiveInterval::getSize
unsigned getSize() const
getSize - Returns the sum of sizes of all the LiveRange's.
Definition: LiveInterval.cpp:969
SI
@ SI
Definition: SIInstrInfo.cpp:7342
llvm::TargetRegisterClass
Definition: TargetRegisterInfo.h:46
llvm::LiveIntervals::isLiveOutOfMBB
bool isLiveOutOfMBB(const LiveRange &LR, const MachineBasicBlock *mbb) const
Definition: LiveIntervals.h:250
llvm::MachineRegisterInfo::reg_instr_nodbg_end
static reg_instr_nodbg_iterator reg_instr_nodbg_end()
Definition: MachineRegisterInfo.h:349
TII
const HexagonInstrInfo * TII
Definition: HexagonCopyToCombine.cpp:129
llvm::MachineOperand
MachineOperand class - Representation of each machine instruction operand.
Definition: MachineOperand.h:49
SmallPtrSet.h
llvm::LiveInterval
LiveInterval - This class represents the liveness of a register, or stack slot.
Definition: LiveInterval.h:680
llvm::LiveQueryResult::valueIn
VNInfo * valueIn() const
Return the value that is live-in to the instruction.
Definition: LiveInterval.h:105
llvm::SlotIndex
SlotIndex - An opaque wrapper around machine indexes.
Definition: SlotIndexes.h:83
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::MachineRegisterInfo::getRegClass
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
Definition: MachineRegisterInfo.h:634
llvm::VirtRegMap::getRegInfo
MachineRegisterInfo & getRegInfo() const
Definition: VirtRegMap.h:93
llvm::Register::isVirtual
bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
Definition: Register.h:91
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition: MachineFunction.h:555
rc
#define rc(i)
llvm::MachineLoop
Definition: MachineLoopInfo.h:45
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
LiveIntervals.h
VirtRegMap.h
llvm::TargetRegisterInfo::getMatchingSuperReg
MCRegister getMatchingSuperReg(MCRegister Reg, unsigned SubIdx, const TargetRegisterClass *RC) const
Return a super-register of the specified register Reg so its sub-register of index SubIdx is Reg.
Definition: TargetRegisterInfo.h:561
llvm::DenseMap
Definition: DenseMap.h:714
llvm::operator<
bool operator<(int64_t V1, const APSInt &V2)
Definition: APSInt.h:343
llvm::MachineRegisterInfo::reg_instr_nodbg_begin
reg_instr_nodbg_iterator reg_instr_nodbg_begin(Register RegNo) const
Definition: MachineRegisterInfo.h:346
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::LiveRange::Query
LiveQueryResult Query(SlotIndex Idx) const
Query Liveness at Idx.
Definition: LiveInterval.h:533
llvm::Register::isVirtualRegister
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
Definition: Register.h:71
llvm::MachineRegisterInfo::reg_operands
iterator_range< reg_iterator > reg_operands(Register Reg) const
Definition: MachineRegisterInfo.h:286
llvm::MachineRegisterInfo::isAllocatable
bool isAllocatable(MCRegister PhysReg) const
isAllocatable - Returns true when PhysReg belongs to an allocatable register class and it hasn't been...
Definition: MachineRegisterInfo.h:918
llvm::MachineFunction::getName
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Definition: MachineFunction.cpp:522
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::Register::asMCReg
MCRegister asMCReg() const
Utility to check-convert this value to a MCRegister.
Definition: Register.h:120
llvm::LiveIntervals::getInterval
LiveInterval & getInterval(Register Reg)
Definition: LiveIntervals.h:114
copyHint
static Register copyHint(const MachineInstr *MI, unsigned Reg, const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI)
Definition: CalcSpillWeights.cpp:46
llvm::any_of
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1512
TargetSubtargetInfo.h
llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::insert
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition: DenseMap.h:207
llvm::LiveInterval::setWeight
void setWeight(float Value)
Definition: LiveInterval.h:714
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::VNInfo::isPHIDef
bool isPHIDef() const
Returns true if this value is defined by a PHI instruction (or was, PHI instructions may have been el...
Definition: LiveInterval.h:78
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::VirtRegAuxInfo::weightCalcHelper
float weightCalcHelper(LiveInterval &LI, SlotIndex *Start=nullptr, SlotIndex *End=nullptr)
Helper function for weight calculations.
Definition: CalcSpillWeights.cpp:152
llvm::LiveIntervals::getSpillWeight
static float getSpillWeight(bool isDef, bool isUse, const MachineBlockFrequencyInfo *MBFI, const MachineInstr &MI)
Calculate the spill weight to assign to a single instruction.
Definition: LiveIntervals.cpp:863
llvm::LiveIntervals::getAliasAnalysis
AAResults * getAliasAnalysis() const
Definition: LiveIntervals.h:215
StackMaps.h
llvm::LiveIntervals
Definition: LiveIntervals.h:54
llvm::VNInfo
VNInfo - Value Number Information.
Definition: LiveInterval.h:53
LiveInterval.h
llvm::MachineRegisterInfo::addRegAllocationHint
void addRegAllocationHint(Register VReg, Register PrefReg)
addRegAllocationHint - Add a register allocation hint to the hints vector for VReg.
Definition: MachineRegisterInfo.h:774
llvm::LiveInterval::markNotSpillable
void markNotSpillable()
markNotSpillable - Mark interval as not spillable
Definition: LiveInterval.h:816
llvm::LiveInterval::reg
Register reg() const
Definition: LiveInterval.h:711
MachineOperand.h
llvm::TargetRegisterInfo::getSubReg
MCRegister getSubReg(MCRegister Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo.
Definition: TargetRegisterInfo.h:1078
llvm::LoopBase::isLoopExiting
bool isLoopExiting(const BlockT *BB) const
True if terminator in the block can branch to another block that is outside of the current loop.
Definition: LoopInfo.h:225
llvm::VNInfo::isUnused
bool isUnused() const
Returns true if this value is unused.
Definition: LiveInterval.h:81
CalcSpillWeights.h
llvm::MachineRegisterInfo::clearSimpleHint
void clearSimpleHint(Register VReg)
Definition: MachineRegisterInfo.h:785
llvm::MachineRegisterInfo::reg_nodbg_empty
bool reg_nodbg_empty(Register RegNo) const
reg_nodbg_empty - Return true if the only instructions using or defining Reg are Debug instructions.
Definition: MachineRegisterInfo.h:377
raw_ostream.h
llvm::LiveRange::vni_end
vni_iterator vni_end()
Definition: LiveInterval.h:225
llvm::LiveRange::const_vni_iterator
VNInfoList::const_iterator const_vni_iterator
Definition: LiveInterval.h:222
MachineFunction.h
TargetRegisterInfo.h
Debug.h
llvm::MachineRegisterInfo::getRegAllocationHint
std::pair< Register, Register > getRegAllocationHint(Register VReg) const
getRegAllocationHint - Return the register allocation hint for the specified virtual register.
Definition: MachineRegisterInfo.h:795
llvm::MCRegister
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:22
llvm::SmallPtrSetImpl::insert
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:364
isRematerializable
static bool isRematerializable(const LiveInterval &LI, const LiveIntervals &LIS, const VirtRegMap &VRM, const TargetInstrInfo &TII)
Definition: CalcSpillWeights.cpp:80