Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/CodeGen/MachineBasicBlock.h
Line
Count
Source (jump to first uncovered line)
1
//===- llvm/CodeGen/MachineBasicBlock.h -------------------------*- C++ -*-===//
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
// Collect the sequence of machine instructions for a basic block.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H
14
#define LLVM_CODEGEN_MACHINEBASICBLOCK_H
15
16
#include "llvm/ADT/GraphTraits.h"
17
#include "llvm/ADT/ilist.h"
18
#include "llvm/ADT/ilist_node.h"
19
#include "llvm/ADT/iterator_range.h"
20
#include "llvm/ADT/simple_ilist.h"
21
#include "llvm/CodeGen/MachineInstr.h"
22
#include "llvm/CodeGen/MachineInstrBundleIterator.h"
23
#include "llvm/IR/DebugLoc.h"
24
#include "llvm/MC/LaneBitmask.h"
25
#include "llvm/MC/MCRegisterInfo.h"
26
#include "llvm/Support/BranchProbability.h"
27
#include "llvm/Support/Printable.h"
28
#include <cassert>
29
#include <cstdint>
30
#include <functional>
31
#include <iterator>
32
#include <string>
33
#include <vector>
34
35
namespace llvm {
36
37
class BasicBlock;
38
class MachineFunction;
39
class MCSymbol;
40
class ModuleSlotTracker;
41
class Pass;
42
class SlotIndexes;
43
class StringRef;
44
class raw_ostream;
45
class TargetRegisterClass;
46
class TargetRegisterInfo;
47
48
template <> struct ilist_traits<MachineInstr> {
49
private:
50
  friend class MachineBasicBlock; // Set by the owning MachineBasicBlock.
51
52
  MachineBasicBlock *Parent;
53
54
  using instr_iterator =
55
      simple_ilist<MachineInstr, ilist_sentinel_tracking<true>>::iterator;
56
57
public:
58
  void addNodeToList(MachineInstr *N);
59
  void removeNodeFromList(MachineInstr *N);
60
  void transferNodesFromList(ilist_traits &FromList, instr_iterator First,
61
                             instr_iterator Last);
62
  void deleteNode(MachineInstr *MI);
63
};
64
65
class MachineBasicBlock
66
    : public ilist_node_with_parent<MachineBasicBlock, MachineFunction> {
67
public:
68
  /// Pair of physical register and lane mask.
69
  /// This is not simply a std::pair typedef because the members should be named
70
  /// clearly as they both have an integer type.
71
  struct RegisterMaskPair {
72
  public:
73
    MCPhysReg PhysReg;
74
    LaneBitmask LaneMask;
75
76
    RegisterMaskPair(MCPhysReg PhysReg, LaneBitmask LaneMask)
77
16.4M
        : PhysReg(PhysReg), LaneMask(LaneMask) {}
78
  };
79
80
private:
81
  using Instructions = ilist<MachineInstr, ilist_sentinel_tracking<true>>;
82
83
  Instructions Insts;
84
  const BasicBlock *BB;
85
  int Number;
86
  MachineFunction *xParent;
87
88
  /// Keep track of the predecessor / successor basic blocks.
89
  std::vector<MachineBasicBlock *> Predecessors;
90
  std::vector<MachineBasicBlock *> Successors;
91
92
  /// Keep track of the probabilities to the successors. This vector has the
93
  /// same order as Successors, or it is empty if we don't use it (disable
94
  /// optimization).
95
  std::vector<BranchProbability> Probs;
96
  using probability_iterator = std::vector<BranchProbability>::iterator;
97
  using const_probability_iterator =
98
      std::vector<BranchProbability>::const_iterator;
99
100
  Optional<uint64_t> IrrLoopHeaderWeight;
101
102
  /// Keep track of the physical registers that are livein of the basicblock.
103
  using LiveInVector = std::vector<RegisterMaskPair>;
104
  LiveInVector LiveIns;
105
106
  /// Alignment of the basic block. Zero if the basic block does not need to be
107
  /// aligned. The alignment is specified as log2(bytes).
108
  unsigned Alignment = 0;
109
110
  /// Indicate that this basic block is entered via an exception handler.
111
  bool IsEHPad = false;
112
113
  /// Indicate that this basic block is potentially the target of an indirect
114
  /// branch.
115
  bool AddressTaken = false;
116
117
  /// Indicate that this basic block needs its symbol be emitted regardless of
118
  /// whether the flow just falls-through to it.
119
  bool LabelMustBeEmitted = false;
120
121
  /// Indicate that this basic block is the entry block of an EH scope, i.e.,
122
  /// the block that used to have a catchpad or cleanuppad instruction in the
123
  /// LLVM IR.
124
  bool IsEHScopeEntry = false;
125
126
  /// Indicate that this basic block is the entry block of an EH funclet.
127
  bool IsEHFuncletEntry = false;
128
129
  /// Indicate that this basic block is the entry block of a cleanup funclet.
130
  bool IsCleanupFuncletEntry = false;
131
132
  /// since getSymbol is a relatively heavy-weight operation, the symbol
133
  /// is only computed once and is cached.
134
  mutable MCSymbol *CachedMCSymbol = nullptr;
135
136
  // Intrusive list support
137
  MachineBasicBlock() = default;
138
139
  explicit MachineBasicBlock(MachineFunction &MF, const BasicBlock *BB);
140
141
  ~MachineBasicBlock();
142
143
  // MachineBasicBlocks are allocated and owned by MachineFunction.
144
  friend class MachineFunction;
145
146
public:
147
  /// Return the LLVM basic block that this instance corresponded to originally.
148
  /// Note that this may be NULL if this instance does not correspond directly
149
  /// to an LLVM basic block.
150
13.5M
  const BasicBlock *getBasicBlock() const { return BB; }
151
152
  /// Return the name of the corresponding LLVM basic block, or an empty string.
153
  StringRef getName() const;
154
155
  /// Return a formatted string to identify this block and its parent function.
156
  std::string getFullName() const;
157
158
  /// Test whether this block is potentially the target of an indirect branch.
159
3.06M
  bool hasAddressTaken() const { return AddressTaken; }
160
161
  /// Set this block to reflect that it potentially is the target of an indirect
162
  /// branch.
163
746
  void setHasAddressTaken() { AddressTaken = true; }
164
165
  /// Test whether this block must have its label emitted.
166
992k
  bool hasLabelMustBeEmitted() const { return LabelMustBeEmitted; }
167
168
  /// Set this block to reflect that, regardless how we flow to it, we need
169
  /// its label be emitted.
170
14
  void setLabelMustBeEmitted() { LabelMustBeEmitted = true; }
171
172
  /// Return the MachineFunction containing this basic block.
173
294M
  const MachineFunction *getParent() const { return xParent; }
174
436M
  MachineFunction *getParent() { return xParent; }
175
176
  using instr_iterator = Instructions::iterator;
177
  using const_instr_iterator = Instructions::const_iterator;
178
  using reverse_instr_iterator = Instructions::reverse_iterator;
179
  using const_reverse_instr_iterator = Instructions::const_reverse_iterator;
180
181
  using iterator = MachineInstrBundleIterator<MachineInstr>;
182
  using const_iterator = MachineInstrBundleIterator<const MachineInstr>;
183
  using reverse_iterator = MachineInstrBundleIterator<MachineInstr, true>;
184
  using const_reverse_iterator =
185
      MachineInstrBundleIterator<const MachineInstr, true>;
186
187
680k
  unsigned size() const { return (unsigned)Insts.size(); }
188
91.6M
  bool empty() const { return Insts.empty(); }
189
190
21.0M
  MachineInstr       &instr_front()       { return Insts.front(); }
191
80
  MachineInstr       &instr_back()        { return Insts.back();  }
192
0
  const MachineInstr &instr_front() const { return Insts.front(); }
193
0
  const MachineInstr &instr_back()  const { return Insts.back();  }
194
195
6.78M
  MachineInstr       &front()             { return Insts.front(); }
196
7.56M
  MachineInstr       &back()              { return *--end();      }
197
0
  const MachineInstr &front()       const { return Insts.front(); }
198
13.4M
  const MachineInstr &back()        const { return *--end();      }
199
200
534M
  instr_iterator                instr_begin()       { return Insts.begin();  }
201
40.0M
  const_instr_iterator          instr_begin() const { return Insts.begin();  }
202
785M
  instr_iterator                  instr_end()       { return Insts.end();    }
203
61.8M
  const_instr_iterator            instr_end() const { return Insts.end();    }
204
11.3M
  reverse_instr_iterator       instr_rbegin()       { return Insts.rbegin(); }
205
2.22M
  const_reverse_instr_iterator instr_rbegin() const { return Insts.rbegin(); }
206
14.8M
  reverse_instr_iterator       instr_rend  ()       { return Insts.rend();   }
207
2.22M
  const_reverse_instr_iterator instr_rend  () const { return Insts.rend();   }
208
209
  using instr_range = iterator_range<instr_iterator>;
210
  using const_instr_range = iterator_range<const_instr_iterator>;
211
379k
  instr_range instrs() { return instr_range(instr_begin(), instr_end()); }
212
31.7k
  const_instr_range instrs() const {
213
31.7k
    return const_instr_range(instr_begin(), instr_end());
214
31.7k
  }
215
216
445M
  iterator                begin()       { return instr_begin();  }
217
37.1M
  const_iterator          begin() const { return instr_begin();  }
218
611M
  iterator                end  ()       { return instr_end();    }
219
58.2M
  const_iterator          end  () const { return instr_end();    }
220
11.2M
  reverse_iterator rbegin() {
221
11.2M
    return reverse_iterator::getAtBundleBegin(instr_rbegin());
222
11.2M
  }
223
2.22M
  const_reverse_iterator rbegin() const {
224
2.22M
    return const_reverse_iterator::getAtBundleBegin(instr_rbegin());
225
2.22M
  }
226
14.4M
  reverse_iterator rend() { return reverse_iterator(instr_rend()); }
227
2.22M
  const_reverse_iterator rend() const {
228
2.22M
    return const_reverse_iterator(instr_rend());
229
2.22M
  }
230
231
  /// Support for MachineInstr::getNextNode().
232
114k
  static Instructions MachineBasicBlock::*getSublistAccess(MachineInstr *) {
233
114k
    return &MachineBasicBlock::Insts;
234
114k
  }
235
236
3.37M
  inline iterator_range<iterator> terminators() {
237
3.37M
    return make_range(getFirstTerminator(), end());
238
3.37M
  }
239
19.9k
  inline iterator_range<const_iterator> terminators() const {
240
19.9k
    return make_range(getFirstTerminator(), end());
241
19.9k
  }
242
243
  /// Returns a range that iterates over the phis in the basic block.
244
29.0k
  inline iterator_range<iterator> phis() {
245
29.0k
    return make_range(begin(), getFirstNonPHI());
246
29.0k
  }
247
0
  inline iterator_range<const_iterator> phis() const {
248
0
    return const_cast<MachineBasicBlock *>(this)->phis();
249
0
  }
250
251
  // Machine-CFG iterators
252
  using pred_iterator = std::vector<MachineBasicBlock *>::iterator;
253
  using const_pred_iterator = std::vector<MachineBasicBlock *>::const_iterator;
254
  using succ_iterator = std::vector<MachineBasicBlock *>::iterator;
255
  using const_succ_iterator = std::vector<MachineBasicBlock *>::const_iterator;
256
  using pred_reverse_iterator =
257
      std::vector<MachineBasicBlock *>::reverse_iterator;
258
  using const_pred_reverse_iterator =
259
      std::vector<MachineBasicBlock *>::const_reverse_iterator;
260
  using succ_reverse_iterator =
261
      std::vector<MachineBasicBlock *>::reverse_iterator;
262
  using const_succ_reverse_iterator =
263
      std::vector<MachineBasicBlock *>::const_reverse_iterator;
264
93.5M
  pred_iterator        pred_begin()       { return Predecessors.begin(); }
265
40.3M
  const_pred_iterator  pred_begin() const { return Predecessors.begin(); }
266
84.1M
  pred_iterator        pred_end()         { return Predecessors.end();   }
267
42.2M
  const_pred_iterator  pred_end()   const { return Predecessors.end();   }
268
  pred_reverse_iterator        pred_rbegin()
269
20.6M
                                          { return Predecessors.rbegin();}
270
  const_pred_reverse_iterator  pred_rbegin() const
271
0
                                          { return Predecessors.rbegin();}
272
  pred_reverse_iterator        pred_rend()
273
20.6M
                                          { return Predecessors.rend();  }
274
  const_pred_reverse_iterator  pred_rend()   const
275
0
                                          { return Predecessors.rend();  }
276
87.3M
  unsigned             pred_size()  const {
277
87.3M
    return (unsigned)Predecessors.size();
278
87.3M
  }
279
48.7M
  bool                 pred_empty() const { return Predecessors.empty(); }
280
112M
  succ_iterator        succ_begin()       { return Successors.begin();   }
281
112M
  const_succ_iterator  succ_begin() const { return Successors.begin();   }
282
176M
  succ_iterator        succ_end()         { return Successors.end();     }
283
127M
  const_succ_iterator  succ_end()   const { return Successors.end();     }
284
  succ_reverse_iterator        succ_rbegin()
285
104k
                                          { return Successors.rbegin();  }
286
  const_succ_reverse_iterator  succ_rbegin() const
287
0
                                          { return Successors.rbegin();  }
288
  succ_reverse_iterator        succ_rend()
289
4
                                          { return Successors.rend();    }
290
  const_succ_reverse_iterator  succ_rend()   const
291
0
                                          { return Successors.rend();    }
292
67.1M
  unsigned             succ_size()  const {
293
67.1M
    return (unsigned)Successors.size();
294
67.1M
  }
295
25.4M
  bool                 succ_empty() const { return Successors.empty();   }
296
297
44.3M
  inline iterator_range<pred_iterator> predecessors() {
298
44.3M
    return make_range(pred_begin(), pred_end());
299
44.3M
  }
300
16.5M
  inline iterator_range<const_pred_iterator> predecessors() const {
301
16.5M
    return make_range(pred_begin(), pred_end());
302
16.5M
  }
303
14.5M
  inline iterator_range<succ_iterator> successors() {
304
14.5M
    return make_range(succ_begin(), succ_end());
305
14.5M
  }
306
55.7M
  inline iterator_range<const_succ_iterator> successors() const {
307
55.7M
    return make_range(succ_begin(), succ_end());
308
55.7M
  }
309
310
  // LiveIn management methods.
311
312
  /// Adds the specified register as a live in. Note that it is an error to add
313
  /// the same register to the same set more than once unless the intention is
314
  /// to call sortUniqueLiveIns after all registers are added.
315
  void addLiveIn(MCPhysReg PhysReg,
316
16.4M
                 LaneBitmask LaneMask = LaneBitmask::getAll()) {
317
16.4M
    LiveIns.push_back(RegisterMaskPair(PhysReg, LaneMask));
318
16.4M
  }
319
562k
  void addLiveIn(const RegisterMaskPair &RegMaskPair) {
320
562k
    LiveIns.push_back(RegMaskPair);
321
562k
  }
322
323
  /// Sorts and uniques the LiveIns vector. It can be significantly faster to do
324
  /// this than repeatedly calling isLiveIn before calling addLiveIn for every
325
  /// LiveIn insertion.
326
  void sortUniqueLiveIns();
327
328
  /// Clear live in list.
329
  void clearLiveIns();
330
331
  /// Add PhysReg as live in to this block, and ensure that there is a copy of
332
  /// PhysReg to a virtual register of class RC. Return the virtual register
333
  /// that is a copy of the live in PhysReg.
334
  unsigned addLiveIn(MCPhysReg PhysReg, const TargetRegisterClass *RC);
335
336
  /// Remove the specified register from the live in set.
337
  void removeLiveIn(MCPhysReg Reg,
338
                    LaneBitmask LaneMask = LaneBitmask::getAll());
339
340
  /// Return true if the specified register is in the live in set.
341
  bool isLiveIn(MCPhysReg Reg,
342
                LaneBitmask LaneMask = LaneBitmask::getAll()) const;
343
344
  // Iteration support for live in sets.  These sets are kept in sorted
345
  // order by their register number.
346
  using livein_iterator = LiveInVector::const_iterator;
347
#ifndef NDEBUG
348
  /// Unlike livein_begin, this method does not check that the liveness
349
  /// information is accurate. Still for debug purposes it may be useful
350
  /// to have iterators that won't assert if the liveness information
351
  /// is not current.
352
  livein_iterator livein_begin_dbg() const { return LiveIns.begin(); }
353
  iterator_range<livein_iterator> liveins_dbg() const {
354
    return make_range(livein_begin_dbg(), livein_end());
355
  }
356
#endif
357
  livein_iterator livein_begin() const;
358
27.3M
  livein_iterator livein_end()   const { return LiveIns.end(); }
359
4.50M
  bool            livein_empty() const { return LiveIns.empty(); }
360
25.1M
  iterator_range<livein_iterator> liveins() const {
361
25.1M
    return make_range(livein_begin(), livein_end());
362
25.1M
  }
363
364
  /// Remove entry from the livein set and return iterator to the next.
365
  livein_iterator removeLiveIn(livein_iterator I);
366
367
  /// Get the clobber mask for the start of this basic block. Funclets use this
368
  /// to prevent register allocation across funclet transitions.
369
  const uint32_t *getBeginClobberMask(const TargetRegisterInfo *TRI) const;
370
371
  /// Get the clobber mask for the end of the basic block.
372
  /// \see getBeginClobberMask()
373
  const uint32_t *getEndClobberMask(const TargetRegisterInfo *TRI) const;
374
375
  /// Return alignment of the basic block. The alignment is specified as
376
  /// log2(bytes).
377
5.61M
  unsigned getAlignment() const { return Alignment; }
378
379
  /// Set alignment of the basic block. The alignment is specified as
380
  /// log2(bytes).
381
18.0k
  void setAlignment(unsigned Align) { Alignment = Align; }
382
383
  /// Returns true if the block is a landing pad. That is this basic block is
384
  /// entered via an exception handler.
385
52.0M
  bool isEHPad() const { return IsEHPad; }
386
387
  /// Indicates the block is a landing pad.  That is this basic block is entered
388
  /// via an exception handler.
389
38.9k
  void setIsEHPad(bool V = true) { IsEHPad = V; }
390
391
  bool hasEHPadSuccessor() const;
392
393
  /// Returns true if this is the entry block of an EH scope, i.e., the block
394
  /// that used to have a catchpad or cleanuppad instruction in the LLVM IR.
395
2.77k
  bool isEHScopeEntry() const { return IsEHScopeEntry; }
396
397
  /// Indicates if this is the entry block of an EH scope, i.e., the block that
398
  /// that used to have a catchpad or cleanuppad instruction in the LLVM IR.
399
458
  void setIsEHScopeEntry(bool V = true) { IsEHScopeEntry = V; }
400
401
  /// Returns true if this is the entry block of an EH funclet.
402
10.3M
  bool isEHFuncletEntry() const { return IsEHFuncletEntry; }
403
404
  /// Indicates if this is the entry block of an EH funclet.
405
302
  void setIsEHFuncletEntry(bool V = true) { IsEHFuncletEntry = V; }
406
407
  /// Returns true if this is the entry block of a cleanup funclet.
408
781
  bool isCleanupFuncletEntry() const { return IsCleanupFuncletEntry; }
409
410
  /// Indicates if this is the entry block of a cleanup funclet.
411
46
  void setIsCleanupFuncletEntry(bool V = true) { IsCleanupFuncletEntry = V; }
412
413
  /// Returns true if it is legal to hoist instructions into this block.
414
  bool isLegalToHoistInto() const;
415
416
  // Code Layout methods.
417
418
  /// Move 'this' block before or after the specified block.  This only moves
419
  /// the block, it does not modify the CFG or adjust potential fall-throughs at
420
  /// the end of the block.
421
  void moveBefore(MachineBasicBlock *NewAfter);
422
  void moveAfter(MachineBasicBlock *NewBefore);
423
424
  /// Update the terminator instructions in block to account for changes to the
425
  /// layout. If the block previously used a fallthrough, it may now need a
426
  /// branch, and if it previously used branching it may now be able to use a
427
  /// fallthrough.
428
  void updateTerminator();
429
430
  // Machine-CFG mutators
431
432
  /// Add Succ as a successor of this MachineBasicBlock.  The Predecessors list
433
  /// of Succ is automatically updated. PROB parameter is stored in
434
  /// Probabilities list. The default probability is set as unknown. Mixing
435
  /// known and unknown probabilities in successor list is not allowed. When all
436
  /// successors have unknown probabilities, 1 / N is returned as the
437
  /// probability for each successor, where N is the number of successors.
438
  ///
439
  /// Note that duplicate Machine CFG edges are not allowed.
440
  void addSuccessor(MachineBasicBlock *Succ,
441
                    BranchProbability Prob = BranchProbability::getUnknown());
442
443
  /// Add Succ as a successor of this MachineBasicBlock.  The Predecessors list
444
  /// of Succ is automatically updated. The probability is not provided because
445
  /// BPI is not available (e.g. -O0 is used), in which case edge probabilities
446
  /// won't be used. Using this interface can save some space.
447
  void addSuccessorWithoutProb(MachineBasicBlock *Succ);
448
449
  /// Set successor probability of a given iterator.
450
  void setSuccProbability(succ_iterator I, BranchProbability Prob);
451
452
  /// Normalize probabilities of all successors so that the sum of them becomes
453
  /// one. This is usually done when the current update on this MBB is done, and
454
  /// the sum of its successors' probabilities is not guaranteed to be one. The
455
  /// user is responsible for the correct use of this function.
456
  /// MBB::removeSuccessor() has an option to do this automatically.
457
661k
  void normalizeSuccProbs() {
458
661k
    BranchProbability::normalizeProbabilities(Probs.begin(), Probs.end());
459
661k
  }
460
461
  /// Validate successors' probabilities and check if the sum of them is
462
  /// approximate one. This only works in DEBUG mode.
463
  void validateSuccProbs() const;
464
465
  /// Remove successor from the successors list of this MachineBasicBlock. The
466
  /// Predecessors list of Succ is automatically updated.
467
  /// If NormalizeSuccProbs is true, then normalize successors' probabilities
468
  /// after the successor is removed.
469
  void removeSuccessor(MachineBasicBlock *Succ,
470
                       bool NormalizeSuccProbs = false);
471
472
  /// Remove specified successor from the successors list of this
473
  /// MachineBasicBlock. The Predecessors list of Succ is automatically updated.
474
  /// If NormalizeSuccProbs is true, then normalize successors' probabilities
475
  /// after the successor is removed.
476
  /// Return the iterator to the element after the one removed.
477
  succ_iterator removeSuccessor(succ_iterator I,
478
                                bool NormalizeSuccProbs = false);
479
480
  /// Replace successor OLD with NEW and update probability info.
481
  void replaceSuccessor(MachineBasicBlock *Old, MachineBasicBlock *New);
482
483
  /// Copy a successor (and any probability info) from original block to this
484
  /// block's. Uses an iterator into the original blocks successors.
485
  ///
486
  /// This is useful when doing a partial clone of successors. Afterward, the
487
  /// probabilities may need to be normalized.
488
  void copySuccessor(MachineBasicBlock *Orig, succ_iterator I);
489
490
  /// Split the old successor into old plus new and updates the probability
491
  /// info.
492
  void splitSuccessor(MachineBasicBlock *Old, MachineBasicBlock *New,
493
                      bool NormalizeSuccProbs = false);
494
495
  /// Transfers all the successors from MBB to this machine basic block (i.e.,
496
  /// copies all the successors FromMBB and remove all the successors from
497
  /// FromMBB).
498
  void transferSuccessors(MachineBasicBlock *FromMBB);
499
500
  /// Transfers all the successors, as in transferSuccessors, and update PHI
501
  /// operands in the successor blocks which refer to FromMBB to refer to this.
502
  void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB);
503
504
  /// Return true if any of the successors have probabilities attached to them.
505
6.49k
  bool hasSuccessorProbabilities() const { return !Probs.empty(); }
506
507
  /// Return true if the specified MBB is a predecessor of this block.
508
  bool isPredecessor(const MachineBasicBlock *MBB) const;
509
510
  /// Return true if the specified MBB is a successor of this block.
511
  bool isSuccessor(const MachineBasicBlock *MBB) const;
512
513
  /// Return true if the specified MBB will be emitted immediately after this
514
  /// block, such that if this block exits by falling through, control will
515
  /// transfer to the specified MBB. Note that MBB need not be a successor at
516
  /// all, for example if this block ends with an unconditional branch to some
517
  /// other block.
518
  bool isLayoutSuccessor(const MachineBasicBlock *MBB) const;
519
520
  /// Return the fallthrough block if the block can implicitly
521
  /// transfer control to the block after it by falling off the end of
522
  /// it.  This should return null if it can reach the block after
523
  /// it, but it uses an explicit branch to do so (e.g., a table
524
  /// jump).  Non-null return  is a conservative answer.
525
  MachineBasicBlock *getFallThrough();
526
527
  /// Return true if the block can implicitly transfer control to the
528
  /// block after it by falling off the end of it.  This should return
529
  /// false if it can reach the block after it, but it uses an
530
  /// explicit branch to do so (e.g., a table jump).  True is a
531
  /// conservative answer.
532
  bool canFallThrough();
533
534
  /// Returns a pointer to the first instruction in this block that is not a
535
  /// PHINode instruction. When adding instructions to the beginning of the
536
  /// basic block, they should be added before the returned value, not before
537
  /// the first instruction, which might be PHI.
538
  /// Returns end() is there's no non-PHI instruction.
539
  iterator getFirstNonPHI();
540
541
  /// Return the first instruction in MBB after I that is not a PHI or a label.
542
  /// This is the correct point to insert lowered copies at the beginning of a
543
  /// basic block that must be before any debugging information.
544
  iterator SkipPHIsAndLabels(iterator I);
545
546
  /// Return the first instruction in MBB after I that is not a PHI, label or
547
  /// debug.  This is the correct point to insert copies at the beginning of a
548
  /// basic block.
549
  iterator SkipPHIsLabelsAndDebug(iterator I);
550
551
  /// Returns an iterator to the first terminator instruction of this basic
552
  /// block. If a terminator does not exist, it returns end().
553
  iterator getFirstTerminator();
554
799k
  const_iterator getFirstTerminator() const {
555
799k
    return const_cast<MachineBasicBlock *>(this)->getFirstTerminator();
556
799k
  }
557
558
  /// Same getFirstTerminator but it ignores bundles and return an
559
  /// instr_iterator instead.
560
  instr_iterator getFirstInstrTerminator();
561
562
  /// Returns an iterator to the first non-debug instruction in the basic block,
563
  /// or end().
564
  iterator getFirstNonDebugInstr();
565
0
  const_iterator getFirstNonDebugInstr() const {
566
0
    return const_cast<MachineBasicBlock *>(this)->getFirstNonDebugInstr();
567
0
  }
568
569
  /// Returns an iterator to the last non-debug instruction in the basic block,
570
  /// or end().
571
  iterator getLastNonDebugInstr();
572
7.24M
  const_iterator getLastNonDebugInstr() const {
573
7.24M
    return const_cast<MachineBasicBlock *>(this)->getLastNonDebugInstr();
574
7.24M
  }
575
576
  /// Convenience function that returns true if the block ends in a return
577
  /// instruction.
578
7.38M
  bool isReturnBlock() const {
579
7.38M
    return !empty() && 
back().isReturn()7.30M
;
580
7.38M
  }
581
582
  /// Convenience function that returns true if the bock ends in a EH scope
583
  /// return instruction.
584
2.49k
  bool isEHScopeReturnBlock() const {
585
2.49k
    return !empty() && 
back().isEHScopeReturn()2.47k
;
586
2.49k
  }
587
588
  /// Split the critical edge from this block to the given successor block, and
589
  /// return the newly created block, or null if splitting is not possible.
590
  ///
591
  /// This function updates LiveVariables, MachineDominatorTree, and
592
  /// MachineLoopInfo, as applicable.
593
  MachineBasicBlock *SplitCriticalEdge(MachineBasicBlock *Succ, Pass &P);
594
595
  /// Check if the edge between this block and the given successor \p
596
  /// Succ, can be split. If this returns true a subsequent call to
597
  /// SplitCriticalEdge is guaranteed to return a valid basic block if
598
  /// no changes occurred in the meantime.
599
  bool canSplitCriticalEdge(const MachineBasicBlock *Succ) const;
600
601
0
  void pop_front() { Insts.pop_front(); }
602
0
  void pop_back() { Insts.pop_back(); }
603
2.86k
  void push_back(MachineInstr *MI) { Insts.push_back(MI); }
604
605
  /// Insert MI into the instruction list before I, possibly inside a bundle.
606
  ///
607
  /// If the insertion point is inside a bundle, MI will be added to the bundle,
608
  /// otherwise MI will not be added to any bundle. That means this function
609
  /// alone can't be used to prepend or append instructions to bundles. See
610
  /// MIBundleBuilder::insert() for a more reliable way of doing that.
611
  instr_iterator insert(instr_iterator I, MachineInstr *M);
612
613
  /// Insert a range of instructions into the instruction list before I.
614
  template<typename IT>
615
510
  void insert(iterator I, IT S, IT E) {
616
510
    assert((I == end() || I->getParent() == this) &&
617
510
           "iterator points outside of basic block");
618
510
    Insts.insert(I.getInstrIterator(), S, E);
619
510
  }
620
621
  /// Insert MI into the instruction list before I.
622
66.4M
  iterator insert(iterator I, MachineInstr *MI) {
623
66.4M
    assert((I == end() || I->getParent() == this) &&
624
66.4M
           "iterator points outside of basic block");
625
66.4M
    assert(!MI->isBundledWithPred() && !MI->isBundledWithSucc() &&
626
66.4M
           "Cannot insert instruction with bundle flags");
627
66.4M
    return Insts.insert(I.getInstrIterator(), MI);
628
66.4M
  }
629
630
  /// Insert MI into the instruction list after I.
631
546
  iterator insertAfter(iterator I, MachineInstr *MI) {
632
546
    assert((I == end() || I->getParent() == this) &&
633
546
           "iterator points outside of basic block");
634
546
    assert(!MI->isBundledWithPred() && !MI->isBundledWithSucc() &&
635
546
           "Cannot insert instruction with bundle flags");
636
546
    return Insts.insertAfter(I.getInstrIterator(), MI);
637
546
  }
638
639
  /// Remove an instruction from the instruction list and delete it.
640
  ///
641
  /// If the instruction is part of a bundle, the other instructions in the
642
  /// bundle will still be bundled after removing the single instruction.
643
  instr_iterator erase(instr_iterator I);
644
645
  /// Remove an instruction from the instruction list and delete it.
646
  ///
647
  /// If the instruction is part of a bundle, the other instructions in the
648
  /// bundle will still be bundled after removing the single instruction.
649
2.85M
  instr_iterator erase_instr(MachineInstr *I) {
650
2.85M
    return erase(instr_iterator(I));
651
2.85M
  }
652
653
  /// Remove a range of instructions from the instruction list and delete them.
654
38.2M
  iterator erase(iterator I, iterator E) {
655
38.2M
    return Insts.erase(I.getInstrIterator(), E.getInstrIterator());
656
38.2M
  }
657
658
  /// Remove an instruction or bundle from the instruction list and delete it.
659
  ///
660
  /// If I points to a bundle of instructions, they are all erased.
661
38.0M
  iterator erase(iterator I) {
662
38.0M
    return erase(I, std::next(I));
663
38.0M
  }
664
665
  /// Remove an instruction from the instruction list and delete it.
666
  ///
667
  /// If I is the head of a bundle of instructions, the whole bundle will be
668
  /// erased.
669
33.8M
  iterator erase(MachineInstr *I) {
670
33.8M
    return erase(iterator(I));
671
33.8M
  }
672
673
  /// Remove the unbundled instruction from the instruction list without
674
  /// deleting it.
675
  ///
676
  /// This function can not be used to remove bundled instructions, use
677
  /// remove_instr to remove individual instructions from a bundle.
678
669k
  MachineInstr *remove(MachineInstr *I) {
679
669k
    assert(!I->isBundled() && "Cannot remove bundled instructions");
680
669k
    return Insts.remove(instr_iterator(I));
681
669k
  }
682
683
  /// Remove the possibly bundled instruction from the instruction list
684
  /// without deleting it.
685
  ///
686
  /// If the instruction is part of a bundle, the other instructions in the
687
  /// bundle will still be bundled after removing the single instruction.
688
  MachineInstr *remove_instr(MachineInstr *I);
689
690
145
  void clear() {
691
145
    Insts.clear();
692
145
  }
693
694
  /// Take an instruction from MBB 'Other' at the position From, and insert it
695
  /// into this MBB right before 'Where'.
696
  ///
697
  /// If From points to a bundle of instructions, the whole bundle is moved.
698
1.87M
  void splice(iterator Where, MachineBasicBlock *Other, iterator From) {
699
1.87M
    // The range splice() doesn't allow noop moves, but this one does.
700
1.87M
    if (Where != From)
701
1.87M
      splice(Where, Other, From, std::next(From));
702
1.87M
  }
703
704
  /// Take a block of instructions from MBB 'Other' in the range [From, To),
705
  /// and insert them into this MBB right before 'Where'.
706
  ///
707
  /// The instruction at 'Where' must not be included in the range of
708
  /// instructions to move.
709
  void splice(iterator Where, MachineBasicBlock *Other,
710
5.27M
              iterator From, iterator To) {
711
5.27M
    Insts.splice(Where.getInstrIterator(), Other->Insts,
712
5.27M
                 From.getInstrIterator(), To.getInstrIterator());
713
5.27M
  }
714
715
  /// This method unlinks 'this' from the containing function, and returns it,
716
  /// but does not delete it.
717
  MachineBasicBlock *removeFromParent();
718
719
  /// This method unlinks 'this' from the containing function and deletes it.
720
  void eraseFromParent();
721
722
  /// Given a machine basic block that branched to 'Old', change the code and
723
  /// CFG so that it branches to 'New' instead.
724
  void ReplaceUsesOfBlockWith(MachineBasicBlock *Old, MachineBasicBlock *New);
725
726
  /// Various pieces of code can cause excess edges in the CFG to be inserted.
727
  /// If we have proven that MBB can only branch to DestA and DestB, remove any
728
  /// other MBB successors from the CFG. DestA and DestB can be null. Besides
729
  /// DestA and DestB, retain other edges leading to LandingPads (currently
730
  /// there can be only one; we don't check or require that here). Note it is
731
  /// possible that DestA and/or DestB are LandingPads.
732
  bool CorrectExtraCFGEdges(MachineBasicBlock *DestA,
733
                            MachineBasicBlock *DestB,
734
                            bool IsCond);
735
736
  /// Find the next valid DebugLoc starting at MBBI, skipping any DBG_VALUE
737
  /// and DBG_LABEL instructions.  Return UnknownLoc if there is none.
738
  DebugLoc findDebugLoc(instr_iterator MBBI);
739
528k
  DebugLoc findDebugLoc(iterator MBBI) {
740
528k
    return findDebugLoc(MBBI.getInstrIterator());
741
528k
  }
742
743
  /// Find the previous valid DebugLoc preceding MBBI, skipping and DBG_VALUE
744
  /// instructions.  Return UnknownLoc if there is none.
745
  DebugLoc findPrevDebugLoc(instr_iterator MBBI);
746
4.82k
  DebugLoc findPrevDebugLoc(iterator MBBI) {
747
4.82k
    return findPrevDebugLoc(MBBI.getInstrIterator());
748
4.82k
  }
749
750
  /// Find and return the merged DebugLoc of the branch instructions of the
751
  /// block. Return UnknownLoc if there is none.
752
  DebugLoc findBranchDebugLoc();
753
754
  /// Possible outcome of a register liveness query to computeRegisterLiveness()
755
  enum LivenessQueryResult {
756
    LQR_Live,   ///< Register is known to be (at least partially) live.
757
    LQR_Dead,   ///< Register is known to be fully dead.
758
    LQR_Unknown ///< Register liveness not decidable from local neighborhood.
759
  };
760
761
  /// Return whether (physical) register \p Reg has been defined and not
762
  /// killed as of just before \p Before.
763
  ///
764
  /// Search is localised to a neighborhood of \p Neighborhood instructions
765
  /// before (searching for defs or kills) and \p Neighborhood instructions
766
  /// after (searching just for defs) \p Before.
767
  ///
768
  /// \p Reg must be a physical register.
769
  LivenessQueryResult computeRegisterLiveness(const TargetRegisterInfo *TRI,
770
                                              unsigned Reg,
771
                                              const_iterator Before,
772
                                              unsigned Neighborhood = 10) const;
773
774
  // Debugging methods.
775
  void dump() const;
776
  void print(raw_ostream &OS, const SlotIndexes * = nullptr,
777
             bool IsStandalone = true) const;
778
  void print(raw_ostream &OS, ModuleSlotTracker &MST,
779
             const SlotIndexes * = nullptr, bool IsStandalone = true) const;
780
781
  // Printing method used by LoopInfo.
782
  void printAsOperand(raw_ostream &OS, bool PrintType = true) const;
783
784
  /// MachineBasicBlocks are uniquely numbered at the function level, unless
785
  /// they're not in a MachineFunction yet, in which case this will return -1.
786
784M
  int getNumber() const { return Number; }
787
9.34M
  void setNumber(int N) { Number = N; }
788
789
  /// Return the MCSymbol for this basic block.
790
  MCSymbol *getSymbol() const;
791
792
1.21k
  Optional<uint64_t> getIrrLoopHeaderWeight() const {
793
1.21k
    return IrrLoopHeaderWeight;
794
1.21k
  }
795
796
0
  void setIrrLoopHeaderWeight(uint64_t Weight) {
797
0
    IrrLoopHeaderWeight = Weight;
798
0
  }
799
800
private:
801
  /// Return probability iterator corresponding to the I successor iterator.
802
  probability_iterator getProbabilityIterator(succ_iterator I);
803
  const_probability_iterator
804
  getProbabilityIterator(const_succ_iterator I) const;
805
806
  friend class MachineBranchProbabilityInfo;
807
  friend class MIPrinter;
808
809
  /// Return probability of the edge from this block to MBB. This method should
810
  /// NOT be called directly, but by using getEdgeProbability method from
811
  /// MachineBranchProbabilityInfo class.
812
  BranchProbability getSuccProbability(const_succ_iterator Succ) const;
813
814
  // Methods used to maintain doubly linked list of blocks...
815
  friend struct ilist_callback_traits<MachineBasicBlock>;
816
817
  // Machine-CFG mutators
818
819
  /// Add Pred as a predecessor of this MachineBasicBlock. Don't do this
820
  /// unless you know what you're doing, because it doesn't update Pred's
821
  /// successors list. Use Pred->addSuccessor instead.
822
  void addPredecessor(MachineBasicBlock *Pred);
823
824
  /// Remove Pred as a predecessor of this MachineBasicBlock. Don't do this
825
  /// unless you know what you're doing, because it doesn't update Pred's
826
  /// successors list. Use Pred->removeSuccessor instead.
827
  void removePredecessor(MachineBasicBlock *Pred);
828
};
829
830
raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB);
831
832
/// Prints a machine basic block reference.
833
///
834
/// The format is:
835
///   %bb.5           - a machine basic block with MBB.getNumber() == 5.
836
///
837
/// Usage: OS << printMBBReference(MBB) << '\n';
838
Printable printMBBReference(const MachineBasicBlock &MBB);
839
840
// This is useful when building IndexedMaps keyed on basic block pointers.
841
struct MBB2NumberFunctor {
842
  using argument_type = const MachineBasicBlock *;
843
87.3M
  unsigned operator()(const MachineBasicBlock *MBB) const {
844
87.3M
    return MBB->getNumber();
845
87.3M
  }
846
};
847
848
//===--------------------------------------------------------------------===//
849
// GraphTraits specializations for machine basic block graphs (machine-CFGs)
850
//===--------------------------------------------------------------------===//
851
852
// Provide specializations of GraphTraits to be able to treat a
853
// MachineFunction as a graph of MachineBasicBlocks.
854
//
855
856
template <> struct GraphTraits<MachineBasicBlock *> {
857
  using NodeRef = MachineBasicBlock *;
858
  using ChildIteratorType = MachineBasicBlock::succ_iterator;
859
860
4.89M
  static NodeRef getEntryNode(MachineBasicBlock *BB) { return BB; }
861
60.7M
  static ChildIteratorType child_begin(NodeRef N) { return N->succ_begin(); }
862
103M
  static ChildIteratorType child_end(NodeRef N) { return N->succ_end(); }
863
};
864
865
template <> struct GraphTraits<const MachineBasicBlock *> {
866
  using NodeRef = const MachineBasicBlock *;
867
  using ChildIteratorType = MachineBasicBlock::const_succ_iterator;
868
869
2.16M
  static NodeRef getEntryNode(const MachineBasicBlock *BB) { return BB; }
870
29.9M
  static ChildIteratorType child_begin(NodeRef N) { return N->succ_begin(); }
871
45.2M
  static ChildIteratorType child_end(NodeRef N) { return N->succ_end(); }
872
};
873
874
// Provide specializations of GraphTraits to be able to treat a
875
// MachineFunction as a graph of MachineBasicBlocks and to walk it
876
// in inverse order.  Inverse order for a function is considered
877
// to be when traversing the predecessor edges of a MBB
878
// instead of the successor edges.
879
//
880
template <> struct GraphTraits<Inverse<MachineBasicBlock*>> {
881
  using NodeRef = MachineBasicBlock *;
882
  using ChildIteratorType = MachineBasicBlock::pred_iterator;
883
884
0
  static NodeRef getEntryNode(Inverse<MachineBasicBlock *> G) {
885
0
    return G.Graph;
886
0
  }
887
888
31.0M
  static ChildIteratorType child_begin(NodeRef N) { return N->pred_begin(); }
889
31.0M
  static ChildIteratorType child_end(NodeRef N) { return N->pred_end(); }
890
};
891
892
template <> struct GraphTraits<Inverse<const MachineBasicBlock*>> {
893
  using NodeRef = const MachineBasicBlock *;
894
  using ChildIteratorType = MachineBasicBlock::const_pred_iterator;
895
896
122k
  static NodeRef getEntryNode(Inverse<const MachineBasicBlock *> G) {
897
122k
    return G.Graph;
898
122k
  }
899
900
541k
  static ChildIteratorType child_begin(NodeRef N) { return N->pred_begin(); }
901
1.32M
  static ChildIteratorType child_end(NodeRef N) { return N->pred_end(); }
902
};
903
904
/// MachineInstrSpan provides an interface to get an iteration range
905
/// containing the instruction it was initialized with, along with all
906
/// those instructions inserted prior to or following that instruction
907
/// at some point after the MachineInstrSpan is constructed.
908
class MachineInstrSpan {
909
  MachineBasicBlock &MBB;
910
  MachineBasicBlock::iterator I, B, E;
911
912
public:
913
  MachineInstrSpan(MachineBasicBlock::iterator I, MachineBasicBlock *BB)
914
      : MBB(*BB), I(I), B(I == MBB.begin() ? MBB.end() : std::prev(I)),
915
482k
        E(std::next(I)) {
916
482k
    assert(I == BB->end() || I->getParent() == BB);
917
482k
  }
918
919
287k
  MachineBasicBlock::iterator begin() {
920
287k
    return B == MBB.end() ? 
MBB.begin()58.1k
:
std::next(B)229k
;
921
287k
  }
922
243k
  MachineBasicBlock::iterator end() { return E; }
923
  bool empty() { return begin() == end(); }
924
925
0
  MachineBasicBlock::iterator getInitial() { return I; }
926
};
927
928
/// Increment \p It until it points to a non-debug instruction or to \p End
929
/// and return the resulting iterator. This function should only be used
930
/// MachineBasicBlock::{iterator, const_iterator, instr_iterator,
931
/// const_instr_iterator} and the respective reverse iterators.
932
template<typename IterT>
933
232M
inline IterT skipDebugInstructionsForward(IterT It, IterT End) {
934
232M
  while (It != End && 
It->isDebugInstr()232M
)
935
942
    It++;
936
232M
  return It;
937
232M
}
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, true> llvm::skipDebugInstructionsForward<llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, true> >(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, true>)
Line
Count
Source
933
209M
inline IterT skipDebugInstructionsForward(IterT It, IterT End) {
934
209M
  while (It != End && 
It->isDebugInstr()209M
)
935
0
    It++;
936
209M
  return It;
937
209M
}
llvm::MachineInstrBundleIterator<llvm::MachineInstr const, false> llvm::skipDebugInstructionsForward<llvm::MachineInstrBundleIterator<llvm::MachineInstr const, false> >(llvm::MachineInstrBundleIterator<llvm::MachineInstr const, false>, llvm::MachineInstrBundleIterator<llvm::MachineInstr const, false>)
Line
Count
Source
933
2.91M
inline IterT skipDebugInstructionsForward(IterT It, IterT End) {
934
2.91M
  while (It != End && 
It->isDebugInstr()2.68M
)
935
138
    It++;
936
2.91M
  return It;
937
2.91M
}
llvm::MachineInstrBundleIterator<llvm::MachineInstr, false> llvm::skipDebugInstructionsForward<llvm::MachineInstrBundleIterator<llvm::MachineInstr, false> >(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>)
Line
Count
Source
933
19.4M
inline IterT skipDebugInstructionsForward(IterT It, IterT End) {
934
19.4M
  while (It != End && 
It->isDebugInstr()19.1M
)
935
270
    It++;
936
19.4M
  return It;
937
19.4M
}
llvm::MachineInstrBundleIterator<llvm::MachineInstr, true> llvm::skipDebugInstructionsForward<llvm::MachineInstrBundleIterator<llvm::MachineInstr, true> >(llvm::MachineInstrBundleIterator<llvm::MachineInstr, true>, llvm::MachineInstrBundleIterator<llvm::MachineInstr, true>)
Line
Count
Source
933
6.71k
inline IterT skipDebugInstructionsForward(IterT It, IterT End) {
934
6.71k
  while (It != End && It->isDebugInstr())
935
2
    It++;
936
6.71k
  return It;
937
6.71k
}
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, false> llvm::skipDebugInstructionsForward<llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, false> >(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, false>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, false>)
Line
Count
Source
933
528k
inline IterT skipDebugInstructionsForward(IterT It, IterT End) {
934
529k
  while (It != End && 
It->isDebugInstr()529k
)
935
532
    It++;
936
528k
  return It;
937
528k
}
938
939
/// Decrement \p It until it points to a non-debug instruction or to \p Begin
940
/// and return the resulting iterator. This function should only be used
941
/// MachineBasicBlock::{iterator, const_iterator, instr_iterator,
942
/// const_instr_iterator} and the respective reverse iterators.
943
template<class IterT>
944
6.42M
inline IterT skipDebugInstructionsBackward(IterT It, IterT Begin) {
945
6.42M
  while (It != Begin && 
It->isDebugInstr()6.01M
)
946
252
    It--;
947
6.42M
  return It;
948
6.42M
}
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, false> llvm::skipDebugInstructionsBackward<llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, false> >(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, false>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, false>)
Line
Count
Source
944
4.92k
inline IterT skipDebugInstructionsBackward(IterT It, IterT Begin) {
945
4.94k
  while (It != Begin && 
It->isDebugInstr()4.75k
)
946
24
    It--;
947
4.92k
  return It;
948
4.92k
}
llvm::MachineInstrBundleIterator<llvm::MachineInstr, false> llvm::skipDebugInstructionsBackward<llvm::MachineInstrBundleIterator<llvm::MachineInstr, false> >(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>)
Line
Count
Source
944
775k
inline IterT skipDebugInstructionsBackward(IterT It, IterT Begin) {
945
775k
  while (It != Begin && 
It->isDebugInstr()607k
)
946
26
    It--;
947
775k
  return It;
948
775k
}
llvm::MachineInstrBundleIterator<llvm::MachineInstr const, false> llvm::skipDebugInstructionsBackward<llvm::MachineInstrBundleIterator<llvm::MachineInstr const, false> >(llvm::MachineInstrBundleIterator<llvm::MachineInstr const, false>, llvm::MachineInstrBundleIterator<llvm::MachineInstr const, false>)
Line
Count
Source
944
5.64M
inline IterT skipDebugInstructionsBackward(IterT It, IterT Begin) {
945
5.64M
  while (It != Begin && 
It->isDebugInstr()5.40M
)
946
202
    It--;
947
5.64M
  return It;
948
5.64M
}
949
950
} // end namespace llvm
951
952
#endif // LLVM_CODEGEN_MACHINEBASICBLOCK_H