LLVM  14.0.0git
InstrRefBasedImpl.h
Go to the documentation of this file.
1 //===- InstrRefBasedImpl.h - Tracking Debug Value MIs ---------------------===//
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 
9 #ifndef LLVM_LIB_CODEGEN_LIVEDEBUGVALUES_INSTRREFBASEDLDV_H
10 #define LLVM_LIB_CODEGEN_LIVEDEBUGVALUES_INSTRREFBASEDLDV_H
11 
12 #include "llvm/ADT/DenseMap.h"
13 #include "llvm/ADT/SmallPtrSet.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/UniqueVector.h"
25 
26 #include "LiveDebugValues.h"
27 
28 class TransferTracker;
29 
30 // Forward dec of unit test class, so that we can peer into the LDV object.
31 class InstrRefLDVTest;
32 
33 namespace LiveDebugValues {
34 
35 class MLocTracker;
36 
37 using namespace llvm;
38 
39 /// Handle-class for a particular "location". This value-type uniquely
40 /// symbolises a register or stack location, allowing manipulation of locations
41 /// without concern for where that location is. Practically, this allows us to
42 /// treat the state of the machine at a particular point as an array of values,
43 /// rather than a map of values.
44 class LocIdx {
45  unsigned Location;
46 
47  // Default constructor is private, initializing to an illegal location number.
48  // Use only for "not an entry" elements in IndexedMaps.
49  LocIdx() : Location(UINT_MAX) {}
50 
51 public:
52 #define NUM_LOC_BITS 24
53  LocIdx(unsigned L) : Location(L) {
54  assert(L < (1 << NUM_LOC_BITS) && "Machine locations must fit in 24 bits");
55  }
56 
57  static LocIdx MakeIllegalLoc() { return LocIdx(); }
59  LocIdx L = LocIdx();
60  --L.Location;
61  return L;
62  }
63 
64  bool isIllegal() const { return Location == UINT_MAX; }
65 
66  uint64_t asU64() const { return Location; }
67 
68  bool operator==(unsigned L) const { return Location == L; }
69 
70  bool operator==(const LocIdx &L) const { return Location == L.Location; }
71 
72  bool operator!=(unsigned L) const { return !(*this == L); }
73 
74  bool operator!=(const LocIdx &L) const { return !(*this == L); }
75 
76  bool operator<(const LocIdx &Other) const {
77  return Location < Other.Location;
78  }
79 };
80 
81 // The location at which a spilled value resides. It consists of a register and
82 // an offset.
83 struct SpillLoc {
84  unsigned SpillBase;
86  bool operator==(const SpillLoc &Other) const {
87  return std::make_pair(SpillBase, SpillOffset) ==
88  std::make_pair(Other.SpillBase, Other.SpillOffset);
89  }
90  bool operator<(const SpillLoc &Other) const {
91  return std::make_tuple(SpillBase, SpillOffset.getFixed(),
92  SpillOffset.getScalable()) <
93  std::make_tuple(Other.SpillBase, Other.SpillOffset.getFixed(),
94  Other.SpillOffset.getScalable());
95  }
96 };
97 
98 /// Unique identifier for a value defined by an instruction, as a value type.
99 /// Casts back and forth to a uint64_t. Probably replacable with something less
100 /// bit-constrained. Each value identifies the instruction and machine location
101 /// where the value is defined, although there may be no corresponding machine
102 /// operand for it (ex: regmasks clobbering values). The instructions are
103 /// one-based, and definitions that are PHIs have instruction number zero.
104 ///
105 /// The obvious limits of a 1M block function or 1M instruction blocks are
106 /// problematic; but by that point we should probably have bailed out of
107 /// trying to analyse the function.
108 class ValueIDNum {
109  union {
110  struct {
111  uint64_t BlockNo : 20; /// The block where the def happens.
112  uint64_t InstNo : 20; /// The Instruction where the def happens.
113  /// One based, is distance from start of block.
114  uint64_t LocNo
115  : NUM_LOC_BITS; /// The machine location where the def happens.
116  } s;
118  } u;
119 
120  static_assert(sizeof(u) == 8, "Badly packed ValueIDNum?");
121 
122 public:
123  // Default-initialize to EmptyValue. This is necessary to make IndexedMaps
124  // of values to work.
125  ValueIDNum() { u.Value = EmptyValue.asU64(); }
126 
127  ValueIDNum(uint64_t Block, uint64_t Inst, uint64_t Loc) {
128  u.s = {Block, Inst, Loc};
129  }
130 
131  ValueIDNum(uint64_t Block, uint64_t Inst, LocIdx Loc) {
132  u.s = {Block, Inst, Loc.asU64()};
133  }
134 
135  uint64_t getBlock() const { return u.s.BlockNo; }
136  uint64_t getInst() const { return u.s.InstNo; }
137  uint64_t getLoc() const { return u.s.LocNo; }
138  bool isPHI() const { return u.s.InstNo == 0; }
139 
140  uint64_t asU64() const { return u.Value; }
141 
143  ValueIDNum Val;
144  Val.u.Value = v;
145  return Val;
146  }
147 
148  bool operator<(const ValueIDNum &Other) const {
149  return asU64() < Other.asU64();
150  }
151 
152  bool operator==(const ValueIDNum &Other) const {
153  return u.Value == Other.u.Value;
154  }
155 
156  bool operator!=(const ValueIDNum &Other) const { return !(*this == Other); }
157 
158  std::string asString(const std::string &mlocname) const {
159  return Twine("Value{bb: ")
160  .concat(Twine(u.s.BlockNo)
161  .concat(Twine(", inst: ")
162  .concat((u.s.InstNo ? Twine(u.s.InstNo)
163  : Twine("live-in"))
164  .concat(Twine(", loc: ").concat(
165  Twine(mlocname)))
166  .concat(Twine("}")))))
167  .str();
168  }
169 
172 };
173 
174 /// Thin wrapper around an integer -- designed to give more type safety to
175 /// spill location numbers.
177 public:
178  explicit SpillLocationNo(unsigned SpillNo) : SpillNo(SpillNo) {}
179  unsigned SpillNo;
180  unsigned id() const { return SpillNo; }
181 
182  bool operator<(const SpillLocationNo &Other) const {
183  return SpillNo < Other.SpillNo;
184  }
185 
186  bool operator==(const SpillLocationNo &Other) const {
187  return SpillNo == Other.SpillNo;
188  }
189  bool operator!=(const SpillLocationNo &Other) const {
190  return !(*this == Other);
191  }
192 };
193 
194 /// Meta qualifiers for a value. Pair of whatever expression is used to qualify
195 /// the the value, and Boolean of whether or not it's indirect.
197 public:
198  DbgValueProperties(const DIExpression *DIExpr, bool Indirect)
199  : DIExpr(DIExpr), Indirect(Indirect) {}
200 
201  /// Extract properties from an existing DBG_VALUE instruction.
203  assert(MI.isDebugValue());
204  DIExpr = MI.getDebugExpression();
205  Indirect = MI.getOperand(1).isImm();
206  }
207 
208  bool operator==(const DbgValueProperties &Other) const {
209  return std::tie(DIExpr, Indirect) == std::tie(Other.DIExpr, Other.Indirect);
210  }
211 
212  bool operator!=(const DbgValueProperties &Other) const {
213  return !(*this == Other);
214  }
215 
217  bool Indirect;
218 };
219 
220 /// Class recording the (high level) _value_ of a variable. Identifies either
221 /// the value of the variable as a ValueIDNum, or a constant MachineOperand.
222 /// This class also stores meta-information about how the value is qualified.
223 /// Used to reason about variable values when performing the second
224 /// (DebugVariable specific) dataflow analysis.
225 class DbgValue {
226 public:
227  /// If Kind is Def, the value number that this value is based on. VPHIs set
228  /// this field to EmptyValue if there is no machine-value for this VPHI, or
229  /// the corresponding machine-value if there is one.
231  /// If Kind is Const, the MachineOperand defining this value.
233  /// For a NoVal or VPHI DbgValue, which block it was generated in.
234  int BlockNo;
235 
236  /// Qualifiers for the ValueIDNum above.
238 
239  typedef enum {
240  Undef, // Represents a DBG_VALUE $noreg in the transfer function only.
241  Def, // This value is defined by an inst, or is a PHI value.
242  Const, // A constant value contained in the MachineOperand field.
243  VPHI, // Incoming values to BlockNo differ, those values must be joined by
244  // a PHI in this block.
245  NoVal, // Empty DbgValue indicating an unknown value. Used as initializer,
246  // before dominating blocks values are propagated in.
247  } KindT;
248  /// Discriminator for whether this is a constant or an in-program value.
250 
251  DbgValue(const ValueIDNum &Val, const DbgValueProperties &Prop, KindT Kind)
252  : ID(Val), MO(None), BlockNo(0), Properties(Prop), Kind(Kind) {
253  assert(Kind == Def);
254  }
255 
256  DbgValue(unsigned BlockNo, const DbgValueProperties &Prop, KindT Kind)
257  : ID(ValueIDNum::EmptyValue), MO(None), BlockNo(BlockNo),
258  Properties(Prop), Kind(Kind) {
259  assert(Kind == NoVal || Kind == VPHI);
260  }
261 
263  : ID(ValueIDNum::EmptyValue), MO(MO), BlockNo(0), Properties(Prop),
264  Kind(Kind) {
265  assert(Kind == Const);
266  }
267 
269  : ID(ValueIDNum::EmptyValue), MO(None), BlockNo(0), Properties(Prop),
270  Kind(Kind) {
271  assert(Kind == Undef &&
272  "Empty DbgValue constructor must pass in Undef kind");
273  }
274 
275 #ifndef NDEBUG
276  void dump(const MLocTracker *MTrack) const;
277 #endif
278 
279  bool operator==(const DbgValue &Other) const {
280  if (std::tie(Kind, Properties) != std::tie(Other.Kind, Other.Properties))
281  return false;
282  else if (Kind == Def && ID != Other.ID)
283  return false;
284  else if (Kind == NoVal && BlockNo != Other.BlockNo)
285  return false;
286  else if (Kind == Const)
287  return MO->isIdenticalTo(*Other.MO);
288  else if (Kind == VPHI && BlockNo != Other.BlockNo)
289  return false;
290  else if (Kind == VPHI && ID != Other.ID)
291  return false;
292 
293  return true;
294  }
295 
296  bool operator!=(const DbgValue &Other) const { return !(*this == Other); }
297 };
298 
300 public:
302  unsigned operator()(const LocIdx &L) const { return L.asU64(); }
303 };
304 
305 /// Tracker for what values are in machine locations. Listens to the Things
306 /// being Done by various instructions, and maintains a table of what machine
307 /// locations have what values (as defined by a ValueIDNum).
308 ///
309 /// There are potentially a much larger number of machine locations on the
310 /// target machine than the actual working-set size of the function. On x86 for
311 /// example, we're extremely unlikely to want to track values through control
312 /// or debug registers. To avoid doing so, MLocTracker has several layers of
313 /// indirection going on, described below, to avoid unnecessarily tracking
314 /// any location.
315 ///
316 /// Here's a sort of diagram of the indexes, read from the bottom up:
317 ///
318 /// Size on stack Offset on stack
319 /// \ /
320 /// Stack Idx (Where in slot is this?)
321 /// /
322 /// /
323 /// Slot Num (%stack.0) /
324 /// FrameIdx => SpillNum /
325 /// \ /
326 /// SpillID (int) Register number (int)
327 /// \ /
328 /// LocationID => LocIdx
329 /// |
330 /// LocIdx => ValueIDNum
331 ///
332 /// The aim here is that the LocIdx => ValueIDNum vector is just an array of
333 /// values in numbered locations, so that later analyses can ignore whether the
334 /// location is a register or otherwise. To map a register / spill location to
335 /// a LocIdx, you have to use the (sparse) LocationID => LocIdx map. And to
336 /// build a LocationID for a stack slot, you need to combine identifiers for
337 /// which stack slot it is and where within that slot is being described.
338 ///
339 /// Register mask operands cause trouble by technically defining every register;
340 /// various hacks are used to avoid tracking registers that are never read and
341 /// only written by regmasks.
342 class MLocTracker {
343 public:
348 
349  /// IndexedMap type, mapping from LocIdx to ValueIDNum.
351 
352  /// Map of LocIdxes to the ValueIDNums that they store. This is tightly
353  /// packed, entries only exist for locations that are being tracked.
355 
356  /// "Map" of machine location IDs (i.e., raw register or spill number) to the
357  /// LocIdx key / number for that location. There are always at least as many
358  /// as the number of registers on the target -- if the value in the register
359  /// is not being tracked, then the LocIdx value will be zero. New entries are
360  /// appended if a new spill slot begins being tracked.
361  /// This, and the corresponding reverse map persist for the analysis of the
362  /// whole function, and is necessarying for decoding various vectors of
363  /// values.
364  std::vector<LocIdx> LocIDToLocIdx;
365 
366  /// Inverse map of LocIDToLocIdx.
368 
369  /// When clobbering register masks, we chose to not believe the machine model
370  /// and don't clobber SP. Do the same for SP aliases, and for efficiency,
371  /// keep a set of them here.
373 
374  /// Unique-ification of spill. Used to number them -- their LocID number is
375  /// the index in SpillLocs minus one plus NumRegs.
377 
378  // If we discover a new machine location, assign it an mphi with this
379  // block number.
380  unsigned CurBB;
381 
382  /// Cached local copy of the number of registers the target has.
383  unsigned NumRegs;
384 
385  /// Number of slot indexes the target has -- distinct segments of a stack
386  /// slot that can take on the value of a subregister, when a super-register
387  /// is written to the stack.
388  unsigned NumSlotIdxes;
389 
390  /// Collection of register mask operands that have been observed. Second part
391  /// of pair indicates the instruction that they happened in. Used to
392  /// reconstruct where defs happened if we start tracking a location later
393  /// on.
395 
396  /// Pair for describing a position within a stack slot -- first the size in
397  /// bits, then the offset.
398  typedef std::pair<unsigned short, unsigned short> StackSlotPos;
399 
400  /// Map from a size/offset pair describing a position in a stack slot, to a
401  /// numeric identifier for that position. Allows easier identification of
402  /// individual positions.
404 
405  /// Inverse of StackSlotIdxes.
407 
408  /// Iterator for locations and the values they contain. Dereferencing
409  /// produces a struct/pair containing the LocIdx key for this location,
410  /// and a reference to the value currently stored. Simplifies the process
411  /// of seeking a particular location.
412  class MLocIterator {
414  LocIdx Idx;
415 
416  public:
417  class value_type {
418  public:
419  value_type(LocIdx Idx, ValueIDNum &Value) : Idx(Idx), Value(Value) {}
420  const LocIdx Idx; /// Read-only index of this location.
421  ValueIDNum &Value; /// Reference to the stored value at this location.
422  };
423 
425  : ValueMap(ValueMap), Idx(Idx) {}
426 
427  bool operator==(const MLocIterator &Other) const {
428  assert(&ValueMap == &Other.ValueMap);
429  return Idx == Other.Idx;
430  }
431 
432  bool operator!=(const MLocIterator &Other) const {
433  return !(*this == Other);
434  }
435 
436  void operator++() { Idx = LocIdx(Idx.asU64() + 1); }
437 
438  value_type operator*() { return value_type(Idx, ValueMap[LocIdx(Idx)]); }
439  };
440 
442  const TargetRegisterInfo &TRI, const TargetLowering &TLI);
443 
444  /// Produce location ID number for a Register. Provides some small amount of
445  /// type safety.
446  /// \param Reg The register we're looking up.
447  unsigned getLocID(Register Reg) { return Reg.id(); }
448 
449  /// Produce location ID number for a spill position.
450  /// \param Spill The number of the spill we're fetching the location for.
451  /// \param SpillSubReg Subregister within the spill we're addressing.
452  unsigned getLocID(SpillLocationNo Spill, unsigned SpillSubReg) {
453  unsigned short Size = TRI.getSubRegIdxSize(SpillSubReg);
454  unsigned short Offs = TRI.getSubRegIdxOffset(SpillSubReg);
455  return getLocID(Spill, {Size, Offs});
456  }
457 
458  /// Produce location ID number for a spill position.
459  /// \param Spill The number of the spill we're fetching the location for.
460  /// \apram SpillIdx size/offset within the spill slot to be addressed.
461  unsigned getLocID(SpillLocationNo Spill, StackSlotPos Idx) {
462  unsigned SlotNo = Spill.id() - 1;
463  SlotNo *= NumSlotIdxes;
464  assert(StackSlotIdxes.find(Idx) != StackSlotIdxes.end());
465  SlotNo += StackSlotIdxes[Idx];
466  SlotNo += NumRegs;
467  return SlotNo;
468  }
469 
470  /// Given a spill number, and a slot within the spill, calculate the ID number
471  /// for that location.
472  unsigned getSpillIDWithIdx(SpillLocationNo Spill, unsigned Idx) {
473  unsigned SlotNo = Spill.id() - 1;
474  SlotNo *= NumSlotIdxes;
475  SlotNo += Idx;
476  SlotNo += NumRegs;
477  return SlotNo;
478  }
479 
480  /// Return the spill number that a location ID corresponds to.
481  SpillLocationNo locIDToSpill(unsigned ID) const {
482  assert(ID >= NumRegs);
483  ID -= NumRegs;
484  // Truncate away the index part, leaving only the spill number.
485  ID /= NumSlotIdxes;
486  return SpillLocationNo(ID + 1); // The UniqueVector is one-based.
487  }
488 
489  /// Returns the spill-slot size/offs that a location ID corresponds to.
490  StackSlotPos locIDToSpillIdx(unsigned ID) const {
491  assert(ID >= NumRegs);
492  ID -= NumRegs;
493  unsigned Idx = ID % NumSlotIdxes;
494  return StackIdxesToPos.find(Idx)->second;
495  }
496 
497  unsigned getNumLocs(void) const { return LocIdxToIDNum.size(); }
498 
499  /// Reset all locations to contain a PHI value at the designated block. Used
500  /// sometimes for actual PHI values, othertimes to indicate the block entry
501  /// value (before any more information is known).
502  void setMPhis(unsigned NewCurBB) {
503  CurBB = NewCurBB;
504  for (auto Location : locations())
505  Location.Value = {CurBB, 0, Location.Idx};
506  }
507 
508  /// Load values for each location from array of ValueIDNums. Take current
509  /// bbnum just in case we read a value from a hitherto untouched register.
510  void loadFromArray(ValueIDNum *Locs, unsigned NewCurBB) {
511  CurBB = NewCurBB;
512  // Iterate over all tracked locations, and load each locations live-in
513  // value into our local index.
514  for (auto Location : locations())
515  Location.Value = Locs[Location.Idx.asU64()];
516  }
517 
518  /// Wipe any un-necessary location records after traversing a block.
519  void reset(void) {
520  // We could reset all the location values too; however either loadFromArray
521  // or setMPhis should be called before this object is re-used. Just
522  // clear Masks, they're definitely not needed.
523  Masks.clear();
524  }
525 
526  /// Clear all data. Destroys the LocID <=> LocIdx map, which makes most of
527  /// the information in this pass uninterpretable.
528  void clear(void) {
529  reset();
530  LocIDToLocIdx.clear();
531  LocIdxToLocID.clear();
532  LocIdxToIDNum.clear();
533  // SpillLocs.reset(); XXX UniqueVector::reset assumes a SpillLoc casts from
534  // 0
535  SpillLocs = decltype(SpillLocs)();
536  StackSlotIdxes.clear();
537  StackIdxesToPos.clear();
538 
539  LocIDToLocIdx.resize(NumRegs, LocIdx::MakeIllegalLoc());
540  }
541 
542  /// Set a locaiton to a certain value.
543  void setMLoc(LocIdx L, ValueIDNum Num) {
544  assert(L.asU64() < LocIdxToIDNum.size());
545  LocIdxToIDNum[L] = Num;
546  }
547 
548  /// Read the value of a particular location
550  assert(L.asU64() < LocIdxToIDNum.size());
551  return LocIdxToIDNum[L];
552  }
553 
554  /// Create a LocIdx for an untracked register ID. Initialize it to either an
555  /// mphi value representing a live-in, or a recent register mask clobber.
556  LocIdx trackRegister(unsigned ID);
557 
559  LocIdx &Index = LocIDToLocIdx[ID];
560  if (Index.isIllegal())
561  Index = trackRegister(ID);
562  return Index;
563  }
564 
565  /// Is register R currently tracked by MLocTracker?
567  LocIdx &Index = LocIDToLocIdx[R];
568  return !Index.isIllegal();
569  }
570 
571  /// Record a definition of the specified register at the given block / inst.
572  /// This doesn't take a ValueIDNum, because the definition and its location
573  /// are synonymous.
574  void defReg(Register R, unsigned BB, unsigned Inst) {
575  unsigned ID = getLocID(R);
576  LocIdx Idx = lookupOrTrackRegister(ID);
577  ValueIDNum ValueID = {BB, Inst, Idx};
578  LocIdxToIDNum[Idx] = ValueID;
579  }
580 
581  /// Set a register to a value number. To be used if the value number is
582  /// known in advance.
583  void setReg(Register R, ValueIDNum ValueID) {
584  unsigned ID = getLocID(R);
585  LocIdx Idx = lookupOrTrackRegister(ID);
586  LocIdxToIDNum[Idx] = ValueID;
587  }
588 
590  unsigned ID = getLocID(R);
591  LocIdx Idx = lookupOrTrackRegister(ID);
592  return LocIdxToIDNum[Idx];
593  }
594 
595  /// Reset a register value to zero / empty. Needed to replicate the
596  /// VarLoc implementation where a copy to/from a register effectively
597  /// clears the contents of the source register. (Values can only have one
598  /// machine location in VarLocBasedImpl).
600  unsigned ID = getLocID(R);
601  LocIdx Idx = LocIDToLocIdx[ID];
602  LocIdxToIDNum[Idx] = ValueIDNum::EmptyValue;
603  }
604 
605  /// Determine the LocIdx of an existing register.
607  unsigned ID = getLocID(R);
608  assert(ID < LocIDToLocIdx.size());
609  assert(LocIDToLocIdx[ID] != UINT_MAX); // Sentinal for IndexedMap.
610  return LocIDToLocIdx[ID];
611  }
612 
613  /// Record a RegMask operand being executed. Defs any register we currently
614  /// track, stores a pointer to the mask in case we have to account for it
615  /// later.
616  void writeRegMask(const MachineOperand *MO, unsigned CurBB, unsigned InstID);
617 
618  /// Find LocIdx for SpillLoc \p L, creating a new one if it's not tracked.
619  SpillLocationNo getOrTrackSpillLoc(SpillLoc L);
620 
621  // Get LocIdx of a spill ID.
622  LocIdx getSpillMLoc(unsigned SpillID) {
623  assert(LocIDToLocIdx[SpillID] != UINT_MAX); // Sentinal for IndexedMap.
624  return LocIDToLocIdx[SpillID];
625  }
626 
627  /// Return true if Idx is a spill machine location.
628  bool isSpill(LocIdx Idx) const { return LocIdxToLocID[Idx] >= NumRegs; }
629 
630  MLocIterator begin() { return MLocIterator(LocIdxToIDNum, 0); }
631 
633  return MLocIterator(LocIdxToIDNum, LocIdxToIDNum.size());
634  }
635 
636  /// Return a range over all locations currently tracked.
638  return llvm::make_range(begin(), end());
639  }
640 
641  std::string LocIdxToName(LocIdx Idx) const;
642 
643  std::string IDAsString(const ValueIDNum &Num) const;
644 
645 #ifndef NDEBUG
646  LLVM_DUMP_METHOD void dump();
647 
648  LLVM_DUMP_METHOD void dump_mloc_map();
649 #endif
650 
651  /// Create a DBG_VALUE based on machine location \p MLoc. Qualify it with the
652  /// information in \pProperties, for variable Var. Don't insert it anywhere,
653  /// just return the builder for it.
654  MachineInstrBuilder emitLoc(Optional<LocIdx> MLoc, const DebugVariable &Var,
655  const DbgValueProperties &Properties);
656 };
657 
658 /// Types for recording sets of variable fragments that overlap. For a given
659 /// local variable, we record all other fragments of that variable that could
660 /// overlap it, to reduce search time.
661 using FragmentOfVar =
662  std::pair<const DILocalVariable *, DIExpression::FragmentInfo>;
663 using OverlapMap =
665 
666 /// Collection of DBG_VALUEs observed when traversing a block. Records each
667 /// variable and the value the DBG_VALUE refers to. Requires the machine value
668 /// location dataflow algorithm to have run already, so that values can be
669 /// identified.
670 class VLocTracker {
671 public:
672  /// Map DebugVariable to the latest Value it's defined to have.
673  /// Needs to be a MapVector because we determine order-in-the-input-MIR from
674  /// the order in this container.
675  /// We only retain the last DbgValue in each block for each variable, to
676  /// determine the blocks live-out variable value. The Vars container forms the
677  /// transfer function for this block, as part of the dataflow analysis. The
678  /// movement of values between locations inside of a block is handled at a
679  /// much later stage, in the TransferTracker class.
682  MachineBasicBlock *MBB = nullptr;
685 
686 public:
687  VLocTracker(const OverlapMap &O, const DIExpression *EmptyExpr)
688  : OverlappingFragments(O), EmptyProperties(EmptyExpr, false) {}
689 
690  void defVar(const MachineInstr &MI, const DbgValueProperties &Properties,
692  assert(MI.isDebugValue() || MI.isDebugRef());
693  DebugVariable Var(MI.getDebugVariable(), MI.getDebugExpression(),
694  MI.getDebugLoc()->getInlinedAt());
695  DbgValue Rec = (ID) ? DbgValue(*ID, Properties, DbgValue::Def)
696  : DbgValue(Properties, DbgValue::Undef);
697 
698  // Attempt insertion; overwrite if it's already mapped.
699  auto Result = Vars.insert(std::make_pair(Var, Rec));
700  if (!Result.second)
701  Result.first->second = Rec;
702  Scopes[Var] = MI.getDebugLoc().get();
703 
704  considerOverlaps(Var, MI.getDebugLoc().get());
705  }
706 
707  void defVar(const MachineInstr &MI, const MachineOperand &MO) {
708  // Only DBG_VALUEs can define constant-valued variables.
709  assert(MI.isDebugValue());
710  DebugVariable Var(MI.getDebugVariable(), MI.getDebugExpression(),
711  MI.getDebugLoc()->getInlinedAt());
712  DbgValueProperties Properties(MI);
713  DbgValue Rec = DbgValue(MO, Properties, DbgValue::Const);
714 
715  // Attempt insertion; overwrite if it's already mapped.
716  auto Result = Vars.insert(std::make_pair(Var, Rec));
717  if (!Result.second)
718  Result.first->second = Rec;
719  Scopes[Var] = MI.getDebugLoc().get();
720 
721  considerOverlaps(Var, MI.getDebugLoc().get());
722  }
723 
724  void considerOverlaps(const DebugVariable &Var, const DILocation *Loc) {
725  auto Overlaps = OverlappingFragments.find(
726  {Var.getVariable(), Var.getFragmentOrDefault()});
727  if (Overlaps == OverlappingFragments.end())
728  return;
729 
730  // Otherwise: terminate any overlapped variable locations.
731  for (auto FragmentInfo : Overlaps->second) {
732  // The "empty" fragment is stored as DebugVariable::DefaultFragment, so
733  // that it overlaps with everything, however its cannonical representation
734  // in a DebugVariable is as "None".
735  Optional<DIExpression::FragmentInfo> OptFragmentInfo = FragmentInfo;
736  if (DebugVariable::isDefaultFragment(FragmentInfo))
737  OptFragmentInfo = None;
738 
739  DebugVariable Overlapped(Var.getVariable(), OptFragmentInfo,
740  Var.getInlinedAt());
741  DbgValue Rec = DbgValue(EmptyProperties, DbgValue::Undef);
742 
743  // Attempt insertion; overwrite if it's already mapped.
744  auto Result = Vars.insert(std::make_pair(Overlapped, Rec));
745  if (!Result.second)
746  Result.first->second = Rec;
747  Scopes[Overlapped] = Loc;
748  }
749  }
750 };
751 
752 // XXX XXX docs
753 class InstrRefBasedLDV : public LDVImpl {
754 public:
755  friend class ::InstrRefLDVTest;
756 
759 
760  // Helper while building OverlapMap, a map of all fragments seen for a given
761  // DILocalVariable.
762  using VarToFragments =
764 
765  /// Machine location/value transfer function, a mapping of which locations
766  /// are assigned which new values.
768 
769  /// Live in/out structure for the variable values: a per-block map of
770  /// variables to their values.
772 
773  using VarAndLoc = std::pair<DebugVariable, DbgValue>;
774 
775  /// Type for a live-in value: the predecessor block, and its value.
776  using InValueT = std::pair<MachineBasicBlock *, DbgValue *>;
777 
778  /// Vector (per block) of a collection (inner smallvector) of live-ins.
779  /// Used as the result type for the variable value dataflow problem.
781 
782 private:
783  MachineDominatorTree *DomTree;
784  const TargetRegisterInfo *TRI;
785  const MachineRegisterInfo *MRI;
786  const TargetInstrInfo *TII;
787  const TargetFrameLowering *TFI;
788  const MachineFrameInfo *MFI;
789  BitVector CalleeSavedRegs;
791  TargetPassConfig *TPC;
792 
793  // An empty DIExpression. Used default / placeholder DbgValueProperties
794  // objects, as we can't have null expressions.
795  const DIExpression *EmptyExpr;
796 
797  /// Object to track machine locations as we step through a block. Could
798  /// probably be a field rather than a pointer, as it's always used.
799  MLocTracker *MTracker = nullptr;
800 
801  /// Number of the current block LiveDebugValues is stepping through.
802  unsigned CurBB;
803 
804  /// Number of the current instruction LiveDebugValues is evaluating.
805  unsigned CurInst;
806 
807  /// Variable tracker -- listens to DBG_VALUEs occurring as InstrRefBasedImpl
808  /// steps through a block. Reads the values at each location from the
809  /// MLocTracker object.
810  VLocTracker *VTracker = nullptr;
811 
812  /// Tracker for transfers, listens to DBG_VALUEs and transfers of values
813  /// between locations during stepping, creates new DBG_VALUEs when values move
814  /// location.
815  TransferTracker *TTracker = nullptr;
816 
817  /// Blocks which are artificial, i.e. blocks which exclusively contain
818  /// instructions without DebugLocs, or with line 0 locations.
820 
821  // Mapping of blocks to and from their RPOT order.
824  DenseMap<unsigned, unsigned> BBNumToRPO;
825 
826  /// Pair of MachineInstr, and its 1-based offset into the containing block.
827  using InstAndNum = std::pair<const MachineInstr *, unsigned>;
828  /// Map from debug instruction number to the MachineInstr labelled with that
829  /// number, and its location within the function. Used to transform
830  /// instruction numbers in DBG_INSTR_REFs into machine value numbers.
831  std::map<uint64_t, InstAndNum> DebugInstrNumToInstr;
832 
833  /// Record of where we observed a DBG_PHI instruction.
834  class DebugPHIRecord {
835  public:
836  uint64_t InstrNum; ///< Instruction number of this DBG_PHI.
837  MachineBasicBlock *MBB; ///< Block where DBG_PHI occurred.
838  ValueIDNum ValueRead; ///< The value number read by the DBG_PHI.
839  LocIdx ReadLoc; ///< Register/Stack location the DBG_PHI reads.
840 
841  operator unsigned() const { return InstrNum; }
842  };
843 
844  /// Map from instruction numbers defined by DBG_PHIs to a record of what that
845  /// DBG_PHI read and where. Populated and edited during the machine value
846  /// location problem -- we use LLVMs SSA Updater to fix changes by
847  /// optimizations that destroy PHI instructions.
848  SmallVector<DebugPHIRecord, 32> DebugPHINumToValue;
849 
850  // Map of overlapping variable fragments.
851  OverlapMap OverlapFragments;
852  VarToFragments SeenFragments;
853 
854  /// True if we need to examine call instructions for stack clobbers. We
855  /// normally assume that they don't clobber SP, but stack probes on Windows
856  /// do.
857  bool AdjustsStackInCalls = false;
858 
859  /// If AdjustsStackInCalls is true, this holds the name of the target's stack
860  /// probe function, which is the function we expect will alter the stack
861  /// pointer.
862  StringRef StackProbeSymbolName;
863 
864  /// Tests whether this instruction is a spill to a stack slot.
865  bool isSpillInstruction(const MachineInstr &MI, MachineFunction *MF);
866 
867  /// Decide if @MI is a spill instruction and return true if it is. We use 2
868  /// criteria to make this decision:
869  /// - Is this instruction a store to a spill slot?
870  /// - Is there a register operand that is both used and killed?
871  /// TODO: Store optimization can fold spills into other stores (including
872  /// other spills). We do not handle this yet (more than one memory operand).
873  bool isLocationSpill(const MachineInstr &MI, MachineFunction *MF,
874  unsigned &Reg);
875 
876  /// If a given instruction is identified as a spill, return the spill slot
877  /// and set \p Reg to the spilled register.
878  Optional<SpillLocationNo> isRestoreInstruction(const MachineInstr &MI,
879  MachineFunction *MF, unsigned &Reg);
880 
881  /// Given a spill instruction, extract the spill slot information, ensure it's
882  /// tracked, and return the spill number.
883  SpillLocationNo extractSpillBaseRegAndOffset(const MachineInstr &MI);
884 
885  /// Observe a single instruction while stepping through a block.
886  void process(MachineInstr &MI, ValueIDNum **MLiveOuts = nullptr,
887  ValueIDNum **MLiveIns = nullptr);
888 
889  /// Examines whether \p MI is a DBG_VALUE and notifies trackers.
890  /// \returns true if MI was recognized and processed.
891  bool transferDebugValue(const MachineInstr &MI);
892 
893  /// Examines whether \p MI is a DBG_INSTR_REF and notifies trackers.
894  /// \returns true if MI was recognized and processed.
895  bool transferDebugInstrRef(MachineInstr &MI, ValueIDNum **MLiveOuts,
896  ValueIDNum **MLiveIns);
897 
898  /// Stores value-information about where this PHI occurred, and what
899  /// instruction number is associated with it.
900  /// \returns true if MI was recognized and processed.
901  bool transferDebugPHI(MachineInstr &MI);
902 
903  /// Examines whether \p MI is copy instruction, and notifies trackers.
904  /// \returns true if MI was recognized and processed.
905  bool transferRegisterCopy(MachineInstr &MI);
906 
907  /// Examines whether \p MI is stack spill or restore instruction, and
908  /// notifies trackers. \returns true if MI was recognized and processed.
909  bool transferSpillOrRestoreInst(MachineInstr &MI);
910 
911  /// Examines \p MI for any registers that it defines, and notifies trackers.
912  void transferRegisterDef(MachineInstr &MI);
913 
914  /// Copy one location to the other, accounting for movement of subregisters
915  /// too.
916  void performCopy(Register Src, Register Dst);
917 
918  void accumulateFragmentMap(MachineInstr &MI);
919 
920  /// Determine the machine value number referred to by (potentially several)
921  /// DBG_PHI instructions. Block duplication and tail folding can duplicate
922  /// DBG_PHIs, shifting the position where values in registers merge, and
923  /// forming another mini-ssa problem to solve.
924  /// \p Here the position of a DBG_INSTR_REF seeking a machine value number
925  /// \p InstrNum Debug instruction number defined by DBG_PHI instructions.
926  /// \returns The machine value number at position Here, or None.
927  Optional<ValueIDNum> resolveDbgPHIs(MachineFunction &MF,
928  ValueIDNum **MLiveOuts,
929  ValueIDNum **MLiveIns, MachineInstr &Here,
930  uint64_t InstrNum);
931 
932  /// Step through the function, recording register definitions and movements
933  /// in an MLocTracker. Convert the observations into a per-block transfer
934  /// function in \p MLocTransfer, suitable for using with the machine value
935  /// location dataflow problem.
936  void
937  produceMLocTransferFunction(MachineFunction &MF,
938  SmallVectorImpl<MLocTransferMap> &MLocTransfer,
939  unsigned MaxNumBlocks);
940 
941  /// Solve the machine value location dataflow problem. Takes as input the
942  /// transfer functions in \p MLocTransfer. Writes the output live-in and
943  /// live-out arrays to the (initialized to zero) multidimensional arrays in
944  /// \p MInLocs and \p MOutLocs. The outer dimension is indexed by block
945  /// number, the inner by LocIdx.
946  void buildMLocValueMap(MachineFunction &MF, ValueIDNum **MInLocs,
947  ValueIDNum **MOutLocs,
948  SmallVectorImpl<MLocTransferMap> &MLocTransfer);
949 
950  /// Examine the stack indexes (i.e. offsets within the stack) to find the
951  /// basic units of interference -- like reg units, but for the stack.
952  void findStackIndexInterference(SmallVectorImpl<unsigned> &Slots);
953 
954  /// Install PHI values into the live-in array for each block, according to
955  /// the IDF of each register.
956  void placeMLocPHIs(MachineFunction &MF,
958  ValueIDNum **MInLocs,
959  SmallVectorImpl<MLocTransferMap> &MLocTransfer);
960 
961  /// Calculate the iterated-dominance-frontier for a set of defs, using the
962  /// existing LLVM facilities for this. Works for a single "value" or
963  /// machine/variable location.
964  /// \p AllBlocks Set of blocks where we might consume the value.
965  /// \p DefBlocks Set of blocks where the value/location is defined.
966  /// \p PHIBlocks Output set of blocks where PHIs must be placed.
967  void BlockPHIPlacement(const SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
968  const SmallPtrSetImpl<MachineBasicBlock *> &DefBlocks,
970 
971  /// Perform a control flow join (lattice value meet) of the values in machine
972  /// locations at \p MBB. Follows the algorithm described in the file-comment,
973  /// reading live-outs of predecessors from \p OutLocs, the current live ins
974  /// from \p InLocs, and assigning the newly computed live ins back into
975  /// \p InLocs. \returns two bools -- the first indicates whether a change
976  /// was made, the second whether a lattice downgrade occurred. If the latter
977  /// is true, revisiting this block is necessary.
978  bool mlocJoin(MachineBasicBlock &MBB,
980  ValueIDNum **OutLocs, ValueIDNum *InLocs);
981 
982  /// Solve the variable value dataflow problem, for a single lexical scope.
983  /// Uses the algorithm from the file comment to resolve control flow joins
984  /// using PHI placement and value propagation. Reads the locations of machine
985  /// values from the \p MInLocs and \p MOutLocs arrays (see buildMLocValueMap)
986  /// and reads the variable values transfer function from \p AllTheVlocs.
987  /// Live-in and Live-out variable values are stored locally, with the live-ins
988  /// permanently stored to \p Output once a fixedpoint is reached.
989  /// \p VarsWeCareAbout contains a collection of the variables in \p Scope
990  /// that we should be tracking.
991  /// \p AssignBlocks contains the set of blocks that aren't in \p DILoc's
992  /// scope, but which do contain DBG_VALUEs, which VarLocBasedImpl tracks
993  /// locations through.
994  void buildVLocValueMap(const DILocation *DILoc,
995  const SmallSet<DebugVariable, 4> &VarsWeCareAbout,
997  LiveInsT &Output, ValueIDNum **MOutLocs,
998  ValueIDNum **MInLocs,
999  SmallVectorImpl<VLocTracker> &AllTheVLocs);
1000 
1001  /// Attempt to eliminate un-necessary PHIs on entry to a block. Examines the
1002  /// live-in values coming from predecessors live-outs, and replaces any PHIs
1003  /// already present in this blocks live-ins with a live-through value if the
1004  /// PHI isn't needed.
1005  /// \p LiveIn Old live-in value, overwritten with new one if live-in changes.
1006  /// \returns true if any live-ins change value, either from value propagation
1007  /// or PHI elimination.
1008  bool vlocJoin(MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
1010  DbgValue &LiveIn);
1011 
1012  /// For the given block and live-outs feeding into it, try to find a
1013  /// machine location where all the variable values join together.
1014  /// \returns Value ID of a machine PHI if an appropriate one is available.
1016  pickVPHILoc(const MachineBasicBlock &MBB, const DebugVariable &Var,
1017  const LiveIdxT &LiveOuts, ValueIDNum **MOutLocs,
1018  const SmallVectorImpl<const MachineBasicBlock *> &BlockOrders);
1019 
1020  /// Given the solutions to the two dataflow problems, machine value locations
1021  /// in \p MInLocs and live-in variable values in \p SavedLiveIns, runs the
1022  /// TransferTracker class over the function to produce live-in and transfer
1023  /// DBG_VALUEs, then inserts them. Groups of DBG_VALUEs are inserted in the
1024  /// order given by AllVarsNumbering -- this could be any stable order, but
1025  /// right now "order of appearence in function, when explored in RPO", so
1026  /// that we can compare explictly against VarLocBasedImpl.
1027  void emitLocations(MachineFunction &MF, LiveInsT SavedLiveIns,
1028  ValueIDNum **MOutLocs, ValueIDNum **MInLocs,
1029  DenseMap<DebugVariable, unsigned> &AllVarsNumbering,
1030  const TargetPassConfig &TPC);
1031 
1032  /// Boilerplate computation of some initial sets, artifical blocks and
1033  /// RPOT block ordering.
1034  void initialSetup(MachineFunction &MF);
1035 
1036  bool ExtendRanges(MachineFunction &MF, MachineDominatorTree *DomTree,
1037  TargetPassConfig *TPC, unsigned InputBBLimit,
1038  unsigned InputDbgValLimit) override;
1039 
1040 public:
1041  /// Default construct and initialize the pass.
1042  InstrRefBasedLDV();
1043 
1045  void dump_mloc_transfer(const MLocTransferMap &mloc_transfer) const;
1046 
1047  bool isCalleeSaved(LocIdx L) const;
1048 
1050  // Instruction must have a memory operand that's a stack slot, and isn't
1051  // aliased, meaning it's a spill from regalloc instead of a variable.
1052  // If it's aliased, we can't guarantee its value.
1053  if (!MI.hasOneMemOperand())
1054  return false;
1055  auto *MemOperand = *MI.memoperands_begin();
1056  return MemOperand->isStore() &&
1057  MemOperand->getPseudoValue() &&
1058  MemOperand->getPseudoValue()->kind() == PseudoSourceValue::FixedStack
1059  && !MemOperand->getPseudoValue()->isAliased(MFI);
1060  }
1061 
1062  Optional<LocIdx> findLocationForMemOperand(const MachineInstr &MI);
1063 };
1064 
1065 } // namespace LiveDebugValues
1066 
1067 namespace llvm {
1068 using namespace LiveDebugValues;
1069 
1070 template <> struct DenseMapInfo<LocIdx> {
1071  static inline LocIdx getEmptyKey() { return LocIdx::MakeIllegalLoc(); }
1072  static inline LocIdx getTombstoneKey() { return LocIdx::MakeTombstoneLoc(); }
1073 
1074  static unsigned getHashValue(const LocIdx &Loc) { return Loc.asU64(); }
1075 
1076  static bool isEqual(const LocIdx &A, const LocIdx &B) { return A == B; }
1077 };
1078 
1079 template <> struct DenseMapInfo<ValueIDNum> {
1080  static inline ValueIDNum getEmptyKey() { return ValueIDNum::EmptyValue; }
1081  static inline ValueIDNum getTombstoneKey() {
1083  }
1084 
1085  static unsigned getHashValue(const ValueIDNum &Val) { return Val.asU64(); }
1086 
1087  static bool isEqual(const ValueIDNum &A, const ValueIDNum &B) {
1088  return A == B;
1089  }
1090 };
1091 
1092 } // end namespace llvm
1093 
1094 #endif /* LLVM_LIB_CODEGEN_LIVEDEBUGVALUES_INSTRREFBASEDLDV_H */
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
LiveDebugValues::MLocTracker::MLocIterator
Iterator for locations and the values they contain.
Definition: InstrRefBasedImpl.h:412
LiveDebugValues::MLocTracker::setReg
void setReg(Register R, ValueIDNum ValueID)
Set a register to a value number.
Definition: InstrRefBasedImpl.h:583
LiveDebugValues::SpillLocationNo::SpillNo
unsigned SpillNo
Definition: InstrRefBasedImpl.h:179
LiveDebugValues::MLocTracker::locations
iterator_range< MLocIterator > locations()
Return a range over all locations currently tracked.
Definition: InstrRefBasedImpl.h:637
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:105
MachineInstr.h
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:506
LiveDebugValues::DbgValue::DbgValue
DbgValue(const MachineOperand &MO, const DbgValueProperties &Prop, KindT Kind)
Definition: InstrRefBasedImpl.h:262
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::tgtok::Def
@ Def
Definition: TGLexer.h:50
LiveDebugValues::ValueIDNum::asU64
uint64_t asU64() const
Definition: InstrRefBasedImpl.h:140
LiveDebugValues::MLocTracker::MLocIterator::operator*
value_type operator*()
Definition: InstrRefBasedImpl.h:438
Reg
unsigned Reg
Definition: MachineSink.cpp:1558
LiveDebugValues::DbgValueProperties::DIExpr
const DIExpression * DIExpr
Definition: InstrRefBasedImpl.h:216
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
TargetFrameLowering.h
llvm::TargetFrameLowering
Information about stack frame layout on the target.
Definition: TargetFrameLowering.h:43
LiveDebugValues::MLocTracker::MLocIterator::MLocIterator
MLocIterator(LocToValueType &ValueMap, LocIdx Idx)
Definition: InstrRefBasedImpl.h:424
LiveDebugValues::MLocTracker::NumRegs
unsigned NumRegs
Cached local copy of the number of registers the target has.
Definition: InstrRefBasedImpl.h:383
llvm::DenseMapInfo< LocIdx >::getEmptyKey
static LocIdx getEmptyKey()
Definition: InstrRefBasedImpl.h:1071
llvm::SharedLiveDebugValues::LDVImpl
Definition: LiveDebugValues.h:25
DebugInfoMetadata.h
llvm::MachineRegisterInfo
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Definition: MachineRegisterInfo.h:52
LiveDebugValues::LocIdx::operator!=
bool operator!=(unsigned L) const
Definition: InstrRefBasedImpl.h:72
LiveDebugValues::ValueIDNum::BlockNo
uint64_t BlockNo
Definition: InstrRefBasedImpl.h:111
LiveDebugValues::MLocTracker::MLocIterator::value_type
Definition: InstrRefBasedImpl.h:417
LiveDebugValues::DbgValue::DbgValue
DbgValue(const ValueIDNum &Val, const DbgValueProperties &Prop, KindT Kind)
Definition: InstrRefBasedImpl.h:251
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
LiveDebugValues::ValueIDNum
Unique identifier for a value defined by an instruction, as a value type.
Definition: InstrRefBasedImpl.h:108
LiveDebugValues::ValueIDNum::operator==
bool operator==(const ValueIDNum &Other) const
Definition: InstrRefBasedImpl.h:152
llvm::SmallDenseMap
Definition: DenseMap.h:880
LiveDebugValues::MLocTracker::setMLoc
void setMLoc(LocIdx L, ValueIDNum Num)
Set a locaiton to a certain value.
Definition: InstrRefBasedImpl.h:543
MachineBasicBlock.h
LiveDebugValues::SpillLoc::operator<
bool operator<(const SpillLoc &Other) const
Definition: InstrRefBasedImpl.h:90
LiveDebugValues::ValueIDNum::ValueIDNum
ValueIDNum()
Definition: InstrRefBasedImpl.h:125
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:233
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1580
LiveDebugValues::LocIdx::operator<
bool operator<(const LocIdx &Other) const
Definition: InstrRefBasedImpl.h:76
DenseMap.h
NUM_LOC_BITS
#define NUM_LOC_BITS
Definition: InstrRefBasedImpl.h:52
llvm::IndexedMap::clear
void clear()
Definition: IndexedMap.h:63
LiveDebugValues::ValueIDNum::InstNo
uint64_t InstNo
The block where the def happens.
Definition: InstrRefBasedImpl.h:112
TargetInstrInfo.h
LiveDebugValues::DbgValueProperties::operator!=
bool operator!=(const DbgValueProperties &Other) const
Definition: InstrRefBasedImpl.h:212
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:235
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:226
llvm::SmallSet
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition: SmallSet.h:134
LiveDebugValues::LocIdx::operator==
bool operator==(const LocIdx &L) const
Definition: InstrRefBasedImpl.h:70
llvm::Optional
Definition: APInt.h:33
llvm::MapVector
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:37
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:449
llvm::DenseMapInfo< ValueIDNum >::isEqual
static bool isEqual(const ValueIDNum &A, const ValueIDNum &B)
Definition: InstrRefBasedImpl.h:1087
llvm::RegState::Undef
@ Undef
Value of the register doesn't matter.
Definition: MachineInstrBuilder.h:52
LiveDebugValues::LocIdx::LocIdx
LocIdx(unsigned L)
Definition: InstrRefBasedImpl.h:53
LiveDebugValues::MLocTracker::TRI
const TargetRegisterInfo & TRI
Definition: InstrRefBasedImpl.h:346
llvm::dump
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
Definition: SparseBitVector.h:876
LiveDebugValues::LocIdx::operator==
bool operator==(unsigned L) const
Definition: InstrRefBasedImpl.h:68
LiveDebugValues::ValueIDNum::isPHI
bool isPHI() const
Definition: InstrRefBasedImpl.h:138
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2596
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1559
LiveDebugValues::MLocTracker::TII
const TargetInstrInfo & TII
Definition: InstrRefBasedImpl.h:345
TransferTracker
Tracker for converting machine value locations and variable values into variable locations (the outpu...
Definition: InstrRefBasedImpl.cpp:167
LiveDebugValues::DbgValue::ID
ValueIDNum ID
If Kind is Def, the value number that this value is based on.
Definition: InstrRefBasedImpl.h:230
LiveDebugValues
Definition: InstrRefBasedImpl.h:33
LiveDebugValues::SpillLocationNo::operator<
bool operator<(const SpillLocationNo &Other) const
Definition: InstrRefBasedImpl.h:182
LiveDebugValues::MLocTracker::wipeRegister
void wipeRegister(Register R)
Reset a register value to zero / empty.
Definition: InstrRefBasedImpl.h:599
LiveDebugValues::MLocTracker::StackSlotPos
std::pair< unsigned short, unsigned short > StackSlotPos
Pair for describing a position within a stack slot – first the size in bits, then the offset.
Definition: InstrRefBasedImpl.h:398
LiveDebugValues::MLocTracker::Masks
SmallVector< std::pair< const MachineOperand *, unsigned >, 32 > Masks
Collection of register mask operands that have been observed.
Definition: InstrRefBasedImpl.h:394
llvm::DenseMapInfo
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition: APInt.h:34
LiveDebugValues::MLocTracker::reset
void reset(void)
Wipe any un-necessary location records after traversing a block.
Definition: InstrRefBasedImpl.h:519
llvm::TargetInstrInfo
TargetInstrInfo - Interface to description of machine instruction set.
Definition: TargetInstrInfo.h:97
LiveDebugValues::LocIdxToIndexFunctor::operator()
unsigned operator()(const LocIdx &L) const
Definition: InstrRefBasedImpl.h:302
llvm::IndexedMap::size
StorageT::size_type size() const
Definition: IndexedMap.h:77
LiveDebugValues::MLocTracker::TLI
const TargetLowering & TLI
Definition: InstrRefBasedImpl.h:347
LiveDebugValues::MLocTracker::MLocIterator::value_type::Value
ValueIDNum & Value
Read-only index of this location.
Definition: InstrRefBasedImpl.h:421
LiveDebugValues::MLocTracker::locIDToSpillIdx
StackSlotPos locIDToSpillIdx(unsigned ID) const
Returns the spill-slot size/offs that a location ID corresponds to.
Definition: InstrRefBasedImpl.h:490
llvm::TargetLowering
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Definition: TargetLowering.h:3254
llvm::DebugVariable::getFragmentOrDefault
FragmentInfo getFragmentOrDefault() const
Definition: DebugInfoMetadata.h:3696
llvm::IndexedMap< ValueIDNum, LocIdxToIndexFunctor >
LiveDebugValues::MLocTracker::LocIDToLocIdx
std::vector< LocIdx > LocIDToLocIdx
"Map" of machine location IDs (i.e., raw register or spill number) to the LocIdx key / number for tha...
Definition: InstrRefBasedImpl.h:364
false
Definition: StackSlotColoring.cpp:142
LiveDebugValues::MLocTracker::MLocIterator::operator++
void operator++()
Definition: InstrRefBasedImpl.h:436
LiveDebugValues::ValueIDNum::Value
uint64_t Value
Definition: InstrRefBasedImpl.h:117
TII
const HexagonInstrInfo * TII
Definition: HexagonCopyToCombine.cpp:129
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::MachineOperand
MachineOperand class - Representation of each machine instruction operand.
Definition: MachineOperand.h:49
LiveDebugValues::MLocTracker::MF
MachineFunction & MF
Definition: InstrRefBasedImpl.h:344
LiveDebugValues::MLocTracker::getSpillMLoc
LocIdx getSpillMLoc(unsigned SpillID)
Definition: InstrRefBasedImpl.h:622
LiveDebugValues::ValueIDNum::operator!=
bool operator!=(const ValueIDNum &Other) const
Definition: InstrRefBasedImpl.h:156
LiveDebugValues::ValueIDNum::operator<
bool operator<(const ValueIDNum &Other) const
Definition: InstrRefBasedImpl.h:148
LiveDebugValues::DbgValueProperties::Indirect
bool Indirect
Definition: InstrRefBasedImpl.h:217
UniqueVector.h
LexicalScopes.h
SmallPtrSet.h
LiveDebugValues::MLocTracker::getLocID
unsigned getLocID(Register Reg)
Produce location ID number for a Register.
Definition: InstrRefBasedImpl.h:447
llvm::BitVector
Definition: BitVector.h:74
LiveDebugValues::LocIdx::asU64
uint64_t asU64() const
Definition: InstrRefBasedImpl.h:66
LiveDebugValues::VLocTracker::EmptyProperties
DbgValueProperties EmptyProperties
Definition: InstrRefBasedImpl.h:684
LiveDebugValues::ValueIDNum::getBlock
uint64_t getBlock() const
Definition: InstrRefBasedImpl.h:135
llvm::UniqueVector
UniqueVector - This class produces a sequential ID number (base 1) for each unique entry that is adde...
Definition: UniqueVector.h:24
LiveDebugValues::ValueIDNum::getLoc
uint64_t getLoc() const
Definition: InstrRefBasedImpl.h:137
LiveDebugValues::MLocTracker::defReg
void defReg(Register R, unsigned BB, unsigned Inst)
Record a definition of the specified register at the given block / inst.
Definition: InstrRefBasedImpl.h:574
llvm::None
const NoneType None
Definition: None.h:23
LiveDebugValues::MLocTracker::getLocID
unsigned getLocID(SpillLocationNo Spill, StackSlotPos Idx)
Produce location ID number for a spill position.
Definition: InstrRefBasedImpl.h:461
llvm::DebugVariable::getVariable
const DILocalVariable * getVariable() const
Definition: DebugInfoMetadata.h:3692
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
LiveDebugValues::DbgValue::Properties
DbgValueProperties Properties
Qualifiers for the ValueIDNum above.
Definition: InstrRefBasedImpl.h:237
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
LiveDebugValues::FragmentOfVar
std::pair< const DILocalVariable *, DIExpression::FragmentInfo > FragmentOfVar
Types for recording sets of variable fragments that overlap.
Definition: InstrRefBasedImpl.h:662
LiveDebugValues::MLocTracker::LocIdxToLocID
IndexedMap< unsigned, LocIdxToIndexFunctor > LocIdxToLocID
Inverse map of LocIDToLocIdx.
Definition: InstrRefBasedImpl.h:367
LiveDebugValues::VLocTracker::OverlappingFragments
const OverlapMap & OverlappingFragments
Definition: InstrRefBasedImpl.h:683
LiveDebugValues::SpillLocationNo::operator!=
bool operator!=(const SpillLocationNo &Other) const
Definition: InstrRefBasedImpl.h:189
llvm::Twine::str
std::string str() const
Return the twine contents as a std::string.
Definition: Twine.cpp:17
LiveDebugValues::SpillLoc
Definition: InstrRefBasedImpl.h:83
LiveDebugValues::DbgValue::operator!=
bool operator!=(const DbgValue &Other) const
Definition: InstrRefBasedImpl.h:296
llvm::TargetPassConfig
Target-Independent Code Generator Pass Configuration Options.
Definition: TargetPassConfig.h:84
LiveDebugValues::MLocTracker::lookupOrTrackRegister
LocIdx lookupOrTrackRegister(unsigned ID)
Definition: InstrRefBasedImpl.h:558
LiveDebugValues::DbgValueProperties::DbgValueProperties
DbgValueProperties(const MachineInstr &MI)
Extract properties from an existing DBG_VALUE instruction.
Definition: InstrRefBasedImpl.h:202
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:206
LiveDebugValues::DbgValue
Class recording the (high level) value of a variable.
Definition: InstrRefBasedImpl.h:225
llvm::DenseMapBase::clear
void clear()
Definition: DenseMap.h:111
LiveDebugValues::InstrRefBasedLDV::InValueT
std::pair< MachineBasicBlock *, DbgValue * > InValueT
Type for a live-in value: the predecessor block, and its value.
Definition: InstrRefBasedImpl.h:776
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
llvm::MachineInstrBuilder
Definition: MachineInstrBuilder.h:69
uint64_t
LiveDebugValues::DbgValue::operator==
bool operator==(const DbgValue &Other) const
Definition: InstrRefBasedImpl.h:279
s
multiplies can be turned into SHL s
Definition: README.txt:370
llvm::DenseMap< StackSlotPos, unsigned >
LiveDebugValues::MLocTracker::MLocIterator::value_type::Idx
const LocIdx Idx
Definition: InstrRefBasedImpl.h:420
LiveDebugValues::LocIdx::isIllegal
bool isIllegal() const
Definition: InstrRefBasedImpl.h:64
LiveDebugValues::DbgValue::KindT
KindT
Definition: InstrRefBasedImpl.h:239
llvm::DebugVariable
Identifies a unique instance of a variable.
Definition: DebugInfoMetadata.h:3670
llvm::StackOffset::getScalable
static StackOffset getScalable(ScalarTy Scalable)
Definition: TypeSize.h:144
llvm::concat
detail::concat_range< ValueT, RangeTs... > concat(RangeTs &&... Ranges)
Concatenated range across two or more ranges.
Definition: STLExtras.h:1060
LiveDebugValues::DbgValue::NoVal
@ NoVal
Definition: InstrRefBasedImpl.h:245
TargetPassConfig.h
llvm::DenseMapInfo< LocIdx >::getHashValue
static unsigned getHashValue(const LocIdx &Loc)
Definition: InstrRefBasedImpl.h:1074
LiveDebugValues::MLocTracker::MLocIterator::value_type::value_type
value_type(LocIdx Idx, ValueIDNum &Value)
Definition: InstrRefBasedImpl.h:419
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:150
LiveDebugValues::VLocTracker
Collection of DBG_VALUEs observed when traversing a block.
Definition: InstrRefBasedImpl.h:670
LiveDebugValues::MLocTracker::StackIdxesToPos
DenseMap< unsigned, StackSlotPos > StackIdxesToPos
Inverse of StackSlotIdxes.
Definition: InstrRefBasedImpl.h:406
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::DenseMapInfo< LocIdx >::getTombstoneKey
static LocIdx getTombstoneKey()
Definition: InstrRefBasedImpl.h:1072
LiveDebugValues::InstrRefBasedLDV::hasFoldedStackStore
bool hasFoldedStackStore(const MachineInstr &MI)
Definition: InstrRefBasedImpl.h:1049
LiveDebugValues::DbgValue::DbgValue
DbgValue(const DbgValueProperties &Prop, KindT Kind)
Definition: InstrRefBasedImpl.h:268
LiveDebugValues::SpillLocationNo::id
unsigned id() const
Definition: InstrRefBasedImpl.h:180
LiveDebugValues::MLocTracker
Tracker for what values are in machine locations.
Definition: InstrRefBasedImpl.h:342
llvm::MachineFunction
Definition: MachineFunction.h:234
llvm::DenseMapInfo< ValueIDNum >::getHashValue
static unsigned getHashValue(const ValueIDNum &Val)
Definition: InstrRefBasedImpl.h:1085
llvm::DenseMapInfo< ValueIDNum >::getTombstoneKey
static ValueIDNum getTombstoneKey()
Definition: InstrRefBasedImpl.h:1081
LiveDebugValues::MLocTracker::SpillLocs
UniqueVector< SpillLoc > SpillLocs
Unique-ification of spill.
Definition: InstrRefBasedImpl.h:376
LiveDebugValues::SpillLoc::SpillOffset
StackOffset SpillOffset
Definition: InstrRefBasedImpl.h:85
LiveDebugValues::LocIdx
Handle-class for a particular "location".
Definition: InstrRefBasedImpl.h:44
LiveDebugValues::VLocTracker::considerOverlaps
void considerOverlaps(const DebugVariable &Var, const DILocation *Loc)
Definition: InstrRefBasedImpl.h:724
LiveDebugValues::ValueIDNum::getInst
uint64_t getInst() const
Definition: InstrRefBasedImpl.h:136
LiveDebugValues::MLocTracker::getLocID
unsigned getLocID(SpillLocationNo Spill, unsigned SpillSubReg)
Produce location ID number for a spill position.
Definition: InstrRefBasedImpl.h:452
LiveDebugValues::ValueIDNum::fromU64
static ValueIDNum fromU64(uint64_t v)
Definition: InstrRefBasedImpl.h:142
llvm::MapVector::insert
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition: MapVector.h:118
LiveDebugValues::VLocTracker::defVar
void defVar(const MachineInstr &MI, const DbgValueProperties &Properties, Optional< ValueIDNum > ID)
Definition: InstrRefBasedImpl.h:690
LiveDebugValues::DbgValue::DbgValue
DbgValue(unsigned BlockNo, const DbgValueProperties &Prop, KindT Kind)
Definition: InstrRefBasedImpl.h:256
LiveDebugValues::MLocTracker::loadFromArray
void loadFromArray(ValueIDNum *Locs, unsigned NewCurBB)
Load values for each location from array of ValueIDNums.
Definition: InstrRefBasedImpl.h:510
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
LiveDebugValues::MLocTracker::SPAliases
SmallSet< Register, 8 > SPAliases
When clobbering register masks, we chose to not believe the machine model and don't clobber SP.
Definition: InstrRefBasedImpl.h:372
llvm::StackOffset
StackOffset is a class to represent an offset with 2 dimensions, named fixed and scalable,...
Definition: TypeSize.h:134
LiveDebugValues::MLocTracker::locIDToSpill
SpillLocationNo locIDToSpill(unsigned ID) const
Return the spill number that a location ID corresponds to.
Definition: InstrRefBasedImpl.h:481
LiveDebugValues::DbgValueProperties
Meta qualifiers for a value.
Definition: InstrRefBasedImpl.h:196
llvm::ValueMap
See the file comment.
Definition: ValueMap.h:85
LiveDebugValues::MLocTracker::getSpillIDWithIdx
unsigned getSpillIDWithIdx(SpillLocationNo Spill, unsigned Idx)
Given a spill number, and a slot within the spill, calculate the ID number for that location.
Definition: InstrRefBasedImpl.h:472
llvm::StackOffset::getFixed
static StackOffset getFixed(ScalarTy Fixed)
Definition: TypeSize.h:143
LiveDebugValues::LocIdx::MakeIllegalLoc
static LocIdx MakeIllegalLoc()
Definition: InstrRefBasedImpl.h:57
LiveDebugValues::SpillLocationNo::SpillLocationNo
SpillLocationNo(unsigned SpillNo)
Definition: InstrRefBasedImpl.h:178
llvm::DenseMapInfo< ValueIDNum >::getEmptyKey
static ValueIDNum getEmptyKey()
Definition: InstrRefBasedImpl.h:1080
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
LiveDebugValues::DbgValue::Kind
KindT Kind
Discriminator for whether this is a constant or an in-program value.
Definition: InstrRefBasedImpl.h:249
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
LiveDebugValues::MLocTracker::StackSlotIdxes
DenseMap< StackSlotPos, unsigned > StackSlotIdxes
Map from a size/offset pair describing a position in a stack slot, to a numeric identifier for that p...
Definition: InstrRefBasedImpl.h:403
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
LiveDebugValues::VLocTracker::Vars
MapVector< DebugVariable, DbgValue > Vars
Map DebugVariable to the latest Value it's defined to have.
Definition: InstrRefBasedImpl.h:680
LiveDebugValues::MLocTracker::begin
MLocIterator begin()
Definition: InstrRefBasedImpl.h:630
LiveDebugValues::MLocTracker::readReg
ValueIDNum readReg(Register R)
Definition: InstrRefBasedImpl.h:589
LiveDebugValues::InstrRefBasedLDV
Definition: InstrRefBasedImpl.h:753
llvm::DenseMapBase::end
iterator end()
Definition: DenseMap.h:83
LiveDebugValues::SpillLocationNo
Thin wrapper around an integer – designed to give more type safety to spill location numbers.
Definition: InstrRefBasedImpl.h:176
MachineFrameInfo.h
LiveDebugValues::MLocTracker::getRegMLoc
LocIdx getRegMLoc(Register R)
Determine the LocIdx of an existing register.
Definition: InstrRefBasedImpl.h:606
llvm::AArch64CC::LS
@ LS
Definition: AArch64BaseInfo.h:264
InputBBLimit
static cl::opt< unsigned > InputBBLimit("livedebugvalues-input-bb-limit", cl::desc("Maximum input basic blocks before DBG_VALUE limit applies"), cl::init(10000), cl::Hidden)
LiveDebugValues::LocIdxToIndexFunctor
Definition: InstrRefBasedImpl.h:299
LiveDebugValues::VLocTracker::VLocTracker
VLocTracker(const OverlapMap &O, const DIExpression *EmptyExpr)
Definition: InstrRefBasedImpl.h:687
llvm::SmallVectorImpl::clear
void clear()
Definition: SmallVector.h:585
LiveDebugValues::MLocTracker::LocIdxToIDNum
LocToValueType LocIdxToIDNum
Map of LocIdxes to the ValueIDNums that they store.
Definition: InstrRefBasedImpl.h:354
LiveDebugValues.h
LiveDebugValues::MLocTracker::MLocIterator::operator==
bool operator==(const MLocIterator &Other) const
Definition: InstrRefBasedImpl.h:427
LiveDebugValues::MLocTracker::isSpill
bool isSpill(LocIdx Idx) const
Return true if Idx is a spill machine location.
Definition: InstrRefBasedImpl.h:628
LiveDebugValues::ValueIDNum::asString
std::string asString(const std::string &mlocname) const
Definition: InstrRefBasedImpl.h:158
LiveDebugValues::MLocTracker::MLocIterator::operator!=
bool operator!=(const MLocIterator &Other) const
Definition: InstrRefBasedImpl.h:432
LiveDebugValues::DbgValue::MO
Optional< MachineOperand > MO
If Kind is Const, the MachineOperand defining this value.
Definition: InstrRefBasedImpl.h:232
llvm::DIExpression::FragmentInfo
Holds the characteristics of one fragment of a larger variable.
Definition: DebugInfoMetadata.h:2760
LiveDebugValues::DbgValueProperties::DbgValueProperties
DbgValueProperties(const DIExpression *DIExpr, bool Indirect)
Definition: InstrRefBasedImpl.h:198
LiveDebugValues::SpillLoc::SpillBase
unsigned SpillBase
Definition: InstrRefBasedImpl.h:84
LiveDebugValues::MLocTracker::setMPhis
void setMPhis(unsigned NewCurBB)
Reset all locations to contain a PHI value at the designated block.
Definition: InstrRefBasedImpl.h:502
llvm::MachineFrameInfo
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Definition: MachineFrameInfo.h:107
SmallVector.h
LiveDebugValues::DbgValue::Undef
@ Undef
Definition: InstrRefBasedImpl.h:240
LiveDebugValues::SpillLoc::operator==
bool operator==(const SpillLoc &Other) const
Definition: InstrRefBasedImpl.h:86
LiveDebugValues::ValueIDNum::EmptyValue
static ValueIDNum EmptyValue
Definition: InstrRefBasedImpl.h:170
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
LiveDebugValues::InstrRefBasedLDV::VarAndLoc
std::pair< DebugVariable, DbgValue > VarAndLoc
Definition: InstrRefBasedImpl.h:773
llvm::MCRegisterInfo::getSubRegIdxOffset
unsigned getSubRegIdxOffset(unsigned Idx) const
Get the offset of the bit range covered by a sub-register index.
Definition: MCRegisterInfo.cpp:62
LiveDebugValues::MLocTracker::clear
void clear(void)
Clear all data.
Definition: InstrRefBasedImpl.h:528
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
LiveDebugValues::VLocTracker::defVar
void defVar(const MachineInstr &MI, const MachineOperand &MO)
Definition: InstrRefBasedImpl.h:707
llvm::SmallPtrSetImpl
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:343
LiveDebugValues::ValueIDNum::TombstoneValue
static ValueIDNum TombstoneValue
Definition: InstrRefBasedImpl.h:171
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
LiveDebugValues::MLocTracker::end
MLocIterator end()
Definition: InstrRefBasedImpl.h:632
LiveDebugValues::LocIdx::operator!=
bool operator!=(const LocIdx &L) const
Definition: InstrRefBasedImpl.h:74
LiveDebugValues::ValueIDNum::ValueIDNum
ValueIDNum(uint64_t Block, uint64_t Inst, LocIdx Loc)
Definition: InstrRefBasedImpl.h:131
LiveDebugValues::SpillLocationNo::operator==
bool operator==(const SpillLocationNo &Other) const
Definition: InstrRefBasedImpl.h:186
LiveDebugValues::MLocTracker::isRegisterTracked
bool isRegisterTracked(Register R)
Is register R currently tracked by MLocTracker?
Definition: InstrRefBasedImpl.h:566
llvm::MachineDominatorTree
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Definition: MachineDominators.h:46
llvm::LexicalScopes
LexicalScopes - This class provides interface to collect and use lexical scoping information from mac...
Definition: LexicalScopes.h:141
LiveDebugValues::DbgValueProperties::operator==
bool operator==(const DbgValueProperties &Other) const
Definition: InstrRefBasedImpl.h:208
MachineFunction.h
LiveDebugValues::LocIdx::MakeTombstoneLoc
static LocIdx MakeTombstoneLoc()
Definition: InstrRefBasedImpl.h:58
LiveDebugValues::DbgValue::Const
@ Const
Definition: InstrRefBasedImpl.h:242
LiveDebugValues::MLocTracker::readMLoc
ValueIDNum readMLoc(LocIdx L)
Read the value of a particular location.
Definition: InstrRefBasedImpl.h:549
LiveDebugValues::DbgValue::BlockNo
int BlockNo
For a NoVal or VPHI DbgValue, which block it was generated in.
Definition: InstrRefBasedImpl.h:234
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
LiveDebugValues::ValueIDNum::ValueIDNum
ValueIDNum(uint64_t Block, uint64_t Inst, uint64_t Loc)
Definition: InstrRefBasedImpl.h:127
LiveDebugValues::DbgValue::Def
@ Def
Definition: InstrRefBasedImpl.h:241
LiveDebugValues::MLocTracker::getNumLocs
unsigned getNumLocs(void) const
Definition: InstrRefBasedImpl.h:497
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1195
llvm::MachineOperand::isIdenticalTo
bool isIdenticalTo(const MachineOperand &Other) const
Returns true if this operand is identical to the specified operand except for liveness related flags ...
Definition: MachineOperand.cpp:287
LiveDebugValues::MLocTracker::NumSlotIdxes
unsigned NumSlotIdxes
Number of slot indexes the target has – distinct segments of a stack slot that can take on the value ...
Definition: InstrRefBasedImpl.h:388
llvm::DenseMapInfo< LocIdx >::isEqual
static bool isEqual(const LocIdx &A, const LocIdx &B)
Definition: InstrRefBasedImpl.h:1076
LiveDebugValues::VLocTracker::Scopes
DenseMap< DebugVariable, const DILocation * > Scopes
Definition: InstrRefBasedImpl.h:681
LiveDebugValues::MLocTracker::CurBB
unsigned CurBB
Definition: InstrRefBasedImpl.h:380
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38
llvm::DebugVariable::getInlinedAt
const DILocation * getInlinedAt() const
Definition: DebugInfoMetadata.h:3694
llvm::Twine::concat
Twine concat(const Twine &Suffix) const
Definition: Twine.h:510
llvm::MCRegisterInfo::getSubRegIdxSize
unsigned getSubRegIdxSize(unsigned Idx) const
Get the size of the bit range covered by a sub-register index.
Definition: MCRegisterInfo.cpp:56
LiveDebugValues::DbgValue::VPHI
@ VPHI
Definition: InstrRefBasedImpl.h:243