Coverage Report

Created: 2018-09-25 00:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/ADT/IntervalMap.h
Line
Count
Source (jump to first uncovered line)
1
//===- llvm/ADT/IntervalMap.h - A sorted interval map -----------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
// This file implements a coalescing interval map for small objects.
11
//
12
// KeyT objects are mapped to ValT objects. Intervals of keys that map to the
13
// same value are represented in a compressed form.
14
//
15
// Iterators provide ordered access to the compressed intervals rather than the
16
// individual keys, and insert and erase operations use key intervals as well.
17
//
18
// Like SmallVector, IntervalMap will store the first N intervals in the map
19
// object itself without any allocations. When space is exhausted it switches to
20
// a B+-tree representation with very small overhead for small key and value
21
// objects.
22
//
23
// A Traits class specifies how keys are compared. It also allows IntervalMap to
24
// work with both closed and half-open intervals.
25
//
26
// Keys and values are not stored next to each other in a std::pair, so we don't
27
// provide such a value_type. Dereferencing iterators only returns the mapped
28
// value. The interval bounds are accessible through the start() and stop()
29
// iterator methods.
30
//
31
// IntervalMap is optimized for small key and value objects, 4 or 8 bytes each
32
// is the optimal size. For large objects use std::map instead.
33
//
34
//===----------------------------------------------------------------------===//
35
//
36
// Synopsis:
37
//
38
// template <typename KeyT, typename ValT, unsigned N, typename Traits>
39
// class IntervalMap {
40
// public:
41
//   typedef KeyT key_type;
42
//   typedef ValT mapped_type;
43
//   typedef RecyclingAllocator<...> Allocator;
44
//   class iterator;
45
//   class const_iterator;
46
//
47
//   explicit IntervalMap(Allocator&);
48
//   ~IntervalMap():
49
//
50
//   bool empty() const;
51
//   KeyT start() const;
52
//   KeyT stop() const;
53
//   ValT lookup(KeyT x, Value NotFound = Value()) const;
54
//
55
//   const_iterator begin() const;
56
//   const_iterator end() const;
57
//   iterator begin();
58
//   iterator end();
59
//   const_iterator find(KeyT x) const;
60
//   iterator find(KeyT x);
61
//
62
//   void insert(KeyT a, KeyT b, ValT y);
63
//   void clear();
64
// };
65
//
66
// template <typename KeyT, typename ValT, unsigned N, typename Traits>
67
// class IntervalMap::const_iterator :
68
//   public std::iterator<std::bidirectional_iterator_tag, ValT> {
69
// public:
70
//   bool operator==(const const_iterator &) const;
71
//   bool operator!=(const const_iterator &) const;
72
//   bool valid() const;
73
//
74
//   const KeyT &start() const;
75
//   const KeyT &stop() const;
76
//   const ValT &value() const;
77
//   const ValT &operator*() const;
78
//   const ValT *operator->() const;
79
//
80
//   const_iterator &operator++();
81
//   const_iterator &operator++(int);
82
//   const_iterator &operator--();
83
//   const_iterator &operator--(int);
84
//   void goToBegin();
85
//   void goToEnd();
86
//   void find(KeyT x);
87
//   void advanceTo(KeyT x);
88
// };
89
//
90
// template <typename KeyT, typename ValT, unsigned N, typename Traits>
91
// class IntervalMap::iterator : public const_iterator {
92
// public:
93
//   void insert(KeyT a, KeyT b, Value y);
94
//   void erase();
95
// };
96
//
97
//===----------------------------------------------------------------------===//
98
99
#ifndef LLVM_ADT_INTERVALMAP_H
100
#define LLVM_ADT_INTERVALMAP_H
101
102
#include "llvm/ADT/PointerIntPair.h"
103
#include "llvm/ADT/SmallVector.h"
104
#include "llvm/ADT/bit.h"
105
#include "llvm/Support/AlignOf.h"
106
#include "llvm/Support/Allocator.h"
107
#include "llvm/Support/RecyclingAllocator.h"
108
#include <algorithm>
109
#include <cassert>
110
#include <cstdint>
111
#include <iterator>
112
#include <new>
113
#include <utility>
114
115
namespace llvm {
116
117
//===----------------------------------------------------------------------===//
118
//---                              Key traits                              ---//
119
//===----------------------------------------------------------------------===//
120
//
121
// The IntervalMap works with closed or half-open intervals.
122
// Adjacent intervals that map to the same value are coalesced.
123
//
124
// The IntervalMapInfo traits class is used to determine if a key is contained
125
// in an interval, and if two intervals are adjacent so they can be coalesced.
126
// The provided implementation works for closed integer intervals, other keys
127
// probably need a specialized version.
128
//
129
// The point x is contained in [a;b] when !startLess(x, a) && !stopLess(b, x).
130
//
131
// It is assumed that (a;b] half-open intervals are not used, only [a;b) is
132
// allowed. This is so that stopLess(a, b) can be used to determine if two
133
// intervals overlap.
134
//
135
//===----------------------------------------------------------------------===//
136
137
template <typename T>
138
struct IntervalMapInfo {
139
  /// startLess - Return true if x is not in [a;b].
140
  /// This is x < a both for closed intervals and for [a;b) half-open intervals.
141
  static inline bool startLess(const T &x, const T &a) {
142
    return x < a;
143
  }
144
145
  /// stopLess - Return true if x is not in [a;b].
146
  /// This is b < x for a closed interval, b <= x for [a;b) half-open intervals.
147
  static inline bool stopLess(const T &b, const T &x) {
148
    return b < x;
149
  }
150
151
  /// adjacent - Return true when the intervals [x;a] and [b;y] can coalesce.
152
  /// This is a+1 == b for closed intervals, a == b for half-open intervals.
153
  static inline bool adjacent(const T &a, const T &b) {
154
    return a+1 == b;
155
  }
156
157
  /// nonEmpty - Return true if [a;b] is non-empty.
158
  /// This is a <= b for a closed interval, a < b for [a;b) half-open intervals.
159
  static inline bool nonEmpty(const T &a, const T &b) {
160
    return a <= b;
161
  }
162
};
163
164
template <typename T>
165
struct IntervalMapHalfOpenInfo {
166
  /// startLess - Return true if x is not in [a;b).
167
2.75M
  static inline bool startLess(const T &x, const T &a) {
168
2.75M
    return x < a;
169
2.75M
  }
170
171
  /// stopLess - Return true if x is not in [a;b).
172
445M
  static inline bool stopLess(const T &b, const T &x) {
173
445M
    return b <= x;
174
445M
  }
175
176
  /// adjacent - Return true when the intervals [x;a) and [b;y) can coalesce.
177
12.2M
  static inline bool adjacent(const T &a, const T &b) {
178
12.2M
    return a == b;
179
12.2M
  }
180
181
  /// nonEmpty - Return true if [a;b) is non-empty.
182
  static inline bool nonEmpty(const T &a, const T &b) {
183
    return a < b;
184
  }
185
};
186
187
/// IntervalMapImpl - Namespace used for IntervalMap implementation details.
188
/// It should be considered private to the implementation.
189
namespace IntervalMapImpl {
190
191
using IdxPair = std::pair<unsigned,unsigned>;
192
193
//===----------------------------------------------------------------------===//
194
//---                    IntervalMapImpl::NodeBase                         ---//
195
//===----------------------------------------------------------------------===//
196
//
197
// Both leaf and branch nodes store vectors of pairs.
198
// Leaves store ((KeyT, KeyT), ValT) pairs, branches use (NodeRef, KeyT).
199
//
200
// Keys and values are stored in separate arrays to avoid padding caused by
201
// different object alignments. This also helps improve locality of reference
202
// when searching the keys.
203
//
204
// The nodes don't know how many elements they contain - that information is
205
// stored elsewhere. Omitting the size field prevents padding and allows a node
206
// to fill the allocated cache lines completely.
207
//
208
// These are typical key and value sizes, the node branching factor (N), and
209
// wasted space when nodes are sized to fit in three cache lines (192 bytes):
210
//
211
//   T1  T2   N Waste  Used by
212
//    4   4  24   0    Branch<4> (32-bit pointers)
213
//    8   4  16   0    Leaf<4,4>, Branch<4>
214
//    8   8  12   0    Leaf<4,8>, Branch<8>
215
//   16   4   9  12    Leaf<8,4>
216
//   16   8   8   0    Leaf<8,8>
217
//
218
//===----------------------------------------------------------------------===//
219
220
template <typename T1, typename T2, unsigned N>
221
class NodeBase {
222
public:
223
  enum { Capacity = N };
224
225
  T1 first[N];
226
  T2 second[N];
227
228
  /// copy - Copy elements from another node.
229
  /// @param Other Node elements are copied from.
230
  /// @param i     Beginning of the source range in other.
231
  /// @param j     Beginning of the destination range in this.
232
  /// @param Count Number of elements to copy.
233
  template <unsigned M>
234
  void copy(const NodeBase<T1, T2, M> &Other, unsigned i,
235
5.11M
            unsigned j, unsigned Count) {
236
5.11M
    assert(i + Count <= M && "Invalid source range");
237
5.11M
    assert(j + Count <= N && "Invalid dest range");
238
19.0M
    for (unsigned e = i + Count; i != e; 
++i, ++j13.9M
) {
239
13.9M
      first[j]  = Other.first[i];
240
13.9M
      second[j] = Other.second[i];
241
13.9M
    }
242
5.11M
  }
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::copy<4u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u> const&, unsigned int, unsigned int, unsigned int)
void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::copy<12u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
235
49.5k
            unsigned j, unsigned Count) {
236
49.5k
    assert(i + Count <= M && "Invalid source range");
237
49.5k
    assert(j + Count <= N && "Invalid dest range");
238
304k
    for (unsigned e = i + Count; i != e; 
++i, ++j255k
) {
239
255k
      first[j]  = Other.first[i];
240
255k
      second[j] = Other.second[i];
241
255k
    }
242
49.5k
  }
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::copy<9u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
235
3
            unsigned j, unsigned Count) {
236
3
    assert(i + Count <= M && "Invalid source range");
237
3
    assert(j + Count <= N && "Invalid dest range");
238
6
    for (unsigned e = i + Count; i != e; 
++i, ++j3
) {
239
3
      first[j]  = Other.first[i];
240
3
      second[j] = Other.second[i];
241
3
    }
242
3
  }
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::copy<4u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u> const&, unsigned int, unsigned int, unsigned int)
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::copy<4u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
235
7
            unsigned j, unsigned Count) {
236
7
    assert(i + Count <= M && "Invalid source range");
237
7
    assert(j + Count <= N && "Invalid dest range");
238
15
    for (unsigned e = i + Count; i != e; 
++i, ++j8
) {
239
8
      first[j]  = Other.first[i];
240
8
      second[j] = Other.second[i];
241
8
    }
242
7
  }
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::copy<4u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
235
5
            unsigned j, unsigned Count) {
236
5
    assert(i + Count <= M && "Invalid source range");
237
5
    assert(j + Count <= N && "Invalid dest range");
238
25
    for (unsigned e = i + Count; i != e; 
++i, ++j20
) {
239
20
      first[j]  = Other.first[i];
240
20
      second[j] = Other.second[i];
241
20
    }
242
5
  }
void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::copy<11u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
235
31.9k
            unsigned j, unsigned Count) {
236
31.9k
    assert(i + Count <= M && "Invalid source range");
237
31.9k
    assert(j + Count <= N && "Invalid dest range");
238
63.0k
    for (unsigned e = i + Count; i != e; 
++i, ++j31.0k
) {
239
31.0k
      first[j]  = Other.first[i];
240
31.0k
      second[j] = Other.second[i];
241
31.0k
    }
242
31.9k
  }
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::copy<8u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
235
4.63M
            unsigned j, unsigned Count) {
236
4.63M
    assert(i + Count <= M && "Invalid source range");
237
4.63M
    assert(j + Count <= N && "Invalid dest range");
238
17.3M
    for (unsigned e = i + Count; i != e; 
++i, ++j12.7M
) {
239
12.7M
      first[j]  = Other.first[i];
240
12.7M
      second[j] = Other.second[i];
241
12.7M
    }
242
4.63M
  }
void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::copy<11u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
235
6.57k
            unsigned j, unsigned Count) {
236
6.57k
    assert(i + Count <= M && "Invalid source range");
237
6.57k
    assert(j + Count <= N && "Invalid dest range");
238
78.9k
    for (unsigned e = i + Count; i != e; 
++i, ++j72.3k
) {
239
72.3k
      first[j]  = Other.first[i];
240
72.3k
      second[j] = Other.second[i];
241
72.3k
    }
242
6.57k
  }
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::copy<9u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
235
387k
            unsigned j, unsigned Count) {
236
387k
    assert(i + Count <= M && "Invalid source range");
237
387k
    assert(j + Count <= N && "Invalid dest range");
238
1.27M
    for (unsigned e = i + Count; i != e; 
++i, ++j892k
) {
239
892k
      first[j]  = Other.first[i];
240
892k
      second[j] = Other.second[i];
241
892k
    }
242
387k
  }
243
244
  /// moveLeft - Move elements to the left.
245
  /// @param i     Beginning of the source range.
246
  /// @param j     Beginning of the destination range.
247
  /// @param Count Number of elements to copy.
248
2.79M
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
2.79M
    assert(j <= i && "Use moveRight shift elements right");
250
2.79M
    copy(*this, i, j, Count);
251
2.79M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::moveLeft(unsigned int, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
248
18.8k
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
18.8k
    assert(j <= i && "Use moveRight shift elements right");
250
18.8k
    copy(*this, i, j, Count);
251
18.8k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
248
3
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
3
    assert(j <= i && "Use moveRight shift elements right");
250
3
    copy(*this, i, j, Count);
251
3
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
248
7
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
7
    assert(j <= i && "Use moveRight shift elements right");
250
7
    copy(*this, i, j, Count);
251
7
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
248
31.9k
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
31.9k
    assert(j <= i && "Use moveRight shift elements right");
250
31.9k
    copy(*this, i, j, Count);
251
31.9k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
248
2.41M
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
2.41M
    assert(j <= i && "Use moveRight shift elements right");
250
2.41M
    copy(*this, i, j, Count);
251
2.41M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
248
325k
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
325k
    assert(j <= i && "Use moveRight shift elements right");
250
325k
    copy(*this, i, j, Count);
251
325k
  }
252
253
  /// moveRight - Move elements to the right.
254
  /// @param i     Beginning of the source range.
255
  /// @param j     Beginning of the destination range.
256
  /// @param Count Number of elements to copy.
257
8.44M
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
8.44M
    assert(i <= j && "Use moveLeft shift elements left");
259
8.44M
    assert(j + Count <= N && "Invalid range");
260
26.8M
    while (Count--) {
261
18.4M
      first[j + Count]  = first[i + Count];
262
18.4M
      second[j + Count] = second[i + Count];
263
18.4M
    }
264
8.44M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
2
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
2
    assert(i <= j && "Use moveLeft shift elements left");
259
2
    assert(j + Count <= N && "Invalid range");
260
6
    while (Count--) {
261
4
      first[j + Count]  = first[i + Count];
262
4
      second[j + Count] = second[i + Count];
263
4
    }
264
2
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::moveRight(unsigned int, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
99.7k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
99.7k
    assert(i <= j && "Use moveLeft shift elements left");
259
99.7k
    assert(j + Count <= N && "Invalid range");
260
389k
    while (Count--) {
261
289k
      first[j + Count]  = first[i + Count];
262
289k
      second[j + Count] = second[i + Count];
263
289k
    }
264
99.7k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
9
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
9
    assert(i <= j && "Use moveLeft shift elements left");
259
9
    assert(j + Count <= N && "Invalid range");
260
22
    while (Count--) {
261
13
      first[j + Count]  = first[i + Count];
262
13
      second[j + Count] = second[i + Count];
263
13
    }
264
9
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
7.65M
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
7.65M
    assert(i <= j && "Use moveLeft shift elements left");
259
7.65M
    assert(j + Count <= N && "Invalid range");
260
24.3M
    while (Count--) {
261
16.6M
      first[j + Count]  = first[i + Count];
262
16.6M
      second[j + Count] = second[i + Count];
263
16.6M
    }
264
7.65M
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
298k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
298k
    assert(i <= j && "Use moveLeft shift elements left");
259
298k
    assert(j + Count <= N && "Invalid range");
260
712k
    while (Count--) {
261
414k
      first[j + Count]  = first[i + Count];
262
414k
      second[j + Count] = second[i + Count];
263
414k
    }
264
298k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
386k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
386k
    assert(i <= j && "Use moveLeft shift elements left");
259
386k
    assert(j + Count <= N && "Invalid range");
260
1.42M
    while (Count--) {
261
1.04M
      first[j + Count]  = first[i + Count];
262
1.04M
      second[j + Count] = second[i + Count];
263
1.04M
    }
264
386k
  }
265
266
  /// erase - Erase elements [i;j).
267
  /// @param i    Beginning of the range to erase.
268
  /// @param j    End of the range. (Exclusive).
269
  /// @param Size Number of elements in node.
270
2.79M
  void erase(unsigned i, unsigned j, unsigned Size) {
271
2.79M
    moveLeft(j, i, Size - j);
272
2.79M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::erase(unsigned int, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
270
18.8k
  void erase(unsigned i, unsigned j, unsigned Size) {
271
18.8k
    moveLeft(j, i, Size - j);
272
18.8k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
270
3
  void erase(unsigned i, unsigned j, unsigned Size) {
271
3
    moveLeft(j, i, Size - j);
272
3
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
270
7
  void erase(unsigned i, unsigned j, unsigned Size) {
271
7
    moveLeft(j, i, Size - j);
272
7
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
270
31.9k
  void erase(unsigned i, unsigned j, unsigned Size) {
271
31.9k
    moveLeft(j, i, Size - j);
272
31.9k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
270
2.41M
  void erase(unsigned i, unsigned j, unsigned Size) {
271
2.41M
    moveLeft(j, i, Size - j);
272
2.41M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
270
325k
  void erase(unsigned i, unsigned j, unsigned Size) {
271
325k
    moveLeft(j, i, Size - j);
272
325k
  }
273
274
  /// erase - Erase element at i.
275
  /// @param i    Index of element to erase.
276
  /// @param Size Number of elements in node.
277
1.88M
  void erase(unsigned i, unsigned Size) {
278
1.88M
    erase(i, i+1, Size);
279
1.88M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::erase(unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::erase(unsigned int, unsigned int)
Line
Count
Source
277
2.42k
  void erase(unsigned i, unsigned Size) {
278
2.42k
    erase(i, i+1, Size);
279
2.42k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::erase(unsigned int, unsigned int)
Line
Count
Source
277
3
  void erase(unsigned i, unsigned Size) {
278
3
    erase(i, i+1, Size);
279
3
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::erase(unsigned int, unsigned int)
Line
Count
Source
277
7
  void erase(unsigned i, unsigned Size) {
278
7
    erase(i, i+1, Size);
279
7
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::erase(unsigned int, unsigned int)
Line
Count
Source
277
31.9k
  void erase(unsigned i, unsigned Size) {
278
31.9k
    erase(i, i+1, Size);
279
31.9k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::erase(unsigned int, unsigned int)
Line
Count
Source
277
1.54M
  void erase(unsigned i, unsigned Size) {
278
1.54M
    erase(i, i+1, Size);
279
1.54M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::erase(unsigned int, unsigned int)
Line
Count
Source
277
303k
  void erase(unsigned i, unsigned Size) {
278
303k
    erase(i, i+1, Size);
279
303k
  }
280
281
  /// shift - Shift elements [i;size) 1 position to the right.
282
  /// @param i    Beginning of the range to move.
283
  /// @param Size Number of elements in node.
284
7.67M
  void shift(unsigned i, unsigned Size) {
285
7.67M
    moveRight(i, i + 1, Size - i);
286
7.67M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
2
  void shift(unsigned i, unsigned Size) {
285
2
    moveRight(i, i + 1, Size - i);
286
2
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::shift(unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
85.6k
  void shift(unsigned i, unsigned Size) {
285
85.6k
    moveRight(i, i + 1, Size - i);
286
85.6k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
9
  void shift(unsigned i, unsigned Size) {
285
9
    moveRight(i, i + 1, Size - i);
286
9
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
298k
  void shift(unsigned i, unsigned Size) {
285
298k
    moveRight(i, i + 1, Size - i);
286
298k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
6.91M
  void shift(unsigned i, unsigned Size) {
285
6.91M
    moveRight(i, i + 1, Size - i);
286
6.91M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
372k
  void shift(unsigned i, unsigned Size) {
285
372k
    moveRight(i, i + 1, Size - i);
286
372k
  }
287
288
  /// transferToLeftSib - Transfer elements to a left sibling node.
289
  /// @param Size  Number of elements in this.
290
  /// @param Sib   Left sibling node.
291
  /// @param SSize Number of elements in sib.
292
  /// @param Count Number of elements to transfer.
293
  void transferToLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize,
294
911k
                         unsigned Count) {
295
911k
    Sib.copy(*this, 0, SSize, Count);
296
911k
    erase(0, Count, Size);
297
911k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>&, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>&, unsigned int, unsigned int)
Line
Count
Source
294
16.4k
                         unsigned Count) {
295
16.4k
    Sib.copy(*this, 0, SSize, Count);
296
16.4k
    erase(0, Count, Size);
297
16.4k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>&, unsigned int, unsigned int)
Line
Count
Source
294
873k
                         unsigned Count) {
295
873k
    Sib.copy(*this, 0, SSize, Count);
296
873k
    erase(0, Count, Size);
297
873k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>&, unsigned int, unsigned int)
Line
Count
Source
294
21.7k
                         unsigned Count) {
295
21.7k
    Sib.copy(*this, 0, SSize, Count);
296
21.7k
    erase(0, Count, Size);
297
21.7k
  }
298
299
  /// transferToRightSib - Transfer elements to a right sibling node.
300
  /// @param Size  Number of elements in this.
301
  /// @param Sib   Right sibling node.
302
  /// @param SSize Number of elements in sib.
303
  /// @param Count Number of elements to transfer.
304
  void transferToRightSib(unsigned Size, NodeBase &Sib, unsigned SSize,
305
767k
                          unsigned Count) {
306
767k
    Sib.moveRight(0, Count, SSize);
307
767k
    Sib.copy(*this, Size-Count, 0, Count);
308
767k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>&, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>&, unsigned int, unsigned int)
Line
Count
Source
305
14.1k
                          unsigned Count) {
306
14.1k
    Sib.moveRight(0, Count, SSize);
307
14.1k
    Sib.copy(*this, Size-Count, 0, Count);
308
14.1k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>&, unsigned int, unsigned int)
Line
Count
Source
305
739k
                          unsigned Count) {
306
739k
    Sib.moveRight(0, Count, SSize);
307
739k
    Sib.copy(*this, Size-Count, 0, Count);
308
739k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>&, unsigned int, unsigned int)
Line
Count
Source
305
14.0k
                          unsigned Count) {
306
14.0k
    Sib.moveRight(0, Count, SSize);
307
14.0k
    Sib.copy(*this, Size-Count, 0, Count);
308
14.0k
  }
309
310
  /// adjustFromLeftSib - Adjust the number if elements in this node by moving
311
  /// elements to or from a left sibling node.
312
  /// @param Size  Number of elements in this.
313
  /// @param Sib   Right sibling node.
314
  /// @param SSize Number of elements in sib.
315
  /// @param Add   The number of elements to add to this node, possibly < 0.
316
  /// @return      Number of elements added to this node, possibly negative.
317
1.67M
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
318
1.67M
    if (Add > 0) {
319
767k
      // We want to grow, copy from sib.
320
767k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
321
767k
      Sib.transferToRightSib(SSize, *this, Size, Count);
322
767k
      return Count;
323
911k
    } else {
324
911k
      // We want to shrink, copy to sib.
325
911k
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
326
911k
      transferToLeftSib(Size, Sib, SSize, Count);
327
911k
      return -Count;
328
911k
    }
329
1.67M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>&, unsigned int, int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>&, unsigned int, int)
Line
Count
Source
317
30.6k
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
318
30.6k
    if (Add > 0) {
319
14.1k
      // We want to grow, copy from sib.
320
14.1k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
321
14.1k
      Sib.transferToRightSib(SSize, *this, Size, Count);
322
14.1k
      return Count;
323
16.4k
    } else {
324
16.4k
      // We want to shrink, copy to sib.
325
16.4k
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
326
16.4k
      transferToLeftSib(Size, Sib, SSize, Count);
327
16.4k
      return -Count;
328
16.4k
    }
329
30.6k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>&, unsigned int, int)
Line
Count
Source
317
1.61M
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
318
1.61M
    if (Add > 0) {
319
739k
      // We want to grow, copy from sib.
320
739k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
321
739k
      Sib.transferToRightSib(SSize, *this, Size, Count);
322
739k
      return Count;
323
873k
    } else {
324
873k
      // We want to shrink, copy to sib.
325
873k
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
326
873k
      transferToLeftSib(Size, Sib, SSize, Count);
327
873k
      return -Count;
328
873k
    }
329
1.61M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>&, unsigned int, int)
Line
Count
Source
317
35.8k
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
318
35.8k
    if (Add > 0) {
319
14.0k
      // We want to grow, copy from sib.
320
14.0k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
321
14.0k
      Sib.transferToRightSib(SSize, *this, Size, Count);
322
14.0k
      return Count;
323
21.7k
    } else {
324
21.7k
      // We want to shrink, copy to sib.
325
21.7k
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
326
21.7k
      transferToLeftSib(Size, Sib, SSize, Count);
327
21.7k
      return -Count;
328
21.7k
    }
329
35.8k
  }
330
};
331
332
/// IntervalMapImpl::adjustSiblingSizes - Move elements between sibling nodes.
333
/// @param Node  Array of pointers to sibling nodes.
334
/// @param Nodes Number of nodes.
335
/// @param CurSize Array of current node sizes, will be overwritten.
336
/// @param NewSize Array of desired node sizes.
337
template <typename NodeT>
338
void adjustSiblingSizes(NodeT *Node[], unsigned Nodes,
339
1.11M
                        unsigned CurSize[], const unsigned NewSize[]) {
340
1.11M
  // Move elements right.
341
2.94M
  for (int n = Nodes - 1; n; 
--n1.82M
) {
342
1.82M
    if (CurSize[n] == NewSize[n])
343
165k
      continue;
344
1.65M
    for (int m = n - 1; m != -1; 
--m0
) {
345
1.65M
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
1.65M
                                         NewSize[n] - CurSize[n]);
347
1.65M
      CurSize[m] -= d;
348
1.65M
      CurSize[n] += d;
349
1.65M
      // Keep going if the current node was exhausted.
350
1.65M
      if (CurSize[n] >= NewSize[n])
351
1.65M
          break;
352
1.65M
    }
353
1.65M
  }
354
1.11M
355
1.11M
  if (Nodes == 0)
356
0
    return;
357
1.11M
358
1.11M
  // Move elements left.
359
2.94M
  
for (unsigned n = 0; 1.11M
n != Nodes - 1;
++n1.82M
) {
360
1.82M
    if (CurSize[n] == NewSize[n])
361
1.80M
      continue;
362
21.4k
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
363
21.4k
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
364
21.4k
                                        CurSize[n] -  NewSize[n]);
365
21.4k
      CurSize[m] += d;
366
21.4k
      CurSize[n] -= d;
367
21.4k
      // Keep going if the current node was exhausted.
368
21.4k
      if (CurSize[n] >= NewSize[n])
369
21.4k
          break;
370
21.4k
    }
371
21.4k
  }
372
1.11M
373
1.11M
#ifndef NDEBUG
374
1.11M
  for (unsigned n = 0; n != Nodes; n++)
375
1.11M
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
1.11M
#endif
377
1.11M
}
Unexecuted instantiation: void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
Unexecuted instantiation: void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
Line
Count
Source
339
1.06M
                        unsigned CurSize[], const unsigned NewSize[]) {
340
1.06M
  // Move elements right.
341
2.82M
  for (int n = Nodes - 1; n; 
--n1.75M
) {
342
1.75M
    if (CurSize[n] == NewSize[n])
343
160k
      continue;
344
1.59M
    for (int m = n - 1; m != -1; 
--m0
) {
345
1.59M
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
1.59M
                                         NewSize[n] - CurSize[n]);
347
1.59M
      CurSize[m] -= d;
348
1.59M
      CurSize[n] += d;
349
1.59M
      // Keep going if the current node was exhausted.
350
1.59M
      if (CurSize[n] >= NewSize[n])
351
1.59M
          break;
352
1.59M
    }
353
1.59M
  }
354
1.06M
355
1.06M
  if (Nodes == 0)
356
0
    return;
357
1.06M
358
1.06M
  // Move elements left.
359
2.82M
  
for (unsigned n = 0; 1.06M
n != Nodes - 1;
++n1.75M
) {
360
1.75M
    if (CurSize[n] == NewSize[n])
361
1.73M
      continue;
362
19.9k
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
363
19.9k
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
364
19.9k
                                        CurSize[n] -  NewSize[n]);
365
19.9k
      CurSize[m] += d;
366
19.9k
      CurSize[n] -= d;
367
19.9k
      // Keep going if the current node was exhausted.
368
19.9k
      if (CurSize[n] >= NewSize[n])
369
19.9k
          break;
370
19.9k
    }
371
19.9k
  }
372
1.06M
373
1.06M
#ifndef NDEBUG
374
1.06M
  for (unsigned n = 0; n != Nodes; n++)
375
1.06M
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
1.06M
#endif
377
1.06M
}
void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
Line
Count
Source
339
23.0k
                        unsigned CurSize[], const unsigned NewSize[]) {
340
23.0k
  // Move elements right.
341
54.3k
  for (int n = Nodes - 1; n; 
--n31.2k
) {
342
31.2k
    if (CurSize[n] == NewSize[n])
343
1.10k
      continue;
344
30.1k
    for (int m = n - 1; m != -1; 
--m0
) {
345
30.1k
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
30.1k
                                         NewSize[n] - CurSize[n]);
347
30.1k
      CurSize[m] -= d;
348
30.1k
      CurSize[n] += d;
349
30.1k
      // Keep going if the current node was exhausted.
350
30.1k
      if (CurSize[n] >= NewSize[n])
351
30.1k
          break;
352
30.1k
    }
353
30.1k
  }
354
23.0k
355
23.0k
  if (Nodes == 0)
356
0
    return;
357
23.0k
358
23.0k
  // Move elements left.
359
54.3k
  
for (unsigned n = 0; 23.0k
n != Nodes - 1;
++n31.2k
) {
360
31.2k
    if (CurSize[n] == NewSize[n])
361
30.8k
      continue;
362
368
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
363
368
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
364
368
                                        CurSize[n] -  NewSize[n]);
365
368
      CurSize[m] += d;
366
368
      CurSize[n] -= d;
367
368
      // Keep going if the current node was exhausted.
368
368
      if (CurSize[n] >= NewSize[n])
369
368
          break;
370
368
    }
371
368
  }
372
23.0k
373
23.0k
#ifndef NDEBUG
374
23.0k
  for (unsigned n = 0; n != Nodes; n++)
375
23.0k
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
23.0k
#endif
377
23.0k
}
void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
Line
Count
Source
339
25.6k
                        unsigned CurSize[], const unsigned NewSize[]) {
340
25.6k
  // Move elements right.
341
63.8k
  for (int n = Nodes - 1; n; 
--n38.1k
) {
342
38.1k
    if (CurSize[n] == NewSize[n])
343
3.40k
      continue;
344
34.7k
    for (int m = n - 1; m != -1; 
--m0
) {
345
34.7k
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
34.7k
                                         NewSize[n] - CurSize[n]);
347
34.7k
      CurSize[m] -= d;
348
34.7k
      CurSize[n] += d;
349
34.7k
      // Keep going if the current node was exhausted.
350
34.7k
      if (CurSize[n] >= NewSize[n])
351
34.7k
          break;
352
34.7k
    }
353
34.7k
  }
354
25.6k
355
25.6k
  if (Nodes == 0)
356
0
    return;
357
25.6k
358
25.6k
  // Move elements left.
359
63.8k
  
for (unsigned n = 0; 25.6k
n != Nodes - 1;
++n38.1k
) {
360
38.1k
    if (CurSize[n] == NewSize[n])
361
37.0k
      continue;
362
1.06k
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
363
1.06k
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
364
1.06k
                                        CurSize[n] -  NewSize[n]);
365
1.06k
      CurSize[m] += d;
366
1.06k
      CurSize[n] -= d;
367
1.06k
      // Keep going if the current node was exhausted.
368
1.06k
      if (CurSize[n] >= NewSize[n])
369
1.06k
          break;
370
1.06k
    }
371
1.06k
  }
372
25.6k
373
25.6k
#ifndef NDEBUG
374
25.6k
  for (unsigned n = 0; n != Nodes; n++)
375
25.6k
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
25.6k
#endif
377
25.6k
}
void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
Line
Count
Source
339
106
                        unsigned CurSize[], const unsigned NewSize[]) {
340
106
  // Move elements right.
341
230
  for (int n = Nodes - 1; n; 
--n124
) {
342
124
    if (CurSize[n] == NewSize[n])
343
2
      continue;
344
122
    for (int m = n - 1; m != -1; 
--m0
) {
345
122
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
122
                                         NewSize[n] - CurSize[n]);
347
122
      CurSize[m] -= d;
348
122
      CurSize[n] += d;
349
122
      // Keep going if the current node was exhausted.
350
122
      if (CurSize[n] >= NewSize[n])
351
122
          break;
352
122
    }
353
122
  }
354
106
355
106
  if (Nodes == 0)
356
0
    return;
357
106
358
106
  // Move elements left.
359
230
  
for (unsigned n = 0; 106
n != Nodes - 1;
++n124
) {
360
124
    if (CurSize[n] == NewSize[n])
361
122
      continue;
362
2
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
363
2
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
364
2
                                        CurSize[n] -  NewSize[n]);
365
2
      CurSize[m] += d;
366
2
      CurSize[n] -= d;
367
2
      // Keep going if the current node was exhausted.
368
2
      if (CurSize[n] >= NewSize[n])
369
2
          break;
370
2
    }
371
2
  }
372
106
373
106
#ifndef NDEBUG
374
106
  for (unsigned n = 0; n != Nodes; n++)
375
106
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
106
#endif
377
106
}
378
379
/// IntervalMapImpl::distribute - Compute a new distribution of node elements
380
/// after an overflow or underflow. Reserve space for a new element at Position,
381
/// and compute the node that will hold Position after redistributing node
382
/// elements.
383
///
384
/// It is required that
385
///
386
///   Elements == sum(CurSize), and
387
///   Elements + Grow <= Nodes * Capacity.
388
///
389
/// NewSize[] will be filled in such that:
390
///
391
///   sum(NewSize) == Elements, and
392
///   NewSize[i] <= Capacity.
393
///
394
/// The returned index is the node where Position will go, so:
395
///
396
///   sum(NewSize[0..idx-1]) <= Position
397
///   sum(NewSize[0..idx])   >= Position
398
///
399
/// The last equality, sum(NewSize[0..idx]) == Position, can only happen when
400
/// Grow is set and NewSize[idx] == Capacity-1. The index points to the node
401
/// before the one holding the Position'th element where there is room for an
402
/// insertion.
403
///
404
/// @param Nodes    The number of nodes.
405
/// @param Elements Total elements in all nodes.
406
/// @param Capacity The capacity of each node.
407
/// @param CurSize  Array[Nodes] of current node sizes, or NULL.
408
/// @param NewSize  Array[Nodes] to receive the new node sizes.
409
/// @param Position Insert position.
410
/// @param Grow     Reserve space for a new element at Position.
411
/// @return         (node, offset) for Position.
412
IdxPair distribute(unsigned Nodes, unsigned Elements, unsigned Capacity,
413
                   const unsigned *CurSize, unsigned NewSize[],
414
                   unsigned Position, bool Grow);
415
416
//===----------------------------------------------------------------------===//
417
//---                   IntervalMapImpl::NodeSizer                         ---//
418
//===----------------------------------------------------------------------===//
419
//
420
// Compute node sizes from key and value types.
421
//
422
// The branching factors are chosen to make nodes fit in three cache lines.
423
// This may not be possible if keys or values are very large. Such large objects
424
// are handled correctly, but a std::map would probably give better performance.
425
//
426
//===----------------------------------------------------------------------===//
427
428
enum {
429
  // Cache line size. Most architectures have 32 or 64 byte cache lines.
430
  // We use 64 bytes here because it provides good branching factors.
431
  Log2CacheLine = 6,
432
  CacheLineBytes = 1 << Log2CacheLine,
433
  DesiredNodeBytes = 3 * CacheLineBytes
434
};
435
436
template <typename KeyT, typename ValT>
437
struct NodeSizer {
438
  enum {
439
    // Compute the leaf node branching factor that makes a node fit in three
440
    // cache lines. The branching factor must be at least 3, or some B+-tree
441
    // balancing algorithms won't work.
442
    // LeafSize can't be larger than CacheLineBytes. This is required by the
443
    // PointerIntPair used by NodeRef.
444
    DesiredLeafSize = DesiredNodeBytes /
445
      static_cast<unsigned>(2*sizeof(KeyT)+sizeof(ValT)),
446
    MinLeafSize = 3,
447
    LeafSize = DesiredLeafSize > MinLeafSize ? DesiredLeafSize : MinLeafSize
448
  };
449
450
  using LeafBase = NodeBase<std::pair<KeyT, KeyT>, ValT, LeafSize>;
451
452
  enum {
453
    // Now that we have the leaf branching factor, compute the actual allocation
454
    // unit size by rounding up to a whole number of cache lines.
455
    AllocBytes = (sizeof(LeafBase) + CacheLineBytes-1) & ~(CacheLineBytes-1),
456
457
    // Determine the branching factor for branch nodes.
458
    BranchSize = AllocBytes /
459
      static_cast<unsigned>(sizeof(KeyT) + sizeof(void*))
460
  };
461
462
  /// Allocator - The recycling allocator used for both branch and leaf nodes.
463
  /// This typedef is very likely to be identical for all IntervalMaps with
464
  /// reasonably sized entries, so the same allocator can be shared among
465
  /// different kinds of maps.
466
  using Allocator =
467
      RecyclingAllocator<BumpPtrAllocator, char, AllocBytes, CacheLineBytes>;
468
};
469
470
//===----------------------------------------------------------------------===//
471
//---                     IntervalMapImpl::NodeRef                         ---//
472
//===----------------------------------------------------------------------===//
473
//
474
// B+-tree nodes can be leaves or branches, so we need a polymorphic node
475
// pointer that can point to both kinds.
476
//
477
// All nodes are cache line aligned and the low 6 bits of a node pointer are
478
// always 0. These bits are used to store the number of elements in the
479
// referenced node. Besides saving space, placing node sizes in the parents
480
// allow tree balancing algorithms to run without faulting cache lines for nodes
481
// that may not need to be modified.
482
//
483
// A NodeRef doesn't know whether it references a leaf node or a branch node.
484
// It is the responsibility of the caller to use the correct types.
485
//
486
// Nodes are never supposed to be empty, and it is invalid to store a node size
487
// of 0 in a NodeRef. The valid range of sizes is 1-64.
488
//
489
//===----------------------------------------------------------------------===//
490
491
0
class NodeRef {
Unexecuted instantiation: llvm::IntervalMapImpl::NodeRef::operator=(llvm::IntervalMapImpl::NodeRef&&)
Unexecuted instantiation: llvm::IntervalMapImpl::NodeRef::operator=(llvm::IntervalMapImpl::NodeRef const&)
492
  struct CacheAlignedPointerTraits {
493
1.02M
    static inline void *getAsVoidPointer(void *P) { return P; }
494
78.3M
    static inline void *getFromVoidPointer(void *P) { return P; }
495
    enum { NumLowBitsAvailable = Log2CacheLine };
496
  };
497
  PointerIntPair<void*, Log2CacheLine, unsigned, CacheAlignedPointerTraits> pip;
498
499
public:
500
  /// NodeRef - Create a null ref.
501
5.20M
  NodeRef() = default;
502
503
  /// operator bool - Detect a null ref.
504
3.72M
  explicit operator bool() const { return pip.getOpaqueValue(); }
505
506
  /// NodeRef - Create a reference to the node p with n elements.
507
  template <typename NodeT>
508
1.02M
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
1.02M
    assert(n <= NodeT::Capacity && "Size too big for node");
510
1.02M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
Line
Count
Source
508
5
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
5
    assert(n <= NodeT::Capacity && "Size too big for node");
510
5
  }
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
Line
Count
Source
508
16.5k
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
16.5k
    assert(n <= NodeT::Capacity && "Size too big for node");
510
16.5k
  }
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
Line
Count
Source
508
972k
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
972k
    assert(n <= NodeT::Capacity && "Size too big for node");
510
972k
  }
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
Line
Count
Source
508
139
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
139
    assert(n <= NodeT::Capacity && "Size too big for node");
510
139
  }
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
Line
Count
Source
508
32.1k
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
32.1k
    assert(n <= NodeT::Capacity && "Size too big for node");
510
32.1k
  }
511
512
  /// size - Return the number of elements in the referenced node.
513
44.7M
  unsigned size() const { return pip.getInt() + 1; }
514
515
  /// setSize - Update the node size.
516
8.04M
  void setSize(unsigned n) { pip.setInt(n - 1); }
517
518
  /// subtree - Access the i'th subtree reference in a branch node.
519
  /// This depends on branch nodes storing the NodeRef array as their first
520
  /// member.
521
42.7M
  NodeRef &subtree(unsigned i) const {
522
42.7M
    return reinterpret_cast<NodeRef*>(pip.getPointer())[i];
523
42.7M
  }
524
525
  /// get - Dereference as a NodeT reference.
526
  template <typename NodeT>
527
35.5M
  NodeT &get() const {
528
35.5M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
35.5M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
527
2.73M
  NodeT &get() const {
528
2.73M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
2.73M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
527
31.7M
  NodeT &get() const {
528
31.7M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
31.7M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
527
65
  NodeT &get() const {
528
65
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
65
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
527
45.4k
  NodeT &get() const {
528
45.4k
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
45.4k
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
527
1.05M
  NodeT &get() const {
528
1.05M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
1.05M
  }
530
531
0
  bool operator==(const NodeRef &RHS) const {
532
0
    if (pip == RHS.pip)
533
0
      return true;
534
0
    assert(pip.getPointer() != RHS.pip.getPointer() && "Inconsistent NodeRefs");
535
0
    return false;
536
0
  }
537
538
0
  bool operator!=(const NodeRef &RHS) const {
539
0
    return !operator==(RHS);
540
0
  }
541
};
542
543
//===----------------------------------------------------------------------===//
544
//---                      IntervalMapImpl::LeafNode                       ---//
545
//===----------------------------------------------------------------------===//
546
//
547
// Leaf nodes store up to N disjoint intervals with corresponding values.
548
//
549
// The intervals are kept sorted and fully coalesced so there are no adjacent
550
// intervals mapping to the same value.
551
//
552
// These constraints are always satisfied:
553
//
554
// - Traits::stopLess(start(i), stop(i))    - Non-empty, sane intervals.
555
//
556
// - Traits::stopLess(stop(i), start(i + 1) - Sorted.
557
//
558
// - value(i) != value(i + 1) || !Traits::adjacent(stop(i), start(i + 1))
559
//                                          - Fully coalesced.
560
//
561
//===----------------------------------------------------------------------===//
562
563
template <typename KeyT, typename ValT, unsigned N, typename Traits>
564
class LeafNode : public NodeBase<std::pair<KeyT, KeyT>, ValT, N> {
565
public:
566
2.10M
  const KeyT &start(unsigned i) const { return this->first[i].first; }
Unexecuted instantiation: llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int) const
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int) const
Line
Count
Source
566
2.10M
  const KeyT &start(unsigned i) const { return this->first[i].first; }
567
343M
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
567
332M
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
567
187
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
567
2.53k
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
567
10.4M
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
568
926k
  const ValT &value(unsigned i) const { return this->second[i]; }
569
570
310M
  KeyT &start(unsigned i) { return this->first[i].first; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int)
Line
Count
Source
570
306M
  KeyT &start(unsigned i) { return this->first[i].first; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int)
Line
Count
Source
570
202
  KeyT &start(unsigned i) { return this->first[i].first; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int)
Line
Count
Source
570
5.60k
  KeyT &start(unsigned i) { return this->first[i].first; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int)
Line
Count
Source
570
3.77M
  KeyT &start(unsigned i) { return this->first[i].first; }
571
270M
  KeyT &stop(unsigned i) { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
571
265M
  KeyT &stop(unsigned i) { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
571
146
  KeyT &stop(unsigned i) { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
571
3.53k
  KeyT &stop(unsigned i) { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
571
4.93M
  KeyT &stop(unsigned i) { return this->first[i].second; }
572
189M
  ValT &value(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::value(unsigned int)
Line
Count
Source
572
261
  ValT &value(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::value(unsigned int)
Line
Count
Source
572
6.46k
  ValT &value(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::value(unsigned int)
Line
Count
Source
572
185M
  ValT &value(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::value(unsigned int)
Line
Count
Source
572
4.76M
  ValT &value(unsigned i) { return this->second[i]; }
573
574
  /// findFrom - Find the first interval after i that may contain x.
575
  /// @param i    Starting index for the search.
576
  /// @param Size Number of elements in node.
577
  /// @param x    Key to search for.
578
  /// @return     First index with !stopLess(key[i].stop, x), or size.
579
  ///             This is the first interval that can possibly contain x.
580
131M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
581
131M
    assert(i <= Size && Size <= N && "Bad indices");
582
131M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
583
131M
           "Index is past the needed point");
584
208M
    while (i != Size && 
Traits::stopLess(stop(i), x)194M
)
++i77.2M
;
585
131M
    return i;
586
131M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
580
129M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
581
129M
    assert(i <= Size && Size <= N && "Bad indices");
582
129M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
583
129M
           "Index is past the needed point");
584
203M
    while (i != Size && 
Traits::stopLess(stop(i), x)190M
)
++i73.7M
;
585
129M
    return i;
586
129M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
580
2.43k
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
581
2.43k
    assert(i <= Size && Size <= N && "Bad indices");
582
2.43k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
583
2.43k
           "Index is past the needed point");
584
3.82k
    while (i != Size && 
Traits::stopLess(stop(i), x)2.53k
)
++i1.38k
;
585
2.43k
    return i;
586
2.43k
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
580
1.69M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
581
1.69M
    assert(i <= Size && Size <= N && "Bad indices");
582
1.69M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
583
1.69M
           "Index is past the needed point");
584
5.14M
    while (i != Size && 
Traits::stopLess(stop(i), x)4.67M
)
++i3.44M
;
585
1.69M
    return i;
586
1.69M
  }
587
588
  /// safeFind - Find an interval that is known to exist. This is the same as
589
  /// findFrom except is it assumed that x is at least within range of the last
590
  /// interval.
591
  /// @param i Starting index for the search.
592
  /// @param x Key to search for.
593
  /// @return  First index with !stopLess(key[i].stop, x), never size.
594
  ///          This is the first interval that can possibly contain x.
595
37.9M
  unsigned safeFind(unsigned i, KeyT x) const {
596
37.9M
    assert(i < N && "Bad index");
597
37.9M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
598
37.9M
           "Index is past the needed point");
599
147M
    while (Traits::stopLess(stop(i), x)) 
++i109M
;
600
37.9M
    assert(i < N && "Unsafe intervals");
601
37.9M
    return i;
602
37.9M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
595
36.1M
  unsigned safeFind(unsigned i, KeyT x) const {
596
36.1M
    assert(i < N && "Bad index");
597
36.1M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
598
36.1M
           "Index is past the needed point");
599
142M
    while (Traits::stopLess(stop(i), x)) 
++i106M
;
600
36.1M
    assert(i < N && "Unsafe intervals");
601
36.1M
    return i;
602
36.1M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
595
54
  unsigned safeFind(unsigned i, KeyT x) const {
596
54
    assert(i < N && "Bad index");
597
54
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
598
54
           "Index is past the needed point");
599
187
    while (Traits::stopLess(stop(i), x)) 
++i133
;
600
54
    assert(i < N && "Unsafe intervals");
601
54
    return i;
602
54
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
595
1.78M
  unsigned safeFind(unsigned i, KeyT x) const {
596
1.78M
    assert(i < N && "Bad index");
597
1.78M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
598
1.78M
           "Index is past the needed point");
599
4.84M
    while (Traits::stopLess(stop(i), x)) 
++i3.06M
;
600
1.78M
    assert(i < N && "Unsafe intervals");
601
1.78M
    return i;
602
1.78M
  }
603
604
  /// safeLookup - Lookup mapped value for a safe key.
605
  /// It is assumed that x is within range of the last entry.
606
  /// @param x        Key to search for.
607
  /// @param NotFound Value to return if x is not in any interval.
608
  /// @return         The mapped value at x or NotFound.
609
1.07M
  ValT safeLookup(KeyT x, ValT NotFound) const {
610
1.07M
    unsigned i = safeFind(0, x);
611
1.07M
    return Traits::startLess(x, start(i)) ? 
NotFound149k
:
value(i)926k
;
612
1.07M
  }
613
614
  unsigned insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y);
615
};
616
617
/// insertFrom - Add mapping of [a;b] to y if possible, coalescing as much as
618
/// possible. This may cause the node to grow by 1, or it may cause the node
619
/// to shrink because of coalescing.
620
/// @param Pos  Starting index = insertFrom(0, size, a)
621
/// @param Size Number of elements in node.
622
/// @param a    Interval start.
623
/// @param b    Interval stop.
624
/// @param y    Value be mapped.
625
/// @return     (insert position, new size), or (i, Capacity+1) on overflow.
626
template <typename KeyT, typename ValT, unsigned N, typename Traits>
627
unsigned LeafNode<KeyT, ValT, N, Traits>::
628
18.6M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
18.6M
  unsigned i = Pos;
630
18.6M
  assert(i <= Size && Size <= N && "Invalid index");
631
18.6M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
18.6M
633
18.6M
  // Verify the findFrom invariant.
634
18.6M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
18.6M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
18.6M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
18.6M
638
18.6M
  // Coalesce with previous interval.
639
18.6M
  if (i && 
value(i - 1) == y12.9M
&&
Traits::adjacent(stop(i - 1), a)6.14M
) {
640
2.47M
    Pos = i - 1;
641
2.47M
    // Also coalesce with next interval?
642
2.47M
    if (i != Size && 
value(i) == y2.38M
&&
Traits::adjacent(b, start(i))1.67M
) {
643
502k
      stop(i - 1) = stop(i);
644
502k
      this->erase(i, Size);
645
502k
      return Size - 1;
646
502k
    }
647
1.97M
    stop(i - 1) = b;
648
1.97M
    return Size;
649
1.97M
  }
650
16.1M
651
16.1M
  // Detect overflow.
652
16.1M
  if (i == N)
653
338k
    return N + 1;
654
15.8M
655
15.8M
  // Add new interval at end.
656
15.8M
  if (i == Size) {
657
6.88M
    start(i) = a;
658
6.88M
    stop(i) = b;
659
6.88M
    value(i) = y;
660
6.88M
    return Size + 1;
661
6.88M
  }
662
8.96M
663
8.96M
  // Try to coalesce with following interval.
664
8.96M
  if (value(i) == y && 
Traits::adjacent(b, start(i))4.27M
) {
665
605k
    start(i) = a;
666
605k
    return Size;
667
605k
  }
668
8.36M
669
8.36M
  // We must insert before i. Detect overflow.
670
8.36M
  if (Size == N)
671
1.07M
    return N + 1;
672
7.29M
673
7.29M
  // Insert before i.
674
7.29M
  this->shift(i, Size);
675
7.29M
  start(i) = a;
676
7.29M
  stop(i) = b;
677
7.29M
  value(i) = y;
678
7.29M
  return Size + 1;
679
7.29M
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&, unsigned int, llvm::SlotIndex, llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
628
39
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
39
  unsigned i = Pos;
630
39
  assert(i <= Size && Size <= N && "Invalid index");
631
39
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
39
633
39
  // Verify the findFrom invariant.
634
39
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
39
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
39
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
39
638
39
  // Coalesce with previous interval.
639
39
  if (i && value(i - 1) == y && 
Traits::adjacent(stop(i - 1), a)32
) {
640
27
    Pos = i - 1;
641
27
    // Also coalesce with next interval?
642
27
    if (i != Size && 
value(i) == y21
&&
Traits::adjacent(b, start(i))15
) {
643
3
      stop(i - 1) = stop(i);
644
3
      this->erase(i, Size);
645
3
      return Size - 1;
646
3
    }
647
24
    stop(i - 1) = b;
648
24
    return Size;
649
24
  }
650
12
651
12
  // Detect overflow.
652
12
  if (i == N)
653
0
    return N + 1;
654
12
655
12
  // Add new interval at end.
656
12
  if (i == Size) {
657
10
    start(i) = a;
658
10
    stop(i) = b;
659
10
    value(i) = y;
660
10
    return Size + 1;
661
10
  }
662
2
663
2
  // Try to coalesce with following interval.
664
2
  if (value(i) == y && Traits::adjacent(b, start(i))) {
665
0
    start(i) = a;
666
0
    return Size;
667
0
  }
668
2
669
2
  // We must insert before i. Detect overflow.
670
2
  if (Size == N)
671
0
    return N + 1;
672
2
673
2
  // Insert before i.
674
2
  this->shift(i, Size);
675
2
  start(i) = a;
676
2
  stop(i) = b;
677
2
  value(i) = y;
678
2
  return Size + 1;
679
2
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&, unsigned int, llvm::SlotIndex, llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
628
1.37k
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
1.37k
  unsigned i = Pos;
630
1.37k
  assert(i <= Size && Size <= N && "Invalid index");
631
1.37k
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
1.37k
633
1.37k
  // Verify the findFrom invariant.
634
1.37k
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
1.37k
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
1.37k
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
1.37k
638
1.37k
  // Coalesce with previous interval.
639
1.37k
  if (i && 
value(i - 1) == y822
&&
Traits::adjacent(stop(i - 1), a)578
) {
640
544
    Pos = i - 1;
641
544
    // Also coalesce with next interval?
642
544
    if (i != Size && 
value(i) == y83
&&
Traits::adjacent(b, start(i))19
) {
643
4
      stop(i - 1) = stop(i);
644
4
      this->erase(i, Size);
645
4
      return Size - 1;
646
4
    }
647
540
    stop(i - 1) = b;
648
540
    return Size;
649
540
  }
650
829
651
829
  // Detect overflow.
652
829
  if (i == N)
653
5
    return N + 1;
654
824
655
824
  // Add new interval at end.
656
824
  if (i == Size) {
657
815
    start(i) = a;
658
815
    stop(i) = b;
659
815
    value(i) = y;
660
815
    return Size + 1;
661
815
  }
662
9
663
9
  // Try to coalesce with following interval.
664
9
  if (value(i) == y && 
Traits::adjacent(b, start(i))0
) {
665
0
    start(i) = a;
666
0
    return Size;
667
0
  }
668
9
669
9
  // We must insert before i. Detect overflow.
670
9
  if (Size == N)
671
0
    return N + 1;
672
9
673
9
  // Insert before i.
674
9
  this->shift(i, Size);
675
9
  start(i) = a;
676
9
  stop(i) = b;
677
9
  value(i) = y;
678
9
  return Size + 1;
679
9
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&, unsigned int, llvm::SlotIndex, llvm::SlotIndex, llvm::LiveInterval*)
Line
Count
Source
628
16.6M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
16.6M
  unsigned i = Pos;
630
16.6M
  assert(i <= Size && Size <= N && "Invalid index");
631
16.6M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
16.6M
633
16.6M
  // Verify the findFrom invariant.
634
16.6M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
16.6M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
16.6M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
16.6M
638
16.6M
  // Coalesce with previous interval.
639
16.6M
  if (i && 
value(i - 1) == y11.1M
&&
Traits::adjacent(stop(i - 1), a)4.40M
) {
640
1.50M
    Pos = i - 1;
641
1.50M
    // Also coalesce with next interval?
642
1.50M
    if (i != Size && value(i) == y && 
Traits::adjacent(b, start(i))810k
) {
643
216k
      stop(i - 1) = stop(i);
644
216k
      this->erase(i, Size);
645
216k
      return Size - 1;
646
216k
    }
647
1.28M
    stop(i - 1) = b;
648
1.28M
    return Size;
649
1.28M
  }
650
15.1M
651
15.1M
  // Detect overflow.
652
15.1M
  if (i == N)
653
326k
    return N + 1;
654
14.8M
655
14.8M
  // Add new interval at end.
656
14.8M
  if (i == Size) {
657
6.48M
    start(i) = a;
658
6.48M
    stop(i) = b;
659
6.48M
    value(i) = y;
660
6.48M
    return Size + 1;
661
6.48M
  }
662
8.35M
663
8.35M
  // Try to coalesce with following interval.
664
8.35M
  if (value(i) == y && 
Traits::adjacent(b, start(i))3.68M
) {
665
392k
    start(i) = a;
666
392k
    return Size;
667
392k
  }
668
7.96M
669
7.96M
  // We must insert before i. Detect overflow.
670
7.96M
  if (Size == N)
671
1.04M
    return N + 1;
672
6.91M
673
6.91M
  // Insert before i.
674
6.91M
  this->shift(i, Size);
675
6.91M
  start(i) = a;
676
6.91M
  stop(i) = b;
677
6.91M
  value(i) = y;
678
6.91M
  return Size + 1;
679
6.91M
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&, unsigned int, llvm::SlotIndex, llvm::SlotIndex, unsigned int)
Line
Count
Source
628
2.00M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
2.00M
  unsigned i = Pos;
630
2.00M
  assert(i <= Size && Size <= N && "Invalid index");
631
2.00M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
2.00M
633
2.00M
  // Verify the findFrom invariant.
634
2.00M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
2.00M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
2.00M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
2.00M
638
2.00M
  // Coalesce with previous interval.
639
2.00M
  if (i && 
value(i - 1) == y1.81M
&&
Traits::adjacent(stop(i - 1), a)1.73M
) {
640
975k
    Pos = i - 1;
641
975k
    // Also coalesce with next interval?
642
975k
    if (i != Size && 
value(i) == y885k
&&
Traits::adjacent(b, start(i))862k
) {
643
285k
      stop(i - 1) = stop(i);
644
285k
      this->erase(i, Size);
645
285k
      return Size - 1;
646
285k
    }
647
689k
    stop(i - 1) = b;
648
689k
    return Size;
649
689k
  }
650
1.03M
651
1.03M
  // Detect overflow.
652
1.03M
  if (i == N)
653
11.9k
    return N + 1;
654
1.02M
655
1.02M
  // Add new interval at end.
656
1.02M
  if (i == Size) {
657
407k
    start(i) = a;
658
407k
    stop(i) = b;
659
407k
    value(i) = y;
660
407k
    return Size + 1;
661
407k
  }
662
612k
663
612k
  // Try to coalesce with following interval.
664
612k
  if (value(i) == y && 
Traits::adjacent(b, start(i))590k
) {
665
213k
    start(i) = a;
666
213k
    return Size;
667
213k
  }
668
399k
669
399k
  // We must insert before i. Detect overflow.
670
399k
  if (Size == N)
671
26.6k
    return N + 1;
672
372k
673
372k
  // Insert before i.
674
372k
  this->shift(i, Size);
675
372k
  start(i) = a;
676
372k
  stop(i) = b;
677
372k
  value(i) = y;
678
372k
  return Size + 1;
679
372k
}
680
681
//===----------------------------------------------------------------------===//
682
//---                   IntervalMapImpl::BranchNode                        ---//
683
//===----------------------------------------------------------------------===//
684
//
685
// A branch node stores references to 1--N subtrees all of the same height.
686
//
687
// The key array in a branch node holds the rightmost stop key of each subtree.
688
// It is redundant to store the last stop key since it can be found in the
689
// parent node, but doing so makes tree balancing a lot simpler.
690
//
691
// It is unusual for a branch node to only have one subtree, but it can happen
692
// in the root node if it is smaller than the normal nodes.
693
//
694
// When all of the leaf nodes from all the subtrees are concatenated, they must
695
// satisfy the same constraints as a single leaf node. They must be sorted,
696
// sane, and fully coalesced.
697
//
698
//===----------------------------------------------------------------------===//
699
700
template <typename KeyT, typename ValT, unsigned N, typename Traits>
701
class BranchNode : public NodeBase<NodeRef, KeyT, N> {
702
public:
703
90.9M
  const KeyT &stop(unsigned i) const { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
703
72.3M
  const KeyT &stop(unsigned i) const { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
703
16.1M
  const KeyT &stop(unsigned i) const { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
703
59
  const KeyT &stop(unsigned i) const { return this->second[i]; }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
703
2.19M
  const KeyT &stop(unsigned i) const { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
703
233k
  const KeyT &stop(unsigned i) const { return this->second[i]; }
704
282k
  const NodeRef &subtree(unsigned i) const { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int) const
Line
Count
Source
704
270k
  const NodeRef &subtree(unsigned i) const { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int) const
Line
Count
Source
704
11.9k
  const NodeRef &subtree(unsigned i) const { return this->first[i]; }
705
706
5.70M
  KeyT &stop(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
706
1.01M
  KeyT &stop(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
706
4.51M
  KeyT &stop(unsigned i) { return this->second[i]; }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
706
21
  KeyT &stop(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
706
10.7k
  KeyT &stop(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
706
165k
  KeyT &stop(unsigned i) { return this->second[i]; }
707
1.85M
  NodeRef &subtree(unsigned i) { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
Line
Count
Source
707
10
  NodeRef &subtree(unsigned i) { return this->first[i]; }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
Line
Count
Source
707
1.70M
  NodeRef &subtree(unsigned i) { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
Line
Count
Source
707
85.0k
  NodeRef &subtree(unsigned i) { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
Line
Count
Source
707
61.5k
  NodeRef &subtree(unsigned i) { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
Line
Count
Source
707
549
  NodeRef &subtree(unsigned i) { return this->first[i]; }
708
709
  /// findFrom - Find the first subtree after i that may contain x.
710
  /// @param i    Starting index for the search.
711
  /// @param Size Number of elements in node.
712
  /// @param x    Key to search for.
713
  /// @return     First index with !stopLess(key[i], x), or size.
714
  ///             This is the first subtree that can possibly contain x.
715
30.8M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
716
30.8M
    assert(i <= Size && Size <= N && "Bad indices");
717
30.8M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
718
30.8M
           "Index to findFrom is past the needed point");
719
76.1M
    while (i != Size && 
Traits::stopLess(stop(i), x)73.7M
)
++i45.2M
;
720
30.8M
    return i;
721
30.8M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
715
30.2M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
716
30.2M
    assert(i <= Size && Size <= N && "Bad indices");
717
30.2M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
718
30.2M
           "Index to findFrom is past the needed point");
719
74.6M
    while (i != Size && 
Traits::stopLess(stop(i), x)72.3M
)
++i44.4M
;
720
30.2M
    return i;
721
30.2M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
715
59
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
716
59
    assert(i <= Size && Size <= N && "Bad indices");
717
59
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
718
59
           "Index to findFrom is past the needed point");
719
68
    while (i != Size && 
Traits::stopLess(stop(i), x)59
)
++i9
;
720
59
    return i;
721
59
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
715
644k
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
716
644k
    assert(i <= Size && Size <= N && "Bad indices");
717
644k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
718
644k
           "Index to findFrom is past the needed point");
719
1.44M
    while (i != Size && 
Traits::stopLess(stop(i), x)1.41M
)
++i802k
;
720
644k
    return i;
721
644k
  }
722
723
  /// safeFind - Find a subtree that is known to exist. This is the same as
724
  /// findFrom except is it assumed that x is in range.
725
  /// @param i Starting index for the search.
726
  /// @param x Key to search for.
727
  /// @return  First index with !stopLess(key[i], x), never size.
728
  ///          This is the first subtree that can possibly contain x.
729
3.37M
  unsigned safeFind(unsigned i, KeyT x) const {
730
3.37M
    assert(i < N && "Bad index");
731
3.37M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
732
3.37M
           "Index is past the needed point");
733
16.8M
    while (Traits::stopLess(stop(i), x)) 
++i13.5M
;
734
3.37M
    assert(i < N && "Unsafe intervals");
735
3.37M
    return i;
736
3.37M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
729
3.05M
  unsigned safeFind(unsigned i, KeyT x) const {
730
3.05M
    assert(i < N && "Bad index");
731
3.05M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
732
3.05M
           "Index is past the needed point");
733
16.1M
    while (Traits::stopLess(stop(i), x)) 
++i13.0M
;
734
3.05M
    assert(i < N && "Unsafe intervals");
735
3.05M
    return i;
736
3.05M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
729
45.4k
  unsigned safeFind(unsigned i, KeyT x) const {
730
45.4k
    assert(i < N && "Bad index");
731
45.4k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
732
45.4k
           "Index is past the needed point");
733
233k
    while (Traits::stopLess(stop(i), x)) 
++i188k
;
734
45.4k
    assert(i < N && "Unsafe intervals");
735
45.4k
    return i;
736
45.4k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
729
270k
  unsigned safeFind(unsigned i, KeyT x) const {
730
270k
    assert(i < N && "Bad index");
731
270k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
732
270k
           "Index is past the needed point");
733
509k
    while (Traits::stopLess(stop(i), x)) 
++i238k
;
734
270k
    assert(i < N && "Unsafe intervals");
735
270k
    return i;
736
270k
  }
737
738
  /// safeLookup - Get the subtree containing x, Assuming that x is in range.
739
  /// @param x Key to search for.
740
  /// @return  Subtree containing x
741
282k
  NodeRef safeLookup(KeyT x) const {
742
282k
    return subtree(safeFind(0, x));
743
282k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeLookup(llvm::SlotIndex) const
Line
Count
Source
741
270k
  NodeRef safeLookup(KeyT x) const {
742
270k
    return subtree(safeFind(0, x));
743
270k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeLookup(llvm::SlotIndex) const
Line
Count
Source
741
11.9k
  NodeRef safeLookup(KeyT x) const {
742
11.9k
    return subtree(safeFind(0, x));
743
11.9k
  }
744
745
  /// insert - Insert a new (subtree, stop) pair.
746
  /// @param i    Insert position, following entries will be shifted.
747
  /// @param Size Number of elements in node.
748
  /// @param Node Subtree to insert.
749
  /// @param Stop Last key in subtree.
750
383k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
383k
    assert(Size < N && "branch node overflow");
752
383k
    assert(i <= Size && "Bad insert position");
753
383k
    this->shift(i, Size);
754
383k
    subtree(i) = Node;
755
383k
    stop(i) = Stop;
756
383k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
750
292k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
292k
    assert(Size < N && "branch node overflow");
752
292k
    assert(i <= Size && "Bad insert position");
753
292k
    this->shift(i, Size);
754
292k
    subtree(i) = Node;
755
292k
    stop(i) = Stop;
756
292k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
750
85.0k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
85.0k
    assert(Size < N && "branch node overflow");
752
85.0k
    assert(i <= Size && "Bad insert position");
753
85.0k
    this->shift(i, Size);
754
85.0k
    subtree(i) = Node;
755
85.0k
    stop(i) = Stop;
756
85.0k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
750
5.62k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
5.62k
    assert(Size < N && "branch node overflow");
752
5.62k
    assert(i <= Size && "Bad insert position");
753
5.62k
    this->shift(i, Size);
754
5.62k
    subtree(i) = Node;
755
5.62k
    stop(i) = Stop;
756
5.62k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
750
549
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
549
    assert(Size < N && "branch node overflow");
752
549
    assert(i <= Size && "Bad insert position");
753
549
    this->shift(i, Size);
754
549
    subtree(i) = Node;
755
549
    stop(i) = Stop;
756
549
  }
757
};
758
759
//===----------------------------------------------------------------------===//
760
//---                         IntervalMapImpl::Path                        ---//
761
//===----------------------------------------------------------------------===//
762
//
763
// A Path is used by iterators to represent a position in a B+-tree, and the
764
// path to get there from the root.
765
//
766
// The Path class also contains the tree navigation code that doesn't have to
767
// be templatized.
768
//
769
//===----------------------------------------------------------------------===//
770
771
class Path {
772
  /// Entry - Each step in the path is a node pointer and an offset into that
773
  /// node.
774
0
  struct Entry {
775
    void *node;
776
    unsigned size;
777
    unsigned offset;
778
779
    Entry(void *Node, unsigned Size, unsigned Offset)
780
152M
      : node(Node), size(Size), offset(Offset) {}
781
782
    Entry(NodeRef Node, unsigned Offset)
783
39.5M
      : node(&Node.subtree(0)), size(Node.size()), offset(Offset) {}
784
785
46.2M
    NodeRef &subtree(unsigned i) const {
786
46.2M
      return reinterpret_cast<NodeRef*>(node)[i];
787
46.2M
    }
788
  };
789
790
  /// path - The path entries, path[0] is the root node, path.back() is a leaf.
791
  SmallVector<Entry, 4> path;
792
793
public:
794
  // Node accessors.
795
5.73M
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
5.73M
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
5.73M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
795
1.34M
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
1.34M
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
1.34M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
795
16
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
16
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
16
  }
Unexecuted instantiation: llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
795
3.15M
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
3.15M
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
3.15M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
795
1.06M
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
1.06M
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
1.06M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
795
10.9k
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
10.9k
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
10.9k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
795
133k
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
133k
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
133k
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
795
25.6k
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
25.6k
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
25.6k
  }
798
1.38M
  unsigned size(unsigned Level) const { return path[Level].size; }
799
0
  unsigned offset(unsigned Level) const { return path[Level].offset; }
800
10.4M
  unsigned &offset(unsigned Level) { return path[Level].offset; }
801
802
  // Leaf accessors.
803
697M
  template <typename NodeT> NodeT &leaf() const {
804
697M
    return *reinterpret_cast<NodeT*>(path.back().node);
805
697M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
803
694M
  template <typename NodeT> NodeT &leaf() const {
804
694M
    return *reinterpret_cast<NodeT*>(path.back().node);
805
694M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
803
465
  template <typename NodeT> NodeT &leaf() const {
804
465
    return *reinterpret_cast<NodeT*>(path.back().node);
805
465
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
803
11.0k
  template <typename NodeT> NodeT &leaf() const {
804
11.0k
    return *reinterpret_cast<NodeT*>(path.back().node);
805
11.0k
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
803
3.49M
  template <typename NodeT> NodeT &leaf() const {
804
3.49M
    return *reinterpret_cast<NodeT*>(path.back().node);
805
3.49M
  }
806
56.9M
  unsigned leafSize() const { return path.back().size; }
807
672M
  unsigned leafOffset() const { return path.back().offset; }
808
112M
  unsigned &leafOffset() { return path.back().offset; }
809
810
  /// valid - Return true if path is at a valid node, not at end().
811
388M
  bool valid() const {
812
388M
    return !path.empty() && path.front().offset < path.front().size;
813
388M
  }
814
815
  /// height - Return the height of the tree corresponding to this path.
816
  /// This matches map->height in a full path.
817
69.5M
  unsigned height() const { return path.size() - 1; }
818
819
  /// subtree - Get the subtree referenced from Level. When the path is
820
  /// consistent, node(Level + 1) == subtree(Level).
821
  /// @param Level 0..height-1. The leaves have no subtrees.
822
44.5M
  NodeRef &subtree(unsigned Level) const {
823
44.5M
    return path[Level].subtree(path[Level].offset);
824
44.5M
  }
825
826
  /// reset - Reset cached information about node(Level) from subtree(Level -1).
827
  /// @param Level 1..height. THe node to update after parent node changed.
828
406k
  void reset(unsigned Level) {
829
406k
    path[Level] = Entry(subtree(Level - 1), offset(Level));
830
406k
  }
831
832
  /// push - Add entry to path.
833
  /// @param Node Node to add, should be subtree(path.size()-1).
834
  /// @param Offset Offset into Node.
835
31.6M
  void push(NodeRef Node, unsigned Offset) {
836
31.6M
    path.push_back(Entry(Node, Offset));
837
31.6M
  }
838
839
  /// pop - Remove the last path entry.
840
2.40M
  void pop() {
841
2.40M
    path.pop_back();
842
2.40M
  }
843
844
  /// setSize - Set the size of a node both in the path and in the tree.
845
  /// @param Level 0..height. Note that setting the root size won't change
846
  ///              map->rootSize.
847
  /// @param Size New node size.
848
20.2M
  void setSize(unsigned Level, unsigned Size) {
849
20.2M
    path[Level].size = Size;
850
20.2M
    if (Level)
851
8.04M
      subtree(Level - 1).setSize(Size);
852
20.2M
  }
853
854
  /// setRoot - Clear the path and set a new root node.
855
  /// @param Node New root node.
856
  /// @param Size New root size.
857
  /// @param Offset Offset into root node.
858
151M
  void setRoot(void *Node, unsigned Size, unsigned Offset) {
859
151M
    path.clear();
860
151M
    path.push_back(Entry(Node, Size, Offset));
861
151M
  }
862
863
  /// replaceRoot - Replace the current root node with two new entries after the
864
  /// tree height has increased.
865
  /// @param Root The new root node.
866
  /// @param Size Number of entries in the new root.
867
  /// @param Offsets Offsets into the root and first branch nodes.
868
  void replaceRoot(void *Root, unsigned Size, IdxPair Offsets);
869
870
  /// getLeftSibling - Get the left sibling node at Level, or a null NodeRef.
871
  /// @param Level Get the sibling to node(Level).
872
  /// @return Left sibling, or NodeRef().
873
  NodeRef getLeftSibling(unsigned Level) const;
874
875
  /// moveLeft - Move path to the left sibling at Level. Leave nodes below Level
876
  /// unaltered.
877
  /// @param Level Move node(Level).
878
  void moveLeft(unsigned Level);
879
880
  /// fillLeft - Grow path to Height by taking leftmost branches.
881
  /// @param Height The target height.
882
13.0k
  void fillLeft(unsigned Height) {
883
26.1k
    while (height() < Height)
884
13.1k
      push(subtree(height()), 0);
885
13.0k
  }
886
887
  /// getLeftSibling - Get the left sibling node at Level, or a null NodeRef.
888
  /// @param Level Get the sinbling to node(Level).
889
  /// @return Left sibling, or NodeRef().
890
  NodeRef getRightSibling(unsigned Level) const;
891
892
  /// moveRight - Move path to the left sibling at Level. Leave nodes below
893
  /// Level unaltered.
894
  /// @param Level Move node(Level).
895
  void moveRight(unsigned Level);
896
897
  /// atBegin - Return true if path is at begin().
898
336k
  bool atBegin() const {
899
743k
    for (unsigned i = 0, e = path.size(); i != e; 
++i406k
)
900
571k
      if (path[i].offset != 0)
901
164k
        return false;
902
336k
    
return true172k
;
903
336k
  }
904
905
  /// atLastEntry - Return true if the path is at the last entry of the node at
906
  /// Level.
907
  /// @param Level Node to examine.
908
3.84M
  bool atLastEntry(unsigned Level) const {
909
3.84M
    return path[Level].offset == path[Level].size - 1;
910
3.84M
  }
911
912
  /// legalizeForInsert - Prepare the path for an insertion at Level. When the
913
  /// path is at end(), node(Level) may not be a legal node. legalizeForInsert
914
  /// ensures that node(Level) is real by moving back to the last node at Level,
915
  /// and setting offset(Level) to size(Level) if required.
916
  /// @param Level The level where an insertion is about to take place.
917
1.01M
  void legalizeForInsert(unsigned Level) {
918
1.01M
    if (valid())
919
85.7k
      return;
920
928k
    moveLeft(Level);
921
928k
    ++path[Level].offset;
922
928k
  }
923
};
924
925
} // end namespace IntervalMapImpl
926
927
//===----------------------------------------------------------------------===//
928
//---                          IntervalMap                                ----//
929
//===----------------------------------------------------------------------===//
930
931
template <typename KeyT, typename ValT,
932
          unsigned N = IntervalMapImpl::NodeSizer<KeyT, ValT>::LeafSize,
933
          typename Traits = IntervalMapInfo<KeyT>>
934
class IntervalMap {
935
  using Sizer = IntervalMapImpl::NodeSizer<KeyT, ValT>;
936
  using Leaf = IntervalMapImpl::LeafNode<KeyT, ValT, Sizer::LeafSize, Traits>;
937
  using Branch =
938
      IntervalMapImpl::BranchNode<KeyT, ValT, Sizer::BranchSize, Traits>;
939
  using RootLeaf = IntervalMapImpl::LeafNode<KeyT, ValT, N, Traits>;
940
  using IdxPair = IntervalMapImpl::IdxPair;
941
942
  // The RootLeaf capacity is given as a template parameter. We must compute the
943
  // corresponding RootBranch capacity.
944
  enum {
945
    DesiredRootBranchCap = (sizeof(RootLeaf) - sizeof(KeyT)) /
946
      (sizeof(KeyT) + sizeof(IntervalMapImpl::NodeRef)),
947
    RootBranchCap = DesiredRootBranchCap ? DesiredRootBranchCap : 1
948
  };
949
950
  using RootBranch =
951
      IntervalMapImpl::BranchNode<KeyT, ValT, RootBranchCap, Traits>;
952
953
  // When branched, we store a global start key as well as the branch node.
954
  struct RootBranchData {
955
    KeyT start;
956
    RootBranch node;
957
  };
958
959
public:
960
  using Allocator = typename Sizer::Allocator;
961
  using KeyType = KeyT;
962
  using ValueType = ValT;
963
  using KeyTraits = Traits;
964
965
private:
966
  // The root data is either a RootLeaf or a RootBranchData instance.
967
  AlignedCharArrayUnion<RootLeaf, RootBranchData> data;
968
969
  // Tree height.
970
  // 0: Leaves in root.
971
  // 1: Root points to leaf.
972
  // 2: root->branch->leaf ...
973
  unsigned height;
974
975
  // Number of entries in the root node.
976
  unsigned rootSize;
977
978
  // Allocator used for creating external nodes.
979
  Allocator &allocator;
980
981
  /// Represent data as a node type without breaking aliasing rules.
982
  template <typename T>
983
347M
  T &dataAs() const {
984
347M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
347M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData& llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData>() const
Line
Count
Source
983
64.7M
  T &dataAs() const {
984
64.7M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
64.7M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
983
273M
  T &dataAs() const {
984
273M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
273M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
983
8.52k
  T &dataAs() const {
984
8.52k
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
8.52k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData& llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData>() const
Line
Count
Source
983
172
  T &dataAs() const {
984
172
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
172
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData& llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData>() const
Line
Count
Source
983
2.26M
  T &dataAs() const {
984
2.26M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
2.26M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
983
7.02M
  T &dataAs() const {
984
7.02M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
7.02M
  }
986
987
2.78M
  const RootLeaf &rootLeaf() const {
988
2.78M
    assert(!branched() && "Cannot acces leaf data in branched root");
989
2.78M
    return dataAs<RootLeaf>();
990
2.78M
  }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf() const
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf() const
Line
Count
Source
987
2.78M
  const RootLeaf &rootLeaf() const {
988
2.78M
    assert(!branched() && "Cannot acces leaf data in branched root");
989
2.78M
    return dataAs<RootLeaf>();
990
2.78M
  }
991
277M
  RootLeaf &rootLeaf() {
992
277M
    assert(!branched() && "Cannot acces leaf data in branched root");
993
277M
    return dataAs<RootLeaf>();
994
277M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf()
Line
Count
Source
991
273M
  RootLeaf &rootLeaf() {
992
273M
    assert(!branched() && "Cannot acces leaf data in branched root");
993
273M
    return dataAs<RootLeaf>();
994
273M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf()
Line
Count
Source
991
8.52k
  RootLeaf &rootLeaf() {
992
8.52k
    assert(!branched() && "Cannot acces leaf data in branched root");
993
8.52k
    return dataAs<RootLeaf>();
994
8.52k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf()
Line
Count
Source
991
4.24M
  RootLeaf &rootLeaf() {
992
4.24M
    assert(!branched() && "Cannot acces leaf data in branched root");
993
4.24M
    return dataAs<RootLeaf>();
994
4.24M
  }
995
996
819k
  RootBranchData &rootBranchData() const {
997
819k
    assert(branched() && "Cannot access branch data in non-branched root");
998
819k
    return dataAs<RootBranchData>();
999
819k
  }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData() const
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData() const
Line
Count
Source
996
819k
  RootBranchData &rootBranchData() const {
997
819k
    assert(branched() && "Cannot access branch data in non-branched root");
998
819k
    return dataAs<RootBranchData>();
999
819k
  }
1000
66.2M
  RootBranchData &rootBranchData() {
1001
66.2M
    assert(branched() && "Cannot access branch data in non-branched root");
1002
66.2M
    return dataAs<RootBranchData>();
1003
66.2M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData()
Line
Count
Source
1000
64.7M
  RootBranchData &rootBranchData() {
1001
64.7M
    assert(branched() && "Cannot access branch data in non-branched root");
1002
64.7M
    return dataAs<RootBranchData>();
1003
64.7M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData()
Line
Count
Source
1000
172
  RootBranchData &rootBranchData() {
1001
172
    assert(branched() && "Cannot access branch data in non-branched root");
1002
172
    return dataAs<RootBranchData>();
1003
172
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData()
Line
Count
Source
1000
1.44M
  RootBranchData &rootBranchData() {
1001
1.44M
    assert(branched() && "Cannot access branch data in non-branched root");
1002
1.44M
    return dataAs<RootBranchData>();
1003
1.44M
  }
1004
1005
543k
  const RootBranch &rootBranch() const { return rootBranchData().node; }
1006
65.0M
  RootBranch &rootBranch()             { return rootBranchData().node; }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranch()
Line
Count
Source
1006
63.6M
  RootBranch &rootBranch()             { return rootBranchData().node; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranch()
Line
Count
Source
1006
157
  RootBranch &rootBranch()             { return rootBranchData().node; }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranch()
Line
Count
Source
1006
1.40M
  RootBranch &rootBranch()             { return rootBranchData().node; }
1007
275k
  KeyT rootBranchStart() const { return rootBranchData().start; }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart() const
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart() const
Line
Count
Source
1007
275k
  KeyT rootBranchStart() const { return rootBranchData().start; }
1008
581k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart()
Line
Count
Source
1008
5
  KeyT &rootBranchStart()      { return rootBranchData().start; }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart()
Line
Count
Source
1008
567k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart()
Line
Count
Source
1008
13.6k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
1009
1010
1.02M
  template <typename NodeT> NodeT *newNode() {
1011
1.02M
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
1.02M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
Line
Count
Source
1010
5
  template <typename NodeT> NodeT *newNode() {
1011
5
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
5
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
Line
Count
Source
1010
972k
  template <typename NodeT> NodeT *newNode() {
1011
972k
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
972k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
Line
Count
Source
1010
16.5k
  template <typename NodeT> NodeT *newNode() {
1011
16.5k
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
16.5k
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
Line
Count
Source
1010
32.1k
  template <typename NodeT> NodeT *newNode() {
1011
32.1k
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
32.1k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
Line
Count
Source
1010
139
  template <typename NodeT> NodeT *newNode() {
1011
139
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
139
  }
1013
1014
1.02M
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
1.02M
    P->~NodeT();
1016
1.02M
    allocator.Deallocate(P);
1017
1.02M
  }
Unexecuted instantiation: void llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
void llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
Line
Count
Source
1014
5
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
5
    P->~NodeT();
1016
5
    allocator.Deallocate(P);
1017
5
  }
void llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
Line
Count
Source
1014
16.5k
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
16.5k
    P->~NodeT();
1016
16.5k
    allocator.Deallocate(P);
1017
16.5k
  }
void llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
Line
Count
Source
1014
972k
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
972k
    P->~NodeT();
1016
972k
    allocator.Deallocate(P);
1017
972k
  }
void llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
Line
Count
Source
1014
139
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
139
    P->~NodeT();
1016
139
    allocator.Deallocate(P);
1017
139
  }
void llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
Line
Count
Source
1014
32.1k
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
32.1k
    P->~NodeT();
1016
32.1k
    allocator.Deallocate(P);
1017
32.1k
  }
1018
1019
  IdxPair branchRoot(unsigned Position);
1020
  IdxPair splitRoot(unsigned Position);
1021
1022
315k
  void switchRootToBranch() {
1023
315k
    rootLeaf().~RootLeaf();
1024
315k
    height = 1;
1025
315k
    new (&rootBranchData()) RootBranchData();
1026
315k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToBranch()
Line
Count
Source
1022
5
  void switchRootToBranch() {
1023
5
    rootLeaf().~RootLeaf();
1024
5
    height = 1;
1025
5
    new (&rootBranchData()) RootBranchData();
1026
5
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToBranch()
Line
Count
Source
1022
302k
  void switchRootToBranch() {
1023
302k
    rootLeaf().~RootLeaf();
1024
302k
    height = 1;
1025
302k
    new (&rootBranchData()) RootBranchData();
1026
302k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToBranch()
Line
Count
Source
1022
13.0k
  void switchRootToBranch() {
1023
13.0k
    rootLeaf().~RootLeaf();
1024
13.0k
    height = 1;
1025
13.0k
    new (&rootBranchData()) RootBranchData();
1026
13.0k
  }
1027
1028
315k
  void switchRootToLeaf() {
1029
315k
    rootBranchData().~RootBranchData();
1030
315k
    height = 0;
1031
315k
    new(&rootLeaf()) RootLeaf();
1032
315k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToLeaf()
Line
Count
Source
1028
5
  void switchRootToLeaf() {
1029
5
    rootBranchData().~RootBranchData();
1030
5
    height = 0;
1031
5
    new(&rootLeaf()) RootLeaf();
1032
5
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToLeaf()
Line
Count
Source
1028
302k
  void switchRootToLeaf() {
1029
302k
    rootBranchData().~RootBranchData();
1030
302k
    height = 0;
1031
302k
    new(&rootLeaf()) RootLeaf();
1032
302k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToLeaf()
Line
Count
Source
1028
13.0k
  void switchRootToLeaf() {
1029
13.0k
    rootBranchData().~RootBranchData();
1030
13.0k
    height = 0;
1031
13.0k
    new(&rootLeaf()) RootLeaf();
1032
13.0k
  }
1033
1034
1.10G
  bool branched() const { return height > 0; }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branched() const
Line
Count
Source
1034
1.09G
  bool branched() const { return height > 0; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branched() const
Line
Count
Source
1034
24.0k
  bool branched() const { return height > 0; }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branched() const
Line
Count
Source
1034
11.6M
  bool branched() const { return height > 0; }
1035
1036
  ValT treeSafeLookup(KeyT x, ValT NotFound) const;
1037
  void visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef,
1038
                  unsigned Level));
1039
  void deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level);
1040
1041
public:
1042
5.41M
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1043
5.41M
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1044
5.41M
           "Insufficient alignment");
1045
5.41M
    new(&rootLeaf()) RootLeaf();
1046
5.41M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::IntervalMap(llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, char, 192ul, 64ul>&)
Line
Count
Source
1042
545
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1043
545
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1044
545
           "Insufficient alignment");
1045
545
    new(&rootLeaf()) RootLeaf();
1046
545
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::IntervalMap(llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, char, 192ul, 64ul>&)
Line
Count
Source
1042
4.96M
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1043
4.96M
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1044
4.96M
           "Insufficient alignment");
1045
4.96M
    new(&rootLeaf()) RootLeaf();
1046
4.96M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::IntervalMap(llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, char, 192ul, 64ul>&)
Line
Count
Source
1042
456k
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1043
456k
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1044
456k
           "Insufficient alignment");
1045
456k
    new(&rootLeaf()) RootLeaf();
1046
456k
  }
1047
1048
5.41M
  ~IntervalMap() {
1049
5.41M
    clear();
1050
5.41M
    rootLeaf().~RootLeaf();
1051
5.41M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::~IntervalMap()
Line
Count
Source
1048
545
  ~IntervalMap() {
1049
545
    clear();
1050
545
    rootLeaf().~RootLeaf();
1051
545
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::~IntervalMap()
Line
Count
Source
1048
4.95M
  ~IntervalMap() {
1049
4.95M
    clear();
1050
4.95M
    rootLeaf().~RootLeaf();
1051
4.95M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::~IntervalMap()
Line
Count
Source
1048
456k
  ~IntervalMap() {
1049
456k
    clear();
1050
456k
    rootLeaf().~RootLeaf();
1051
456k
  }
1052
1053
  /// empty -  Return true when no intervals are mapped.
1054
133M
  bool empty() const {
1055
133M
    return rootSize == 0;
1056
133M
  }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::empty() const
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::empty() const
Line
Count
Source
1054
131M
  bool empty() const {
1055
131M
    return rootSize == 0;
1056
131M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::empty() const
Line
Count
Source
1054
1.31M
  bool empty() const {
1055
1.31M
    return rootSize == 0;
1056
1.31M
  }
1057
1058
  /// start - Return the smallest mapped key in a non-empty map.
1059
1.30M
  KeyT start() const {
1060
1.30M
    assert(!empty() && "Empty IntervalMap has no start");
1061
1.30M
    return !branched() ? 
rootLeaf().start(0)1.03M
:
rootBranchStart()275k
;
1062
1.30M
  }
1063
1064
  /// stop - Return the largest mapped key in a non-empty map.
1065
1.21M
  KeyT stop() const {
1066
1.21M
    assert(!empty() && "Empty IntervalMap has no stop");
1067
1.21M
    return !branched() ? 
rootLeaf().stop(rootSize - 1)942k
:
1068
1.21M
                         
rootBranch().stop(rootSize - 1)272k
;
1069
1.21M
  }
1070
1071
  /// lookup - Return the mapped value at x or NotFound.
1072
1.30M
  ValT lookup(KeyT x, ValT NotFound = ValT()) const {
1073
1.30M
    if (empty() || Traits::startLess(x, start()) || 
Traits::stopLess(stop(), x)1.21M
)
1074
233k
      return NotFound;
1075
1.07M
    return branched() ? 
treeSafeLookup(x, NotFound)270k
:
1076
1.07M
                        
rootLeaf().safeLookup(x, NotFound)804k
;
1077
1.07M
  }
1078
1079
  /// insert - Add a mapping of [a;b] to y, coalesce with adjacent intervals.
1080
  /// It is assumed that no key in the interval is mapped to another value, but
1081
  /// overlapping intervals already mapped to y will be coalesced.
1082
1.99M
  void insert(KeyT a, KeyT b, ValT y) {
1083
1.99M
    if (branched() || 
rootSize == RootLeaf::Capacity1.38M
)
1084
657k
      return find(a).insert(a, b, y);
1085
1.33M
1086
1.33M
    // Easy insert into root leaf.
1087
1.33M
    unsigned p = rootLeaf().findFrom(0, rootSize, a);
1088
1.33M
    rootSize = rootLeaf().insertFrom(p, rootSize, a, b, y);
1089
1.33M
  }
1090
1091
  /// clear - Remove all entries.
1092
  void clear();
1093
1094
  class const_iterator;
1095
  class iterator;
1096
  friend class const_iterator;
1097
  friend class iterator;
1098
1099
0
  const_iterator begin() const {
1100
0
    const_iterator I(*this);
1101
0
    I.goToBegin();
1102
0
    return I;
1103
0
  }
1104
1105
137k
  iterator begin() {
1106
137k
    iterator I(*this);
1107
137k
    I.goToBegin();
1108
137k
    return I;
1109
137k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::begin()
Line
Count
Source
1105
2.15k
  iterator begin() {
1106
2.15k
    iterator I(*this);
1107
2.15k
    I.goToBegin();
1108
2.15k
    return I;
1109
2.15k
  }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::begin()
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::begin()
Line
Count
Source
1105
135k
  iterator begin() {
1106
135k
    iterator I(*this);
1107
135k
    I.goToBegin();
1108
135k
    return I;
1109
135k
  }
1110
1111
  const_iterator end() const {
1112
    const_iterator I(*this);
1113
    I.goToEnd();
1114
    return I;
1115
  }
1116
1117
  iterator end() {
1118
    iterator I(*this);
1119
    I.goToEnd();
1120
    return I;
1121
  }
1122
1123
  /// find - Return an iterator pointing to the first interval ending at or
1124
  /// after x, or end().
1125
0
  const_iterator find(KeyT x) const {
1126
0
    const_iterator I(*this);
1127
0
    I.find(x);
1128
0
    return I;
1129
0
  }
1130
1131
11.4M
  iterator find(KeyT x) {
1132
11.4M
    iterator I(*this);
1133
11.4M
    I.find(x);
1134
11.4M
    return I;
1135
11.4M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::find(llvm::SlotIndex)
Line
Count
Source
1131
1.47k
  iterator find(KeyT x) {
1132
1.47k
    iterator I(*this);
1133
1.47k
    I.find(x);
1134
1.47k
    return I;
1135
1.47k
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::find(llvm::SlotIndex)
Line
Count
Source
1131
10.7M
  iterator find(KeyT x) {
1132
10.7M
    iterator I(*this);
1133
10.7M
    I.find(x);
1134
10.7M
    return I;
1135
10.7M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::find(llvm::SlotIndex)
Line
Count
Source
1131
657k
  iterator find(KeyT x) {
1132
657k
    iterator I(*this);
1133
657k
    I.find(x);
1134
657k
    return I;
1135
657k
  }
1136
};
1137
1138
/// treeSafeLookup - Return the mapped value at x or NotFound, assuming a
1139
/// branched root.
1140
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1141
ValT IntervalMap<KeyT, ValT, N, Traits>::
1142
270k
treeSafeLookup(KeyT x, ValT NotFound) const {
1143
270k
  assert(branched() && "treeLookup assumes a branched root");
1144
270k
1145
270k
  IntervalMapImpl::NodeRef NR = rootBranch().safeLookup(x);
1146
282k
  for (unsigned h = height-1; h; 
--h11.9k
)
1147
11.9k
    NR = NR.get<Branch>().safeLookup(x);
1148
270k
  return NR.get<Leaf>().safeLookup(x, NotFound);
1149
270k
}
1150
1151
// branchRoot - Switch from a leaf root to a branched root.
1152
// Return the new (root offset, node offset) corresponding to Position.
1153
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1154
IntervalMapImpl::IdxPair IntervalMap<KeyT, ValT, N, Traits>::
1155
315k
branchRoot(unsigned Position) {
1156
315k
  using namespace IntervalMapImpl;
1157
315k
  // How many external leaf nodes to hold RootLeaf+1?
1158
315k
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1159
315k
1160
315k
  // Compute element distribution among new nodes.
1161
315k
  unsigned size[Nodes];
1162
315k
  IdxPair NewOffset(0, Position);
1163
315k
1164
315k
  // Is is very common for the root node to be smaller than external nodes.
1165
315k
  if (Nodes == 1)
1166
5
    size[0] = rootSize;
1167
315k
  else
1168
315k
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1169
315k
                           Position, true);
1170
315k
1171
315k
  // Allocate new nodes.
1172
315k
  unsigned pos = 0;
1173
315k
  NodeRef node[Nodes];
1174
946k
  for (unsigned n = 0; n != Nodes; 
++n631k
) {
1175
631k
    Leaf *L = newNode<Leaf>();
1176
631k
    L->copy(rootLeaf(), pos, 0, size[n]);
1177
631k
    node[n] = NodeRef(L, size[n]);
1178
631k
    pos += size[n];
1179
631k
  }
1180
315k
1181
315k
  // Destroy the old leaf node, construct branch node instead.
1182
315k
  switchRootToBranch();
1183
946k
  for (unsigned n = 0; n != Nodes; 
++n631k
) {
1184
631k
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1185
631k
    rootBranch().subtree(n) = node[n];
1186
631k
  }
1187
315k
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1188
315k
  rootSize = Nodes;
1189
315k
  return NewOffset;
1190
315k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branchRoot(unsigned int)
Line
Count
Source
1155
5
branchRoot(unsigned Position) {
1156
5
  using namespace IntervalMapImpl;
1157
5
  // How many external leaf nodes to hold RootLeaf+1?
1158
5
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1159
5
1160
5
  // Compute element distribution among new nodes.
1161
5
  unsigned size[Nodes];
1162
5
  IdxPair NewOffset(0, Position);
1163
5
1164
5
  // Is is very common for the root node to be smaller than external nodes.
1165
5
  if (Nodes == 1)
1166
5
    size[0] = rootSize;
1167
0
  else
1168
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1169
0
                           Position, true);
1170
5
1171
5
  // Allocate new nodes.
1172
5
  unsigned pos = 0;
1173
5
  NodeRef node[Nodes];
1174
10
  for (unsigned n = 0; n != Nodes; 
++n5
) {
1175
5
    Leaf *L = newNode<Leaf>();
1176
5
    L->copy(rootLeaf(), pos, 0, size[n]);
1177
5
    node[n] = NodeRef(L, size[n]);
1178
5
    pos += size[n];
1179
5
  }
1180
5
1181
5
  // Destroy the old leaf node, construct branch node instead.
1182
5
  switchRootToBranch();
1183
10
  for (unsigned n = 0; n != Nodes; 
++n5
) {
1184
5
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1185
5
    rootBranch().subtree(n) = node[n];
1186
5
  }
1187
5
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1188
5
  rootSize = Nodes;
1189
5
  return NewOffset;
1190
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branchRoot(unsigned int)
Line
Count
Source
1155
302k
branchRoot(unsigned Position) {
1156
302k
  using namespace IntervalMapImpl;
1157
302k
  // How many external leaf nodes to hold RootLeaf+1?
1158
302k
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1159
302k
1160
302k
  // Compute element distribution among new nodes.
1161
302k
  unsigned size[Nodes];
1162
302k
  IdxPair NewOffset(0, Position);
1163
302k
1164
302k
  // Is is very common for the root node to be smaller than external nodes.
1165
302k
  if (Nodes == 1)
1166
0
    size[0] = rootSize;
1167
302k
  else
1168
302k
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1169
302k
                           Position, true);
1170
302k
1171
302k
  // Allocate new nodes.
1172
302k
  unsigned pos = 0;
1173
302k
  NodeRef node[Nodes];
1174
907k
  for (unsigned n = 0; n != Nodes; 
++n605k
) {
1175
605k
    Leaf *L = newNode<Leaf>();
1176
605k
    L->copy(rootLeaf(), pos, 0, size[n]);
1177
605k
    node[n] = NodeRef(L, size[n]);
1178
605k
    pos += size[n];
1179
605k
  }
1180
302k
1181
302k
  // Destroy the old leaf node, construct branch node instead.
1182
302k
  switchRootToBranch();
1183
907k
  for (unsigned n = 0; n != Nodes; 
++n605k
) {
1184
605k
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1185
605k
    rootBranch().subtree(n) = node[n];
1186
605k
  }
1187
302k
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1188
302k
  rootSize = Nodes;
1189
302k
  return NewOffset;
1190
302k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branchRoot(unsigned int)
Line
Count
Source
1155
13.0k
branchRoot(unsigned Position) {
1156
13.0k
  using namespace IntervalMapImpl;
1157
13.0k
  // How many external leaf nodes to hold RootLeaf+1?
1158
13.0k
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1159
13.0k
1160
13.0k
  // Compute element distribution among new nodes.
1161
13.0k
  unsigned size[Nodes];
1162
13.0k
  IdxPair NewOffset(0, Position);
1163
13.0k
1164
13.0k
  // Is is very common for the root node to be smaller than external nodes.
1165
13.0k
  if (Nodes == 1)
1166
0
    size[0] = rootSize;
1167
13.0k
  else
1168
13.0k
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1169
13.0k
                           Position, true);
1170
13.0k
1171
13.0k
  // Allocate new nodes.
1172
13.0k
  unsigned pos = 0;
1173
13.0k
  NodeRef node[Nodes];
1174
39.0k
  for (unsigned n = 0; n != Nodes; 
++n26.0k
) {
1175
26.0k
    Leaf *L = newNode<Leaf>();
1176
26.0k
    L->copy(rootLeaf(), pos, 0, size[n]);
1177
26.0k
    node[n] = NodeRef(L, size[n]);
1178
26.0k
    pos += size[n];
1179
26.0k
  }
1180
13.0k
1181
13.0k
  // Destroy the old leaf node, construct branch node instead.
1182
13.0k
  switchRootToBranch();
1183
39.0k
  for (unsigned n = 0; n != Nodes; 
++n26.0k
) {
1184
26.0k
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1185
26.0k
    rootBranch().subtree(n) = node[n];
1186
26.0k
  }
1187
13.0k
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1188
13.0k
  rootSize = Nodes;
1189
13.0k
  return NewOffset;
1190
13.0k
}
1191
1192
// splitRoot - Split the current BranchRoot into multiple Branch nodes.
1193
// Return the new (root offset, node offset) corresponding to Position.
1194
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1195
IntervalMapImpl::IdxPair IntervalMap<KeyT, ValT, N, Traits>::
1196
6.57k
splitRoot(unsigned Position) {
1197
6.57k
  using namespace IntervalMapImpl;
1198
6.57k
  // How many external leaf nodes to hold RootBranch+1?
1199
6.57k
  const unsigned Nodes = RootBranch::Capacity / Branch::Capacity + 1;
1200
6.57k
1201
6.57k
  // Compute element distribution among new nodes.
1202
6.57k
  unsigned Size[Nodes];
1203
6.57k
  IdxPair NewOffset(0, Position);
1204
6.57k
1205
6.57k
  // Is is very common for the root node to be smaller than external nodes.
1206
6.57k
  if (Nodes == 1)
1207
6.57k
    Size[0] = rootSize;
1208
0
  else
1209
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, Size,
1210
0
                           Position, true);
1211
6.57k
1212
6.57k
  // Allocate new nodes.
1213
6.57k
  unsigned Pos = 0;
1214
6.57k
  NodeRef Node[Nodes];
1215
13.1k
  for (unsigned n = 0; n != Nodes; 
++n6.57k
) {
1216
6.57k
    Branch *B = newNode<Branch>();
1217
6.57k
    B->copy(rootBranch(), Pos, 0, Size[n]);
1218
6.57k
    Node[n] = NodeRef(B, Size[n]);
1219
6.57k
    Pos += Size[n];
1220
6.57k
  }
1221
6.57k
1222
13.1k
  for (unsigned n = 0; n != Nodes; 
++n6.57k
) {
1223
6.57k
    rootBranch().stop(n) = Node[n].template get<Branch>().stop(Size[n]-1);
1224
6.57k
    rootBranch().subtree(n) = Node[n];
1225
6.57k
  }
1226
6.57k
  rootSize = Nodes;
1227
6.57k
  ++height;
1228
6.57k
  return NewOffset;
1229
6.57k
}
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::splitRoot(unsigned int)
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::splitRoot(unsigned int)
Line
Count
Source
1196
6.50k
splitRoot(unsigned Position) {
1197
6.50k
  using namespace IntervalMapImpl;
1198
6.50k
  // How many external leaf nodes to hold RootBranch+1?
1199
6.50k
  const unsigned Nodes = RootBranch::Capacity / Branch::Capacity + 1;
1200
6.50k
1201
6.50k
  // Compute element distribution among new nodes.
1202
6.50k
  unsigned Size[Nodes];
1203
6.50k
  IdxPair NewOffset(0, Position);
1204
6.50k
1205
6.50k
  // Is is very common for the root node to be smaller than external nodes.
1206
6.50k
  if (Nodes == 1)
1207
6.50k
    Size[0] = rootSize;
1208
0
  else
1209
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, Size,
1210
0
                           Position, true);
1211
6.50k
1212
6.50k
  // Allocate new nodes.
1213
6.50k
  unsigned Pos = 0;
1214
6.50k
  NodeRef Node[Nodes];
1215
13.0k
  for (unsigned n = 0; n != Nodes; 
++n6.50k
) {
1216
6.50k
    Branch *B = newNode<Branch>();
1217
6.50k
    B->copy(rootBranch(), Pos, 0, Size[n]);
1218
6.50k
    Node[n] = NodeRef(B, Size[n]);
1219
6.50k
    Pos += Size[n];
1220
6.50k
  }
1221
6.50k
1222
13.0k
  for (unsigned n = 0; n != Nodes; 
++n6.50k
) {
1223
6.50k
    rootBranch().stop(n) = Node[n].template get<Branch>().stop(Size[n]-1);
1224
6.50k
    rootBranch().subtree(n) = Node[n];
1225
6.50k
  }
1226
6.50k
  rootSize = Nodes;
1227
6.50k
  ++height;
1228
6.50k
  return NewOffset;
1229
6.50k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::splitRoot(unsigned int)
Line
Count
Source
1196
70
splitRoot(unsigned Position) {
1197
70
  using namespace IntervalMapImpl;
1198
70
  // How many external leaf nodes to hold RootBranch+1?
1199
70
  const unsigned Nodes = RootBranch::Capacity / Branch::Capacity + 1;
1200
70
1201
70
  // Compute element distribution among new nodes.
1202
70
  unsigned Size[Nodes];
1203
70
  IdxPair NewOffset(0, Position);
1204
70
1205
70
  // Is is very common for the root node to be smaller than external nodes.
1206
70
  if (Nodes == 1)
1207
70
    Size[0] = rootSize;
1208
0
  else
1209
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, Size,
1210
0
                           Position, true);
1211
70
1212
70
  // Allocate new nodes.
1213
70
  unsigned Pos = 0;
1214
70
  NodeRef Node[Nodes];
1215
140
  for (unsigned n = 0; n != Nodes; 
++n70
) {
1216
70
    Branch *B = newNode<Branch>();
1217
70
    B->copy(rootBranch(), Pos, 0, Size[n]);
1218
70
    Node[n] = NodeRef(B, Size[n]);
1219
70
    Pos += Size[n];
1220
70
  }
1221
70
1222
140
  for (unsigned n = 0; n != Nodes; 
++n70
) {
1223
70
    rootBranch().stop(n) = Node[n].template get<Branch>().stop(Size[n]-1);
1224
70
    rootBranch().subtree(n) = Node[n];
1225
70
  }
1226
70
  rootSize = Nodes;
1227
70
  ++height;
1228
70
  return NewOffset;
1229
70
}
1230
1231
/// visitNodes - Visit each external node.
1232
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1233
void IntervalMap<KeyT, ValT, N, Traits>::
1234
305k
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1235
305k
  if (!branched())
1236
0
    return;
1237
305k
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1238
305k
1239
305k
  // Collect level 0 nodes from the root.
1240
1.13M
  for (unsigned i = 0; i != rootSize; 
++i831k
)
1241
831k
    Refs.push_back(rootBranch().subtree(i));
1242
305k
1243
305k
  // Visit all branch nodes.
1244
312k
  for (unsigned h = height - 1; h; 
--h6.51k
) {
1245
22.9k
    for (unsigned i = 0, e = Refs.size(); i != e; 
++i16.4k
) {
1246
171k
      for (unsigned j = 0, s = Refs[i].size(); j != s; 
++j155k
)
1247
155k
        NextRefs.push_back(Refs[i].subtree(j));
1248
16.4k
      (this->*f)(Refs[i], h);
1249
16.4k
    }
1250
6.51k
    Refs.clear();
1251
6.51k
    Refs.swap(NextRefs);
1252
6.51k
  }
1253
305k
1254
305k
  // Visit all leaf nodes.
1255
1.27M
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i970k
)
1256
970k
    (this->*f)(Refs[i], 0);
1257
305k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::visitNodes(void (llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::*)(llvm::IntervalMapImpl::NodeRef, unsigned int))
Line
Count
Source
1234
5
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1235
5
  if (!branched())
1236
0
    return;
1237
5
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1238
5
1239
5
  // Collect level 0 nodes from the root.
1240
10
  for (unsigned i = 0; i != rootSize; 
++i5
)
1241
5
    Refs.push_back(rootBranch().subtree(i));
1242
5
1243
5
  // Visit all branch nodes.
1244
5
  for (unsigned h = height - 1; h; 
--h0
) {
1245
0
    for (unsigned i = 0, e = Refs.size(); i != e; ++i) {
1246
0
      for (unsigned j = 0, s = Refs[i].size(); j != s; ++j)
1247
0
        NextRefs.push_back(Refs[i].subtree(j));
1248
0
      (this->*f)(Refs[i], h);
1249
0
    }
1250
0
    Refs.clear();
1251
0
    Refs.swap(NextRefs);
1252
0
  }
1253
5
1254
5
  // Visit all leaf nodes.
1255
10
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i5
)
1256
5
    (this->*f)(Refs[i], 0);
1257
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::visitNodes(void (llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::*)(llvm::IntervalMapImpl::NodeRef, unsigned int))
Line
Count
Source
1234
292k
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1235
292k
  if (!branched())
1236
0
    return;
1237
292k
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1238
292k
1239
292k
  // Collect level 0 nodes from the root.
1240
1.09M
  for (unsigned i = 0; i != rootSize; 
++i801k
)
1241
801k
    Refs.push_back(rootBranch().subtree(i));
1242
292k
1243
292k
  // Visit all branch nodes.
1244
298k
  for (unsigned h = height - 1; h; 
--h6.44k
) {
1245
22.7k
    for (unsigned i = 0, e = Refs.size(); i != e; 
++i16.3k
) {
1246
170k
      for (unsigned j = 0, s = Refs[i].size(); j != s; 
++j154k
)
1247
154k
        NextRefs.push_back(Refs[i].subtree(j));
1248
16.3k
      (this->*f)(Refs[i], h);
1249
16.3k
    }
1250
6.44k
    Refs.clear();
1251
6.44k
    Refs.swap(NextRefs);
1252
6.44k
  }
1253
292k
1254
292k
  // Visit all leaf nodes.
1255
1.23M
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i939k
)
1256
939k
    (this->*f)(Refs[i], 0);
1257
292k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::visitNodes(void (llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::*)(llvm::IntervalMapImpl::NodeRef, unsigned int))
Line
Count
Source
1234
13.0k
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1235
13.0k
  if (!branched())
1236
0
    return;
1237
13.0k
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1238
13.0k
1239
13.0k
  // Collect level 0 nodes from the root.
1240
42.8k
  for (unsigned i = 0; i != rootSize; 
++i29.8k
)
1241
29.8k
    Refs.push_back(rootBranch().subtree(i));
1242
13.0k
1243
13.0k
  // Visit all branch nodes.
1244
13.0k
  for (unsigned h = height - 1; h; 
--h70
) {
1245
205
    for (unsigned i = 0, e = Refs.size(); i != e; 
++i135
) {
1246
1.21k
      for (unsigned j = 0, s = Refs[i].size(); j != s; 
++j1.08k
)
1247
1.08k
        NextRefs.push_back(Refs[i].subtree(j));
1248
135
      (this->*f)(Refs[i], h);
1249
135
    }
1250
70
    Refs.clear();
1251
70
    Refs.swap(NextRefs);
1252
70
  }
1253
13.0k
1254
13.0k
  // Visit all leaf nodes.
1255
43.8k
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i30.8k
)
1256
30.8k
    (this->*f)(Refs[i], 0);
1257
13.0k
}
1258
1259
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1260
void IntervalMap<KeyT, ValT, N, Traits>::
1261
986k
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1262
986k
  if (Level)
1263
16.4k
    deleteNode(&Node.get<Branch>());
1264
970k
  else
1265
970k
    deleteNode(&Node.get<Leaf>());
1266
986k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1261
5
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1262
5
  if (Level)
1263
0
    deleteNode(&Node.get<Branch>());
1264
5
  else
1265
5
    deleteNode(&Node.get<Leaf>());
1266
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1261
955k
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1262
955k
  if (Level)
1263
16.3k
    deleteNode(&Node.get<Branch>());
1264
939k
  else
1265
939k
    deleteNode(&Node.get<Leaf>());
1266
955k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1261
30.9k
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1262
30.9k
  if (Level)
1263
135
    deleteNode(&Node.get<Branch>());
1264
30.8k
  else
1265
30.8k
    deleteNode(&Node.get<Leaf>());
1266
30.9k
}
1267
1268
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1269
void IntervalMap<KeyT, ValT, N, Traits>::
1270
74.8M
clear() {
1271
74.8M
  if (branched()) {
1272
305k
    visitNodes(&IntervalMap::deleteNode);
1273
305k
    switchRootToLeaf();
1274
305k
  }
1275
74.8M
  rootSize = 0;
1276
74.8M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::clear()
Line
Count
Source
1270
545
clear() {
1271
545
  if (branched()) {
1272
5
    visitNodes(&IntervalMap::deleteNode);
1273
5
    switchRootToLeaf();
1274
5
  }
1275
545
  rootSize = 0;
1276
545
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::clear()
Line
Count
Source
1270
74.0M
clear() {
1271
74.0M
  if (branched()) {
1272
292k
    visitNodes(&IntervalMap::deleteNode);
1273
292k
    switchRootToLeaf();
1274
292k
  }
1275
74.0M
  rootSize = 0;
1276
74.0M
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::clear()
Line
Count
Source
1270
708k
clear() {
1271
708k
  if (branched()) {
1272
13.0k
    visitNodes(&IntervalMap::deleteNode);
1273
13.0k
    switchRootToLeaf();
1274
13.0k
  }
1275
708k
  rootSize = 0;
1276
708k
}
1277
1278
//===----------------------------------------------------------------------===//
1279
//---                   IntervalMap::const_iterator                       ----//
1280
//===----------------------------------------------------------------------===//
1281
1282
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1283
class IntervalMap<KeyT, ValT, N, Traits>::const_iterator :
1284
  public std::iterator<std::bidirectional_iterator_tag, ValT> {
1285
1286
protected:
1287
  friend class IntervalMap;
1288
1289
  // The map referred to.
1290
  IntervalMap *map = nullptr;
1291
1292
  // We store a full path from the root to the current position.
1293
  // The path may be partially filled, but never between iterator calls.
1294
  IntervalMapImpl::Path path;
1295
1296
  explicit const_iterator(const IntervalMap &map) :
1297
11.5M
    map(const_cast<IntervalMap*>(&map)) {}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator(llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1297
3.63k
    map(const_cast<IntervalMap*>(&map)) {}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator(llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1297
10.7M
    map(const_cast<IntervalMap*>(&map)) {}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator(llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1297
793k
    map(const_cast<IntervalMap*>(&map)) {}
1298
1299
1.02G
  bool branched() const {
1300
1.02G
    assert(map && "Invalid iterator");
1301
1.02G
    return map->branched();
1302
1.02G
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::branched() const
Line
Count
Source
1299
1.01G
  bool branched() const {
1300
1.01G
    assert(map && "Invalid iterator");
1301
1.01G
    return map->branched();
1302
1.01G
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::branched() const
Line
Count
Source
1299
23.4k
  bool branched() const {
1300
23.4k
    assert(map && "Invalid iterator");
1301
23.4k
    return map->branched();
1302
23.4k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::branched() const
Line
Count
Source
1299
5.35M
  bool branched() const {
1300
5.35M
    assert(map && "Invalid iterator");
1301
5.35M
    return map->branched();
1302
5.35M
  }
1303
1304
151M
  void setRoot(unsigned Offset) {
1305
151M
    if (branched())
1306
30.9M
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1307
120M
    else
1308
120M
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1309
151M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1304
150M
  void setRoot(unsigned Offset) {
1305
150M
    if (branched())
1306
30.2M
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1307
120M
    else
1308
120M
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1309
150M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1304
3.67k
  void setRoot(unsigned Offset) {
1305
3.67k
    if (branched())
1306
78
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1307
3.60k
    else
1308
3.60k
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1309
3.67k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1304
852k
  void setRoot(unsigned Offset) {
1305
852k
    if (branched())
1306
657k
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1307
194k
    else
1308
194k
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1309
852k
  }
1310
1311
  void pathFillFind(KeyT x);
1312
  void treeFind(KeyT x);
1313
  void treeAdvanceTo(KeyT x);
1314
1315
  /// unsafeStart - Writable access to start() for iterator.
1316
288M
  KeyT &unsafeStart() const {
1317
288M
    assert(valid() && "Cannot access invalid iterator");
1318
288M
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())80.3M
:
1319
288M
                        
path.leaf<RootLeaf>().start(path.leafOffset())208M
;
1320
288M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStart() const
Line
Count
Source
1316
287M
  KeyT &unsafeStart() const {
1317
287M
    assert(valid() && "Cannot access invalid iterator");
1318
287M
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())79.9M
:
1319
287M
                        
path.leaf<RootLeaf>().start(path.leafOffset())207M
;
1320
287M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStart() const
Line
Count
Source
1316
4.93k
  KeyT &unsafeStart() const {
1317
4.93k
    assert(valid() && "Cannot access invalid iterator");
1318
4.93k
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())168
:
1319
4.93k
                        
path.leaf<RootLeaf>().start(path.leafOffset())4.76k
;
1320
4.93k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStart() const
Line
Count
Source
1316
1.13M
  KeyT &unsafeStart() const {
1317
1.13M
    assert(valid() && "Cannot access invalid iterator");
1318
1.13M
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())366k
:
1319
1.13M
                        
path.leaf<RootLeaf>().start(path.leafOffset())768k
;
1320
1.13M
  }
1321
1322
  /// unsafeStop - Writable access to stop() for iterator.
1323
232M
  KeyT &unsafeStop() const {
1324
232M
    assert(valid() && "Cannot access invalid iterator");
1325
232M
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())49.0M
:
1326
232M
                        
path.leaf<RootLeaf>().stop(path.leafOffset())183M
;
1327
232M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStop() const
Line
Count
Source
1323
231M
  KeyT &unsafeStop() const {
1324
231M
    assert(valid() && "Cannot access invalid iterator");
1325
231M
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())48.7M
:
1326
231M
                        
path.leaf<RootLeaf>().stop(path.leafOffset())183M
;
1327
231M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStop() const
Line
Count
Source
1323
1.63k
  KeyT &unsafeStop() const {
1324
1.63k
    assert(valid() && "Cannot access invalid iterator");
1325
1.63k
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())59
:
1326
1.63k
                        
path.leaf<RootLeaf>().stop(path.leafOffset())1.57k
;
1327
1.63k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStop() const
Line
Count
Source
1323
841k
  KeyT &unsafeStop() const {
1324
841k
    assert(valid() && "Cannot access invalid iterator");
1325
841k
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())258k
:
1326
841k
                        
path.leaf<RootLeaf>().stop(path.leafOffset())582k
;
1327
841k
  }
1328
1329
  /// unsafeValue - Writable access to value() for iterator.
1330
150M
  ValT &unsafeValue() const {
1331
150M
    assert(valid() && "Cannot access invalid iterator");
1332
150M
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())33.9M
:
1333
150M
                        
path.leaf<RootLeaf>().value(path.leafOffset())117M
;
1334
150M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeValue() const
Line
Count
Source
1330
4.87k
  ValT &unsafeValue() const {
1331
4.87k
    assert(valid() && "Cannot access invalid iterator");
1332
4.87k
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())187
:
1333
4.87k
                        
path.leaf<RootLeaf>().value(path.leafOffset())4.68k
;
1334
4.87k
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeValue() const
Line
Count
Source
1330
150M
  ValT &unsafeValue() const {
1331
150M
    assert(valid() && "Cannot access invalid iterator");
1332
150M
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())33.7M
:
1333
150M
                        
path.leaf<RootLeaf>().value(path.leafOffset())116M
;
1334
150M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeValue() const
Line
Count
Source
1330
556k
  ValT &unsafeValue() const {
1331
556k
    assert(valid() && "Cannot access invalid iterator");
1332
556k
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())176k
:
1333
556k
                        
path.leaf<RootLeaf>().value(path.leafOffset())380k
;
1334
556k
  }
1335
1336
public:
1337
  /// const_iterator - Create an iterator that isn't pointing anywhere.
1338
97.5M
  const_iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator()
Line
Count
Source
1338
97.4M
  const_iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator()
Line
Count
Source
1338
15
  const_iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator()
Line
Count
Source
1338
107k
  const_iterator() = default;
1339
1340
  /// setMap - Change the map iterated over. This call must be followed by a
1341
  /// call to goToBegin(), goToEnd(), or find()
1342
129M
  void setMap(const IntervalMap &m) { map = const_cast<IntervalMap*>(&m); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setMap(llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1342
129M
  void setMap(const IntervalMap &m) { map = const_cast<IntervalMap*>(&m); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setMap(llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1342
15
  void setMap(const IntervalMap &m) { map = const_cast<IntervalMap*>(&m); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setMap(llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1342
107k
  void setMap(const IntervalMap &m) { map = const_cast<IntervalMap*>(&m); }
1343
1344
  /// valid - Return true if the current position is valid, false for end().
1345
379M
  bool valid() const { return path.valid(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::valid() const
Line
Count
Source
1345
377M
  bool valid() const { return path.valid(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::valid() const
Line
Count
Source
1345
8.37k
  bool valid() const { return path.valid(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::valid() const
Line
Count
Source
1345
2.07M
  bool valid() const { return path.valid(); }
1346
1347
  /// atBegin - Return true if the current position is the first map entry.
1348
  bool atBegin() const { return path.atBegin(); }
1349
1350
  /// start - Return the beginning of the current interval.
1351
288M
  const KeyT &start() const { return unsafeStart(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::start() const
Line
Count
Source
1351
287M
  const KeyT &start() const { return unsafeStart(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::start() const
Line
Count
Source
1351
3.86k
  const KeyT &start() const { return unsafeStart(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::start() const
Line
Count
Source
1351
1.13M
  const KeyT &start() const { return unsafeStart(); }
1352
1353
  /// stop - Return the end of the current interval.
1354
232M
  const KeyT &stop() const { return unsafeStop(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::stop() const
Line
Count
Source
1354
231M
  const KeyT &stop() const { return unsafeStop(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::stop() const
Line
Count
Source
1354
1.59k
  const KeyT &stop() const { return unsafeStop(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::stop() const
Line
Count
Source
1354
841k
  const KeyT &stop() const { return unsafeStop(); }
1355
1356
  /// value - Return the mapped value at the current interval.
1357
150M
  const ValT &value() const { return unsafeValue(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::value() const
Line
Count
Source
1357
3.98k
  const ValT &value() const { return unsafeValue(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::value() const
Line
Count
Source
1357
150M
  const ValT &value() const { return unsafeValue(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::value() const
Line
Count
Source
1357
556k
  const ValT &value() const { return unsafeValue(); }
1358
1359
  const ValT &operator*() const { return value(); }
1360
1361
  bool operator==(const const_iterator &RHS) const {
1362
    assert(map == RHS.map && "Cannot compare iterators from different maps");
1363
    if (!valid())
1364
      return !RHS.valid();
1365
    if (path.leafOffset() != RHS.path.leafOffset())
1366
      return false;
1367
    return &path.template leaf<Leaf>() == &RHS.path.template leaf<Leaf>();
1368
  }
1369
1370
  bool operator!=(const const_iterator &RHS) const {
1371
    return !operator==(RHS);
1372
  }
1373
1374
  /// goToBegin - Move to the first interval in map.
1375
137k
  void goToBegin() {
1376
137k
    setRoot(0);
1377
137k
    if (branched())
1378
13.0k
      path.fillLeft(map->height);
1379
137k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::goToBegin()
Line
Count
Source
1375
2.16k
  void goToBegin() {
1376
2.16k
    setRoot(0);
1377
2.16k
    if (branched())
1378
19
      path.fillLeft(map->height);
1379
2.16k
  }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::goToBegin()
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::goToBegin()
Line
Count
Source
1375
135k
  void goToBegin() {
1376
135k
    setRoot(0);
1377
135k
    if (branched())
1378
13.0k
      path.fillLeft(map->height);
1379
135k
  }
1380
1381
  /// goToEnd - Move beyond the last interval in map.
1382
  void goToEnd() {
1383
    setRoot(map->rootSize);
1384
  }
1385
1386
  /// preincrement - move to the next interval.
1387
38.1M
  const_iterator &operator++() {
1388
38.1M
    assert(valid() && "Cannot increment end()");
1389
38.1M
    if (++path.leafOffset() == path.leafSize() && 
branched()11.2M
)
1390
3.52M
      path.moveRight(map->height);
1391
38.1M
    return *this;
1392
38.1M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator++()
Line
Count
Source
1387
37.8M
  const_iterator &operator++() {
1388
37.8M
    assert(valid() && "Cannot increment end()");
1389
37.8M
    if (++path.leafOffset() == path.leafSize() && 
branched()11.1M
)
1390
3.51M
      path.moveRight(map->height);
1391
37.8M
    return *this;
1392
37.8M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator++()
Line
Count
Source
1387
3.12k
  const_iterator &operator++() {
1388
3.12k
    assert(valid() && "Cannot increment end()");
1389
3.12k
    if (++path.leafOffset() == path.leafSize() && 
branched()2.14k
)
1390
22
      path.moveRight(map->height);
1391
3.12k
    return *this;
1392
3.12k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator++()
Line
Count
Source
1387
270k
  const_iterator &operator++() {
1388
270k
    assert(valid() && "Cannot increment end()");
1389
270k
    if (++path.leafOffset() == path.leafSize() && 
branched()72.5k
)
1390
10.7k
      path.moveRight(map->height);
1391
270k
    return *this;
1392
270k
  }
1393
1394
  /// postincrement - Dont do that!
1395
  const_iterator operator++(int) {
1396
    const_iterator tmp = *this;
1397
    operator++();
1398
    return tmp;
1399
  }
1400
1401
  /// predecrement - move to the previous interval.
1402
4.19M
  const_iterator &operator--() {
1403
4.19M
    if (path.leafOffset() && 
(3.90M
valid()3.90M
||
!branched()721k
))
1404
3.71M
      --path.leafOffset();
1405
473k
    else
1406
473k
      path.moveLeft(map->height);
1407
4.19M
    return *this;
1408
4.19M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator--()
Line
Count
Source
1402
4.19M
  const_iterator &operator--() {
1403
4.19M
    if (path.leafOffset() && 
(3.90M
valid()3.90M
||
!branched()721k
))
1404
3.71M
      --path.leafOffset();
1405
473k
    else
1406
473k
      path.moveLeft(map->height);
1407
4.19M
    return *this;
1408
4.19M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator--()
Line
Count
Source
1402
12
  const_iterator &operator--() {
1403
12
    if (path.leafOffset() && (valid() || 
!branched()0
))
1404
12
      --path.leafOffset();
1405
0
    else
1406
0
      path.moveLeft(map->height);
1407
12
    return *this;
1408
12
  }
1409
1410
  /// postdecrement - Dont do that!
1411
  const_iterator operator--(int) {
1412
    const_iterator tmp = *this;
1413
    operator--();
1414
    return tmp;
1415
  }
1416
1417
  /// find - Move to the first interval with stop >= x, or end().
1418
  /// This is a full search from the root, the current position is ignored.
1419
149M
  void find(KeyT x) {
1420
149M
    if (branched())
1421
28.8M
      treeFind(x);
1422
120M
    else
1423
120M
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1424
149M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::find(llvm::SlotIndex)
Line
Count
Source
1419
148M
  void find(KeyT x) {
1420
148M
    if (branched())
1421
28.2M
      treeFind(x);
1422
120M
    else
1423
120M
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1424
148M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::find(llvm::SlotIndex)
Line
Count
Source
1419
1.50k
  void find(KeyT x) {
1420
1.50k
    if (branched())
1421
55
      treeFind(x);
1422
1.45k
    else
1423
1.45k
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1424
1.50k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::find(llvm::SlotIndex)
Line
Count
Source
1419
707k
  void find(KeyT x) {
1420
707k
    if (branched())
1421
634k
      treeFind(x);
1422
72.1k
    else
1423
72.1k
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1424
707k
  }
1425
1426
  /// advanceTo - Move to the first interval with stop >= x, or end().
1427
  /// The search is started from the current position, and no earlier positions
1428
  /// can be found. This is much faster than find() for small moves.
1429
26.9M
  void advanceTo(KeyT x) {
1430
26.9M
    if (!valid())
1431
6.40M
      return;
1432
20.5M
    if (branched())
1433
10.3M
      treeAdvanceTo(x);
1434
10.1M
    else
1435
10.1M
      path.leafOffset() =
1436
10.1M
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1437
20.5M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::advanceTo(llvm::SlotIndex)
Line
Count
Source
1429
26.5M
  void advanceTo(KeyT x) {
1430
26.5M
    if (!valid())
1431
6.34M
      return;
1432
20.1M
    if (branched())
1433
10.2M
      treeAdvanceTo(x);
1434
9.86M
    else
1435
9.86M
      path.leafOffset() =
1436
9.86M
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1437
20.1M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::advanceTo(llvm::SlotIndex)
Line
Count
Source
1429
997
  void advanceTo(KeyT x) {
1430
997
    if (!valid())
1431
2
      return;
1432
995
    if (branched())
1433
8
      treeAdvanceTo(x);
1434
987
    else
1435
987
      path.leafOffset() =
1436
987
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1437
995
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::advanceTo(llvm::SlotIndex)
Line
Count
Source
1429
453k
  void advanceTo(KeyT x) {
1430
453k
    if (!valid())
1431
57.0k
      return;
1432
396k
    if (branched())
1433
105k
      treeAdvanceTo(x);
1434
290k
    else
1435
290k
      path.leafOffset() =
1436
290k
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1437
396k
  }
1438
};
1439
1440
/// pathFillFind - Complete path by searching for x.
1441
/// @param x Key to search for.
1442
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1443
void IntervalMap<KeyT, ValT, N, Traits>::
1444
28.9M
const_iterator::pathFillFind(KeyT x) {
1445
28.9M
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1446
31.6M
  for (unsigned i = map->height - path.height() - 1; i; 
--i2.72M
) {
1447
2.72M
    unsigned p = NR.get<Branch>().safeFind(0, x);
1448
2.72M
    path.push(NR, p);
1449
2.72M
    NR = NR.subtree(p);
1450
2.72M
  }
1451
28.9M
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1452
28.9M
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::pathFillFind(llvm::SlotIndex)
Line
Count
Source
1444
28.2M
const_iterator::pathFillFind(KeyT x) {
1445
28.2M
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1446
30.9M
  for (unsigned i = map->height - path.height() - 1; i; 
--i2.68M
) {
1447
2.68M
    unsigned p = NR.get<Branch>().safeFind(0, x);
1448
2.68M
    path.push(NR, p);
1449
2.68M
    NR = NR.subtree(p);
1450
2.68M
  }
1451
28.2M
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1452
28.2M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::pathFillFind(llvm::SlotIndex)
Line
Count
Source
1444
50
const_iterator::pathFillFind(KeyT x) {
1445
50
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1446
50
  for (unsigned i = map->height - path.height() - 1; i; 
--i0
) {
1447
0
    unsigned p = NR.get<Branch>().safeFind(0, x);
1448
0
    path.push(NR, p);
1449
0
    NR = NR.subtree(p);
1450
0
  }
1451
50
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1452
50
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::pathFillFind(llvm::SlotIndex)
Line
Count
Source
1444
612k
const_iterator::pathFillFind(KeyT x) {
1445
612k
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1446
645k
  for (unsigned i = map->height - path.height() - 1; i; 
--i33.2k
) {
1447
33.2k
    unsigned p = NR.get<Branch>().safeFind(0, x);
1448
33.2k
    path.push(NR, p);
1449
33.2k
    NR = NR.subtree(p);
1450
33.2k
  }
1451
612k
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1452
612k
}
1453
1454
/// treeFind - Find in a branched tree.
1455
/// @param x Key to search for.
1456
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1457
void IntervalMap<KeyT, ValT, N, Traits>::
1458
28.8M
const_iterator::treeFind(KeyT x) {
1459
28.8M
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1460
28.8M
  if (valid())
1461
26.9M
    pathFillFind(x);
1462
28.8M
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeFind(llvm::SlotIndex)
Line
Count
Source
1458
28.2M
const_iterator::treeFind(KeyT x) {
1459
28.2M
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1460
28.2M
  if (valid())
1461
26.3M
    pathFillFind(x);
1462
28.2M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeFind(llvm::SlotIndex)
Line
Count
Source
1458
55
const_iterator::treeFind(KeyT x) {
1459
55
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1460
55
  if (valid())
1461
50
    pathFillFind(x);
1462
55
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeFind(llvm::SlotIndex)
Line
Count
Source
1458
634k
const_iterator::treeFind(KeyT x) {
1459
634k
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1460
634k
  if (valid())
1461
604k
    pathFillFind(x);
1462
634k
}
1463
1464
/// treeAdvanceTo - Find position after the current one.
1465
/// @param x Key to search for.
1466
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1467
void IntervalMap<KeyT, ValT, N, Traits>::
1468
10.3M
const_iterator::treeAdvanceTo(KeyT x) {
1469
10.3M
  // Can we stay on the same leaf node?
1470
10.3M
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1471
8.00M
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1472
8.00M
    return;
1473
8.00M
  }
1474
2.39M
1475
2.39M
  // Drop the current leaf.
1476
2.39M
  path.pop();
1477
2.39M
1478
2.39M
  // Search towards the root for a usable subtree.
1479
2.39M
  if (path.height()) {
1480
484k
    for (unsigned l = path.height() - 1; l; 
--l6.97k
) {
1481
21.3k
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1482
14.4k
        // The branch node at l+1 is usable
1483
14.4k
        path.offset(l + 1) =
1484
14.4k
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1485
14.4k
        return pathFillFind(x);
1486
14.4k
      }
1487
6.97k
      path.pop();
1488
6.97k
    }
1489
477k
    // Is the level-1 Branch usable?
1490
477k
    
if (463k
!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)463k
) {
1491
351k
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1492
351k
      return pathFillFind(x);
1493
351k
    }
1494
2.03M
  }
1495
2.03M
1496
2.03M
  // We reached the root.
1497
2.03M
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1498
2.03M
  if (valid())
1499
1.58M
    pathFillFind(x);
1500
2.03M
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeAdvanceTo(llvm::SlotIndex)
Line
Count
Source
1468
10.2M
const_iterator::treeAdvanceTo(KeyT x) {
1469
10.2M
  // Can we stay on the same leaf node?
1470
10.2M
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1471
7.90M
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1472
7.90M
    return;
1473
7.90M
  }
1474
2.38M
1475
2.38M
  // Drop the current leaf.
1476
2.38M
  path.pop();
1477
2.38M
1478
2.38M
  // Search towards the root for a usable subtree.
1479
2.38M
  if (path.height()) {
1480
484k
    for (unsigned l = path.height() - 1; l; 
--l6.97k
) {
1481
21.3k
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1482
14.4k
        // The branch node at l+1 is usable
1483
14.4k
        path.offset(l + 1) =
1484
14.4k
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1485
14.4k
        return pathFillFind(x);
1486
14.4k
      }
1487
6.97k
      path.pop();
1488
6.97k
    }
1489
477k
    // Is the level-1 Branch usable?
1490
477k
    
if (463k
!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)463k
) {
1491
350k
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1492
350k
      return pathFillFind(x);
1493
350k
    }
1494
2.02M
  }
1495
2.02M
1496
2.02M
  // We reached the root.
1497
2.02M
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1498
2.02M
  if (valid())
1499
1.57M
    pathFillFind(x);
1500
2.02M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeAdvanceTo(llvm::SlotIndex)
Line
Count
Source
1468
8
const_iterator::treeAdvanceTo(KeyT x) {
1469
8
  // Can we stay on the same leaf node?
1470
8
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1471
4
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1472
4
    return;
1473
4
  }
1474
4
1475
4
  // Drop the current leaf.
1476
4
  path.pop();
1477
4
1478
4
  // Search towards the root for a usable subtree.
1479
4
  if (path.height()) {
1480
0
    for (unsigned l = path.height() - 1; l; --l) {
1481
0
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1482
0
        // The branch node at l+1 is usable
1483
0
        path.offset(l + 1) =
1484
0
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1485
0
        return pathFillFind(x);
1486
0
      }
1487
0
      path.pop();
1488
0
    }
1489
0
    // Is the level-1 Branch usable?
1490
0
    if (!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)) {
1491
0
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1492
0
      return pathFillFind(x);
1493
0
    }
1494
4
  }
1495
4
1496
4
  // We reached the root.
1497
4
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1498
4
  if (valid())
1499
0
    pathFillFind(x);
1500
4
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeAdvanceTo(llvm::SlotIndex)
Line
Count
Source
1468
105k
const_iterator::treeAdvanceTo(KeyT x) {
1469
105k
  // Can we stay on the same leaf node?
1470
105k
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1471
96.3k
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1472
96.3k
    return;
1473
96.3k
  }
1474
9.68k
1475
9.68k
  // Drop the current leaf.
1476
9.68k
  path.pop();
1477
9.68k
1478
9.68k
  // Search towards the root for a usable subtree.
1479
9.68k
  if (path.height()) {
1480
251
    for (unsigned l = path.height() - 1; l; 
--l0
) {
1481
0
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1482
0
        // The branch node at l+1 is usable
1483
0
        path.offset(l + 1) =
1484
0
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1485
0
        return pathFillFind(x);
1486
0
      }
1487
0
      path.pop();
1488
0
    }
1489
251
    // Is the level-1 Branch usable?
1490
251
    if (!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)) {
1491
227
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1492
227
      return pathFillFind(x);
1493
227
    }
1494
9.46k
  }
1495
9.46k
1496
9.46k
  // We reached the root.
1497
9.46k
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1498
9.46k
  if (valid())
1499
7.84k
    pathFillFind(x);
1500
9.46k
}
1501
1502
//===----------------------------------------------------------------------===//
1503
//---                       IntervalMap::iterator                         ----//
1504
//===----------------------------------------------------------------------===//
1505
1506
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1507
class IntervalMap<KeyT, ValT, N, Traits>::iterator : public const_iterator {
1508
  friend class IntervalMap;
1509
1510
  using IdxPair = IntervalMapImpl::IdxPair;
1511
1512
11.5M
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator(llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >&)
Line
Count
Source
1512
3.63k
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator(llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >&)
Line
Count
Source
1512
10.7M
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator(llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >&)
Line
Count
Source
1512
793k
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
1513
1514
  void setNodeStop(unsigned Level, KeyT Stop);
1515
  bool insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop);
1516
  template <typename NodeT> bool overflow(unsigned Level);
1517
  void treeInsert(KeyT a, KeyT b, ValT y);
1518
  void eraseNode(unsigned Level);
1519
  void treeErase(bool UpdateRoot = true);
1520
  bool canCoalesceLeft(KeyT Start, ValT x);
1521
  bool canCoalesceRight(KeyT Stop, ValT x);
1522
1523
public:
1524
  /// iterator - Create null iterator.
1525
2.66M
  iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator()
Line
Count
Source
1525
2.55M
  iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator()
Line
Count
Source
1525
15
  iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator()
Line
Count
Source
1525
107k
  iterator() = default;
1526
1527
  /// setStart - Move the start of the current interval.
1528
  /// This may cause coalescing with the previous interval.
1529
  /// @param a New start key, must not overlap the previous interval.
1530
  void setStart(KeyT a);
1531
1532
  /// setStop - Move the end of the current interval.
1533
  /// This may cause coalescing with the following interval.
1534
  /// @param b New stop key, must not overlap the following interval.
1535
  void setStop(KeyT b);
1536
1537
  /// setValue - Change the mapped value of the current interval.
1538
  /// This may cause coalescing with the previous and following intervals.
1539
  /// @param x New value.
1540
  void setValue(ValT x);
1541
1542
  /// setStartUnchecked - Move the start of the current interval without
1543
  /// checking for coalescing or overlaps.
1544
  /// This should only be used when it is known that coalescing is not required.
1545
  /// @param a New start key.
1546
260
  void setStartUnchecked(KeyT a) { this->unsafeStart() = a; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStartUnchecked(llvm::SlotIndex)
Line
Count
Source
1546
260
  void setStartUnchecked(KeyT a) { this->unsafeStart() = a; }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStartUnchecked(llvm::SlotIndex)
1547
1548
  /// setStopUnchecked - Move the end of the current interval without checking
1549
  /// for coalescing or overlaps.
1550
  /// This should only be used when it is known that coalescing is not required.
1551
  /// @param b New stop key.
1552
264
  void setStopUnchecked(KeyT b) {
1553
264
    this->unsafeStop() = b;
1554
264
    // Update keys in branch nodes as well.
1555
264
    if (this->path.atLastEntry(this->path.height()))
1556
85
      setNodeStop(this->path.height(), b);
1557
264
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStopUnchecked(llvm::SlotIndex)
Line
Count
Source
1552
45
  void setStopUnchecked(KeyT b) {
1553
45
    this->unsafeStop() = b;
1554
45
    // Update keys in branch nodes as well.
1555
45
    if (this->path.atLastEntry(this->path.height()))
1556
44
      setNodeStop(this->path.height(), b);
1557
45
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStopUnchecked(llvm::SlotIndex)
Line
Count
Source
1552
219
  void setStopUnchecked(KeyT b) {
1553
219
    this->unsafeStop() = b;
1554
219
    // Update keys in branch nodes as well.
1555
219
    if (this->path.atLastEntry(this->path.height()))
1556
41
      setNodeStop(this->path.height(), b);
1557
219
  }
1558
1559
  /// setValueUnchecked - Change the mapped value of the current interval
1560
  /// without checking for coalescing.
1561
  /// @param x New value.
1562
890
  void setValueUnchecked(ValT x) { this->unsafeValue() = x; }
1563
1564
  /// insert - Insert mapping [a;b] -> y before the current position.
1565
  void insert(KeyT a, KeyT b, ValT y);
1566
1567
  /// erase - Erase the current interval.
1568
  void erase();
1569
1570
14.7M
  iterator &operator++() {
1571
14.7M
    const_iterator::operator++();
1572
14.7M
    return *this;
1573
14.7M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator++()
Line
Count
Source
1570
14.7M
  iterator &operator++() {
1571
14.7M
    const_iterator::operator++();
1572
14.7M
    return *this;
1573
14.7M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator++()
Line
Count
Source
1570
1.48k
  iterator &operator++() {
1571
1.48k
    const_iterator::operator++();
1572
1.48k
    return *this;
1573
1.48k
  }
1574
1575
  iterator operator++(int) {
1576
    iterator tmp = *this;
1577
    operator++();
1578
    return tmp;
1579
  }
1580
1581
4.19M
  iterator &operator--() {
1582
4.19M
    const_iterator::operator--();
1583
4.19M
    return *this;
1584
4.19M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator--()
Line
Count
Source
1581
4.19M
  iterator &operator--() {
1582
4.19M
    const_iterator::operator--();
1583
4.19M
    return *this;
1584
4.19M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator--()
Line
Count
Source
1581
12
  iterator &operator--() {
1582
12
    const_iterator::operator--();
1583
12
    return *this;
1584
12
  }
1585
1586
  iterator operator--(int) {
1587
    iterator tmp = *this;
1588
    operator--();
1589
    return tmp;
1590
  }
1591
};
1592
1593
/// canCoalesceLeft - Can the current interval coalesce to the left after
1594
/// changing start or value?
1595
/// @param Start New start of current interval.
1596
/// @param Value New value for current interval.
1597
/// @return True when updating the current interval would enable coalescing.
1598
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1599
bool IntervalMap<KeyT, ValT, N, Traits>::
1600
56
iterator::canCoalesceLeft(KeyT Start, ValT Value) {
1601
56
  using namespace IntervalMapImpl;
1602
56
  Path &P = this->path;
1603
56
  if (!this->branched()) {
1604
56
    unsigned i = P.leafOffset();
1605
56
    RootLeaf &Node = P.leaf<RootLeaf>();
1606
56
    return i && 
Node.value(i-1) == Value21
&&
1607
56
                
Traits::adjacent(Node.stop(i-1), Start)3
;
1608
56
  }
1609
0
  // Branched.
1610
0
  if (unsigned i = P.leafOffset()) {
1611
0
    Leaf &Node = P.leaf<Leaf>();
1612
0
    return Node.value(i-1) == Value && Traits::adjacent(Node.stop(i-1), Start);
1613
0
  } else if (NodeRef NR = P.getLeftSibling(P.height())) {
1614
0
    unsigned i = NR.size() - 1;
1615
0
    Leaf &Node = NR.get<Leaf>();
1616
0
    return Node.value(i) == Value && Traits::adjacent(Node.stop(i), Start);
1617
0
  }
1618
0
  return false;
1619
0
}
1620
1621
/// canCoalesceRight - Can the current interval coalesce to the right after
1622
/// changing stop or value?
1623
/// @param Stop New stop of current interval.
1624
/// @param Value New value for current interval.
1625
/// @return True when updating the current interval would enable coalescing.
1626
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1627
bool IntervalMap<KeyT, ValT, N, Traits>::
1628
56
iterator::canCoalesceRight(KeyT Stop, ValT Value) {
1629
56
  using namespace IntervalMapImpl;
1630
56
  Path &P = this->path;
1631
56
  unsigned i = P.leafOffset() + 1;
1632
56
  if (!this->branched()) {
1633
56
    if (i >= P.leafSize())
1634
44
      return false;
1635
12
    RootLeaf &Node = P.leaf<RootLeaf>();
1636
12
    return Node.value(i) == Value && 
Traits::adjacent(Stop, Node.start(i))0
;
1637
12
  }
1638
0
  // Branched.
1639
0
  if (i < P.leafSize()) {
1640
0
    Leaf &Node = P.leaf<Leaf>();
1641
0
    return Node.value(i) == Value && Traits::adjacent(Stop, Node.start(i));
1642
0
  } else if (NodeRef NR = P.getRightSibling(P.height())) {
1643
0
    Leaf &Node = NR.get<Leaf>();
1644
0
    return Node.value(0) == Value && Traits::adjacent(Stop, Node.start(0));
1645
0
  }
1646
0
  return false;
1647
0
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::canCoalesceRight(llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
1628
56
iterator::canCoalesceRight(KeyT Stop, ValT Value) {
1629
56
  using namespace IntervalMapImpl;
1630
56
  Path &P = this->path;
1631
56
  unsigned i = P.leafOffset() + 1;
1632
56
  if (!this->branched()) {
1633
56
    if (i >= P.leafSize())
1634
44
      return false;
1635
12
    RootLeaf &Node = P.leaf<RootLeaf>();
1636
12
    return Node.value(i) == Value && 
Traits::adjacent(Stop, Node.start(i))0
;
1637
12
  }
1638
0
  // Branched.
1639
0
  if (i < P.leafSize()) {
1640
0
    Leaf &Node = P.leaf<Leaf>();
1641
0
    return Node.value(i) == Value && Traits::adjacent(Stop, Node.start(i));
1642
0
  } else if (NodeRef NR = P.getRightSibling(P.height())) {
1643
0
    Leaf &Node = NR.get<Leaf>();
1644
0
    return Node.value(0) == Value && Traits::adjacent(Stop, Node.start(0));
1645
0
  }
1646
0
  return false;
1647
0
}
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::canCoalesceRight(llvm::SlotIndex, unsigned int)
1648
1649
/// setNodeStop - Update the stop key of the current node at level and above.
1650
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1651
void IntervalMap<KeyT, ValT, N, Traits>::
1652
3.79M
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1653
3.79M
  // There are no references to the root node, so nothing to update.
1654
3.79M
  if (!Level)
1655
44
    return;
1656
3.79M
  IntervalMapImpl::Path &P = this->path;
1657
3.79M
  // Update nodes pointing to the current node.
1658
4.13M
  while (--Level) {
1659
855k
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1660
855k
    if (!P.atLastEntry(Level))
1661
508k
      return;
1662
855k
  }
1663
3.79M
  // Update root separately since it has a different layout.
1664
3.79M
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1665
3.28M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setNodeStop(unsigned int, llvm::SlotIndex)
Line
Count
Source
1652
60
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1653
60
  // There are no references to the root node, so nothing to update.
1654
60
  if (!Level)
1655
44
    return;
1656
16
  IntervalMapImpl::Path &P = this->path;
1657
16
  // Update nodes pointing to the current node.
1658
16
  while (--Level) {
1659
0
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1660
0
    if (!P.atLastEntry(Level))
1661
0
      return;
1662
0
  }
1663
16
  // Update root separately since it has a different layout.
1664
16
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1665
16
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setNodeStop(unsigned int, llvm::SlotIndex)
Line
Count
Source
1652
3.65M
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1653
3.65M
  // There are no references to the root node, so nothing to update.
1654
3.65M
  if (!Level)
1655
0
    return;
1656
3.65M
  IntervalMapImpl::Path &P = this->path;
1657
3.65M
  // Update nodes pointing to the current node.
1658
3.99M
  while (--Level) {
1659
846k
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1660
846k
    if (!P.atLastEntry(Level))
1661
500k
      return;
1662
846k
  }
1663
3.65M
  // Update root separately since it has a different layout.
1664
3.65M
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1665
3.15M
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setNodeStop(unsigned int, llvm::SlotIndex)
Line
Count
Source
1652
140k
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1653
140k
  // There are no references to the root node, so nothing to update.
1654
140k
  if (!Level)
1655
0
    return;
1656
140k
  IntervalMapImpl::Path &P = this->path;
1657
140k
  // Update nodes pointing to the current node.
1658
143k
  while (--Level) {
1659
9.84k
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1660
9.84k
    if (!P.atLastEntry(Level))
1661
7.43k
      return;
1662
9.84k
  }
1663
140k
  // Update root separately since it has a different layout.
1664
140k
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1665
133k
}
1666
1667
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1668
void IntervalMap<KeyT, ValT, N, Traits>::
1669
803
iterator::setStart(KeyT a) {
1670
803
  assert(Traits::nonEmpty(a, this->stop()) && "Cannot move start beyond stop");
1671
803
  KeyT &CurStart = this->unsafeStart();
1672
803
  if (!Traits::startLess(a, CurStart) || 
!canCoalesceLeft(a, this->value())0
) {
1673
803
    CurStart = a;
1674
803
    return;
1675
803
  }
1676
0
  // Coalesce with the interval to the left.
1677
0
  --*this;
1678
0
  a = this->start();
1679
0
  erase();
1680
0
  setStartUnchecked(a);
1681
0
}
1682
1683
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1684
void IntervalMap<KeyT, ValT, N, Traits>::
1685
219
iterator::setStop(KeyT b) {
1686
219
  assert(Traits::nonEmpty(this->start(), b) && "Cannot move stop beyond start");
1687
219
  if (Traits::startLess(b, this->stop()) ||
1688
219
      
!canCoalesceRight(b, this->value())0
) {
1689
219
    setStopUnchecked(b);
1690
219
    return;
1691
219
  }
1692
0
  // Coalesce with interval to the right.
1693
0
  KeyT a = this->start();
1694
0
  erase();
1695
0
  setStartUnchecked(a);
1696
0
}
1697
1698
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1699
void IntervalMap<KeyT, ValT, N, Traits>::
1700
56
iterator::setValue(ValT x) {
1701
56
  setValueUnchecked(x);
1702
56
  if (canCoalesceRight(this->stop(), x)) {
1703
0
    KeyT a = this->start();
1704
0
    erase();
1705
0
    setStartUnchecked(a);
1706
0
  }
1707
56
  if (canCoalesceLeft(this->start(), x)) {
1708
3
    --*this;
1709
3
    KeyT a = this->start();
1710
3
    erase();
1711
3
    setStartUnchecked(a);
1712
3
  }
1713
56
}
1714
1715
/// insertNode - insert a node before the current path at level.
1716
/// Leave the current path pointing at the new node.
1717
/// @param Level path index of the node to be inserted.
1718
/// @param Node The node to be inserted.
1719
/// @param Stop The last index in the new node.
1720
/// @return True if the tree height was increased.
1721
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1722
bool IntervalMap<KeyT, ValT, N, Traits>::
1723
383k
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1724
383k
  assert(Level && "Cannot insert next to the root");
1725
383k
  bool SplitRoot = false;
1726
383k
  IntervalMap &IM = *this->map;
1727
383k
  IntervalMapImpl::Path &P = this->path;
1728
383k
1729
383k
  if (Level == 1) {
1730
304k
    // Insert into the root branch node.
1731
304k
    if (IM.rootSize < RootBranch::Capacity) {
1732
298k
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1733
298k
      P.setSize(0, ++IM.rootSize);
1734
298k
      P.reset(Level);
1735
298k
      return SplitRoot;
1736
298k
    }
1737
6.57k
1738
6.57k
    // We need to split the root while keeping our position.
1739
6.57k
    SplitRoot = true;
1740
6.57k
    IdxPair Offset = IM.splitRoot(P.offset(0));
1741
6.57k
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1742
6.57k
1743
6.57k
    // Fall through to insert at the new higher level.
1744
6.57k
    ++Level;
1745
6.57k
  }
1746
383k
1747
383k
  // When inserting before end(), make sure we have a valid path.
1748
383k
  P.legalizeForInsert(--Level);
1749
85.6k
1750
85.6k
  // Insert into the branch node at Level-1.
1751
85.6k
  if (P.size(Level) == Branch::Capacity) {
1752
23.1k
    // Branch node is full, handle handle the overflow.
1753
23.1k
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1754
23.1k
    SplitRoot = overflow<Branch>(Level);
1755
23.1k
    Level += SplitRoot;
1756
23.1k
  }
1757
85.6k
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1758
85.6k
  P.setSize(Level, P.size(Level) + 1);
1759
85.6k
  if (P.atLastEntry(Level))
1760
747
    setNodeStop(Level, Stop);
1761
85.6k
  P.reset(Level + 1);
1762
85.6k
  return SplitRoot;
1763
383k
}
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insertNode(unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insertNode(unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
1723
377k
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1724
377k
  assert(Level && "Cannot insert next to the root");
1725
377k
  bool SplitRoot = false;
1726
377k
  IntervalMap &IM = *this->map;
1727
377k
  IntervalMapImpl::Path &P = this->path;
1728
377k
1729
377k
  if (Level == 1) {
1730
299k
    // Insert into the root branch node.
1731
299k
    if (IM.rootSize < RootBranch::Capacity) {
1732
292k
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1733
292k
      P.setSize(0, ++IM.rootSize);
1734
292k
      P.reset(Level);
1735
292k
      return SplitRoot;
1736
292k
    }
1737
6.50k
1738
6.50k
    // We need to split the root while keeping our position.
1739
6.50k
    SplitRoot = true;
1740
6.50k
    IdxPair Offset = IM.splitRoot(P.offset(0));
1741
6.50k
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1742
6.50k
1743
6.50k
    // Fall through to insert at the new higher level.
1744
6.50k
    ++Level;
1745
6.50k
  }
1746
377k
1747
377k
  // When inserting before end(), make sure we have a valid path.
1748
377k
  P.legalizeForInsert(--Level);
1749
85.0k
1750
85.0k
  // Insert into the branch node at Level-1.
1751
85.0k
  if (P.size(Level) == Branch::Capacity) {
1752
23.0k
    // Branch node is full, handle handle the overflow.
1753
23.0k
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1754
23.0k
    SplitRoot = overflow<Branch>(Level);
1755
23.0k
    Level += SplitRoot;
1756
23.0k
  }
1757
85.0k
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1758
85.0k
  P.setSize(Level, P.size(Level) + 1);
1759
85.0k
  if (P.atLastEntry(Level))
1760
742
    setNodeStop(Level, Stop);
1761
85.0k
  P.reset(Level + 1);
1762
85.0k
  return SplitRoot;
1763
377k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insertNode(unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
1723
6.17k
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1724
6.17k
  assert(Level && "Cannot insert next to the root");
1725
6.17k
  bool SplitRoot = false;
1726
6.17k
  IntervalMap &IM = *this->map;
1727
6.17k
  IntervalMapImpl::Path &P = this->path;
1728
6.17k
1729
6.17k
  if (Level == 1) {
1730
5.69k
    // Insert into the root branch node.
1731
5.69k
    if (IM.rootSize < RootBranch::Capacity) {
1732
5.62k
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1733
5.62k
      P.setSize(0, ++IM.rootSize);
1734
5.62k
      P.reset(Level);
1735
5.62k
      return SplitRoot;
1736
5.62k
    }
1737
70
1738
70
    // We need to split the root while keeping our position.
1739
70
    SplitRoot = true;
1740
70
    IdxPair Offset = IM.splitRoot(P.offset(0));
1741
70
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1742
70
1743
70
    // Fall through to insert at the new higher level.
1744
70
    ++Level;
1745
70
  }
1746
6.17k
1747
6.17k
  // When inserting before end(), make sure we have a valid path.
1748
6.17k
  P.legalizeForInsert(--Level);
1749
549
1750
549
  // Insert into the branch node at Level-1.
1751
549
  if (P.size(Level) == Branch::Capacity) {
1752
106
    // Branch node is full, handle handle the overflow.
1753
106
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1754
106
    SplitRoot = overflow<Branch>(Level);
1755
106
    Level += SplitRoot;
1756
106
  }
1757
549
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1758
549
  P.setSize(Level, P.size(Level) + 1);
1759
549
  if (P.atLastEntry(Level))
1760
5
    setNodeStop(Level, Stop);
1761
549
  P.reset(Level + 1);
1762
549
  return SplitRoot;
1763
6.17k
}
1764
1765
// insert
1766
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1767
void IntervalMap<KeyT, ValT, N, Traits>::
1768
15.9M
iterator::insert(KeyT a, KeyT b, ValT y) {
1769
15.9M
  if (this->branched())
1770
4.72M
    return treeInsert(a, b, y);
1771
11.2M
  IntervalMap &IM = *this->map;
1772
11.2M
  IntervalMapImpl::Path &P = this->path;
1773
11.2M
1774
11.2M
  // Try simple root leaf insert.
1775
11.2M
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1776
11.2M
1777
11.2M
  // Was the root node insert successful?
1778
11.2M
  if (Size <= RootLeaf::Capacity) {
1779
10.9M
    P.setSize(0, IM.rootSize = Size);
1780
10.9M
    return;
1781
10.9M
  }
1782
315k
1783
315k
  // Root leaf node is full, we must branch.
1784
315k
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1785
315k
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1786
315k
1787
315k
  // Now it fits in the new leaf.
1788
315k
  treeInsert(a, b, y);
1789
315k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insert(llvm::SlotIndex, llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
1768
1.40k
iterator::insert(KeyT a, KeyT b, ValT y) {
1769
1.40k
  if (this->branched())
1770
34
    return treeInsert(a, b, y);
1771
1.37k
  IntervalMap &IM = *this->map;
1772
1.37k
  IntervalMapImpl::Path &P = this->path;
1773
1.37k
1774
1.37k
  // Try simple root leaf insert.
1775
1.37k
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1776
1.37k
1777
1.37k
  // Was the root node insert successful?
1778
1.37k
  if (Size <= RootLeaf::Capacity) {
1779
1.36k
    P.setSize(0, IM.rootSize = Size);
1780
1.36k
    return;
1781
1.36k
  }
1782
5
1783
5
  // Root leaf node is full, we must branch.
1784
5
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1785
5
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1786
5
1787
5
  // Now it fits in the new leaf.
1788
5
  treeInsert(a, b, y);
1789
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insert(llvm::SlotIndex, llvm::SlotIndex, llvm::LiveInterval*)
Line
Count
Source
1768
15.3M
iterator::insert(KeyT a, KeyT b, ValT y) {
1769
15.3M
  if (this->branched())
1770
4.11M
    return treeInsert(a, b, y);
1771
11.2M
  IntervalMap &IM = *this->map;
1772
11.2M
  IntervalMapImpl::Path &P = this->path;
1773
11.2M
1774
11.2M
  // Try simple root leaf insert.
1775
11.2M
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1776
11.2M
1777
11.2M
  // Was the root node insert successful?
1778
11.2M
  if (Size <= RootLeaf::Capacity) {
1779
10.8M
    P.setSize(0, IM.rootSize = Size);
1780
10.8M
    return;
1781
10.8M
  }
1782
302k
1783
302k
  // Root leaf node is full, we must branch.
1784
302k
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1785
302k
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1786
302k
1787
302k
  // Now it fits in the new leaf.
1788
302k
  treeInsert(a, b, y);
1789
302k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insert(llvm::SlotIndex, llvm::SlotIndex, unsigned int)
Line
Count
Source
1768
657k
iterator::insert(KeyT a, KeyT b, ValT y) {
1769
657k
  if (this->branched())
1770
612k
    return treeInsert(a, b, y);
1771
44.8k
  IntervalMap &IM = *this->map;
1772
44.8k
  IntervalMapImpl::Path &P = this->path;
1773
44.8k
1774
44.8k
  // Try simple root leaf insert.
1775
44.8k
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1776
44.8k
1777
44.8k
  // Was the root node insert successful?
1778
44.8k
  if (Size <= RootLeaf::Capacity) {
1779
31.8k
    P.setSize(0, IM.rootSize = Size);
1780
31.8k
    return;
1781
31.8k
  }
1782
13.0k
1783
13.0k
  // Root leaf node is full, we must branch.
1784
13.0k
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1785
13.0k
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1786
13.0k
1787
13.0k
  // Now it fits in the new leaf.
1788
13.0k
  treeInsert(a, b, y);
1789
13.0k
}
1790
1791
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1792
void IntervalMap<KeyT, ValT, N, Traits>::
1793
5.03M
iterator::treeInsert(KeyT a, KeyT b, ValT y) {
1794
5.03M
  using namespace IntervalMapImpl;
1795
5.03M
  Path &P = this->path;
1796
5.03M
1797
5.03M
  if (!P.valid())
1798
926k
    P.legalizeForInsert(this->map->height);
1799
5.03M
1800
5.03M
  // Check if this insertion will extend the node to the left.
1801
5.03M
  if (P.leafOffset() == 0 && 
Traits::startLess(a, P.leaf<Leaf>().start(0))370k
) {
1802
370k
    // Node is growing to the left, will it affect a left sibling node?
1803
370k
    if (NodeRef Sib = P.getLeftSibling(P.height())) {
1804
277k
      Leaf &SibLeaf = Sib.get<Leaf>();
1805
277k
      unsigned SibOfs = Sib.size() - 1;
1806
277k
      if (SibLeaf.value(SibOfs) == y &&
1807
277k
          
Traits::adjacent(SibLeaf.stop(SibOfs), a)97.6k
) {
1808
59.9k
        // This insertion will coalesce with the last entry in SibLeaf. We can
1809
59.9k
        // handle it in two ways:
1810
59.9k
        //  1. Extend SibLeaf.stop to b and be done, or
1811
59.9k
        //  2. Extend a to SibLeaf, erase the SibLeaf entry and continue.
1812
59.9k
        // We prefer 1., but need 2 when coalescing to the right as well.
1813
59.9k
        Leaf &CurLeaf = P.leaf<Leaf>();
1814
59.9k
        P.moveLeft(P.height());
1815
59.9k
        if (Traits::stopLess(b, CurLeaf.start(0)) &&
1816
59.9k
            (y != CurLeaf.value(0) || 
!Traits::adjacent(b, CurLeaf.start(0))44.6k
)) {
1817
40.8k
          // Easy, just extend SibLeaf and we're done.
1818
40.8k
          setNodeStop(P.height(), SibLeaf.stop(SibOfs) = b);
1819
40.8k
          return;
1820
40.8k
        } else {
1821
19.1k
          // We have both left and right coalescing. Erase the old SibLeaf entry
1822
19.1k
          // and continue inserting the larger interval.
1823
19.1k
          a = SibLeaf.start(SibOfs);
1824
19.1k
          treeErase(/* UpdateRoot= */false);
1825
19.1k
        }
1826
59.9k
      }
1827
277k
    } else {
1828
93.4k
      // No left sibling means we are at begin(). Update cached bound.
1829
93.4k
      this->map->rootBranchStart() = a;
1830
93.4k
    }
1831
370k
  }
1832
5.03M
1833
5.03M
  // When we are inserting at the end of a leaf node, we must update stops.
1834
5.03M
  unsigned Size = P.leafSize();
1835
4.99M
  bool Grow = P.leafOffset() == Size;
1836
4.99M
  Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), Size, a, b, y);
1837
4.99M
1838
4.99M
  // Leaf insertion unsuccessful? Overflow and try again.
1839
4.99M
  if (Size > Leaf::Capacity) {
1840
1.09M
    overflow<Leaf>(P.height());
1841
1.09M
    Grow = P.leafOffset() == P.leafSize();
1842
1.09M
    Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), P.leafSize(), a, b, y);
1843
1.09M
    assert(Size <= Leaf::Capacity && "overflow() didn't make room");
1844
1.09M
  }
1845
4.99M
1846
4.99M
  // Inserted, update offset and leaf size.
1847
4.99M
  P.setSize(P.height(), Size);
1848
4.99M
1849
4.99M
  // Insert was the last node entry, update stops.
1850
4.99M
  if (Grow)
1851
1.11M
    setNodeStop(P.height(), b);
1852
4.99M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::treeInsert(llvm::SlotIndex, llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
1793
39
iterator::treeInsert(KeyT a, KeyT b, ValT y) {
1794
39
  using namespace IntervalMapImpl;
1795
39
  Path &P = this->path;
1796
39
1797
39
  if (!P.valid())
1798
11
    P.legalizeForInsert(this->map->height);
1799
39
1800
39
  // Check if this insertion will extend the node to the left.
1801
39
  if (P.leafOffset() == 0 && 
Traits::startLess(a, P.leaf<Leaf>().start(0))0
) {
1802
0
    // Node is growing to the left, will it affect a left sibling node?
1803
0
    if (NodeRef Sib = P.getLeftSibling(P.height())) {
1804
0
      Leaf &SibLeaf = Sib.get<Leaf>();
1805
0
      unsigned SibOfs = Sib.size() - 1;
1806
0
      if (SibLeaf.value(SibOfs) == y &&
1807
0
          Traits::adjacent(SibLeaf.stop(SibOfs), a)) {
1808
0
        // This insertion will coalesce with the last entry in SibLeaf. We can
1809
0
        // handle it in two ways:
1810
0
        //  1. Extend SibLeaf.stop to b and be done, or
1811
0
        //  2. Extend a to SibLeaf, erase the SibLeaf entry and continue.
1812
0
        // We prefer 1., but need 2 when coalescing to the right as well.
1813
0
        Leaf &CurLeaf = P.leaf<Leaf>();
1814
0
        P.moveLeft(P.height());
1815
0
        if (Traits::stopLess(b, CurLeaf.start(0)) &&
1816
0
            (y != CurLeaf.value(0) || !Traits::adjacent(b, CurLeaf.start(0)))) {
1817
0
          // Easy, just extend SibLeaf and we're done.
1818
0
          setNodeStop(P.height(), SibLeaf.stop(SibOfs) = b);
1819
0
          return;
1820
0
        } else {
1821
0
          // We have both left and right coalescing. Erase the old SibLeaf entry
1822
0
          // and continue inserting the larger interval.
1823
0
          a = SibLeaf.start(SibOfs);
1824
0
          treeErase(/* UpdateRoot= */false);
1825
0
        }
1826
0
      }
1827
0
    } else {
1828
0
      // No left sibling means we are at begin(). Update cached bound.
1829
0
      this->map->rootBranchStart() = a;
1830
0
    }
1831
0
  }
1832
39
1833
39
  // When we are inserting at the end of a leaf node, we must update stops.
1834
39
  unsigned Size = P.leafSize();
1835
39
  bool Grow = P.leafOffset() == Size;
1836
39
  Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), Size, a, b, y);
1837
39
1838
39
  // Leaf insertion unsuccessful? Overflow and try again.
1839
39
  if (Size > Leaf::Capacity) {
1840
0
    overflow<Leaf>(P.height());
1841
0
    Grow = P.leafOffset() == P.leafSize();
1842
0
    Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), P.leafSize(), a, b, y);
1843
0
    assert(Size <= Leaf::Capacity && "overflow() didn't make room");
1844
0
  }
1845
39
1846
39
  // Inserted, update offset and leaf size.
1847
39
  P.setSize(P.height(), Size);
1848
39
1849
39
  // Insert was the last node entry, update stops.
1850
39
  if (Grow)
1851
16
    setNodeStop(P.height(), b);
1852
39
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::treeInsert(llvm::SlotIndex, llvm::SlotIndex, llvm::LiveInterval*)
Line
Count
Source
1793
4.41M
iterator::treeInsert(KeyT a, KeyT b, ValT y) {
1794
4.41M
  using namespace IntervalMapImpl;
1795
4.41M
  Path &P = this->path;
1796
4.41M
1797
4.41M
  if (!P.valid())
1798
896k
    P.legalizeForInsert(this->map->height);
1799
4.41M
1800
4.41M
  // Check if this insertion will extend the node to the left.
1801
4.41M
  if (P.leafOffset() == 0 && 
Traits::startLess(a, P.leaf<Leaf>().start(0))297k
) {
1802
297k
    // Node is growing to the left, will it affect a left sibling node?
1803
297k
    if (NodeRef Sib = P.getLeftSibling(P.height())) {
1804
205k
      Leaf &SibLeaf = Sib.get<Leaf>();
1805
205k
      unsigned SibOfs = Sib.size() - 1;
1806
205k
      if (SibLeaf.value(SibOfs) == y &&
1807
205k
          
Traits::adjacent(SibLeaf.stop(SibOfs), a)26.1k
) {
1808
15.1k
        // This insertion will coalesce with the last entry in SibLeaf. We can
1809
15.1k
        // handle it in two ways:
1810
15.1k
        //  1. Extend SibLeaf.stop to b and be done, or
1811
15.1k
        //  2. Extend a to SibLeaf, erase the SibLeaf entry and continue.
1812
15.1k
        // We prefer 1., but need 2 when coalescing to the right as well.
1813
15.1k
        Leaf &CurLeaf = P.leaf<Leaf>();
1814
15.1k
        P.moveLeft(P.height());
1815
15.1k
        if (Traits::stopLess(b, CurLeaf.start(0)) &&
1816
15.1k
            (y != CurLeaf.value(0) || 
!Traits::adjacent(b, CurLeaf.start(0))0
)) {
1817
15.1k
          // Easy, just extend SibLeaf and we're done.
1818
15.1k
          setNodeStop(P.height(), SibLeaf.stop(SibOfs) = b);
1819
15.1k
          return;
1820
15.1k
        } else {
1821
0
          // We have both left and right coalescing. Erase the old SibLeaf entry
1822
0
          // and continue inserting the larger interval.
1823
0
          a = SibLeaf.start(SibOfs);
1824
0
          treeErase(/* UpdateRoot= */false);
1825
0
        }
1826
15.1k
      }
1827
205k
    } else {
1828
92.7k
      // No left sibling means we are at begin(). Update cached bound.
1829
92.7k
      this->map->rootBranchStart() = a;
1830
92.7k
    }
1831
297k
  }
1832
4.41M
1833
4.41M
  // When we are inserting at the end of a leaf node, we must update stops.
1834
4.41M
  unsigned Size = P.leafSize();
1835
4.39M
  bool Grow = P.leafOffset() == Size;
1836
4.39M
  Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), Size, a, b, y);
1837
4.39M
1838
4.39M
  // Leaf insertion unsuccessful? Overflow and try again.
1839
4.39M
  if (Size > Leaf::Capacity) {
1840
1.06M
    overflow<Leaf>(P.height());
1841
1.06M
    Grow = P.leafOffset() == P.leafSize();
1842
1.06M
    Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), P.leafSize(), a, b, y);
1843
1.06M
    assert(Size <= Leaf::Capacity && "overflow() didn't make room");
1844
1.06M
  }
1845
4.39M
1846
4.39M
  // Inserted, update offset and leaf size.
1847
4.39M
  P.setSize(P.height(), Size);
1848
4.39M
1849
4.39M
  // Insert was the last node entry, update stops.
1850
4.39M
  if (Grow)
1851
1.07M
    setNodeStop(P.height(), b);
1852
4.39M
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::treeInsert(llvm::SlotIndex, llvm::SlotIndex, unsigned int)
Line
Count
Source
1793
625k
iterator::treeInsert(KeyT a, KeyT b, ValT y) {
1794
625k
  using namespace IntervalMapImpl;
1795
625k
  Path &P = this->path;
1796
625k
1797
625k
  if (!P.valid())
1798
30.6k
    P.legalizeForInsert(this->map->height);
1799
625k
1800
625k
  // Check if this insertion will extend the node to the left.
1801
625k
  if (P.leafOffset() == 0 && 
Traits::startLess(a, P.leaf<Leaf>().start(0))72.6k
) {
1802
72.6k
    // Node is growing to the left, will it affect a left sibling node?
1803
72.6k
    if (NodeRef Sib = P.getLeftSibling(P.height())) {
1804
71.9k
      Leaf &SibLeaf = Sib.get<Leaf>();
1805
71.9k
      unsigned SibOfs = Sib.size() - 1;
1806
71.9k
      if (SibLeaf.value(SibOfs) == y &&
1807
71.9k
          
Traits::adjacent(SibLeaf.stop(SibOfs), a)71.5k
) {
1808
44.8k
        // This insertion will coalesce with the last entry in SibLeaf. We can
1809
44.8k
        // handle it in two ways:
1810
44.8k
        //  1. Extend SibLeaf.stop to b and be done, or
1811
44.8k
        //  2. Extend a to SibLeaf, erase the SibLeaf entry and continue.
1812
44.8k
        // We prefer 1., but need 2 when coalescing to the right as well.
1813
44.8k
        Leaf &CurLeaf = P.leaf<Leaf>();
1814
44.8k
        P.moveLeft(P.height());
1815
44.8k
        if (Traits::stopLess(b, CurLeaf.start(0)) &&
1816
44.8k
            (y != CurLeaf.value(0) || 
!Traits::adjacent(b, CurLeaf.start(0))44.6k
)) {
1817
25.6k
          // Easy, just extend SibLeaf and we're done.
1818
25.6k
          setNodeStop(P.height(), SibLeaf.stop(SibOfs) = b);
1819
25.6k
          return;
1820
25.6k
        } else {
1821
19.1k
          // We have both left and right coalescing. Erase the old SibLeaf entry
1822
19.1k
          // and continue inserting the larger interval.
1823
19.1k
          a = SibLeaf.start(SibOfs);
1824
19.1k
          treeErase(/* UpdateRoot= */false);
1825
19.1k
        }
1826
44.8k
      }
1827
71.9k
    } else {
1828
663
      // No left sibling means we are at begin(). Update cached bound.
1829
663
      this->map->rootBranchStart() = a;
1830
663
    }
1831
72.6k
  }
1832
625k
1833
625k
  // When we are inserting at the end of a leaf node, we must update stops.
1834
625k
  unsigned Size = P.leafSize();
1835
600k
  bool Grow = P.leafOffset() == Size;
1836
600k
  Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), Size, a, b, y);
1837
600k
1838
600k
  // Leaf insertion unsuccessful? Overflow and try again.
1839
600k
  if (Size > Leaf::Capacity) {
1840
25.6k
    overflow<Leaf>(P.height());
1841
25.6k
    Grow = P.leafOffset() == P.leafSize();
1842
25.6k
    Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), P.leafSize(), a, b, y);
1843
25.6k
    assert(Size <= Leaf::Capacity && "overflow() didn't make room");
1844
25.6k
  }
1845
600k
1846
600k
  // Inserted, update offset and leaf size.
1847
600k
  P.setSize(P.height(), Size);
1848
600k
1849
600k
  // Insert was the last node entry, update stops.
1850
600k
  if (Grow)
1851
39.0k
    setNodeStop(P.height(), b);
1852
600k
}
1853
1854
/// erase - erase the current interval and move to the next position.
1855
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1856
void IntervalMap<KeyT, ValT, N, Traits>::
1857
1.36M
iterator::erase() {
1858
1.36M
  IntervalMap &IM = *this->map;
1859
1.36M
  IntervalMapImpl::Path &P = this->path;
1860
1.36M
  assert(P.valid() && "Cannot erase end()");
1861
1.36M
  if (this->branched())
1862
406k
    return treeErase();
1863
955k
  IM.rootLeaf().erase(P.leafOffset(), IM.rootSize);
1864
955k
  P.setSize(0, --IM.rootSize);
1865
955k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::erase()
Line
Count
Source
1857
3
iterator::erase() {
1858
3
  IntervalMap &IM = *this->map;
1859
3
  IntervalMapImpl::Path &P = this->path;
1860
3
  assert(P.valid() && "Cannot erase end()");
1861
3
  if (this->branched())
1862
0
    return treeErase();
1863
3
  IM.rootLeaf().erase(P.leafOffset(), IM.rootSize);
1864
3
  P.setSize(0, --IM.rootSize);
1865
3
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::erase()
Line
Count
Source
1857
1.36M
iterator::erase() {
1858
1.36M
  IntervalMap &IM = *this->map;
1859
1.36M
  IntervalMapImpl::Path &P = this->path;
1860
1.36M
  assert(P.valid() && "Cannot erase end()");
1861
1.36M
  if (this->branched())
1862
406k
    return treeErase();
1863
955k
  IM.rootLeaf().erase(P.leafOffset(), IM.rootSize);
1864
955k
  P.setSize(0, --IM.rootSize);
1865
955k
}
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::erase()
1866
1867
/// treeErase - erase() for a branched tree.
1868
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1869
void IntervalMap<KeyT, ValT, N, Traits>::
1870
425k
iterator::treeErase(bool UpdateRoot) {
1871
425k
  IntervalMap &IM = *this->map;
1872
425k
  IntervalMapImpl::Path &P = this->path;
1873
425k
  Leaf &Node = P.leaf<Leaf>();
1874
425k
1875
425k
  // Nodes are not allowed to become empty.
1876
425k
  if (P.leafSize() == 1) {
1877
34.4k
    IM.deleteNode(&Node);
1878
34.4k
    eraseNode(IM.height);
1879
34.4k
    // Update rootBranchStart if we erased begin().
1880
34.4k
    if (UpdateRoot && 
IM.branched()33.1k
&&
P.valid()23.1k
&&
P.atBegin()20.7k
)
1881
17.5k
      IM.rootBranchStart() = P.leaf<Leaf>().start(0);
1882
34.4k
    return;
1883
34.4k
  }
1884
391k
1885
391k
  // Erase current entry.
1886
391k
  Node.erase(P.leafOffset(), P.leafSize());
1887
391k
  unsigned NewSize = P.leafSize() - 1;
1888
391k
  P.setSize(IM.height, NewSize);
1889
391k
  // When we erase the last entry, update stop and move to a legal position.
1890
391k
  if (P.leafOffset() == NewSize) {
1891
75.2k
    setNodeStop(IM.height, Node.stop(NewSize - 1));
1892
75.2k
    P.moveRight(IM.height);
1893
316k
  } else if (UpdateRoot && P.atBegin())
1894
154k
    IM.rootBranchStart() = P.leaf<Leaf>().start(0);
1895
391k
}
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::treeErase(bool)
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::treeErase(bool)
Line
Count
Source
1870
406k
iterator::treeErase(bool UpdateRoot) {
1871
406k
  IntervalMap &IM = *this->map;
1872
406k
  IntervalMapImpl::Path &P = this->path;
1873
406k
  Leaf &Node = P.leaf<Leaf>();
1874
406k
1875
406k
  // Nodes are not allowed to become empty.
1876
406k
  if (P.leafSize() == 1) {
1877
33.1k
    IM.deleteNode(&Node);
1878
33.1k
    eraseNode(IM.height);
1879
33.1k
    // Update rootBranchStart if we erased begin().
1880
33.1k
    if (UpdateRoot && IM.branched() && 
P.valid()23.1k
&&
P.atBegin()20.7k
)
1881
17.5k
      IM.rootBranchStart() = P.leaf<Leaf>().start(0);
1882
33.1k
    return;
1883
33.1k
  }
1884
373k
1885
373k
  // Erase current entry.
1886
373k
  Node.erase(P.leafOffset(), P.leafSize());
1887
373k
  unsigned NewSize = P.leafSize() - 1;
1888
373k
  P.setSize(IM.height, NewSize);
1889
373k
  // When we erase the last entry, update stop and move to a legal position.
1890
373k
  if (P.leafOffset() == NewSize) {
1891
57.3k
    setNodeStop(IM.height, Node.stop(NewSize - 1));
1892
57.3k
    P.moveRight(IM.height);
1893
316k
  } else if (UpdateRoot && P.atBegin())
1894
154k
    IM.rootBranchStart() = P.leaf<Leaf>().start(0);
1895
373k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::treeErase(bool)
Line
Count
Source
1870
19.1k
iterator::treeErase(bool UpdateRoot) {
1871
19.1k
  IntervalMap &IM = *this->map;
1872
19.1k
  IntervalMapImpl::Path &P = this->path;
1873
19.1k
  Leaf &Node = P.leaf<Leaf>();
1874
19.1k
1875
19.1k
  // Nodes are not allowed to become empty.
1876
19.1k
  if (P.leafSize() == 1) {
1877
1.29k
    IM.deleteNode(&Node);
1878
1.29k
    eraseNode(IM.height);
1879
1.29k
    // Update rootBranchStart if we erased begin().
1880
1.29k
    if (UpdateRoot && 
IM.branched()0
&&
P.valid()0
&&
P.atBegin()0
)
1881
0
      IM.rootBranchStart() = P.leaf<Leaf>().start(0);
1882
1.29k
    return;
1883
1.29k
  }
1884
17.8k
1885
17.8k
  // Erase current entry.
1886
17.8k
  Node.erase(P.leafOffset(), P.leafSize());
1887
17.8k
  unsigned NewSize = P.leafSize() - 1;
1888
17.8k
  P.setSize(IM.height, NewSize);
1889
17.8k
  // When we erase the last entry, update stop and move to a legal position.
1890
17.8k
  if (P.leafOffset() == NewSize) {
1891
17.8k
    setNodeStop(IM.height, Node.stop(NewSize - 1));
1892
17.8k
    P.moveRight(IM.height);
1893
17.8k
  } else 
if (0
UpdateRoot0
&&
P.atBegin()0
)
1894
0
    IM.rootBranchStart() = P.leaf<Leaf>().start(0);
1895
17.8k
}
1896
1897
/// eraseNode - Erase the current node at Level from its parent and move path to
1898
/// the first entry of the next sibling node.
1899
/// The node must be deallocated by the caller.
1900
/// @param Level 1..height, the root node cannot be erased.
1901
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1902
void IntervalMap<KeyT, ValT, N, Traits>::
1903
34.6k
iterator::eraseNode(unsigned Level) {
1904
34.6k
  assert(Level && "Cannot erase root node");
1905
34.6k
  IntervalMap &IM = *this->map;
1906
34.6k
  IntervalMapImpl::Path &P = this->path;
1907
34.6k
1908
34.6k
  if (--Level == 0) {
1909
31.9k
    IM.rootBranch().erase(P.offset(0), IM.rootSize);
1910
31.9k
    P.setSize(0, --IM.rootSize);
1911
31.9k
    // If this cleared the root, switch to height=0.
1912
31.9k
    if (IM.empty()) {
1913
10.0k
      IM.switchRootToLeaf();
1914
10.0k
      this->setRoot(0);
1915
10.0k
      return;
1916
10.0k
    }
1917
2.64k
  } else {
1918
2.64k
    // Remove node ref from branch node at Level.
1919
2.64k
    Branch &Parent = P.node<Branch>(Level);
1920
2.64k
    if (P.size(Level) == 1) {
1921
218
      // Branch node became empty, remove it recursively.
1922
218
      IM.deleteNode(&Parent);
1923
218
      eraseNode(Level);
1924
2.42k
    } else {
1925
2.42k
      // Branch node won't become empty.
1926
2.42k
      Parent.erase(P.offset(Level), P.size(Level));
1927
2.42k
      unsigned NewSize = P.size(Level) - 1;
1928
2.42k
      P.setSize(Level, NewSize);
1929
2.42k
      // If we removed the last branch, update stop and move to a legal pos.
1930
2.42k
      if (P.offset(Level) == NewSize) {
1931
92
        setNodeStop(Level, Parent.stop(NewSize - 1));
1932
92
        P.moveRight(Level);
1933
92
      }
1934
2.42k
    }
1935
2.64k
  }
1936
34.6k
  // Update path cache for the new right sibling position.
1937
34.6k
  
if (24.6k
P.valid()24.6k
) {
1938
22.1k
    P.reset(Level + 1);
1939
22.1k
    P.offset(Level + 1) = 0;
1940
22.1k
  }
1941
24.6k
}
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::eraseNode(unsigned int)
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::eraseNode(unsigned int)
Line
Count
Source
1903
33.3k
iterator::eraseNode(unsigned Level) {
1904
33.3k
  assert(Level && "Cannot erase root node");
1905
33.3k
  IntervalMap &IM = *this->map;
1906
33.3k
  IntervalMapImpl::Path &P = this->path;
1907
33.3k
1908
33.3k
  if (--Level == 0) {
1909
30.9k
    IM.rootBranch().erase(P.offset(0), IM.rootSize);
1910
30.9k
    P.setSize(0, --IM.rootSize);
1911
30.9k
    // If this cleared the root, switch to height=0.
1912
30.9k
    if (IM.empty()) {
1913
10.0k
      IM.switchRootToLeaf();
1914
10.0k
      this->setRoot(0);
1915
10.0k
      return;
1916
10.0k
    }
1917
2.40k
  } else {
1918
2.40k
    // Remove node ref from branch node at Level.
1919
2.40k
    Branch &Parent = P.node<Branch>(Level);
1920
2.40k
    if (P.size(Level) == 1) {
1921
214
      // Branch node became empty, remove it recursively.
1922
214
      IM.deleteNode(&Parent);
1923
214
      eraseNode(Level);
1924
2.18k
    } else {
1925
2.18k
      // Branch node won't become empty.
1926
2.18k
      Parent.erase(P.offset(Level), P.size(Level));
1927
2.18k
      unsigned NewSize = P.size(Level) - 1;
1928
2.18k
      P.setSize(Level, NewSize);
1929
2.18k
      // If we removed the last branch, update stop and move to a legal pos.
1930
2.18k
      if (P.offset(Level) == NewSize) {
1931
49
        setNodeStop(Level, Parent.stop(NewSize - 1));
1932
49
        P.moveRight(Level);
1933
49
      }
1934
2.18k
    }
1935
2.40k
  }
1936
33.3k
  // Update path cache for the new right sibling position.
1937
33.3k
  
if (23.3k
P.valid()23.3k
) {
1938
20.8k
    P.reset(Level + 1);
1939
20.8k
    P.offset(Level + 1) = 0;
1940
20.8k
  }
1941
23.3k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::eraseNode(unsigned int)
Line
Count
Source
1903
1.29k
iterator::eraseNode(unsigned Level) {
1904
1.29k
  assert(Level && "Cannot erase root node");
1905
1.29k
  IntervalMap &IM = *this->map;
1906
1.29k
  IntervalMapImpl::Path &P = this->path;
1907
1.29k
1908
1.29k
  if (--Level == 0) {
1909
1.06k
    IM.rootBranch().erase(P.offset(0), IM.rootSize);
1910
1.06k
    P.setSize(0, --IM.rootSize);
1911
1.06k
    // If this cleared the root, switch to height=0.
1912
1.06k
    if (IM.empty()) {
1913
0
      IM.switchRootToLeaf();
1914
0
      this->setRoot(0);
1915
0
      return;
1916
0
    }
1917
237
  } else {
1918
237
    // Remove node ref from branch node at Level.
1919
237
    Branch &Parent = P.node<Branch>(Level);
1920
237
    if (P.size(Level) == 1) {
1921
4
      // Branch node became empty, remove it recursively.
1922
4
      IM.deleteNode(&Parent);
1923
4
      eraseNode(Level);
1924
233
    } else {
1925
233
      // Branch node won't become empty.
1926
233
      Parent.erase(P.offset(Level), P.size(Level));
1927
233
      unsigned NewSize = P.size(Level) - 1;
1928
233
      P.setSize(Level, NewSize);
1929
233
      // If we removed the last branch, update stop and move to a legal pos.
1930
233
      if (P.offset(Level) == NewSize) {
1931
43
        setNodeStop(Level, Parent.stop(NewSize - 1));
1932
43
        P.moveRight(Level);
1933
43
      }
1934
233
    }
1935
237
  }
1936
1.29k
  // Update path cache for the new right sibling position.
1937
1.29k
  if (P.valid()) {
1938
1.29k
    P.reset(Level + 1);
1939
1.29k
    P.offset(Level + 1) = 0;
1940
1.29k
  }
1941
1.29k
}
1942
1943
/// overflow - Distribute entries of the current node evenly among
1944
/// its siblings and ensure that the current node is not full.
1945
/// This may require allocating a new node.
1946
/// @tparam NodeT The type of node at Level (Leaf or Branch).
1947
/// @param Level path index of the overflowing node.
1948
/// @return True when the tree height was changed.
1949
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1950
template <typename NodeT>
1951
bool IntervalMap<KeyT, ValT, N, Traits>::
1952
1.11M
iterator::overflow(unsigned Level) {
1953
1.11M
  using namespace IntervalMapImpl;
1954
1.11M
  Path &P = this->path;
1955
1.11M
  unsigned CurSize[4];
1956
1.11M
  NodeT *Node[4];
1957
1.11M
  unsigned Nodes = 0;
1958
1.11M
  unsigned Elements = 0;
1959
1.11M
  unsigned Offset = P.offset(Level);
1960
1.11M
1961
1.11M
  // Do we have a left sibling?
1962
1.11M
  NodeRef LeftSib = P.getLeftSibling(Level);
1963
1.11M
  if (LeftSib) {
1964
943k
    Offset += Elements = CurSize[Nodes] = LeftSib.size();
1965
943k
    Node[Nodes++] = &LeftSib.get<NodeT>();
1966
943k
  }
1967
1.11M
1968
1.11M
  // Current node.
1969
1.11M
  Elements += CurSize[Nodes] = P.size(Level);
1970
1.11M
  Node[Nodes++] = &P.node<NodeT>(Level);
1971
1.11M
1972
1.11M
  // Do we have a right sibling?
1973
1.11M
  NodeRef RightSib = P.getRightSibling(Level);
1974
1.11M
  if (RightSib) {
1975
495k
    Elements += CurSize[Nodes] = RightSib.size();
1976
495k
    Node[Nodes++] = &RightSib.get<NodeT>();
1977
495k
  }
1978
1.11M
1979
1.11M
  // Do we need to allocate a new node?
1980
1.11M
  unsigned NewNode = 0;
1981
1.11M
  if (Elements + 1 > Nodes * NodeT::Capacity) {
1982
383k
    // Insert NewNode at the penultimate position, or after a single node.
1983
383k
    NewNode = Nodes == 1 ? 
17.65k
:
Nodes - 1376k
;
1984
383k
    CurSize[Nodes] = CurSize[NewNode];
1985
383k
    Node[Nodes] = Node[NewNode];
1986
383k
    CurSize[NewNode] = 0;
1987
383k
    Node[NewNode] = this->map->template newNode<NodeT>();
1988
383k
    ++Nodes;
1989
383k
  }
1990
1.11M
1991
1.11M
  // Compute the new element distribution.
1992
1.11M
  unsigned NewSize[4];
1993
1.11M
  IdxPair NewOffset = distribute(Nodes, Elements, NodeT::Capacity,
1994
1.11M
                                 CurSize, NewSize, Offset, true);
1995
1.11M
  adjustSiblingSizes(Node, Nodes, CurSize, NewSize);
1996
1.11M
1997
1.11M
  // Move current location to the leftmost node.
1998
1.11M
  if (LeftSib)
1999
943k
    P.moveLeft(Level);
2000
1.11M
2001
1.11M
  // Elements have been rearranged, now update node sizes and stops.
2002
1.11M
  bool SplitRoot = false;
2003
1.11M
  unsigned Pos = 0;
2004
2.94M
  while (true) {
2005
2.94M
    KeyT Stop = Node[Pos]->stop(NewSize[Pos]-1);
2006
2.94M
    if (NewNode && 
Pos == NewNode1.21M
) {
2007
383k
      SplitRoot = insertNode(Level, NodeRef(Node[Pos], NewSize[Pos]), Stop);
2008
383k
      Level += SplitRoot;
2009
2.55M
    } else {
2010
2.55M
      P.setSize(Level, NewSize[Pos]);
2011
2.55M
      setNodeStop(Level, Stop);
2012
2.55M
    }
2013
2.94M
    if (Pos + 1 == Nodes)
2014
1.11M
      break;
2015
1.82M
    P.moveRight(Level);
2016
1.82M
    ++Pos;
2017
1.82M
  }
2018
1.11M
2019
1.11M
  // Where was I? Find NewOffset.
2020
1.73M
  while(Pos != NewOffset.first) {
2021
618k
    P.moveLeft(Level);
2022
618k
    --Pos;
2023
618k
  }
2024
1.11M
  P.offset(Level) = NewOffset.second;
2025
1.11M
  return SplitRoot;
2026
1.11M
}
Unexecuted instantiation: bool llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::overflow<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int)
Unexecuted instantiation: bool llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::overflow<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int)
bool llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::overflow<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int)
Line
Count
Source
1952
1.06M
iterator::overflow(unsigned Level) {
1953
1.06M
  using namespace IntervalMapImpl;
1954
1.06M
  Path &P = this->path;
1955
1.06M
  unsigned CurSize[4];
1956
1.06M
  NodeT *Node[4];
1957
1.06M
  unsigned Nodes = 0;
1958
1.06M
  unsigned Elements = 0;
1959
1.06M
  unsigned Offset = P.offset(Level);
1960
1.06M
1961
1.06M
  // Do we have a left sibling?
1962
1.06M
  NodeRef LeftSib = P.getLeftSibling(Level);
1963
1.06M
  if (LeftSib) {
1964
906k
    Offset += Elements = CurSize[Nodes] = LeftSib.size();
1965
906k
    Node[Nodes++] = &LeftSib.get<NodeT>();
1966
906k
  }
1967
1.06M
1968
1.06M
  // Current node.
1969
1.06M
  Elements += CurSize[Nodes] = P.size(Level);
1970
1.06M
  Node[Nodes++] = &P.node<NodeT>(Level);
1971
1.06M
1972
1.06M
  // Do we have a right sibling?
1973
1.06M
  NodeRef RightSib = P.getRightSibling(Level);
1974
1.06M
  if (RightSib) {
1975
479k
    Elements += CurSize[Nodes] = RightSib.size();
1976
479k
    Node[Nodes++] = &RightSib.get<NodeT>();
1977
479k
  }
1978
1.06M
1979
1.06M
  // Do we need to allocate a new node?
1980
1.06M
  unsigned NewNode = 0;
1981
1.06M
  if (Elements + 1 > Nodes * NodeT::Capacity) {
1982
367k
    // Insert NewNode at the penultimate position, or after a single node.
1983
367k
    NewNode = Nodes == 1 ? 
13.05k
:
Nodes - 1364k
;
1984
367k
    CurSize[Nodes] = CurSize[NewNode];
1985
367k
    Node[Nodes] = Node[NewNode];
1986
367k
    CurSize[NewNode] = 0;
1987
367k
    Node[NewNode] = this->map->template newNode<NodeT>();
1988
367k
    ++Nodes;
1989
367k
  }
1990
1.06M
1991
1.06M
  // Compute the new element distribution.
1992
1.06M
  unsigned NewSize[4];
1993
1.06M
  IdxPair NewOffset = distribute(Nodes, Elements, NodeT::Capacity,
1994
1.06M
                                 CurSize, NewSize, Offset, true);
1995
1.06M
  adjustSiblingSizes(Node, Nodes, CurSize, NewSize);
1996
1.06M
1997
1.06M
  // Move current location to the leftmost node.
1998
1.06M
  if (LeftSib)
1999
906k
    P.moveLeft(Level);
2000
1.06M
2001
1.06M
  // Elements have been rearranged, now update node sizes and stops.
2002
1.06M
  bool SplitRoot = false;
2003
1.06M
  unsigned Pos = 0;
2004
2.82M
  while (true) {
2005
2.82M
    KeyT Stop = Node[Pos]->stop(NewSize[Pos]-1);
2006
2.82M
    if (NewNode && 
Pos == NewNode1.16M
) {
2007
367k
      SplitRoot = insertNode(Level, NodeRef(Node[Pos], NewSize[Pos]), Stop);
2008
367k
      Level += SplitRoot;
2009
2.45M
    } else {
2010
2.45M
      P.setSize(Level, NewSize[Pos]);
2011
2.45M
      setNodeStop(Level, Stop);
2012
2.45M
    }
2013
2.82M
    if (Pos + 1 == Nodes)
2014
1.06M
      break;
2015
1.75M
    P.moveRight(Level);
2016
1.75M
    ++Pos;
2017
1.75M
  }
2018
1.06M
2019
1.06M
  // Where was I? Find NewOffset.
2020
1.66M
  while(Pos != NewOffset.first) {
2021
596k
    P.moveLeft(Level);
2022
596k
    --Pos;
2023
596k
  }
2024
1.06M
  P.offset(Level) = NewOffset.second;
2025
1.06M
  return SplitRoot;
2026
1.06M
}
bool llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::overflow<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int)
Line
Count
Source
1952
23.0k
iterator::overflow(unsigned Level) {
1953
23.0k
  using namespace IntervalMapImpl;
1954
23.0k
  Path &P = this->path;
1955
23.0k
  unsigned CurSize[4];
1956
23.0k
  NodeT *Node[4];
1957
23.0k
  unsigned Nodes = 0;
1958
23.0k
  unsigned Elements = 0;
1959
23.0k
  unsigned Offset = P.offset(Level);
1960
23.0k
1961
23.0k
  // Do we have a left sibling?
1962
23.0k
  NodeRef LeftSib = P.getLeftSibling(Level);
1963
23.0k
  if (LeftSib) {
1964
15.9k
    Offset += Elements = CurSize[Nodes] = LeftSib.size();
1965
15.9k
    Node[Nodes++] = &LeftSib.get<NodeT>();
1966
15.9k
  }
1967
23.0k
1968
23.0k
  // Current node.
1969
23.0k
  Elements += CurSize[Nodes] = P.size(Level);
1970
23.0k
  Node[Nodes++] = &P.node<NodeT>(Level);
1971
23.0k
1972
23.0k
  // Do we have a right sibling?
1973
23.0k
  NodeRef RightSib = P.getRightSibling(Level);
1974
23.0k
  if (RightSib) {
1975
5.27k
    Elements += CurSize[Nodes] = RightSib.size();
1976
5.27k
    Node[Nodes++] = &RightSib.get<NodeT>();
1977
5.27k
  }
1978
23.0k
1979
23.0k
  // Do we need to allocate a new node?
1980
23.0k
  unsigned NewNode = 0;
1981
23.0k
  if (Elements + 1 > Nodes * NodeT::Capacity) {
1982
10.0k
    // Insert NewNode at the penultimate position, or after a single node.
1983
10.0k
    NewNode = Nodes == 1 ? 
14.52k
:
Nodes - 15.49k
;
1984
10.0k
    CurSize[Nodes] = CurSize[NewNode];
1985
10.0k
    Node[Nodes] = Node[NewNode];
1986
10.0k
    CurSize[NewNode] = 0;
1987
10.0k
    Node[NewNode] = this->map->template newNode<NodeT>();
1988
10.0k
    ++Nodes;
1989
10.0k
  }
1990
23.0k
1991
23.0k
  // Compute the new element distribution.
1992
23.0k
  unsigned NewSize[4];
1993
23.0k
  IdxPair NewOffset = distribute(Nodes, Elements, NodeT::Capacity,
1994
23.0k
                                 CurSize, NewSize, Offset, true);
1995
23.0k
  adjustSiblingSizes(Node, Nodes, CurSize, NewSize);
1996
23.0k
1997
23.0k
  // Move current location to the leftmost node.
1998
23.0k
  if (LeftSib)
1999
15.9k
    P.moveLeft(Level);
2000
23.0k
2001
23.0k
  // Elements have been rearranged, now update node sizes and stops.
2002
23.0k
  bool SplitRoot = false;
2003
23.0k
  unsigned Pos = 0;
2004
54.3k
  while (true) {
2005
54.3k
    KeyT Stop = Node[Pos]->stop(NewSize[Pos]-1);
2006
54.3k
    if (NewNode && 
Pos == NewNode26.0k
) {
2007
10.0k
      SplitRoot = insertNode(Level, NodeRef(Node[Pos], NewSize[Pos]), Stop);
2008
10.0k
      Level += SplitRoot;
2009
44.2k
    } else {
2010
44.2k
      P.setSize(Level, NewSize[Pos]);
2011
44.2k
      setNodeStop(Level, Stop);
2012
44.2k
    }
2013
54.3k
    if (Pos + 1 == Nodes)
2014
23.0k
      break;
2015
31.2k
    P.moveRight(Level);
2016
31.2k
    ++Pos;
2017
31.2k
  }
2018
23.0k
2019
23.0k
  // Where was I? Find NewOffset.
2020
30.7k
  while(Pos != NewOffset.first) {
2021
7.67k
    P.moveLeft(Level);
2022
7.67k
    --Pos;
2023
7.67k
  }
2024
23.0k
  P.offset(Level) = NewOffset.second;
2025
23.0k
  return SplitRoot;
2026
23.0k
}
bool llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::overflow<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int)
Line
Count
Source
1952
25.6k
iterator::overflow(unsigned Level) {
1953
25.6k
  using namespace IntervalMapImpl;
1954
25.6k
  Path &P = this->path;
1955
25.6k
  unsigned CurSize[4];
1956
25.6k
  NodeT *Node[4];
1957
25.6k
  unsigned Nodes = 0;
1958
25.6k
  unsigned Elements = 0;
1959
25.6k
  unsigned Offset = P.offset(Level);
1960
25.6k
1961
25.6k
  // Do we have a left sibling?
1962
25.6k
  NodeRef LeftSib = P.getLeftSibling(Level);
1963
25.6k
  if (LeftSib) {
1964
21.0k
    Offset += Elements = CurSize[Nodes] = LeftSib.size();
1965
21.0k
    Node[Nodes++] = &LeftSib.get<NodeT>();
1966
21.0k
  }
1967
25.6k
1968
25.6k
  // Current node.
1969
25.6k
  Elements += CurSize[Nodes] = P.size(Level);
1970
25.6k
  Node[Nodes++] = &P.node<NodeT>(Level);
1971
25.6k
1972
25.6k
  // Do we have a right sibling?
1973
25.6k
  NodeRef RightSib = P.getRightSibling(Level);
1974
25.6k
  if (RightSib) {
1975
11.0k
    Elements += CurSize[Nodes] = RightSib.size();
1976
11.0k
    Node[Nodes++] = &RightSib.get<NodeT>();
1977
11.0k
  }
1978
25.6k
1979
25.6k
  // Do we need to allocate a new node?
1980
25.6k
  unsigned NewNode = 0;
1981
25.6k
  if (Elements + 1 > Nodes * NodeT::Capacity) {
1982
6.10k
    // Insert NewNode at the penultimate position, or after a single node.
1983
6.10k
    NewNode = Nodes == 1 ? 
117
:
Nodes - 16.09k
;
1984
6.10k
    CurSize[Nodes] = CurSize[NewNode];
1985
6.10k
    Node[Nodes] = Node[NewNode];
1986
6.10k
    CurSize[NewNode] = 0;
1987
6.10k
    Node[NewNode] = this->map->template newNode<NodeT>();
1988
6.10k
    ++Nodes;
1989
6.10k
  }
1990
25.6k
1991
25.6k
  // Compute the new element distribution.
1992
25.6k
  unsigned NewSize[4];
1993
25.6k
  IdxPair NewOffset = distribute(Nodes, Elements, NodeT::Capacity,
1994
25.6k
                                 CurSize, NewSize, Offset, true);
1995
25.6k
  adjustSiblingSizes(Node, Nodes, CurSize, NewSize);
1996
25.6k
1997
25.6k
  // Move current location to the leftmost node.
1998
25.6k
  if (LeftSib)
1999
21.0k
    P.moveLeft(Level);
2000
25.6k
2001
25.6k
  // Elements have been rearranged, now update node sizes and stops.
2002
25.6k
  bool SplitRoot = false;
2003
25.6k
  unsigned Pos = 0;
2004
63.8k
  while (true) {
2005
63.8k
    KeyT Stop = Node[Pos]->stop(NewSize[Pos]-1);
2006
63.8k
    if (NewNode && 
Pos == NewNode19.1k
) {
2007
6.10k
      SplitRoot = insertNode(Level, NodeRef(Node[Pos], NewSize[Pos]), Stop);
2008
6.10k
      Level += SplitRoot;
2009
57.6k
    } else {
2010
57.6k
      P.setSize(Level, NewSize[Pos]);
2011
57.6k
      setNodeStop(Level, Stop);
2012
57.6k
    }
2013
63.8k
    if (Pos + 1 == Nodes)
2014
25.6k
      break;
2015
38.1k
    P.moveRight(Level);
2016
38.1k
    ++Pos;
2017
38.1k
  }
2018
25.6k
2019
25.6k
  // Where was I? Find NewOffset.
2020
39.8k
  while(Pos != NewOffset.first) {
2021
14.2k
    P.moveLeft(Level);
2022
14.2k
    --Pos;
2023
14.2k
  }
2024
25.6k
  P.offset(Level) = NewOffset.second;
2025
25.6k
  return SplitRoot;
2026
25.6k
}
bool llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::overflow<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int)
Line
Count
Source
1952
106
iterator::overflow(unsigned Level) {
1953
106
  using namespace IntervalMapImpl;
1954
106
  Path &P = this->path;
1955
106
  unsigned CurSize[4];
1956
106
  NodeT *Node[4];
1957
106
  unsigned Nodes = 0;
1958
106
  unsigned Elements = 0;
1959
106
  unsigned Offset = P.offset(Level);
1960
106
1961
106
  // Do we have a left sibling?
1962
106
  NodeRef LeftSib = P.getLeftSibling(Level);
1963
106
  if (LeftSib) {
1964
39
    Offset += Elements = CurSize[Nodes] = LeftSib.size();
1965
39
    Node[Nodes++] = &LeftSib.get<NodeT>();
1966
39
  }
1967
106
1968
106
  // Current node.
1969
106
  Elements += CurSize[Nodes] = P.size(Level);
1970
106
  Node[Nodes++] = &P.node<NodeT>(Level);
1971
106
1972
106
  // Do we have a right sibling?
1973
106
  NodeRef RightSib = P.getRightSibling(Level);
1974
106
  if (RightSib) {
1975
16
    Elements += CurSize[Nodes] = RightSib.size();
1976
16
    Node[Nodes++] = &RightSib.get<NodeT>();
1977
16
  }
1978
106
1979
106
  // Do we need to allocate a new node?
1980
106
  unsigned NewNode = 0;
1981
106
  if (Elements + 1 > Nodes * NodeT::Capacity) {
1982
69
    // Insert NewNode at the penultimate position, or after a single node.
1983
69
    NewNode = Nodes == 1 ? 
154
:
Nodes - 115
;
1984
69
    CurSize[Nodes] = CurSize[NewNode];
1985
69
    Node[Nodes] = Node[NewNode];
1986
69
    CurSize[NewNode] = 0;
1987
69
    Node[NewNode] = this->map->template newNode<NodeT>();
1988
69
    ++Nodes;
1989
69
  }
1990
106
1991
106
  // Compute the new element distribution.
1992
106
  unsigned NewSize[4];
1993
106
  IdxPair NewOffset = distribute(Nodes, Elements, NodeT::Capacity,
1994
106
                                 CurSize, NewSize, Offset, true);
1995
106
  adjustSiblingSizes(Node, Nodes, CurSize, NewSize);
1996
106
1997
106
  // Move current location to the leftmost node.
1998
106
  if (LeftSib)
1999
39
    P.moveLeft(Level);
2000
106
2001
106
  // Elements have been rearranged, now update node sizes and stops.
2002
106
  bool SplitRoot = false;
2003
106
  unsigned Pos = 0;
2004
230
  while (true) {
2005
230
    KeyT Stop = Node[Pos]->stop(NewSize[Pos]-1);
2006
230
    if (NewNode && 
Pos == NewNode154
) {
2007
69
      SplitRoot = insertNode(Level, NodeRef(Node[Pos], NewSize[Pos]), Stop);
2008
69
      Level += SplitRoot;
2009
161
    } else {
2010
161
      P.setSize(Level, NewSize[Pos]);
2011
161
      setNodeStop(Level, Stop);
2012
161
    }
2013
230
    if (Pos + 1 == Nodes)
2014
106
      break;
2015
124
    P.moveRight(Level);
2016
124
    ++Pos;
2017
124
  }
2018
106
2019
106
  // Where was I? Find NewOffset.
2020
144
  while(Pos != NewOffset.first) {
2021
38
    P.moveLeft(Level);
2022
38
    --Pos;
2023
38
  }
2024
106
  P.offset(Level) = NewOffset.second;
2025
106
  return SplitRoot;
2026
106
}
2027
2028
//===----------------------------------------------------------------------===//
2029
//---                       IntervalMapOverlaps                           ----//
2030
//===----------------------------------------------------------------------===//
2031
2032
/// IntervalMapOverlaps - Iterate over the overlaps of mapped intervals in two
2033
/// IntervalMaps. The maps may be different, but the KeyT and Traits types
2034
/// should be the same.
2035
///
2036
/// Typical uses:
2037
///
2038
/// 1. Test for overlap:
2039
///    bool overlap = IntervalMapOverlaps(a, b).valid();
2040
///
2041
/// 2. Enumerate overlaps:
2042
///    for (IntervalMapOverlaps I(a, b); I.valid() ; ++I) { ... }
2043
///
2044
template <typename MapA, typename MapB>
2045
class IntervalMapOverlaps {
2046
  using KeyType = typename MapA::KeyType;
2047
  using Traits = typename MapA::KeyTraits;
2048
2049
  typename MapA::const_iterator posA;
2050
  typename MapB::const_iterator posB;
2051
2052
  /// advance - Move posA and posB forward until reaching an overlap, or until
2053
  /// either meets end.
2054
  /// Don't move the iterators if they are already overlapping.
2055
  void advance() {
2056
    if (!valid())
2057
      return;
2058
2059
    if (Traits::stopLess(posA.stop(), posB.start())) {
2060
      // A ends before B begins. Catch up.
2061
      posA.advanceTo(posB.start());
2062
      if (!posA.valid() || !Traits::stopLess(posB.stop(), posA.start()))
2063
        return;
2064
    } else if (Traits::stopLess(posB.stop(), posA.start())) {
2065
      // B ends before A begins. Catch up.
2066
      posB.advanceTo(posA.start());
2067
      if (!posB.valid() || !Traits::stopLess(posA.stop(), posB.start()))
2068
        return;
2069
    } else
2070
      // Already overlapping.
2071
      return;
2072
2073
    while (true) {
2074
      // Make a.end > b.start.
2075
      posA.advanceTo(posB.start());
2076
      if (!posA.valid() || !Traits::stopLess(posB.stop(), posA.start()))
2077
        return;
2078
      // Make b.end > a.start.
2079
      posB.advanceTo(posA.start());
2080
      if (!posB.valid() || !Traits::stopLess(posA.stop(), posB.start()))
2081
        return;
2082
    }
2083
  }
2084
2085
public:
2086
  /// IntervalMapOverlaps - Create an iterator for the overlaps of a and b.
2087
  IntervalMapOverlaps(const MapA &a, const MapB &b)
2088
    : posA(b.empty() ? a.end() : a.find(b.start())),
2089
      posB(posA.valid() ? b.find(posA.start()) : b.end()) { advance(); }
2090
2091
  /// valid - Return true if iterator is at an overlap.
2092
  bool valid() const {
2093
    return posA.valid() && posB.valid();
2094
  }
2095
2096
  /// a - access the left hand side in the overlap.
2097
  const typename MapA::const_iterator &a() const { return pos