Coverage Report

Created: 2018-12-14 11:24

/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.61M
  static inline bool startLess(const T &x, const T &a) {
168
2.61M
    return x < a;
169
2.61M
  }
llvm::IntervalMapHalfOpenInfo<llvm::SlotIndex>::startLess(llvm::SlotIndex const&, llvm::SlotIndex const&)
Line
Count
Source
167
2.61M
  static inline bool startLess(const T &x, const T &a) {
168
2.61M
    return x < a;
169
2.61M
  }
llvm::IntervalMapHalfOpenInfo<long long>::startLess(long long const&, long long const&)
Line
Count
Source
167
1.34k
  static inline bool startLess(const T &x, const T &a) {
168
1.34k
    return x < a;
169
1.34k
  }
170
171
  /// stopLess - Return true if x is not in [a;b).
172
428M
  static inline bool stopLess(const T &b, const T &x) {
173
428M
    return b <= x;
174
428M
  }
llvm::IntervalMapHalfOpenInfo<llvm::SlotIndex>::stopLess(llvm::SlotIndex const&, llvm::SlotIndex const&)
Line
Count
Source
172
427M
  static inline bool stopLess(const T &b, const T &x) {
173
427M
    return b <= x;
174
427M
  }
llvm::IntervalMapHalfOpenInfo<long long>::stopLess(long long const&, long long const&)
Line
Count
Source
172
804k
  static inline bool stopLess(const T &b, const T &x) {
173
804k
    return b <= x;
174
804k
  }
175
176
  /// adjacent - Return true when the intervals [x;a) and [b;y) can coalesce.
177
12.3M
  static inline bool adjacent(const T &a, const T &b) {
178
12.3M
    return a == b;
179
12.3M
  }
llvm::IntervalMapHalfOpenInfo<llvm::SlotIndex>::adjacent(llvm::SlotIndex const&, llvm::SlotIndex const&)
Line
Count
Source
177
11.9M
  static inline bool adjacent(const T &a, const T &b) {
178
11.9M
    return a == b;
179
11.9M
  }
llvm::IntervalMapHalfOpenInfo<long long>::adjacent(long long const&, long long const&)
Line
Count
Source
177
371k
  static inline bool adjacent(const T &a, const T &b) {
178
371k
    return a == b;
179
371k
  }
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
4.99M
            unsigned j, unsigned Count) {
236
4.99M
    assert(i + Count <= M && "Invalid source range");
237
4.99M
    assert(j + Count <= N && "Invalid dest range");
238
18.6M
    for (unsigned e = i + Count; i != e; 
++i, ++j13.6M
) {
239
13.6M
      first[j]  = Other.first[i];
240
13.6M
      second[j] = Other.second[i];
241
13.6M
    }
242
4.99M
  }
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.0k
            unsigned j, unsigned Count) {
236
49.0k
    assert(i + Count <= M && "Invalid source range");
237
49.0k
    assert(j + Count <= N && "Invalid dest range");
238
301k
    for (unsigned e = i + Count; i != e; 
++i, ++j252k
) {
239
252k
      first[j]  = Other.first[i];
240
252k
      second[j] = Other.second[i];
241
252k
    }
242
49.0k
  }
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.4k
            unsigned j, unsigned Count) {
236
31.4k
    assert(i + Count <= M && "Invalid source range");
237
31.4k
    assert(j + Count <= N && "Invalid dest range");
238
63.2k
    for (unsigned e = i + Count; i != e; 
++i, ++j31.8k
) {
239
31.8k
      first[j]  = Other.first[i];
240
31.8k
      second[j] = Other.second[i];
241
31.8k
    }
242
31.4k
  }
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.53M
            unsigned j, unsigned Count) {
236
4.53M
    assert(i + Count <= M && "Invalid source range");
237
4.53M
    assert(j + Count <= N && "Invalid dest range");
238
16.9M
    for (unsigned e = i + Count; i != e; 
++i, ++j12.4M
) {
239
12.4M
      first[j]  = Other.first[i];
240
12.4M
      second[j] = Other.second[i];
241
12.4M
    }
242
4.53M
  }
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.48k
            unsigned j, unsigned Count) {
236
6.48k
    assert(i + Count <= M && "Invalid source range");
237
6.48k
    assert(j + Count <= N && "Invalid dest range");
238
77.7k
    for (unsigned e = i + Count; i != e; 
++i, ++j71.3k
) {
239
71.3k
      first[j]  = Other.first[i];
240
71.3k
      second[j] = Other.second[i];
241
71.3k
    }
242
6.48k
  }
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
377k
            unsigned j, unsigned Count) {
236
377k
    assert(i + Count <= M && "Invalid source range");
237
377k
    assert(j + Count <= N && "Invalid dest range");
238
1.24M
    for (unsigned e = i + Count; i != e; 
++i, ++j865k
) {
239
865k
      first[j]  = Other.first[i];
240
865k
      second[j] = Other.second[i];
241
865k
    }
242
377k
  }
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::copy<8u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u> const&, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::copy<12u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u> const&, unsigned int, unsigned int, unsigned int)
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>::copy<11u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
235
318
            unsigned j, unsigned Count) {
236
318
    assert(i + Count <= M && "Invalid source range");
237
318
    assert(j + Count <= N && "Invalid dest range");
238
1.53k
    for (unsigned e = i + Count; i != e; 
++i, ++j1.21k
) {
239
1.21k
      first[j]  = Other.first[i];
240
1.21k
      second[j] = Other.second[i];
241
1.21k
    }
242
318
  }
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::copy<8u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u> const&, unsigned int, unsigned int, unsigned int)
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>::copy<8u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 8u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
235
105
            unsigned j, unsigned Count) {
236
105
    assert(i + Count <= M && "Invalid source range");
237
105
    assert(j + Count <= N && "Invalid dest range");
238
945
    for (unsigned e = i + Count; i != e; 
++i, ++j840
) {
239
840
      first[j]  = Other.first[i];
240
840
      second[j] = Other.second[i];
241
840
    }
242
105
  }
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 8u>::copy<8u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 8u> const&, unsigned int, unsigned int, unsigned int)
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.72M
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
2.72M
    assert(j <= i && "Use moveRight shift elements right");
250
2.72M
    copy(*this, i, j, Count);
251
2.72M
  }
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.4k
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
31.4k
    assert(j <= i && "Use moveRight shift elements right");
250
31.4k
    copy(*this, i, j, Count);
251
31.4k
  }
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.35M
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
2.35M
    assert(j <= i && "Use moveRight shift elements right");
250
2.35M
    copy(*this, i, j, Count);
251
2.35M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
248
319k
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
319k
    assert(j <= i && "Use moveRight shift elements right");
250
319k
    copy(*this, i, j, Count);
251
319k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::moveLeft(unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::moveLeft(unsigned int, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
248
48
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
249
48
    assert(j <= i && "Use moveRight shift elements right");
250
48
    copy(*this, i, j, Count);
251
48
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 8u>::moveLeft(unsigned int, unsigned int, unsigned int)
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.27M
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
8.27M
    assert(i <= j && "Use moveLeft shift elements left");
259
8.27M
    assert(j + Count <= N && "Invalid range");
260
26.2M
    while (Count--) {
261
17.9M
      first[j + Count]  = first[i + Count];
262
17.9M
      second[j + Count] = second[i + Count];
263
17.9M
    }
264
8.27M
  }
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
98.6k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
98.6k
    assert(i <= j && "Use moveLeft shift elements left");
259
98.6k
    assert(j + Count <= N && "Invalid range");
260
384k
    while (Count--) {
261
286k
      first[j + Count]  = first[i + Count];
262
286k
      second[j + Count] = second[i + Count];
263
286k
    }
264
98.6k
  }
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.46M
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
7.46M
    assert(i <= j && "Use moveLeft shift elements left");
259
7.46M
    assert(j + Count <= N && "Invalid range");
260
23.6M
    while (Count--) {
261
16.1M
      first[j + Count]  = first[i + Count];
262
16.1M
      second[j + Count] = second[i + Count];
263
16.1M
    }
264
7.46M
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
291k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
291k
    assert(i <= j && "Use moveLeft shift elements left");
259
291k
    assert(j + Count <= N && "Invalid range");
260
694k
    while (Count--) {
261
403k
      first[j + Count]  = first[i + Count];
262
403k
      second[j + Count] = second[i + Count];
263
403k
    }
264
291k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
376k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
376k
    assert(i <= j && "Use moveLeft shift elements left");
259
376k
    assert(j + Count <= N && "Invalid range");
260
1.38M
    while (Count--) {
261
1.01M
      first[j + Count]  = first[i + Count];
262
1.01M
      second[j + Count] = second[i + Count];
263
1.01M
    }
264
376k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
1.04k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
1.04k
    assert(i <= j && "Use moveLeft shift elements left");
259
1.04k
    assert(j + Count <= N && "Invalid range");
260
9.31k
    while (Count--) {
261
8.27k
      first[j + Count]  = first[i + Count];
262
8.27k
      second[j + Count] = second[i + Count];
263
8.27k
    }
264
1.04k
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
97
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
97
    assert(i <= j && "Use moveLeft shift elements left");
259
97
    assert(j + Count <= N && "Invalid range");
260
221
    while (Count--) {
261
124
      first[j + Count]  = first[i + Count];
262
124
      second[j + Count] = second[i + Count];
263
124
    }
264
97
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::moveRight(unsigned int, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 8u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
257
43.6k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
258
43.6k
    assert(i <= j && "Use moveLeft shift elements left");
259
43.6k
    assert(j + Count <= N && "Invalid range");
260
113k
    while (Count--) {
261
69.7k
      first[j + Count]  = first[i + Count];
262
69.7k
      second[j + Count] = second[i + Count];
263
69.7k
    }
264
43.6k
  }
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.72M
  void erase(unsigned i, unsigned j, unsigned Size) {
271
2.72M
    moveLeft(j, i, Size - j);
272
2.72M
  }
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.4k
  void erase(unsigned i, unsigned j, unsigned Size) {
271
31.4k
    moveLeft(j, i, Size - j);
272
31.4k
  }
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.35M
  void erase(unsigned i, unsigned j, unsigned Size) {
271
2.35M
    moveLeft(j, i, Size - j);
272
2.35M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
270
319k
  void erase(unsigned i, unsigned j, unsigned Size) {
271
319k
    moveLeft(j, i, Size - j);
272
319k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::erase(unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::erase(unsigned int, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
270
48
  void erase(unsigned i, unsigned j, unsigned Size) {
271
48
    moveLeft(j, i, Size - j);
272
48
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 8u>::erase(unsigned int, unsigned int, unsigned int)
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.82M
  void erase(unsigned i, unsigned Size) {
278
1.82M
    erase(i, i+1, Size);
279
1.82M
  }
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.51k
  void erase(unsigned i, unsigned Size) {
278
2.51k
    erase(i, i+1, Size);
279
2.51k
  }
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.4k
  void erase(unsigned i, unsigned Size) {
278
31.4k
    erase(i, i+1, Size);
279
31.4k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::erase(unsigned int, unsigned int)
Line
Count
Source
277
1.49M
  void erase(unsigned i, unsigned Size) {
278
1.49M
    erase(i, i+1, Size);
279
1.49M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::erase(unsigned int, unsigned int)
Line
Count
Source
277
299k
  void erase(unsigned i, unsigned Size) {
278
299k
    erase(i, i+1, Size);
279
299k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::erase(unsigned int, unsigned int)
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::erase(unsigned int, unsigned int)
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>::erase(unsigned int, unsigned int)
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 8u>::erase(unsigned int, unsigned int)
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.52M
  void shift(unsigned i, unsigned Size) {
285
7.52M
    moveRight(i, i + 1, Size - i);
286
7.52M
  }
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
84.7k
  void shift(unsigned i, unsigned Size) {
285
84.7k
    moveRight(i, i + 1, Size - i);
286
84.7k
  }
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
291k
  void shift(unsigned i, unsigned Size) {
285
291k
    moveRight(i, i + 1, Size - i);
286
291k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
6.74M
  void shift(unsigned i, unsigned Size) {
285
6.74M
    moveRight(i, i + 1, Size - i);
286
6.74M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
363k
  void shift(unsigned i, unsigned Size) {
285
363k
    moveRight(i, i + 1, Size - i);
286
363k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
823
  void shift(unsigned i, unsigned Size) {
285
823
    moveRight(i, i + 1, Size - i);
286
823
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
97
  void shift(unsigned i, unsigned Size) {
285
97
    moveRight(i, i + 1, Size - i);
286
97
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::shift(unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 8u>::shift(unsigned int, unsigned int)
Line
Count
Source
284
43.6k
  void shift(unsigned i, unsigned Size) {
285
43.6k
    moveRight(i, i + 1, Size - i);
286
43.6k
  }
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
899k
                         unsigned Count) {
295
899k
    Sib.copy(*this, 0, SSize, Count);
296
899k
    erase(0, Count, Size);
297
899k
  }
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.2k
                         unsigned Count) {
295
16.2k
    Sib.copy(*this, 0, SSize, Count);
296
16.2k
    erase(0, Count, Size);
297
16.2k
  }
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
863k
                         unsigned Count) {
295
863k
    Sib.copy(*this, 0, SSize, Count);
296
863k
    erase(0, Count, Size);
297
863k
  }
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
20.0k
                         unsigned Count) {
295
20.0k
    Sib.copy(*this, 0, SSize, Count);
296
20.0k
    erase(0, Count, Size);
297
20.0k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>&, unsigned int, unsigned int)
Line
Count
Source
294
48
                         unsigned Count) {
295
48
    Sib.copy(*this, 0, SSize, Count);
296
48
    erase(0, Count, Size);
297
48
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>&, unsigned int, unsigned int)
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
746k
                          unsigned Count) {
306
746k
    Sib.moveRight(0, Count, SSize);
307
746k
    Sib.copy(*this, Size-Count, 0, Count);
308
746k
  }
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
13.9k
                          unsigned Count) {
306
13.9k
    Sib.moveRight(0, Count, SSize);
307
13.9k
    Sib.copy(*this, Size-Count, 0, Count);
308
13.9k
  }
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
719k
                          unsigned Count) {
306
719k
    Sib.moveRight(0, Count, SSize);
307
719k
    Sib.copy(*this, Size-Count, 0, Count);
308
719k
  }
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
12.8k
                          unsigned Count) {
306
12.8k
    Sib.moveRight(0, Count, SSize);
307
12.8k
    Sib.copy(*this, Size-Count, 0, Count);
308
12.8k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>&, unsigned int, unsigned int)
Line
Count
Source
305
222
                          unsigned Count) {
306
222
    Sib.moveRight(0, Count, SSize);
307
222
    Sib.copy(*this, Size-Count, 0, Count);
308
222
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>&, unsigned int, unsigned int)
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.64M
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
318
1.64M
    if (Add > 0) {
319
746k
      // We want to grow, copy from sib.
320
746k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
321
746k
      Sib.transferToRightSib(SSize, *this, Size, Count);
322
746k
      return Count;
323
899k
    } else {
324
899k
      // We want to shrink, copy to sib.
325
899k
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
326
899k
      transferToLeftSib(Size, Sib, SSize, Count);
327
899k
      return -Count;
328
899k
    }
329
1.64M
  }
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.2k
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
318
30.2k
    if (Add > 0) {
319
13.9k
      // We want to grow, copy from sib.
320
13.9k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
321
13.9k
      Sib.transferToRightSib(SSize, *this, Size, Count);
322
13.9k
      return Count;
323
16.2k
    } else {
324
16.2k
      // We want to shrink, copy to sib.
325
16.2k
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
326
16.2k
      transferToLeftSib(Size, Sib, SSize, Count);
327
16.2k
      return -Count;
328
16.2k
    }
329
30.2k
  }
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.58M
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
318
1.58M
    if (Add > 0) {
319
719k
      // We want to grow, copy from sib.
320
719k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
321
719k
      Sib.transferToRightSib(SSize, *this, Size, Count);
322
719k
      return Count;
323
863k
    } else {
324
863k
      // We want to shrink, copy to sib.
325
863k
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
326
863k
      transferToLeftSib(Size, Sib, SSize, Count);
327
863k
      return -Count;
328
863k
    }
329
1.58M
  }
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
32.9k
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
318
32.9k
    if (Add > 0) {
319
12.8k
      // We want to grow, copy from sib.
320
12.8k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
321
12.8k
      Sib.transferToRightSib(SSize, *this, Size, Count);
322
12.8k
      return Count;
323
20.0k
    } else {
324
20.0k
      // We want to shrink, copy to sib.
325
20.0k
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
326
20.0k
      transferToLeftSib(Size, Sib, SSize, Count);
327
20.0k
      return -Count;
328
20.0k
    }
329
32.9k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, UnitT, 11u>&, unsigned int, int)
Line
Count
Source
317
270
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
318
270
    if (Add > 0) {
319
222
      // We want to grow, copy from sib.
320
222
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
321
222
      Sib.transferToRightSib(SSize, *this, Size, Count);
322
222
      return Count;
323
222
    } else {
324
48
      // We want to shrink, copy to sib.
325
48
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
326
48
      transferToLeftSib(Size, Sib, SSize, Count);
327
48
      return -Count;
328
48
    }
329
270
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>&, unsigned int, int)
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.09M
                        unsigned CurSize[], const unsigned NewSize[]) {
340
1.09M
  // Move elements right.
341
2.87M
  for (int n = Nodes - 1; n; 
--n1.78M
) {
342
1.78M
    if (CurSize[n] == NewSize[n])
343
158k
      continue;
344
1.62M
    for (int m = n - 1; m != -1; 
--m0
) {
345
1.62M
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
1.62M
                                         NewSize[n] - CurSize[n]);
347
1.62M
      CurSize[m] -= d;
348
1.62M
      CurSize[n] += d;
349
1.62M
      // Keep going if the current node was exhausted.
350
1.62M
      if (CurSize[n] >= NewSize[n])
351
1.62M
          break;
352
1.62M
    }
353
1.62M
  }
354
1.09M
355
1.09M
  if (Nodes == 0)
356
0
    return;
357
1.09M
358
1.09M
  // Move elements left.
359
2.87M
  
for (unsigned n = 0; 1.09M
n != Nodes - 1;
++n1.78M
) {
360
1.78M
    if (CurSize[n] == NewSize[n])
361
1.75M
      continue;
362
23.7k
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
363
23.7k
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
364
23.7k
                                        CurSize[n] -  NewSize[n]);
365
23.7k
      CurSize[m] += d;
366
23.7k
      CurSize[n] -= d;
367
23.7k
      // Keep going if the current node was exhausted.
368
23.7k
      if (CurSize[n] >= NewSize[n])
369
23.7k
          break;
370
23.7k
    }
371
23.7k
  }
372
1.09M
373
1.09M
#ifndef NDEBUG
374
1.09M
  for (unsigned n = 0; n != Nodes; n++)
375
1.09M
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
1.09M
#endif
377
1.09M
}
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.04M
                        unsigned CurSize[], const unsigned NewSize[]) {
340
1.04M
  // Move elements right.
341
2.76M
  for (int n = Nodes - 1; n; 
--n1.71M
) {
342
1.71M
    if (CurSize[n] == NewSize[n])
343
154k
      continue;
344
1.56M
    for (int m = n - 1; m != -1; 
--m0
) {
345
1.56M
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
1.56M
                                         NewSize[n] - CurSize[n]);
347
1.56M
      CurSize[m] -= d;
348
1.56M
      CurSize[n] += d;
349
1.56M
      // Keep going if the current node was exhausted.
350
1.56M
      if (CurSize[n] >= NewSize[n])
351
1.56M
          break;
352
1.56M
    }
353
1.56M
  }
354
1.04M
355
1.04M
  if (Nodes == 0)
356
0
    return;
357
1.04M
358
1.04M
  // Move elements left.
359
2.76M
  
for (unsigned n = 0; 1.04M
n != Nodes - 1;
++n1.71M
) {
360
1.71M
    if (CurSize[n] == NewSize[n])
361
1.69M
      continue;
362
22.3k
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
363
22.3k
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
364
22.3k
                                        CurSize[n] -  NewSize[n]);
365
22.3k
      CurSize[m] += d;
366
22.3k
      CurSize[n] -= d;
367
22.3k
      // Keep going if the current node was exhausted.
368
22.3k
      if (CurSize[n] >= NewSize[n])
369
22.3k
          break;
370
22.3k
    }
371
22.3k
  }
372
1.04M
373
1.04M
#ifndef NDEBUG
374
1.04M
  for (unsigned n = 0; n != Nodes; n++)
375
1.04M
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
1.04M
#endif
377
1.04M
}
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
22.8k
                        unsigned CurSize[], const unsigned NewSize[]) {
340
22.8k
  // Move elements right.
341
53.7k
  for (int n = Nodes - 1; n; 
--n30.9k
) {
342
30.9k
    if (CurSize[n] == NewSize[n])
343
1.11k
      continue;
344
29.8k
    for (int m = n - 1; m != -1; 
--m0
) {
345
29.8k
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
29.8k
                                         NewSize[n] - CurSize[n]);
347
29.8k
      CurSize[m] -= d;
348
29.8k
      CurSize[n] += d;
349
29.8k
      // Keep going if the current node was exhausted.
350
29.8k
      if (CurSize[n] >= NewSize[n])
351
29.8k
          break;
352
29.8k
    }
353
29.8k
  }
354
22.8k
355
22.8k
  if (Nodes == 0)
356
0
    return;
357
22.8k
358
22.8k
  // Move elements left.
359
53.7k
  
for (unsigned n = 0; 22.8k
n != Nodes - 1;
++n30.9k
) {
360
30.9k
    if (CurSize[n] == NewSize[n])
361
30.6k
      continue;
362
332
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
363
332
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
364
332
                                        CurSize[n] -  NewSize[n]);
365
332
      CurSize[m] += d;
366
332
      CurSize[n] -= d;
367
332
      // Keep going if the current node was exhausted.
368
332
      if (CurSize[n] >= NewSize[n])
369
332
          break;
370
332
    }
371
332
  }
372
22.8k
373
22.8k
#ifndef NDEBUG
374
22.8k
  for (unsigned n = 0; n != Nodes; n++)
375
22.8k
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
22.8k
#endif
377
22.8k
}
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
23.5k
                        unsigned CurSize[], const unsigned NewSize[]) {
340
23.5k
  // Move elements right.
341
58.5k
  for (int n = Nodes - 1; n; 
--n34.9k
) {
342
34.9k
    if (CurSize[n] == NewSize[n])
343
3.02k
      continue;
344
31.9k
    for (int m = n - 1; m != -1; 
--m0
) {
345
31.9k
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
31.9k
                                         NewSize[n] - CurSize[n]);
347
31.9k
      CurSize[m] -= d;
348
31.9k
      CurSize[n] += d;
349
31.9k
      // Keep going if the current node was exhausted.
350
31.9k
      if (CurSize[n] >= NewSize[n])
351
31.9k
          break;
352
31.9k
    }
353
31.9k
  }
354
23.5k
355
23.5k
  if (Nodes == 0)
356
0
    return;
357
23.5k
358
23.5k
  // Move elements left.
359
58.5k
  
for (unsigned n = 0; 23.5k
n != Nodes - 1;
++n34.9k
) {
360
34.9k
    if (CurSize[n] == NewSize[n])
361
33.9k
      continue;
362
1.01k
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
363
1.01k
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
364
1.01k
                                        CurSize[n] -  NewSize[n]);
365
1.01k
      CurSize[m] += d;
366
1.01k
      CurSize[n] -= d;
367
1.01k
      // Keep going if the current node was exhausted.
368
1.01k
      if (CurSize[n] >= NewSize[n])
369
1.01k
          break;
370
1.01k
    }
371
1.01k
  }
372
23.5k
373
23.5k
#ifndef NDEBUG
374
23.5k
  for (unsigned n = 0; n != Nodes; n++)
375
23.5k
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
23.5k
#endif
377
23.5k
}
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
83
                        unsigned CurSize[], const unsigned NewSize[]) {
340
83
  // Move elements right.
341
183
  for (int n = Nodes - 1; n; 
--n100
) {
342
100
    if (CurSize[n] == NewSize[n])
343
5
      continue;
344
95
    for (int m = n - 1; m != -1; 
--m0
) {
345
95
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
95
                                         NewSize[n] - CurSize[n]);
347
95
      CurSize[m] -= d;
348
95
      CurSize[n] += d;
349
95
      // Keep going if the current node was exhausted.
350
95
      if (CurSize[n] >= NewSize[n])
351
95
          break;
352
95
    }
353
95
  }
354
83
355
83
  if (Nodes == 0)
356
0
    return;
357
83
358
83
  // Move elements left.
359
183
  
for (unsigned n = 0; 83
n != Nodes - 1;
++n100
) {
360
100
    if (CurSize[n] == NewSize[n])
361
98
      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
83
373
83
#ifndef NDEBUG
374
83
  for (unsigned n = 0; n != Nodes; n++)
375
83
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
83
#endif
377
83
}
void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >**, unsigned int, unsigned int*, unsigned int const*)
Line
Count
Source
339
222
                        unsigned CurSize[], const unsigned NewSize[]) {
340
222
  // Move elements right.
341
492
  for (int n = Nodes - 1; n; 
--n270
) {
342
270
    if (CurSize[n] == NewSize[n])
343
0
      continue;
344
270
    for (int m = n - 1; m != -1; 
--m0
) {
345
270
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
346
270
                                         NewSize[n] - CurSize[n]);
347
270
      CurSize[m] -= d;
348
270
      CurSize[n] += d;
349
270
      // Keep going if the current node was exhausted.
350
270
      if (CurSize[n] >= NewSize[n])
351
270
          break;
352
270
    }
353
270
  }
354
222
355
222
  if (Nodes == 0)
356
0
    return;
357
222
358
222
  // Move elements left.
359
492
  
for (unsigned n = 0; 222
n != Nodes - 1;
++n270
) {
360
270
    if (CurSize[n] == NewSize[n])
361
270
      continue;
362
0
    for (unsigned m = n + 1; m != Nodes; ++m) {
363
0
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
364
0
                                        CurSize[n] -  NewSize[n]);
365
0
      CurSize[m] += d;
366
0
      CurSize[n] -= d;
367
0
      // Keep going if the current node was exhausted.
368
0
      if (CurSize[n] >= NewSize[n])
369
0
          break;
370
0
    }
371
0
  }
372
222
373
222
#ifndef NDEBUG
374
222
  for (unsigned n = 0; n != Nodes; n++)
375
222
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
376
222
#endif
377
222
}
Unexecuted instantiation: void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >**, unsigned int, unsigned int*, unsigned int const*)
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.00M
    static inline void *getAsVoidPointer(void *P) { return P; }
494
76.7M
    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.09M
  NodeRef() = default;
502
503
  /// operator bool - Detect a null ref.
504
3.63M
  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.00M
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
1.00M
    assert(n <= NodeT::Capacity && "Size too big for node");
510
1.00M
  }
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.3k
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
16.3k
    assert(n <= NodeT::Capacity && "Size too big for node");
510
16.3k
  }
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
953k
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
953k
    assert(n <= NodeT::Capacity && "Size too big for node");
510
953k
  }
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
109
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
109
    assert(n <= NodeT::Capacity && "Size too big for node");
510
109
  }
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
31.0k
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
31.0k
    assert(n <= NodeT::Capacity && "Size too big for node");
510
31.0k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >*, unsigned int)
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >*, unsigned int)
Line
Count
Source
508
202
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
509
202
    assert(n <= NodeT::Capacity && "Size too big for node");
510
202
  }
511
512
  /// size - Return the number of elements in the referenced node.
513
43.7M
  unsigned size() const { return pip.getInt() + 1; }
514
515
  /// setSize - Update the node size.
516
7.82M
  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
41.7M
  NodeRef &subtree(unsigned i) const {
522
41.7M
    return reinterpret_cast<NodeRef*>(pip.getPointer())[i];
523
41.7M
  }
524
525
  /// get - Dereference as a NodeT reference.
526
  template <typename NodeT>
527
34.9M
  NodeT &get() const {
528
34.9M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
34.9M
  }
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.64M
  NodeT &get() const {
528
2.64M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
2.64M
  }
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.2M
  NodeT &get() const {
528
31.2M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
31.2M
  }
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
36.0k
  NodeT &get() const {
528
36.0k
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
36.0k
  }
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.01M
  NodeT &get() const {
528
1.01M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
1.01M
  }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >() const
Line
Count
Source
527
3.07k
  NodeT &get() const {
528
3.07k
    return *reinterpret_cast<NodeT*>(pip.getPointer());
529
3.07k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >() const
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
1.99M
  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
1.99M
  const KeyT &start(unsigned i) const { return this->first[i].first; }
567
328M
  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
317M
  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.63k
  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.0M
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int) const
Line
Count
Source
567
799k
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int) const
Line
Count
Source
567
2.50k
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
568
878k
  const ValT &value(unsigned i) const { return this->second[i]; }
569
570
295M
  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
286M
  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.82k
  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.66M
  KeyT &start(unsigned i) { return this->first[i].first; }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::start(unsigned int)
Line
Count
Source
570
5.60k
  KeyT &start(unsigned i) { return this->first[i].first; }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::start(unsigned int)
Line
Count
Source
570
5.17M
  KeyT &start(unsigned i) { return this->first[i].first; }
571
256M
  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
247M
  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.68k
  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.79M
  KeyT &stop(unsigned i) { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int)
Line
Count
Source
571
1.42k
  KeyT &stop(unsigned i) { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int)
Line
Count
Source
571
4.13M
  KeyT &stop(unsigned i) { return this->first[i].second; }
572
180M
  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.74k
  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
171M
  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.63M
  ValT &value(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::value(unsigned int)
Line
Count
Source
572
2.39k
  ValT &value(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::value(unsigned int)
Line
Count
Source
572
4.46M
  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
124M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
581
124M
    assert(i <= Size && Size <= N && "Bad indices");
582
124M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
583
124M
           "Index is past the needed point");
584
200M
    while (i != Size && 
Traits::stopLess(stop(i), x)182M
)
++i76.6M
;
585
124M
    return i;
586
124M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
580
117M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
581
117M
    assert(i <= Size && Size <= N && "Bad indices");
582
117M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
583
117M
           "Index is past the needed point");
584
190M
    while (i != Size && 
Traits::stopLess(stop(i), x)177M
)
++i73.1M
;
585
117M
    return i;
586
117M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
580
2.57k
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
581
2.57k
    assert(i <= Size && Size <= N && "Bad indices");
582
2.57k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
583
2.57k
           "Index is past the needed point");
584
4.02k
    while (i != Size && 
Traits::stopLess(stop(i), x)2.63k
)
++i1.44k
;
585
2.57k
    return i;
586
2.57k
  }
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.66M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
581
1.66M
    assert(i <= Size && Size <= N && "Bad indices");
582
1.66M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
583
1.66M
           "Index is past the needed point");
584
5.04M
    while (i != Size && 
Traits::stopLess(stop(i), x)4.59M
)
++i3.38M
;
585
1.66M
    return i;
586
1.66M
  }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::findFrom(unsigned int, unsigned int, long long) const
Line
Count
Source
580
4.83M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
581
4.83M
    assert(i <= Size && Size <= N && "Bad indices");
582
4.83M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
583
4.83M
           "Index is past the needed point");
584
4.87M
    while (i != Size && 
Traits::stopLess(stop(i), x)799k
)
++i44.9k
;
585
4.83M
    return i;
586
4.83M
  }
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.1M
  unsigned safeFind(unsigned i, KeyT x) const {
596
37.1M
    assert(i < N && "Bad index");
597
37.1M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
598
37.1M
           "Index is past the needed point");
599
144M
    while (Traits::stopLess(stop(i), x)) 
++i107M
;
600
37.1M
    assert(i < N && "Unsafe intervals");
601
37.1M
    return i;
602
37.1M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
595
35.4M
  unsigned safeFind(unsigned i, KeyT x) const {
596
35.4M
    assert(i < N && "Bad index");
597
35.4M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
598
35.4M
           "Index is past the needed point");
599
140M
    while (Traits::stopLess(stop(i), x)) 
++i104M
;
600
35.4M
    assert(i < N && "Unsafe intervals");
601
35.4M
    return i;
602
35.4M
  }
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.70M
  unsigned safeFind(unsigned i, KeyT x) const {
596
1.70M
    assert(i < N && "Bad index");
597
1.70M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
598
1.70M
           "Index is past the needed point");
599
4.58M
    while (Traits::stopLess(stop(i), x)) 
++i2.87M
;
600
1.70M
    assert(i < N && "Unsafe intervals");
601
1.70M
    return i;
602
1.70M
  }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::safeFind(unsigned int, long long) const
Line
Count
Source
595
2.48k
  unsigned safeFind(unsigned i, KeyT x) const {
596
2.48k
    assert(i < N && "Bad index");
597
2.48k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
598
2.48k
           "Index is past the needed point");
599
2.50k
    while (Traits::stopLess(stop(i), x)) 
++i18
;
600
2.48k
    assert(i < N && "Unsafe intervals");
601
2.48k
    return i;
602
2.48k
  }
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.02M
  ValT safeLookup(KeyT x, ValT NotFound) const {
610
1.02M
    unsigned i = safeFind(0, x);
611
1.02M
    return Traits::startLess(x, start(i)) ? 
NotFound141k
:
value(i)878k
;
612
1.02M
  }
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
22.8M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
22.8M
  unsigned i = Pos;
630
22.8M
  assert(i <= Size && Size <= N && "Invalid index");
631
22.8M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
22.8M
633
22.8M
  // Verify the findFrom invariant.
634
22.8M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
22.8M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
22.8M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
22.8M
638
22.8M
  // Coalesce with previous interval.
639
22.8M
  if (i && 
value(i - 1) == y12.6M
&&
Traits::adjacent(stop(i - 1), a)6.00M
) {
640
2.40M
    Pos = i - 1;
641
2.40M
    // Also coalesce with next interval?
642
2.40M
    if (i != Size && 
value(i) == y2.32M
&&
Traits::adjacent(b, start(i))1.63M
) {
643
492k
      stop(i - 1) = stop(i);
644
492k
      this->erase(i, Size);
645
492k
      return Size - 1;
646
492k
    }
647
1.91M
    stop(i - 1) = b;
648
1.91M
    return Size;
649
1.91M
  }
650
20.4M
651
20.4M
  // Detect overflow.
652
20.4M
  if (i == N)
653
338k
    return N + 1;
654
20.0M
655
20.0M
  // Add new interval at end.
656
20.0M
  if (i == Size) {
657
10.9M
    start(i) = a;
658
10.9M
    stop(i) = b;
659
10.9M
    value(i) = y;
660
10.9M
    return Size + 1;
661
10.9M
  }
662
9.11M
663
9.11M
  // Try to coalesce with following interval.
664
9.11M
  if (value(i) == y && 
Traits::adjacent(b, start(i))4.57M
) {
665
923k
    start(i) = a;
666
923k
    return Size;
667
923k
  }
668
8.19M
669
8.19M
  // We must insert before i. Detect overflow.
670
8.19M
  if (Size == N)
671
1.04M
    return N + 1;
672
7.14M
673
7.14M
  // Insert before i.
674
7.14M
  this->shift(i, Size);
675
7.14M
  start(i) = a;
676
7.14M
  stop(i) = b;
677
7.14M
  value(i) = y;
678
7.14M
  return Size + 1;
679
7.14M
}
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.43k
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
1.43k
  unsigned i = Pos;
630
1.43k
  assert(i <= Size && Size <= N && "Invalid index");
631
1.43k
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
1.43k
633
1.43k
  // Verify the findFrom invariant.
634
1.43k
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
1.43k
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
1.43k
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
1.43k
638
1.43k
  // Coalesce with previous interval.
639
1.43k
  if (i && 
value(i - 1) == y844
&&
Traits::adjacent(stop(i - 1), a)594
) {
640
558
    Pos = i - 1;
641
558
    // Also coalesce with next interval?
642
558
    if (i != Size && 
value(i) == y87
&&
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
554
    stop(i - 1) = b;
648
554
    return Size;
649
554
  }
650
881
651
881
  // Detect overflow.
652
881
  if (i == N)
653
5
    return N + 1;
654
876
655
876
  // Add new interval at end.
656
876
  if (i == Size) {
657
867
    start(i) = a;
658
867
    stop(i) = b;
659
867
    value(i) = y;
660
867
    return Size + 1;
661
867
  }
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.4M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
16.4M
  unsigned i = Pos;
630
16.4M
  assert(i <= Size && Size <= N && "Invalid index");
631
16.4M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
16.4M
633
16.4M
  // Verify the findFrom invariant.
634
16.4M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
16.4M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
16.4M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
16.4M
638
16.4M
  // Coalesce with previous interval.
639
16.4M
  if (i && 
value(i - 1) == y10.8M
&&
Traits::adjacent(stop(i - 1), a)4.30M
) {
640
1.45M
    Pos = i - 1;
641
1.45M
    // Also coalesce with next interval?
642
1.45M
    if (i != Size && value(i) == y && 
Traits::adjacent(b, start(i))786k
) {
643
210k
      stop(i - 1) = stop(i);
644
210k
      this->erase(i, Size);
645
210k
      return Size - 1;
646
210k
    }
647
1.24M
    stop(i - 1) = b;
648
1.24M
    return Size;
649
1.24M
  }
650
14.9M
651
14.9M
  // Detect overflow.
652
14.9M
  if (i == N)
653
326k
    return N + 1;
654
14.6M
655
14.6M
  // Add new interval at end.
656
14.6M
  if (i == Size) {
657
6.50M
    start(i) = a;
658
6.50M
    stop(i) = b;
659
6.50M
    value(i) = y;
660
6.50M
    return Size + 1;
661
6.50M
  }
662
8.14M
663
8.14M
  // Try to coalesce with following interval.
664
8.14M
  if (value(i) == y && 
Traits::adjacent(b, start(i))3.62M
) {
665
387k
    start(i) = a;
666
387k
    return Size;
667
387k
  }
668
7.75M
669
7.75M
  // We must insert before i. Detect overflow.
670
7.75M
  if (Size == N)
671
1.01M
    return N + 1;
672
6.74M
673
6.74M
  // Insert before i.
674
6.74M
  this->shift(i, Size);
675
6.74M
  start(i) = a;
676
6.74M
  stop(i) = b;
677
6.74M
  value(i) = y;
678
6.74M
  return Size + 1;
679
6.74M
}
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
1.95M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
1.95M
  unsigned i = Pos;
630
1.95M
  assert(i <= Size && Size <= N && "Invalid index");
631
1.95M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
1.95M
633
1.95M
  // Verify the findFrom invariant.
634
1.95M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
1.95M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
1.95M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
1.95M
638
1.95M
  // Coalesce with previous interval.
639
1.95M
  if (i && 
value(i - 1) == y1.76M
&&
Traits::adjacent(stop(i - 1), a)1.69M
) {
640
955k
    Pos = i - 1;
641
955k
    // Also coalesce with next interval?
642
955k
    if (i != Size && 
value(i) == y868k
&&
Traits::adjacent(b, start(i))846k
) {
643
281k
      stop(i - 1) = stop(i);
644
281k
      this->erase(i, Size);
645
281k
      return Size - 1;
646
281k
    }
647
673k
    stop(i - 1) = b;
648
673k
    return Size;
649
673k
  }
650
1.00M
651
1.00M
  // Detect overflow.
652
1.00M
  if (i == N)
653
11.6k
    return N + 1;
654
989k
655
989k
  // Add new interval at end.
656
989k
  if (i == Size) {
657
392k
    start(i) = a;
658
392k
    stop(i) = b;
659
392k
    value(i) = y;
660
392k
    return Size + 1;
661
392k
  }
662
597k
663
597k
  // Try to coalesce with following interval.
664
597k
  if (value(i) == y && 
Traits::adjacent(b, start(i))576k
) {
665
209k
    start(i) = a;
666
209k
    return Size;
667
209k
  }
668
388k
669
388k
  // We must insert before i. Detect overflow.
670
388k
  if (Size == N)
671
24.6k
    return N + 1;
672
363k
673
363k
  // Insert before i.
674
363k
  this->shift(i, Size);
675
363k
  start(i) = a;
676
363k
  stop(i) = b;
677
363k
  value(i) = y;
678
363k
  return Size + 1;
679
363k
}
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::insertFrom(unsigned int&, unsigned int, long long, long long, UnitT)
Line
Count
Source
628
1.56k
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
1.56k
  unsigned i = Pos;
630
1.56k
  assert(i <= Size && Size <= N && "Invalid index");
631
1.56k
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
1.56k
633
1.56k
  // Verify the findFrom invariant.
634
1.56k
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
1.56k
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
1.56k
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
1.56k
638
1.56k
  // Coalesce with previous interval.
639
1.56k
  if (i && 
value(i - 1) == y0
&&
Traits::adjacent(stop(i - 1), a)0
) {
640
0
    Pos = i - 1;
641
0
    // Also coalesce with next interval?
642
0
    if (i != Size && value(i) == y && Traits::adjacent(b, start(i))) {
643
0
      stop(i - 1) = stop(i);
644
0
      this->erase(i, Size);
645
0
      return Size - 1;
646
0
    }
647
0
    stop(i - 1) = b;
648
0
    return Size;
649
0
  }
650
1.56k
651
1.56k
  // Detect overflow.
652
1.56k
  if (i == N)
653
0
    return N + 1;
654
1.56k
655
1.56k
  // Add new interval at end.
656
1.56k
  if (i == Size) {
657
0
    start(i) = a;
658
0
    stop(i) = b;
659
0
    value(i) = y;
660
0
    return Size + 1;
661
0
  }
662
1.56k
663
1.56k
  // Try to coalesce with following interval.
664
1.56k
  if (value(i) == y && Traits::adjacent(b, start(i))) {
665
523
    start(i) = a;
666
523
    return Size;
667
523
  }
668
1.04k
669
1.04k
  // We must insert before i. Detect overflow.
670
1.04k
  if (Size == N)
671
222
    return N + 1;
672
823
673
823
  // Insert before i.
674
823
  this->shift(i, Size);
675
823
  start(i) = a;
676
823
  stop(i) = b;
677
823
  value(i) = y;
678
823
  return Size + 1;
679
823
}
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::insertFrom(unsigned int&, unsigned int, long long, long long, UnitT)
Line
Count
Source
628
4.41M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
629
4.41M
  unsigned i = Pos;
630
4.41M
  assert(i <= Size && Size <= N && "Invalid index");
631
4.41M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
632
4.41M
633
4.41M
  // Verify the findFrom invariant.
634
4.41M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
635
4.41M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
636
4.41M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
637
4.41M
638
4.41M
  // Coalesce with previous interval.
639
4.41M
  if (i && 
value(i - 1) == y0
&&
Traits::adjacent(stop(i - 1), a)0
) {
640
0
    Pos = i - 1;
641
0
    // Also coalesce with next interval?
642
0
    if (i != Size && value(i) == y && Traits::adjacent(b, start(i))) {
643
0
      stop(i - 1) = stop(i);
644
0
      this->erase(i, Size);
645
0
      return Size - 1;
646
0
    }
647
0
    stop(i - 1) = b;
648
0
    return Size;
649
0
  }
650
4.41M
651
4.41M
  // Detect overflow.
652
4.41M
  if (i == N)
653
0
    return N + 1;
654
4.41M
655
4.41M
  // Add new interval at end.
656
4.41M
  if (i == Size) {
657
4.04M
    start(i) = a;
658
4.04M
    stop(i) = b;
659
4.04M
    value(i) = y;
660
4.04M
    return Size + 1;
661
4.04M
  }
662
370k
663
370k
  // Try to coalesce with following interval.
664
370k
  if (value(i) == y && Traits::adjacent(b, start(i))) {
665
326k
    start(i) = a;
666
326k
    return Size;
667
326k
  }
668
43.7k
669
43.7k
  // We must insert before i. Detect overflow.
670
43.7k
  if (Size == N)
671
105
    return N + 1;
672
43.6k
673
43.6k
  // Insert before i.
674
43.6k
  this->shift(i, Size);
675
43.6k
  start(i) = a;
676
43.6k
  stop(i) = b;
677
43.6k
  value(i) = y;
678
43.6k
  return Size + 1;
679
43.6k
}
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
89.1M
  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
71.2M
  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
15.6M
  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.11M
  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
177k
  const KeyT &stop(unsigned i) const { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int) const
Line
Count
Source
703
2.50k
  const KeyT &stop(unsigned i) const { return this->second[i]; }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int) const
704
270k
  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
260k
  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
10.3k
  const NodeRef &subtree(unsigned i) const { return this->first[i]; }
705
706
5.59M
  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.00M
  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.42M
  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
7.71k
  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
159k
  KeyT &stop(unsigned i) { return this->second[i]; }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int)
llvm::IntervalMapImpl::BranchNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int)
Line
Count
Source
706
597
  KeyT &stop(unsigned i) { return this->second[i]; }
707
1.81M
  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.66M
  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
84.3k
  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
59.8k
  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
353
  NodeRef &subtree(unsigned i) { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::subtree(unsigned int)
Line
Count
Source
707
404
  NodeRef &subtree(unsigned i) { return this->first[i]; }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >::subtree(unsigned int)
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.3M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
716
30.3M
    assert(i <= Size && Size <= N && "Bad indices");
717
30.3M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
718
30.3M
           "Index to findFrom is past the needed point");
719
74.8M
    while (i != Size && 
Traits::stopLess(stop(i), x)72.5M
)
++i44.4M
;
720
30.3M
    return i;
721
30.3M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
715
29.7M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
716
29.7M
    assert(i <= Size && Size <= N && "Bad indices");
717
29.7M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
718
29.7M
           "Index to findFrom is past the needed point");
719
73.4M
    while (i != Size && 
Traits::stopLess(stop(i), x)71.2M
)
++i43.7M
;
720
29.7M
    return i;
721
29.7M
  }
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
618k
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
716
618k
    assert(i <= Size && Size <= N && "Bad indices");
717
618k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
718
618k
           "Index to findFrom is past the needed point");
719
1.39M
    while (i != Size && 
Traits::stopLess(stop(i), x)1.36M
)
++i774k
;
720
618k
    return i;
721
618k
  }
llvm::IntervalMapImpl::BranchNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::findFrom(unsigned int, unsigned int, long long) const
Line
Count
Source
715
2.49k
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
716
2.49k
    assert(i <= Size && Size <= N && "Bad indices");
717
2.49k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
718
2.49k
           "Index to findFrom is past the needed point");
719
2.50k
    while (i != Size && 
Traits::stopLess(stop(i), x)2.50k
)
++i18
;
720
2.49k
    return i;
721
2.49k
  }
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.25M
  unsigned safeFind(unsigned i, KeyT x) const {
730
3.25M
    assert(i < N && "Bad index");
731
3.25M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
732
3.25M
           "Index is past the needed point");
733
16.3M
    while (Traits::stopLess(stop(i), x)) 
++i13.0M
;
734
3.25M
    assert(i < N && "Unsafe intervals");
735
3.25M
    return i;
736
3.25M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
729
2.95M
  unsigned safeFind(unsigned i, KeyT x) const {
730
2.95M
    assert(i < N && "Bad index");
731
2.95M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
732
2.95M
           "Index is past the needed point");
733
15.6M
    while (Traits::stopLess(stop(i), x)) 
++i12.6M
;
734
2.95M
    assert(i < N && "Unsafe intervals");
735
2.95M
    return i;
736
2.95M
  }
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
36.0k
  unsigned safeFind(unsigned i, KeyT x) const {
730
36.0k
    assert(i < N && "Bad index");
731
36.0k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
732
36.0k
           "Index is past the needed point");
733
177k
    while (Traits::stopLess(stop(i), x)) 
++i141k
;
734
36.0k
    assert(i < N && "Unsafe intervals");
735
36.0k
    return i;
736
36.0k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
729
260k
  unsigned safeFind(unsigned i, KeyT x) const {
730
260k
    assert(i < N && "Bad index");
731
260k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
732
260k
           "Index is past the needed point");
733
489k
    while (Traits::stopLess(stop(i), x)) 
++i228k
;
734
260k
    assert(i < N && "Unsafe intervals");
735
260k
    return i;
736
260k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >::safeFind(unsigned int, long long) const
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
270k
  NodeRef safeLookup(KeyT x) const {
742
270k
    return subtree(safeFind(0, x));
743
270k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeLookup(llvm::SlotIndex) const
Line
Count
Source
741
260k
  NodeRef safeLookup(KeyT x) const {
742
260k
    return subtree(safeFind(0, x));
743
260k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeLookup(llvm::SlotIndex) const
Line
Count
Source
741
10.3k
  NodeRef safeLookup(KeyT x) const {
742
10.3k
    return subtree(safeFind(0, x));
743
10.3k
  }
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
376k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
376k
    assert(Size < N && "branch node overflow");
752
376k
    assert(i <= Size && "Bad insert position");
753
376k
    this->shift(i, Size);
754
376k
    subtree(i) = Node;
755
376k
    stop(i) = Stop;
756
376k
  }
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
286k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
286k
    assert(Size < N && "branch node overflow");
752
286k
    assert(i <= Size && "Bad insert position");
753
286k
    this->shift(i, Size);
754
286k
    subtree(i) = Node;
755
286k
    stop(i) = Stop;
756
286k
  }
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
84.3k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
84.3k
    assert(Size < N && "branch node overflow");
752
84.3k
    assert(i <= Size && "Bad insert position");
753
84.3k
    this->shift(i, Size);
754
84.3k
    subtree(i) = Node;
755
84.3k
    stop(i) = Stop;
756
84.3k
  }
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.34k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
5.34k
    assert(Size < N && "branch node overflow");
752
5.34k
    assert(i <= Size && "Bad insert position");
753
5.34k
    this->shift(i, Size);
754
5.34k
    subtree(i) = Node;
755
5.34k
    stop(i) = Stop;
756
5.34k
  }
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
353
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
353
    assert(Size < N && "branch node overflow");
752
353
    assert(i <= Size && "Bad insert position");
753
353
    this->shift(i, Size);
754
353
    subtree(i) = Node;
755
353
    stop(i) = Stop;
756
353
  }
llvm::IntervalMapImpl::BranchNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, long long)
Line
Count
Source
750
97
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
751
97
    assert(Size < N && "branch node overflow");
752
97
    assert(i <= Size && "Bad insert position");
753
97
    this->shift(i, Size);
754
97
    subtree(i) = Node;
755
97
    stop(i) = Stop;
756
97
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, long long)
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
141M
      : node(Node), size(Size), offset(Offset) {}
781
782
    Entry(NodeRef Node, unsigned Offset)
783
38.6M
      : node(&Node.subtree(0)), size(Node.size()), offset(Offset) {}
784
785
45.2M
    NodeRef &subtree(unsigned i) const {
786
45.2M
      return reinterpret_cast<NodeRef*>(node)[i];
787
45.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.61M
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
5.61M
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
5.61M
  }
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.32M
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
1.32M
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
1.32M
  }
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.08M
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
3.08M
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
3.08M
  }
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.04M
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
1.04M
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
1.04M
  }
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
7.97k
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
7.97k
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
7.97k
  }
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
127k
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
127k
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
127k
  }
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
23.5k
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
23.5k
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
23.5k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >(unsigned int) const
llvm::IntervalMapImpl::BranchNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> > >(unsigned int) const
Line
Count
Source
795
395
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
395
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
395
  }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >(unsigned int) const
Line
Count
Source
795
222
  template <typename NodeT> NodeT &node(unsigned Level) const {
796
222
    return *reinterpret_cast<NodeT*>(path[Level].node);
797
222
  }
798
1.35M
  unsigned size(unsigned Level) const { return path[Level].size; }
799
0
  unsigned offset(unsigned Level) const { return path[Level].offset; }
800
10.1M
  unsigned &offset(unsigned Level) { return path[Level].offset; }
801
802
  // Leaf accessors.
803
648M
  template <typename NodeT> NodeT &leaf() const {
804
648M
    return *reinterpret_cast<NodeT*>(path.back().node);
805
648M
  }
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
643M
  template <typename NodeT> NodeT &leaf() const {
804
643M
    return *reinterpret_cast<NodeT*>(path.back().node);
805
643M
  }
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.5k
  template <typename NodeT> NodeT &leaf() const {
804
11.5k
    return *reinterpret_cast<NodeT*>(path.back().node);
805
11.5k
  }
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.35M
  template <typename NodeT> NodeT &leaf() const {
804
3.35M
    return *reinterpret_cast<NodeT*>(path.back().node);
805
3.35M
  }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >() const
Line
Count
Source
803
747k
  template <typename NodeT> NodeT &leaf() const {
804
747k
    return *reinterpret_cast<NodeT*>(path.back().node);
805
747k
  }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> > >() const
Line
Count
Source
803
423k
  template <typename NodeT> NodeT &leaf() const {
804
423k
    return *reinterpret_cast<NodeT*>(path.back().node);
805
423k
  }
806
54.5M
  unsigned leafSize() const { return path.back().size; }
807
624M
  unsigned leafOffset() const { return path.back().offset; }
808
108M
  unsigned &leafOffset() { return path.back().offset; }
809
810
  /// valid - Return true if path is at a valid node, not at end().
811
370M
  bool valid() const {
812
370M
    return !path.empty() && path.front().offset < path.front().size;
813
370M
  }
814
815
  /// height - Return the height of the tree corresponding to this path.
816
  /// This matches map->height in a full path.
817
68.2M
  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
43.5M
  NodeRef &subtree(unsigned Level) const {
823
43.5M
    return path[Level].subtree(path[Level].offset);
824
43.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
398k
  void reset(unsigned Level) {
829
398k
    path[Level] = Entry(subtree(Level - 1), offset(Level));
830
398k
  }
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.0M
  void push(NodeRef Node, unsigned Offset) {
836
31.0M
    path.push_back(Entry(Node, Offset));
837
31.0M
  }
838
839
  /// pop - Remove the last path entry.
840
2.27M
  void pop() {
841
2.27M
    path.pop_back();
842
2.27M
  }
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
19.9M
  void setSize(unsigned Level, unsigned Size) {
849
19.9M
    path[Level].size = Size;
850
19.9M
    if (Level)
851
7.82M
      subtree(Level - 1).setSize(Size);
852
19.9M
  }
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
140M
  void setRoot(void *Node, unsigned Size, unsigned Offset) {
859
140M
    path.clear();
860
140M
    path.push_back(Entry(Node, Size, Offset));
861
140M
  }
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
14.0k
  void fillLeft(unsigned Height) {
883
28.0k
    while (height() < Height)
884
14.0k
      push(subtree(height()), 0);
885
14.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
322k
  bool atBegin() const {
899
719k
    for (unsigned i = 0, e = path.size(); i != e; 
++i396k
)
900
550k
      if (path[i].offset != 0)
901
154k
        return false;
902
322k
    
return true168k
;
903
322k
  }
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.63M
  bool atLastEntry(unsigned Level) const {
909
3.63M
    return path[Level].offset == path[Level].size - 1;
910
3.63M
  }
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
84.8k
      return;
920
925k
    moveLeft(Level);
921
925k
    ++path[Level].offset;
922
925k
  }
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
  LLVM_ALIGNAS(RootLeaf) LLVM_ALIGNAS(RootBranchData)
968
  AlignedCharArrayUnion<RootLeaf, RootBranchData> data;
969
970
  // Tree height.
971
  // 0: Leaves in root.
972
  // 1: Root points to leaf.
973
  // 2: root->branch->leaf ...
974
  unsigned height;
975
976
  // Number of entries in the root node.
977
  unsigned rootSize;
978
979
  // Allocator used for creating external nodes.
980
  Allocator &allocator;
981
982
  /// Represent data as a node type without breaking aliasing rules.
983
  template <typename T>
984
340M
  T &dataAs() const {
985
340M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
986
340M
  }
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
984
63.7M
  T &dataAs() const {
985
63.7M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
986
63.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
984
249M
  T &dataAs() const {
985
249M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
986
249M
  }
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
984
9.05k
  T &dataAs() const {
985
9.05k
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
986
9.05k
  }
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
984
172
  T &dataAs() const {
985
172
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
986
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
984
2.17M
  T &dataAs() const {
985
2.17M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
986
2.17M
  }
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
984
6.80M
  T &dataAs() const {
985
6.80M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
986
6.80M
  }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::dataAs<llvm::IntervalMapImpl::LeafNode<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> > >() const
Line
Count
Source
984
18.5M
  T &dataAs() const {
985
18.5M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
986
18.5M
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::RootBranchData& llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::dataAs<llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::RootBranchData>() const
Line
Count
Source
984
9.75k
  T &dataAs() const {
985
9.75k
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
986
9.75k
  }
987
988
2.61M
  const RootLeaf &rootLeaf() const {
989
2.61M
    assert(!branched() && "Cannot acces leaf data in branched root");
990
2.61M
    return dataAs<RootLeaf>();
991
2.61M
  }
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
988
2.61M
  const RootLeaf &rootLeaf() const {
989
2.61M
    assert(!branched() && "Cannot acces leaf data in branched root");
990
2.61M
    return dataAs<RootLeaf>();
991
2.61M
  }
992
272M
  RootLeaf &rootLeaf() {
993
272M
    assert(!branched() && "Cannot acces leaf data in branched root");
994
272M
    return dataAs<RootLeaf>();
995
272M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf()
Line
Count
Source
992
249M
  RootLeaf &rootLeaf() {
993
249M
    assert(!branched() && "Cannot acces leaf data in branched root");
994
249M
    return dataAs<RootLeaf>();
995
249M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf()
Line
Count
Source
992
9.05k
  RootLeaf &rootLeaf() {
993
9.05k
    assert(!branched() && "Cannot acces leaf data in branched root");
994
9.05k
    return dataAs<RootLeaf>();
995
9.05k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf()
Line
Count
Source
992
4.19M
  RootLeaf &rootLeaf() {
993
4.19M
    assert(!branched() && "Cannot acces leaf data in branched root");
994
4.19M
    return dataAs<RootLeaf>();
995
4.19M
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::rootLeaf()
Line
Count
Source
992
18.5M
  RootLeaf &rootLeaf() {
993
18.5M
    assert(!branched() && "Cannot acces leaf data in branched root");
994
18.5M
    return dataAs<RootLeaf>();
995
18.5M
  }
996
997
786k
  RootBranchData &rootBranchData() const {
998
786k
    assert(branched() && "Cannot access branch data in non-branched root");
999
786k
    return dataAs<RootBranchData>();
1000
786k
  }
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
997
786k
  RootBranchData &rootBranchData() const {
998
786k
    assert(branched() && "Cannot access branch data in non-branched root");
999
786k
    return dataAs<RootBranchData>();
1000
786k
  }
1001
65.1M
  RootBranchData &rootBranchData() {
1002
65.1M
    assert(branched() && "Cannot access branch data in non-branched root");
1003
65.1M
    return dataAs<RootBranchData>();
1004
65.1M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData()
Line
Count
Source
1001
63.7M
  RootBranchData &rootBranchData() {
1002
63.7M
    assert(branched() && "Cannot access branch data in non-branched root");
1003
63.7M
    return dataAs<RootBranchData>();
1004
63.7M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData()
Line
Count
Source
1001
172
  RootBranchData &rootBranchData() {
1002
172
    assert(branched() && "Cannot access branch data in non-branched root");
1003
172
    return dataAs<RootBranchData>();
1004
172
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData()
Line
Count
Source
1001
1.38M
  RootBranchData &rootBranchData() {
1002
1.38M
    assert(branched() && "Cannot access branch data in non-branched root");
1003
1.38M
    return dataAs<RootBranchData>();
1004
1.38M
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::rootBranchData()
Line
Count
Source
1001
9.75k
  RootBranchData &rootBranchData() {
1002
9.75k
    assert(branched() && "Cannot access branch data in non-branched root");
1003
9.75k
    return dataAs<RootBranchData>();
1004
9.75k
  }
1005
1006
522k
  const RootBranch &rootBranch() const { return rootBranchData().node; }
1007
63.9M
  RootBranch &rootBranch()             { return rootBranchData().node; }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranch()
Line
Count
Source
1007
62.5M
  RootBranch &rootBranch()             { return rootBranchData().node; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranch()
Line
Count
Source
1007
157
  RootBranch &rootBranch()             { return rootBranchData().node; }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranch()
Line
Count
Source
1007
1.34M
  RootBranch &rootBranch()             { return rootBranchData().node; }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::rootBranch()
Line
Count
Source
1007
8.09k
  RootBranch &rootBranch()             { return rootBranchData().node; }
1008
264k
  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
1008
264k
  KeyT rootBranchStart() const { return rootBranchData().start; }
1009
567k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart()
Line
Count
Source
1009
5
  KeyT &rootBranchStart()      { return rootBranchData().start; }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart()
Line
Count
Source
1009
552k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart()
Line
Count
Source
1009
13.3k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::rootBranchStart()
Line
Count
Source
1009
1.45k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
1010
1011
1.00M
  template <typename NodeT> NodeT *newNode() {
1012
1.00M
    return new(allocator.template Allocate<NodeT>()) NodeT();
1013
1.00M
  }
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
1011
5
  template <typename NodeT> NodeT *newNode() {
1012
5
    return new(allocator.template Allocate<NodeT>()) NodeT();
1013
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
1011
953k
  template <typename NodeT> NodeT *newNode() {
1012
953k
    return new(allocator.template Allocate<NodeT>()) NodeT();
1013
953k
  }
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
1011
16.3k
  template <typename NodeT> NodeT *newNode() {
1012
16.3k
    return new(allocator.template Allocate<NodeT>()) NodeT();
1013
16.3k
  }
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
1011
31.0k
  template <typename NodeT> NodeT *newNode() {
1012
31.0k
    return new(allocator.template Allocate<NodeT>()) NodeT();
1013
31.0k
  }
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
1011
109
  template <typename NodeT> NodeT *newNode() {
1012
109
    return new(allocator.template Allocate<NodeT>()) NodeT();
1013
109
  }
llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >* llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::newNode<llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >()
Line
Count
Source
1011
202
  template <typename NodeT> NodeT *newNode() {
1012
202
    return new(allocator.template Allocate<NodeT>()) NodeT();
1013
202
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >* llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::newNode<llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >()
1014
1015
1.00M
  template <typename NodeT> void deleteNode(NodeT *P) {
1016
1.00M
    P->~NodeT();
1017
1.00M
    allocator.Deallocate(P);
1018
1.00M
  }
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
1015
5
  template <typename NodeT> void deleteNode(NodeT *P) {
1016
5
    P->~NodeT();
1017
5
    allocator.Deallocate(P);
1018
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
1015
16.3k
  template <typename NodeT> void deleteNode(NodeT *P) {
1016
16.3k
    P->~NodeT();
1017
16.3k
    allocator.Deallocate(P);
1018
16.3k
  }
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
1015
953k
  template <typename NodeT> void deleteNode(NodeT *P) {
1016
953k
    P->~NodeT();
1017
953k
    allocator.Deallocate(P);
1018
953k
  }
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
1015
109
  template <typename NodeT> void deleteNode(NodeT *P) {
1016
109
    P->~NodeT();
1017
109
    allocator.Deallocate(P);
1018
109
  }
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
1015
31.0k
  template <typename NodeT> void deleteNode(NodeT *P) {
1016
31.0k
    P->~NodeT();
1017
31.0k
    allocator.Deallocate(P);
1018
31.0k
  }
void llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::deleteNode<llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::LeafNode<long long, UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >*)
Line
Count
Source
1015
202
  template <typename NodeT> void deleteNode(NodeT *P) {
1016
202
    P->~NodeT();
1017
202
    allocator.Deallocate(P);
1018
202
  }
Unexecuted instantiation: void llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::deleteNode<llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::BranchNode<long long, UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >*)
1019
1020
  IdxPair branchRoot(unsigned Position);
1021
  IdxPair splitRoot(unsigned Position);
1022
1023
309k
  void switchRootToBranch() {
1024
309k
    rootLeaf().~RootLeaf();
1025
309k
    height = 1;
1026
309k
    new (&rootBranchData()) RootBranchData();
1027
309k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToBranch()
Line
Count
Source
1023
5
  void switchRootToBranch() {
1024
5
    rootLeaf().~RootLeaf();
1025
5
    height = 1;
1026
5
    new (&rootBranchData()) RootBranchData();
1027
5
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToBranch()
Line
Count
Source
1023
296k
  void switchRootToBranch() {
1024
296k
    rootLeaf().~RootLeaf();
1025
296k
    height = 1;
1026
296k
    new (&rootBranchData()) RootBranchData();
1027
296k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToBranch()
Line
Count
Source
1023
12.7k
  void switchRootToBranch() {
1024
12.7k
    rootLeaf().~RootLeaf();
1025
12.7k
    height = 1;
1026
12.7k
    new (&rootBranchData()) RootBranchData();
1027
12.7k
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::switchRootToBranch()
Line
Count
Source
1023
105
  void switchRootToBranch() {
1024
105
    rootLeaf().~RootLeaf();
1025
105
    height = 1;
1026
105
    new (&rootBranchData()) RootBranchData();
1027
105
  }
1028
1029
309k
  void switchRootToLeaf() {
1030
309k
    rootBranchData().~RootBranchData();
1031
309k
    height = 0;
1032
309k
    new(&rootLeaf()) RootLeaf();
1033
309k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToLeaf()
Line
Count
Source
1029
5
  void switchRootToLeaf() {
1030
5
    rootBranchData().~RootBranchData();
1031
5
    height = 0;
1032
5
    new(&rootLeaf()) RootLeaf();
1033
5
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToLeaf()
Line
Count
Source
1029
296k
  void switchRootToLeaf() {
1030
296k
    rootBranchData().~RootBranchData();
1031
296k
    height = 0;
1032
296k
    new(&rootLeaf()) RootLeaf();
1033
296k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToLeaf()
Line
Count
Source
1029
12.7k
  void switchRootToLeaf() {
1030
12.7k
    rootBranchData().~RootBranchData();
1031
12.7k
    height = 0;
1032
12.7k
    new(&rootLeaf()) RootLeaf();
1033
12.7k
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::switchRootToLeaf()
Line
Count
Source
1029
105
  void switchRootToLeaf() {
1030
105
    rootBranchData().~RootBranchData();
1031
105
    height = 0;
1032
105
    new(&rootLeaf()) RootLeaf();
1033
105
  }
1034
1035
1.04G
  bool branched() const { return height > 0; }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branched() const
Line
Count
Source
1035
1.01G
  bool branched() const { return height > 0; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branched() const
Line
Count
Source
1035
25.2k
  bool branched() const { return height > 0; }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branched() const
Line
Count
Source
1035
11.2M
  bool branched() const { return height > 0; }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::branched() const
Line
Count
Source
1035
10.9M
  bool branched() const { return height > 0; }
1036
1037
  ValT treeSafeLookup(KeyT x, ValT NotFound) const;
1038
  void visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef,
1039
                  unsigned Level));
1040
  void deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level);
1041
1042
public:
1043
9.58M
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1044
9.58M
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1045
9.58M
           "Insufficient alignment");
1046
9.58M
    new(&rootLeaf()) RootLeaf();
1047
9.58M
  }
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
1043
589
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1044
589
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1045
589
           "Insufficient alignment");
1046
589
    new(&rootLeaf()) RootLeaf();
1047
589
  }
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
1043
5.07M
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1044
5.07M
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1045
5.07M
           "Insufficient alignment");
1046
5.07M
    new(&rootLeaf()) RootLeaf();
1047
5.07M
  }
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
1043
468k
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1044
468k
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1045
468k
           "Insufficient alignment");
1046
468k
    new(&rootLeaf()) RootLeaf();
1047
468k
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::IntervalMap(llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, char, 192ul, 64ul>&)
Line
Count
Source
1043
4.04M
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1044
4.04M
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1045
4.04M
           "Insufficient alignment");
1046
4.04M
    new(&rootLeaf()) RootLeaf();
1047
4.04M
  }
1048
1049
9.58M
  ~IntervalMap() {
1050
9.58M
    clear();
1051
9.58M
    rootLeaf().~RootLeaf();
1052
9.58M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::~IntervalMap()
Line
Count
Source
1049
589
  ~IntervalMap() {
1050
589
    clear();
1051
589
    rootLeaf().~RootLeaf();
1052
589
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::~IntervalMap()
Line
Count
Source
1049
5.06M
  ~IntervalMap() {
1050
5.06M
    clear();
1051
5.06M
    rootLeaf().~RootLeaf();
1052
5.06M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::~IntervalMap()
Line
Count
Source
1049
468k
  ~IntervalMap() {
1050
468k
    clear();
1051
468k
    rootLeaf().~RootLeaf();
1052
468k
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::~IntervalMap()
Line
Count
Source
1049
4.04M
  ~IntervalMap() {
1050
4.04M
    clear();
1051
4.04M
    rootLeaf().~RootLeaf();
1052
4.04M
  }
1053
1054
  /// empty -  Return true when no intervals are mapped.
1055
121M
  bool empty() const {
1056
121M
    return rootSize == 0;
1057
121M
  }
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
1055
120M
  bool empty() const {
1056
120M
    return rootSize == 0;
1057
120M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::empty() const
Line
Count
Source
1055
1.23M
  bool empty() const {
1056
1.23M
    return rootSize == 0;
1057
1.23M
  }
Unexecuted instantiation: llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::empty() const
1058
1059
  /// start - Return the smallest mapped key in a non-empty map.
1060
1.23M
  KeyT start() const {
1061
1.23M
    assert(!empty() && "Empty IntervalMap has no start");
1062
1.23M
    return !branched() ? 
rootLeaf().start(0)971k
:
rootBranchStart()264k
;
1063
1.23M
  }
1064
1065
  /// stop - Return the largest mapped key in a non-empty map.
1066
1.14M
  KeyT stop() const {
1067
1.14M
    assert(!empty() && "Empty IntervalMap has no stop");
1068
1.14M
    return !branched() ? 
rootLeaf().stop(rootSize - 1)883k
:
1069
1.14M
                         
rootBranch().stop(rootSize - 1)262k
;
1070
1.14M
  }
1071
1072
  /// lookup - Return the mapped value at x or NotFound.
1073
1.23M
  ValT lookup(KeyT x, ValT NotFound = ValT()) const {
1074
1.23M
    if (empty() || Traits::startLess(x, start()) || 
Traits::stopLess(stop(), x)1.14M
)
1075
215k
      return NotFound;
1076
1.02M
    return branched() ? 
treeSafeLookup(x, NotFound)260k
:
1077
1.02M
                        
rootLeaf().safeLookup(x, NotFound)760k
;
1078
1.02M
  }
1079
1080
  /// insert - Add a mapping of [a;b] to y, coalesce with adjacent intervals.
1081
  /// It is assumed that no key in the interval is mapped to another value, but
1082
  /// overlapping intervals already mapped to y will be coalesced.
1083
6.36M
  void insert(KeyT a, KeyT b, ValT y) {
1084
6.36M
    if (branched() || 
rootSize == RootLeaf::Capacity5.77M
)
1085
634k
      return find(a).insert(a, b, y);
1086
5.73M
1087
5.73M
    // Easy insert into root leaf.
1088
5.73M
    unsigned p = rootLeaf().findFrom(0, rootSize, a);
1089
5.73M
    rootSize = rootLeaf().insertFrom(p, rootSize, a, b, y);
1090
5.73M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(llvm::SlotIndex, llvm::SlotIndex, unsigned int)
Line
Count
Source
1083
1.94M
  void insert(KeyT a, KeyT b, ValT y) {
1084
1.94M
    if (branched() || 
rootSize == RootLeaf::Capacity1.35M
)
1085
632k
      return find(a).insert(a, b, y);
1086
1.31M
1087
1.31M
    // Easy insert into root leaf.
1088
1.31M
    unsigned p = rootLeaf().findFrom(0, rootSize, a);
1089
1.31M
    rootSize = rootLeaf().insertFrom(p, rootSize, a, b, y);
1090
1.31M
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::insert(long long, long long, UnitT)
Line
Count
Source
1083
4.42M
  void insert(KeyT a, KeyT b, ValT y) {
1084
4.42M
    if (branched() || 
rootSize == RootLeaf::Capacity4.41M
)
1085
1.49k
      return find(a).insert(a, b, y);
1086
4.41M
1087
4.41M
    // Easy insert into root leaf.
1088
4.41M
    unsigned p = rootLeaf().findFrom(0, rootSize, a);
1089
4.41M
    rootSize = rootLeaf().insertFrom(p, rootSize, a, b, y);
1090
4.41M
  }
1091
1092
  /// clear - Remove all entries.
1093
  void clear();
1094
1095
  class const_iterator;
1096
  class iterator;
1097
  friend class const_iterator;
1098
  friend class iterator;
1099
1100
0
  const_iterator begin() const {
1101
0
    const_iterator I(*this);
1102
0
    I.goToBegin();
1103
0
    return I;
1104
0
  }
1105
1106
542k
  iterator begin() {
1107
542k
    iterator I(*this);
1108
542k
    I.goToBegin();
1109
542k
    return I;
1110
542k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::begin()
Line
Count
Source
1106
2.32k
  iterator begin() {
1107
2.32k
    iterator I(*this);
1108
2.32k
    I.goToBegin();
1109
2.32k
    return I;
1110
2.32k
  }
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
1106
130k
  iterator begin() {
1107
130k
    iterator I(*this);
1108
130k
    I.goToBegin();
1109
130k
    return I;
1110
130k
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::begin()
Line
Count
Source
1106
410k
  iterator begin() {
1107
410k
    iterator I(*this);
1108
410k
    I.goToBegin();
1109
410k
    return I;
1110
410k
  }
1111
1112
  const_iterator end() const {
1113
    const_iterator I(*this);
1114
    I.goToEnd();
1115
    return I;
1116
  }
1117
1118
416k
  iterator end() {
1119
416k
    iterator I(*this);
1120
416k
    I.goToEnd();
1121
416k
    return I;
1122
416k
  }
1123
1124
  /// find - Return an iterator pointing to the first interval ending at or
1125
  /// after x, or end().
1126
0
  const_iterator find(KeyT x) const {
1127
0
    const_iterator I(*this);
1128
0
    I.find(x);
1129
0
    return I;
1130
0
  }
1131
1132
11.7M
  iterator find(KeyT x) {
1133
11.7M
    iterator I(*this);
1134
11.7M
    I.find(x);
1135
11.7M
    return I;
1136
11.7M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::find(llvm::SlotIndex)
Line
Count
Source
1132
1.54k
  iterator find(KeyT x) {
1133
1.54k
    iterator I(*this);
1134
1.54k
    I.find(x);
1135
1.54k
    return I;
1136
1.54k
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::find(llvm::SlotIndex)
Line
Count
Source
1132
10.6M
  iterator find(KeyT x) {
1133
10.6M
    iterator I(*this);
1134
10.6M
    I.find(x);
1135
10.6M
    return I;
1136
10.6M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::find(llvm::SlotIndex)
Line
Count
Source
1132
632k
  iterator find(KeyT x) {
1133
632k
    iterator I(*this);
1134
632k
    I.find(x);
1135
632k
    return I;
1136
632k
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::find(long long)
Line
Count
Source
1132
417k
  iterator find(KeyT x) {
1133
417k
    iterator I(*this);
1134
417k
    I.find(x);
1135
417k
    return I;
1136
417k
  }
1137
};
1138
1139
/// treeSafeLookup - Return the mapped value at x or NotFound, assuming a
1140
/// branched root.
1141
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1142
ValT IntervalMap<KeyT, ValT, N, Traits>::
1143
260k
treeSafeLookup(KeyT x, ValT NotFound) const {
1144
260k
  assert(branched() && "treeLookup assumes a branched root");
1145
260k
1146
260k
  IntervalMapImpl::NodeRef NR = rootBranch().safeLookup(x);
1147
270k
  for (unsigned h = height-1; h; 
--h10.3k
)
1148
10.3k
    NR = NR.get<Branch>().safeLookup(x);
1149
260k
  return NR.get<Leaf>().safeLookup(x, NotFound);
1150
260k
}
1151
1152
// branchRoot - Switch from a leaf root to a branched root.
1153
// Return the new (root offset, node offset) corresponding to Position.
1154
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1155
IntervalMapImpl::IdxPair IntervalMap<KeyT, ValT, N, Traits>::
1156
309k
branchRoot(unsigned Position) {
1157
309k
  using namespace IntervalMapImpl;
1158
309k
  // How many external leaf nodes to hold RootLeaf+1?
1159
309k
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1160
309k
1161
309k
  // Compute element distribution among new nodes.
1162
309k
  unsigned size[Nodes];
1163
309k
  IdxPair NewOffset(0, Position);
1164
309k
1165
309k
  // Is is very common for the root node to be smaller than external nodes.
1166
309k
  if (Nodes == 1)
1167
110
    size[0] = rootSize;
1168
309k
  else
1169
309k
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1170
309k
                           Position, true);
1171
309k
1172
309k
  // Allocate new nodes.
1173
309k
  unsigned pos = 0;
1174
309k
  NodeRef node[Nodes];
1175
927k
  for (unsigned n = 0; n != Nodes; 
++n618k
) {
1176
618k
    Leaf *L = newNode<Leaf>();
1177
618k
    L->copy(rootLeaf(), pos, 0, size[n]);
1178
618k
    node[n] = NodeRef(L, size[n]);
1179
618k
    pos += size[n];
1180
618k
  }
1181
309k
1182
309k
  // Destroy the old leaf node, construct branch node instead.
1183
309k
  switchRootToBranch();
1184
927k
  for (unsigned n = 0; n != Nodes; 
++n618k
) {
1185
618k
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1186
618k
    rootBranch().subtree(n) = node[n];
1187
618k
  }
1188
309k
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1189
309k
  rootSize = Nodes;
1190
309k
  return NewOffset;
1191
309k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branchRoot(unsigned int)
Line
Count
Source
1156
5
branchRoot(unsigned Position) {
1157
5
  using namespace IntervalMapImpl;
1158
5
  // How many external leaf nodes to hold RootLeaf+1?
1159
5
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1160
5
1161
5
  // Compute element distribution among new nodes.
1162
5
  unsigned size[Nodes];
1163
5
  IdxPair NewOffset(0, Position);
1164
5
1165
5
  // Is is very common for the root node to be smaller than external nodes.
1166
5
  if (Nodes == 1)
1167
5
    size[0] = rootSize;
1168
0
  else
1169
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1170
0
                           Position, true);
1171
5
1172
5
  // Allocate new nodes.
1173
5
  unsigned pos = 0;
1174
5
  NodeRef node[Nodes];
1175
10
  for (unsigned n = 0; n != Nodes; 
++n5
) {
1176
5
    Leaf *L = newNode<Leaf>();
1177
5
    L->copy(rootLeaf(), pos, 0, size[n]);
1178
5
    node[n] = NodeRef(L, size[n]);
1179
5
    pos += size[n];
1180
5
  }
1181
5
1182
5
  // Destroy the old leaf node, construct branch node instead.
1183
5
  switchRootToBranch();
1184
10
  for (unsigned n = 0; n != Nodes; 
++n5
) {
1185
5
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1186
5
    rootBranch().subtree(n) = node[n];
1187
5
  }
1188
5
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1189
5
  rootSize = Nodes;
1190
5
  return NewOffset;
1191
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branchRoot(unsigned int)
Line
Count
Source
1156
296k
branchRoot(unsigned Position) {
1157
296k
  using namespace IntervalMapImpl;
1158
296k
  // How many external leaf nodes to hold RootLeaf+1?
1159
296k
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1160
296k
1161
296k
  // Compute element distribution among new nodes.
1162
296k
  unsigned size[Nodes];
1163
296k
  IdxPair NewOffset(0, Position);
1164
296k
1165
296k
  // Is is very common for the root node to be smaller than external nodes.
1166
296k
  if (Nodes == 1)
1167
0
    size[0] = rootSize;
1168
296k
  else
1169
296k
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1170
296k
                           Position, true);
1171
296k
1172
296k
  // Allocate new nodes.
1173
296k
  unsigned pos = 0;
1174
296k
  NodeRef node[Nodes];
1175
889k
  for (unsigned n = 0; n != Nodes; 
++n592k
) {
1176
592k
    Leaf *L = newNode<Leaf>();
1177
592k
    L->copy(rootLeaf(), pos, 0, size[n]);
1178
592k
    node[n] = NodeRef(L, size[n]);
1179
592k
    pos += size[n];
1180
592k
  }
1181
296k
1182
296k
  // Destroy the old leaf node, construct branch node instead.
1183
296k
  switchRootToBranch();
1184
889k
  for (unsigned n = 0; n != Nodes; 
++n592k
) {
1185
592k
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1186
592k
    rootBranch().subtree(n) = node[n];
1187
592k
  }
1188
296k
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1189
296k
  rootSize = Nodes;
1190
296k
  return NewOffset;
1191
296k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branchRoot(unsigned int)
Line
Count
Source
1156
12.7k
branchRoot(unsigned Position) {
1157
12.7k
  using namespace IntervalMapImpl;
1158
12.7k
  // How many external leaf nodes to hold RootLeaf+1?
1159
12.7k
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1160
12.7k
1161
12.7k
  // Compute element distribution among new nodes.
1162
12.7k
  unsigned size[Nodes];
1163
12.7k
  IdxPair NewOffset(0, Position);
1164
12.7k
1165
12.7k
  // Is is very common for the root node to be smaller than external nodes.
1166
12.7k
  if (Nodes == 1)
1167
0
    size[0] = rootSize;
1168
12.7k
  else
1169
12.7k
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1170
12.7k
                           Position, true);
1171
12.7k
1172
12.7k
  // Allocate new nodes.
1173
12.7k
  unsigned pos = 0;
1174
12.7k
  NodeRef node[Nodes];
1175
38.1k
  for (unsigned n = 0; n != Nodes; 
++n25.4k
) {
1176
25.4k
    Leaf *L = newNode<Leaf>();
1177
25.4k
    L->copy(rootLeaf(), pos, 0, size[n]);
1178
25.4k
    node[n] = NodeRef(L, size[n]);
1179
25.4k
    pos += size[n];
1180
25.4k
  }
1181
12.7k
1182
12.7k
  // Destroy the old leaf node, construct branch node instead.
1183
12.7k
  switchRootToBranch();
1184
38.1k
  for (unsigned n = 0; n != Nodes; 
++n25.4k
) {
1185
25.4k
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1186
25.4k
    rootBranch().subtree(n) = node[n];
1187
25.4k
  }
1188
12.7k
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1189
12.7k
  rootSize = Nodes;
1190
12.7k
  return NewOffset;
1191
12.7k
}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::branchRoot(unsigned int)
Line
Count
Source
1156
105
branchRoot(unsigned Position) {
1157
105
  using namespace IntervalMapImpl;
1158
105
  // How many external leaf nodes to hold RootLeaf+1?
1159
105
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1160
105
1161
105
  // Compute element distribution among new nodes.
1162
105
  unsigned size[Nodes];
1163
105
  IdxPair NewOffset(0, Position);
1164
105
1165
105
  // Is is very common for the root node to be smaller than external nodes.
1166
105
  if (Nodes == 1)
1167
105
    size[0] = rootSize;
1168
0
  else
1169
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1170
0
                           Position, true);
1171
105
1172
105
  // Allocate new nodes.
1173
105
  unsigned pos = 0;
1174
105
  NodeRef node[Nodes];
1175
210
  for (unsigned n = 0; n != Nodes; 
++n105
) {
1176
105
    Leaf *L = newNode<Leaf>();
1177
105
    L->copy(rootLeaf(), pos, 0, size[n]);
1178
105
    node[n] = NodeRef(L, size[n]);
1179
105
    pos += size[n];
1180
105
  }
1181
105
1182
105
  // Destroy the old leaf node, construct branch node instead.
1183
105
  switchRootToBranch();
1184
210
  for (unsigned n = 0; n != Nodes; 
++n105
) {
1185
105
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1186
105
    rootBranch().subtree(n) = node[n];
1187
105
  }
1188
105
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1189
105
  rootSize = Nodes;
1190
105
  return NewOffset;
1191
105
}
1192
1193
// splitRoot - Split the current BranchRoot into multiple Branch nodes.
1194
// Return the new (root offset, node offset) corresponding to Position.
1195
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1196
IntervalMapImpl::IdxPair IntervalMap<KeyT, ValT, N, Traits>::
1197
6.48k
splitRoot(unsigned Position) {
1198
6.48k
  using namespace IntervalMapImpl;
1199
6.48k
  // How many external leaf nodes to hold RootBranch+1?
1200
6.48k
  const unsigned Nodes = RootBranch::Capacity / Branch::Capacity + 1;
1201
6.48k
1202
6.48k
  // Compute element distribution among new nodes.
1203
6.48k
  unsigned Size[Nodes];
1204
6.48k
  IdxPair NewOffset(0, Position);
1205
6.48k
1206
6.48k
  // Is is very common for the root node to be smaller than external nodes.
1207
6.48k
  if (Nodes == 1)
1208
6.48k
    Size[0] = rootSize;
1209
0
  else
1210
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, Size,
1211
0
                           Position, true);
1212
6.48k
1213
6.48k
  // Allocate new nodes.
1214
6.48k
  unsigned Pos = 0;
1215
6.48k
  NodeRef Node[Nodes];
1216
12.9k
  for (unsigned n = 0; n != Nodes; 
++n6.48k
) {
1217
6.48k
    Branch *B = newNode<Branch>();
1218
6.48k
    B->copy(rootBranch(), Pos, 0, Size[n]);
1219
6.48k
    Node[n] = NodeRef(B, Size[n]);
1220
6.48k
    Pos += Size[n];
1221
6.48k
  }
1222
6.48k
1223
12.9k
  for (unsigned n = 0; n != Nodes; 
++n6.48k
) {
1224
6.48k
    rootBranch().stop(n) = Node[n].template get<Branch>().stop(Size[n]-1);
1225
6.48k
    rootBranch().subtree(n) = Node[n];
1226
6.48k
  }
1227
6.48k
  rootSize = Nodes;
1228
6.48k
  ++height;
1229
6.48k
  return NewOffset;
1230
6.48k
}
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
1197
6.42k
splitRoot(unsigned Position) {
1198
6.42k
  using namespace IntervalMapImpl;
1199
6.42k
  // How many external leaf nodes to hold RootBranch+1?
1200
6.42k
  const unsigned Nodes = RootBranch::Capacity / Branch::Capacity + 1;
1201
6.42k
1202
6.42k
  // Compute element distribution among new nodes.
1203
6.42k
  unsigned Size[Nodes];
1204
6.42k
  IdxPair NewOffset(0, Position);
1205
6.42k
1206
6.42k
  // Is is very common for the root node to be smaller than external nodes.
1207
6.42k
  if (Nodes == 1)
1208
6.42k
    Size[0] = rootSize;
1209
0
  else
1210
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, Size,
1211
0
                           Position, true);
1212
6.42k
1213
6.42k
  // Allocate new nodes.
1214
6.42k
  unsigned Pos = 0;
1215
6.42k
  NodeRef Node[Nodes];
1216
12.8k
  for (unsigned n = 0; n != Nodes; 
++n6.42k
) {
1217
6.42k
    Branch *B = newNode<Branch>();
1218
6.42k
    B->copy(rootBranch(), Pos, 0, Size[n]);
1219
6.42k
    Node[n] = NodeRef(B, Size[n]);
1220
6.42k
    Pos += Size[n];
1221
6.42k
  }
1222
6.42k
1223
12.8k
  for (unsigned n = 0; n != Nodes; 
++n6.42k
) {
1224
6.42k
    rootBranch().stop(n) = Node[n].template get<Branch>().stop(Size[n]-1);
1225
6.42k
    rootBranch().subtree(n) = Node[n];
1226
6.42k
  }
1227
6.42k
  rootSize = Nodes;
1228
6.42k
  ++height;
1229
6.42k
  return NewOffset;
1230
6.42k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::splitRoot(unsigned int)
Line
Count
Source
1197
58
splitRoot(unsigned Position) {
1198
58
  using namespace IntervalMapImpl;
1199
58
  // How many external leaf nodes to hold RootBranch+1?
1200
58
  const unsigned Nodes = RootBranch::Capacity / Branch::Capacity + 1;
1201
58
1202
58
  // Compute element distribution among new nodes.
1203
58
  unsigned Size[Nodes];
1204
58
  IdxPair NewOffset(0, Position);
1205
58
1206
58
  // Is is very common for the root node to be smaller than external nodes.
1207
58
  if (Nodes == 1)
1208
58
    Size[0] = rootSize;
1209
0
  else
1210
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, Size,
1211
0
                           Position, true);
1212
58
1213
58
  // Allocate new nodes.
1214
58
  unsigned Pos = 0;
1215
58
  NodeRef Node[Nodes];
1216
116
  for (unsigned n = 0; n != Nodes; 
++n58
) {
1217
58
    Branch *B = newNode<Branch>();
1218
58
    B->copy(rootBranch(), Pos, 0, Size[n]);
1219
58
    Node[n] = NodeRef(B, Size[n]);
1220
58
    Pos += Size[n];
1221
58
  }
1222
58
1223
116
  for (unsigned n = 0; n != Nodes; 
++n58
) {
1224
58
    rootBranch().stop(n) = Node[n].template get<Branch>().stop(Size[n]-1);
1225
58
    rootBranch().subtree(n) = Node[n];
1226
58
  }
1227
58
  rootSize = Nodes;
1228
58
  ++height;
1229
58
  return NewOffset;
1230
58
}
Unexecuted instantiation: llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::splitRoot(unsigned int)
1231
1232
/// visitNodes - Visit each external node.
1233
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1234
void IntervalMap<KeyT, ValT, N, Traits>::
1235
299k
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1236
299k
  if (!branched())
1237
0
    return;
1238
299k
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1239
299k
1240
299k
  // Collect level 0 nodes from the root.
1241
1.11M
  for (unsigned i = 0; i != rootSize; 
++i813k
)
1242
813k
    Refs.push_back(rootBranch().subtree(i));
1243
299k
1244
299k
  // Visit all branch nodes.
1245
305k
  for (unsigned h = height - 1; h; 
--h6.41k
) {
1246
22.6k
    for (unsigned i = 0, e = Refs.size(); i != e; 
++i16.2k
) {
1247
169k
      for (unsigned j = 0, s = Refs[i].size(); j != s; 
++j153k
)
1248
153k
        NextRefs.push_back(Refs[i].subtree(j));
1249
16.2k
      (this->*f)(Refs[i], h);
1250
16.2k
    }
1251
6.41k
    Refs.clear();
1252
6.41k
    Refs.swap(NextRefs);
1253
6.41k
  }
1254
299k
1255
299k
  // Visit all leaf nodes.
1256
1.25M
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i950k
)
1257
950k
    (this->*f)(Refs[i], 0);
1258
299k
}
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
1235
5
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1236
5
  if (!branched())
1237
0
    return;
1238
5
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1239
5
1240
5
  // Collect level 0 nodes from the root.
1241
10
  for (unsigned i = 0; i != rootSize; 
++i5
)
1242
5
    Refs.push_back(rootBranch().subtree(i));
1243
5
1244
5
  // Visit all branch nodes.
1245
5
  for (unsigned h = height - 1; h; 
--h0
) {
1246
0
    for (unsigned i = 0, e = Refs.size(); i != e; ++i) {
1247
0
      for (unsigned j = 0, s = Refs[i].size(); j != s; ++j)
1248
0
        NextRefs.push_back(Refs[i].subtree(j));
1249
0
      (this->*f)(Refs[i], h);
1250
0
    }
1251
0
    Refs.clear();
1252
0
    Refs.swap(NextRefs);
1253
0
  }
1254
5
1255
5
  // Visit all leaf nodes.
1256
10
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i5
)
1257
5
    (this->*f)(Refs[i], 0);
1258
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
1235
286k
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1236
286k
  if (!branched())
1237
0
    return;
1238
286k
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1239
286k
1240
286k
  // Collect level 0 nodes from the root.
1241
1.07M
  for (unsigned i = 0; i != rootSize; 
++i784k
)
1242
784k
    Refs.push_back(rootBranch().subtree(i));
1243
286k
1244
286k
  // Visit all branch nodes.
1245
293k
  for (unsigned h = height - 1; h; 
--h6.36k
) {
1246
22.4k
    for (unsigned i = 0, e = Refs.size(); i != e; 
++i16.0k
) {
1247
168k
      for (unsigned j = 0, s = Refs[i].size(); j != s; 
++j152k
)
1248
152k
        NextRefs.push_back(Refs[i].subtree(j));
1249
16.0k
      (this->*f)(Refs[i], h);
1250
16.0k
    }
1251
6.36k
    Refs.clear();
1252
6.36k
    Refs.swap(NextRefs);
1253
6.36k
  }
1254
286k
1255
286k
  // Visit all leaf nodes.
1256
1.20M
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i920k
)
1257
920k
    (this->*f)(Refs[i], 0);
1258
286k
}
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
1235
12.7k
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1236
12.7k
  if (!branched())
1237
0
    return;
1238
12.7k
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1239
12.7k
1240
12.7k
  // Collect level 0 nodes from the root.
1241
41.7k
  for (unsigned i = 0; i != rootSize; 
++i29.0k
)
1242
29.0k
    Refs.push_back(rootBranch().subtree(i));
1243
12.7k
1244
12.7k
  // Visit all branch nodes.
1245
12.7k
  for (unsigned h = height - 1; h; 
--h58
) {
1246
166
    for (unsigned i = 0, e = Refs.size(); i != e; 
++i108
) {
1247
921
      for (unsigned j = 0, s = Refs[i].size(); j != s; 
++j813
)
1248
813
        NextRefs.push_back(Refs[i].subtree(j));
1249
108
      (this->*f)(Refs[i], h);
1250
108
    }
1251
58
    Refs.clear();
1252
58
    Refs.swap(NextRefs);
1253
58
  }
1254
12.7k
1255
12.7k
  // Visit all leaf nodes.
1256
42.4k
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i29.7k
)
1257
29.7k
    (this->*f)(Refs[i], 0);
1258
12.7k
}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::visitNodes(void (llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::*)(llvm::IntervalMapImpl::NodeRef, unsigned int))
Line
Count
Source
1235
105
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1236
105
  if (!branched())
1237
0
    return;
1238
105
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1239
105
1240
105
  // Collect level 0 nodes from the root.
1241
307
  for (unsigned i = 0; i != rootSize; 
++i202
)
1242
202
    Refs.push_back(rootBranch().subtree(i));
1243
105
1244
105
  // Visit all branch nodes.
1245
105
  for (unsigned h = height - 1; h; 
--h0
) {
1246
0
    for (unsigned i = 0, e = Refs.size(); i != e; ++i) {
1247
0
      for (unsigned j = 0, s = Refs[i].size(); j != s; ++j)
1248
0
        NextRefs.push_back(Refs[i].subtree(j));
1249
0
      (this->*f)(Refs[i], h);
1250
0
    }
1251
0
    Refs.clear();
1252
0
    Refs.swap(NextRefs);
1253
0
  }
1254
105
1255
105
  // Visit all leaf nodes.
1256
307
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i202
)
1257
202
    (this->*f)(Refs[i], 0);
1258
105
}
1259
1260
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1261
void IntervalMap<KeyT, ValT, N, Traits>::
1262
967k
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1263
967k
  if (Level)
1264
16.2k
    deleteNode(&Node.get<Branch>());
1265
950k
  else
1266
950k
    deleteNode(&Node.get<Leaf>());
1267
967k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1262
5
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1263
5
  if (Level)
1264
0
    deleteNode(&Node.get<Branch>());
1265
5
  else
1266
5
    deleteNode(&Node.get<Leaf>());
1267
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1262
936k
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1263
936k
  if (Level)
1264
16.0k
    deleteNode(&Node.get<Branch>());
1265
920k
  else
1266
920k
    deleteNode(&Node.get<Leaf>());
1267
936k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1262
29.8k
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1263
29.8k
  if (Level)
1264
108
    deleteNode(&Node.get<Branch>());
1265
29.7k
  else
1266
29.7k
    deleteNode(&Node.get<Leaf>());
1267
29.8k
}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1262
202
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1263
202
  if (Level)
1264
0
    deleteNode(&Node.get<Branch>());
1265
202
  else
1266
202
    deleteNode(&Node.get<Leaf>());
1267
202
}
1268
1269
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1270
void IntervalMap<KeyT, ValT, N, Traits>::
1271
81.1M
clear() {
1272
81.1M
  if (branched()) {
1273
299k
    visitNodes(&IntervalMap::deleteNode);
1274
299k
    switchRootToLeaf();
1275
299k
  }
1276
81.1M
  rootSize = 0;
1277
81.1M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::clear()
Line
Count
Source
1271
589
clear() {
1272
589
  if (branched()) {
1273
5
    visitNodes(&IntervalMap::deleteNode);
1274
5
    switchRootToLeaf();
1275
5
  }
1276
589
  rootSize = 0;
1277
589
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::clear()
Line
Count
Source
1271
76.4M
clear() {
1272
76.4M
  if (branched()) {
1273
286k
    visitNodes(&IntervalMap::deleteNode);
1274
286k
    switchRootToLeaf();
1275
286k
  }
1276
76.4M
  rootSize = 0;
1277
76.4M
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::clear()
Line
Count
Source
1271
712k
clear() {
1272
712k
  if (branched()) {
1273
12.7k
    visitNodes(&IntervalMap::deleteNode);
1274
12.7k
    switchRootToLeaf();
1275
12.7k
  }
1276
712k
  rootSize = 0;
1277
712k
}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::clear()
Line
Count
Source
1271
4.04M
clear() {
1272
4.04M
  if (branched()) {
1273
105
    visitNodes(&IntervalMap::deleteNode);
1274
105
    switchRootToLeaf();
1275
105
  }
1276
4.04M
  rootSize = 0;
1277
4.04M
}
1278
1279
//===----------------------------------------------------------------------===//
1280
//---                   IntervalMap::const_iterator                       ----//
1281
//===----------------------------------------------------------------------===//
1282
1283
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1284
class IntervalMap<KeyT, ValT, N, Traits>::const_iterator :
1285
  public std::iterator<std::bidirectional_iterator_tag, ValT> {
1286
1287
protected:
1288
  friend class IntervalMap;
1289
1290
  // The map referred to.
1291
  IntervalMap *map = nullptr;
1292
1293
  // We store a full path from the root to the current position.
1294
  // The path may be partially filled, but never between iterator calls.
1295
  IntervalMapImpl::Path path;
1296
1297
  explicit const_iterator(const IntervalMap &map) :
1298
12.6M
    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
1298
3.87k
    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
1298
10.6M
    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
1298
763k
    map(const_cast<IntervalMap*>(&map)) {}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::const_iterator(llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> > const&)
Line
Count
Source
1298
1.24M
    map(const_cast<IntervalMap*>(&map)) {}
1299
1300
949M
  bool branched() const {
1301
949M
    assert(map && "Invalid iterator");
1302
949M
    return map->branched();
1303
949M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::branched() const
Line
Count
Source
1300
941M
  bool branched() const {
1301
941M
    assert(map && "Invalid iterator");
1302
941M
    return map->branched();
1303
941M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::branched() const
Line
Count
Source
1300
24.6k
  bool branched() const {
1301
24.6k
    assert(map && "Invalid iterator");
1302
24.6k
    return map->branched();
1303
24.6k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::branched() const
Line
Count
Source
1300
5.13M
  bool branched() const {
1301
5.13M
    assert(map && "Invalid iterator");
1302
5.13M
    return map->branched();
1303
5.13M
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::branched() const
Line
Count
Source
1300
2.52M
  bool branched() const {
1301
2.52M
    assert(map && "Invalid iterator");
1302
2.52M
    return map->branched();
1303
2.52M
  }
1304
1305
140M
  void setRoot(unsigned Offset) {
1306
140M
    if (branched())
1307
30.3M
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1308
109M
    else
1309
109M
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1310
140M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1305
138M
  void setRoot(unsigned Offset) {
1306
138M
    if (branched())
1307
29.7M
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1308
108M
    else
1309
108M
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1310
138M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1305
3.91k
  void setRoot(unsigned Offset) {
1306
3.91k
    if (branched())
1307
78
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1308
3.84k
    else
1309
3.84k
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1310
3.91k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1305
819k
  void setRoot(unsigned Offset) {
1306
819k
    if (branched())
1307
631k
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1308
188k
    else
1309
188k
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1310
819k
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1305
1.24M
  void setRoot(unsigned Offset) {
1306
1.24M
    if (branched())
1307
4.98k
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1308
1.23M
    else
1309
1.23M
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1310
1.24M
  }
1311
1312
  void pathFillFind(KeyT x);
1313
  void treeFind(KeyT x);
1314
  void treeAdvanceTo(KeyT x);
1315
1316
  /// unsafeStart - Writable access to start() for iterator.
1317
269M
  KeyT &unsafeStart() const {
1318
269M
    assert(valid() && "Cannot access invalid iterator");
1319
269M
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())76.2M
:
1320
269M
                        
path.leaf<RootLeaf>().start(path.leafOffset())193M
;
1321
269M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStart() const
Line
Count
Source
1317
268M
  KeyT &unsafeStart() const {
1318
268M
    assert(valid() && "Cannot access invalid iterator");
1319
268M
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())75.9M
:
1320
268M
                        
path.leaf<RootLeaf>().start(path.leafOffset())192M
;
1321
268M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStart() const
Line
Count
Source
1317
5.09k
  KeyT &unsafeStart() const {
1318
5.09k
    assert(valid() && "Cannot access invalid iterator");
1319
5.09k
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())168
:
1320
5.09k
                        
path.leaf<RootLeaf>().start(path.leafOffset())4.92k
;
1321
5.09k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStart() const
Line
Count
Source
1317
1.08M
  KeyT &unsafeStart() const {
1318
1.08M
    assert(valid() && "Cannot access invalid iterator");
1319
1.08M
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())346k
:
1320
1.08M
                        
path.leaf<RootLeaf>().start(path.leafOffset())741k
;
1321
1.08M
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::unsafeStart() const
Line
Count
Source
1317
385k
  KeyT &unsafeStart() const {
1318
385k
    assert(valid() && "Cannot access invalid iterator");
1319
385k
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())1.24k
:
1320
385k
                        
path.leaf<RootLeaf>().start(path.leafOffset())384k
;
1321
385k
  }
1322
1323
  /// unsafeStop - Writable access to stop() for iterator.
1324
215M
  KeyT &unsafeStop() const {
1325
215M
    assert(valid() && "Cannot access invalid iterator");
1326
215M
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())47.3M
:
1327
215M
                        
path.leaf<RootLeaf>().stop(path.leafOffset())168M
;
1328
215M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStop() const
Line
Count
Source
1324
214M
  KeyT &unsafeStop() const {
1325
214M
    assert(valid() && "Cannot access invalid iterator");
1326
214M
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())47.1M
:
1327
214M
                        
path.leaf<RootLeaf>().stop(path.leafOffset())167M
;
1328
214M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStop() const
Line
Count
Source
1324
1.70k
  KeyT &unsafeStop() const {
1325
1.70k
    assert(valid() && "Cannot access invalid iterator");
1326
1.70k
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())59
:
1327
1.70k
                        
path.leaf<RootLeaf>().stop(path.leafOffset())1.64k
;
1328
1.70k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStop() const
Line
Count
Source
1324
802k
  KeyT &unsafeStop() const {
1325
802k
    assert(valid() && "Cannot access invalid iterator");
1326
802k
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())242k
:
1327
802k
                        
path.leaf<RootLeaf>().stop(path.leafOffset())559k
;
1328
802k
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::unsafeStop() const
Line
Count
Source
1324
38.5k
  KeyT &unsafeStop() const {
1325
38.5k
    assert(valid() && "Cannot access invalid iterator");
1326
38.5k
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())8
:
1327
38.5k
                        
path.leaf<RootLeaf>().stop(path.leafOffset())38.5k
;
1328
38.5k
  }
1329
1330
  /// unsafeValue - Writable access to value() for iterator.
1331
137M
  ValT &unsafeValue() const {
1332
137M
    assert(valid() && "Cannot access invalid iterator");
1333
137M
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())32.6M
:
1334
137M
                        
path.leaf<RootLeaf>().value(path.leafOffset())105M
;
1335
137M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeValue() const
Line
Count
Source
1331
5.08k
  ValT &unsafeValue() const {
1332
5.08k
    assert(valid() && "Cannot access invalid iterator");
1333
5.08k
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())187
:
1334
5.08k
                        
path.leaf<RootLeaf>().value(path.leafOffset())4.89k
;
1335
5.08k
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeValue() const
Line
Count
Source
1331
137M
  ValT &unsafeValue() const {
1332
137M
    assert(valid() && "Cannot access invalid iterator");
1333
137M
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())32.4M
:
1334
137M
                        
path.leaf<RootLeaf>().value(path.leafOffset())104M
;
1335
137M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeValue() const
Line
Count
Source
1331
532k
  ValT &unsafeValue() const {
1332
532k
    assert(valid() && "Cannot access invalid iterator");
1333
532k
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())168k
:
1334
532k
                        
path.leaf<RootLeaf>().value(path.leafOffset())364k
;
1335
532k
  }
1336
1337
public:
1338
  /// const_iterator - Create an iterator that isn't pointing anywhere.
1339
86.0M
  const_iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator()
Line
Count
Source
1339
85.9M
  const_iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator()
Line
Count
Source
1339
15
  const_iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator()
Line
Count
Source
1339
103k
  const_iterator() = default;
1340
1341
  /// setMap - Change the map iterated over. This call must be followed by a
1342
  /// call to goToBegin(), goToEnd(), or find()
1343
117M
  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
1343
117M
  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
1343
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
1343
103k
  void setMap(const IntervalMap &m) { map = const_cast<IntervalMap*>(&m); }
1344
1345
  /// valid - Return true if the current position is valid, false for end().
1346
361M
  bool valid() const { return path.valid(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::valid() const
Line
Count
Source
1346
358M
  bool valid() const { return path.valid(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::valid() const
Line
Count
Source
1346
8.88k
  bool valid() const { return path.valid(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::valid() const
Line
Count
Source
1346
1.99M
  bool valid() const { return path.valid(); }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::valid() const
Line
Count
Source
1346
927k
  bool valid() const { return path.valid(); }
1347
1348
  /// atBegin - Return true if the current position is the first map entry.
1349
  bool atBegin() const { return path.atBegin(); }
1350
1351
  /// start - Return the beginning of the current interval.
1352
269M
  const KeyT &start() const { return unsafeStart(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::start() const
Line
Count
Source
1352
268M
  const KeyT &start() const { return unsafeStart(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::start() const
Line
Count
Source
1352
4.00k
  const KeyT &start() const { return unsafeStart(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::start() const
Line
Count
Source
1352
1.08M
  const KeyT &start() const { return unsafeStart(); }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::start() const
Line
Count
Source
1352
385k
  const KeyT &start() const { return unsafeStart(); }
1353
1354
  /// stop - Return the end of the current interval.
1355
215M
  const KeyT &stop() const { return unsafeStop(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::stop() const
Line
Count
Source
1355
214M
  const KeyT &stop() const { return unsafeStop(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::stop() const
Line
Count
Source
1355
1.66k
  const KeyT &stop() const { return unsafeStop(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::stop() const
Line
Count
Source
1355
802k
  const KeyT &stop() const { return unsafeStop(); }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::stop() const
Line
Count
Source
1355
38.5k
  const KeyT &stop() const { return unsafeStop(); }
1356
1357
  /// value - Return the mapped value at the current interval.
1358
137M
  const ValT &value() const { return unsafeValue(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::value() const
Line
Count
Source
1358
4.17k
  const ValT &value() const { return unsafeValue(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::value() const
Line
Count
Source
1358
137M
  const ValT &value() const { return unsafeValue(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::value() const
Line
Count
Source
1358
532k
  const ValT &value() const { return unsafeValue(); }
1359
1360
  const ValT &operator*() const { return value(); }
1361
1362
826k
  bool operator==(const const_iterator &RHS) const {
1363
826k
    assert(map == RHS.map && "Cannot compare iterators from different maps");
1364
826k
    if (!valid())
1365
60.6k
      return !RHS.valid();
1366
765k
    if (path.leafOffset() != RHS.path.leafOffset())
1367
393k
      return false;
1368
371k
    return &path.template leaf<Leaf>() == &RHS.path.template leaf<Leaf>();
1369
371k
  }
1370
1371
826k
  bool operator!=(const const_iterator &RHS) const {
1372
826k
    return !operator==(RHS);
1373
826k
  }
1374
1375
  /// goToBegin - Move to the first interval in map.
1376
542k
  void goToBegin() {
1377
542k
    setRoot(0);
1378
542k
    if (branched())
1379
13.9k
      path.fillLeft(map->height);
1380
542k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::goToBegin()
Line
Count
Source
1376
2.34k
  void goToBegin() {
1377
2.34k
    setRoot(0);
1378
2.34k
    if (branched())
1379
19
      path.fillLeft(map->height);
1380
2.34k
  }
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
1376
130k
  void goToBegin() {
1377
130k
    setRoot(0);
1378
130k
    if (branched())
1379
12.7k
      path.fillLeft(map->height);
1380
130k
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::goToBegin()
Line
Count
Source
1376
410k
  void goToBegin() {
1377
410k
    setRoot(0);
1378
410k
    if (branched())
1379
1.24k
      path.fillLeft(map->height);
1380
410k
  }
1381
1382
  /// goToEnd - Move beyond the last interval in map.
1383
416k
  void goToEnd() {
1384
416k
    setRoot(map->rootSize);
1385
416k
  }
1386
1387
  /// preincrement - move to the next interval.
1388
36.4M
  const_iterator &operator++() {
1389
36.4M
    assert(valid() && "Cannot increment end()");
1390
36.4M
    if (++path.leafOffset() == path.leafSize() && 
branched()10.9M
)
1391
3.31M
      path.moveRight(map->height);
1392
36.4M
    return *this;
1393
36.4M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator++()
Line
Count
Source
1388
36.1M
  const_iterator &operator++() {
1389
36.1M
    assert(valid() && "Cannot increment end()");
1390
36.1M
    if (++path.leafOffset() == path.leafSize() && 
branched()10.9M
)
1391
3.30M
      path.moveRight(map->height);
1392
36.1M
    return *this;
1393
36.1M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator++()
Line
Count
Source
1388
3.29k
  const_iterator &operator++() {
1389
3.29k
    assert(valid() && "Cannot increment end()");
1390
3.29k
    if (++path.leafOffset() == path.leafSize() && 
branched()2.28k
)
1391
22
      path.moveRight(map->height);
1392
3.29k
    return *this;
1393
3.29k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator++()
Line
Count
Source
1388
257k
  const_iterator &operator++() {
1389
257k
    assert(valid() && "Cannot increment end()");
1390
257k
    if (++path.leafOffset() == path.leafSize() && 
branched()69.1k
)
1391
9.84k
      path.moveRight(map->height);
1392
257k
    return *this;
1393
257k
  }
1394
1395
  /// postincrement - Dont do that!
1396
  const_iterator operator++(int) {
1397
    const_iterator tmp = *this;
1398
    operator++();
1399
    return tmp;
1400
  }
1401
1402
  /// predecrement - move to the previous interval.
1403
3.98M
  const_iterator &operator--() {
1404
3.98M
    if (path.leafOffset() && 
(3.71M
valid()3.71M
||
!branched()724k
))
1405
3.53M
      --path.leafOffset();
1406
448k
    else
1407
448k
      path.moveLeft(map->height);
1408
3.98M
    return *this;
1409
3.98M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator--()
Line
Count
Source
1403
3.94M
  const_iterator &operator--() {
1404
3.94M
    if (path.leafOffset() && 
(3.67M
valid()3.67M
||
!branched()693k
))
1405
3.50M
      --path.leafOffset();
1406
448k
    else
1407
448k
      path.moveLeft(map->height);
1408
3.94M
    return *this;
1409
3.94M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator--()
Line
Count
Source
1403
12
  const_iterator &operator--() {
1404
12
    if (path.leafOffset() && (valid() || 
!branched()0
))
1405
12
      --path.leafOffset();
1406
0
    else
1407
0
      path.moveLeft(map->height);
1408
12
    return *this;
1409
12
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::operator--()
Line
Count
Source
1403
38.5k
  const_iterator &operator--() {
1404
38.5k
    if (path.leafOffset() && (valid() || 
!branched()30.3k
))
1405
38.5k
      --path.leafOffset();
1406
5
    else
1407
5
      path.moveLeft(map->height);
1408
38.5k
    return *this;
1409
38.5k
  }
1410
1411
  /// postdecrement - Dont do that!
1412
  const_iterator operator--(int) {
1413
    const_iterator tmp = *this;
1414
    operator--();
1415
    return tmp;
1416
  }
1417
1418
  /// find - Move to the first interval with stop >= x, or end().
1419
  /// This is a full search from the root, the current position is ignored.
1420
137M
  void find(KeyT x) {
1421
137M
    if (branched())
1422
28.4M
      treeFind(x);
1423
108M
    else
1424
108M
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1425
137M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::find(llvm::SlotIndex)
Line
Count
Source
1420
136M
  void find(KeyT x) {
1421
136M
    if (branched())
1422
27.8M
      treeFind(x);
1423
108M
    else
1424
108M
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1425
136M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::find(llvm::SlotIndex)
Line
Count
Source
1420
1.57k
  void find(KeyT x) {
1421
1.57k
    if (branched())
1422
55
      treeFind(x);
1423
1.51k
    else
1424
1.51k
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1425
1.57k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::find(llvm::SlotIndex)
Line
Count
Source
1420
679k
  void find(KeyT x) {
1421
679k
    if (branched())
1422
609k
      treeFind(x);
1423
70.5k
    else
1424
70.5k
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1425
679k
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::find(long long)
Line
Count
Source
1420
417k
  void find(KeyT x) {
1421
417k
    if (branched())
1422
2.49k
      treeFind(x);
1423
415k
    else
1424
415k
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1425
417k
  }
1426
1427
  /// advanceTo - Move to the first interval with stop >= x, or end().
1428
  /// The search is started from the current position, and no earlier positions
1429
  /// can be found. This is much faster than find() for small moves.
1430
26.0M
  void advanceTo(KeyT x) {
1431
26.0M
    if (!valid())
1432
6.34M
      return;
1433
19.6M
    if (branched())
1434
9.94M
      treeAdvanceTo(x);
1435
9.75M
    else
1436
9.75M
      path.leafOffset() =
1437
9.75M
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1438
19.6M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::advanceTo(llvm::SlotIndex)
Line
Count
Source
1430
25.6M
  void advanceTo(KeyT x) {
1431
25.6M
    if (!valid())
1432
6.28M
      return;
1433
19.3M
    if (branched())
1434
9.83M
      treeAdvanceTo(x);
1435
9.47M
    else
1436
9.47M
      path.leafOffset() =
1437
9.47M
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1438
19.3M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::advanceTo(llvm::SlotIndex)
Line
Count
Source
1430
1.06k
  void advanceTo(KeyT x) {
1431
1.06k
    if (!valid())
1432
2
      return;
1433
1.06k
    if (branched())
1434
8
      treeAdvanceTo(x);
1435
1.05k
    else
1436
1.05k
      path.leafOffset() =
1437
1.05k
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1438
1.06k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::advanceTo(llvm::SlotIndex)
Line
Count
Source
1430
436k
  void advanceTo(KeyT x) {
1431
436k
    if (!valid())
1432
54.7k
      return;
1433
382k
    if (branched())
1434
104k
      treeAdvanceTo(x);
1435
277k
    else
1436
277k
      path.leafOffset() =
1437
277k
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1438
382k
  }
1439
};
1440
1441
/// pathFillFind - Complete path by searching for x.
1442
/// @param x Key to search for.
1443
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1444
void IntervalMap<KeyT, ValT, N, Traits>::
1445
28.4M
const_iterator::pathFillFind(KeyT x) {
1446
28.4M
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1447
31.0M
  for (unsigned i = map->height - path.height() - 1; i; 
--i2.62M
) {
1448
2.62M
    unsigned p = NR.get<Branch>().safeFind(0, x);
1449
2.62M
    path.push(NR, p);
1450
2.62M
    NR = NR.subtree(p);
1451
2.62M
  }
1452
28.4M
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1453
28.4M
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::pathFillFind(llvm::SlotIndex)
Line
Count
Source
1445
27.8M
const_iterator::pathFillFind(KeyT x) {
1446
27.8M
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1447
30.4M
  for (unsigned i = map->height - path.height() - 1; i; 
--i2.60M
) {
1448
2.60M
    unsigned p = NR.get<Branch>().safeFind(0, x);
1449
2.60M
    path.push(NR, p);
1450
2.60M
    NR = NR.subtree(p);
1451
2.60M
  }
1452
27.8M
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1453
27.8M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::pathFillFind(llvm::SlotIndex)
Line
Count
Source
1445
50
const_iterator::pathFillFind(KeyT x) {
1446
50
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1447
50
  for (unsigned i = map->height - path.height() - 1; i; 
--i0
) {
1448
0
    unsigned p = NR.get<Branch>().safeFind(0, x);
1449
0
    path.push(NR, p);
1450
0
    NR = NR.subtree(p);
1451
0
  }
1452
50
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1453
50
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::pathFillFind(llvm::SlotIndex)
Line
Count
Source
1445
587k
const_iterator::pathFillFind(KeyT x) {
1446
587k
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1447
613k
  for (unsigned i = map->height - path.height() - 1; i; 
--i25.4k
) {
1448
25.4k
    unsigned p = NR.get<Branch>().safeFind(0, x);
1449
25.4k
    path.push(NR, p);
1450
25.4k
    NR = NR.subtree(p);
1451
25.4k
  }
1452
587k
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1453
587k
}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::pathFillFind(long long)
Line
Count
Source
1445
2.48k
const_iterator::pathFillFind(KeyT x) {
1446
2.48k
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1447
2.48k
  for (unsigned i = map->height - path.height() - 1; i; 
--i0
) {
1448
0
    unsigned p = NR.get<Branch>().safeFind(0, x);
1449
0
    path.push(NR, p);
1450
0
    NR = NR.subtree(p);
1451
0
  }
1452
2.48k
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1453
2.48k
}
1454
1455
/// treeFind - Find in a branched tree.
1456
/// @param x Key to search for.
1457
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1458
void IntervalMap<KeyT, ValT, N, Traits>::
1459
28.4M
const_iterator::treeFind(KeyT x) {
1460
28.4M
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1461
28.4M
  if (valid())
1462
26.5M
    pathFillFind(x);
1463
28.4M
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeFind(llvm::SlotIndex)
Line
Count
Source
1459
27.8M
const_iterator::treeFind(KeyT x) {
1460
27.8M
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1461
27.8M
  if (valid())
1462
26.0M
    pathFillFind(x);
1463
27.8M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeFind(llvm::SlotIndex)
Line
Count
Source
1459
55
const_iterator::treeFind(KeyT x) {
1460
55
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1461
55
  if (valid())
1462
50
    pathFillFind(x);
1463
55
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeFind(llvm::SlotIndex)
Line
Count
Source
1459
609k
const_iterator::treeFind(KeyT x) {
1460
609k
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1461
609k
  if (valid())
1462
579k
    pathFillFind(x);
1463
609k
}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::treeFind(long long)
Line
Count
Source
1459
2.49k
const_iterator::treeFind(KeyT x) {
1460
2.49k
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1461
2.49k
  if (valid())
1462
2.48k
    pathFillFind(x);
1463
2.49k
}
1464
1465
/// treeAdvanceTo - Find position after the current one.
1466
/// @param x Key to search for.
1467
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1468
void IntervalMap<KeyT, ValT, N, Traits>::
1469
9.94M
const_iterator::treeAdvanceTo(KeyT x) {
1470
9.94M
  // Can we stay on the same leaf node?
1471
9.94M
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1472
7.67M
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1473
7.67M
    return;
1474
7.67M
  }
1475
2.26M
1476
2.26M
  // Drop the current leaf.
1477
2.26M
  path.pop();
1478
2.26M
1479
2.26M
  // Search towards the root for a usable subtree.
1480
2.26M
  if (path.height()) {
1481
470k
    for (unsigned l = path.height() - 1; l; 
--l6.21k
) {
1482
19.3k
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1483
13.1k
        // The branch node at l+1 is usable
1484
13.1k
        path.offset(l + 1) =
1485
13.1k
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1486
13.1k
        return pathFillFind(x);
1487
13.1k
      }
1488
6.21k
      path.pop();
1489
6.21k
    }
1490
464k
    // Is the level-1 Branch usable?
1491
464k
    
if (451k
!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)451k
) {
1492
342k
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1493
342k
      return pathFillFind(x);
1494
342k
    }
1495
1.91M
  }
1496
1.91M
1497
1.91M
  // We reached the root.
1498
1.91M
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1499
1.91M
  if (valid())
1500
1.49M
    pathFillFind(x);
1501
1.91M
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeAdvanceTo(llvm::SlotIndex)
Line
Count
Source
1469
9.83M
const_iterator::treeAdvanceTo(KeyT x) {
1470
9.83M
  // Can we stay on the same leaf node?
1471
9.83M
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1472
7.57M
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1473
7.57M
    return;
1474
7.57M
  }
1475
2.25M
1476
2.25M
  // Drop the current leaf.
1477
2.25M
  path.pop();
1478
2.25M
1479
2.25M
  // Search towards the root for a usable subtree.
1480
2.25M
  if (path.height()) {
1481
470k
    for (unsigned l = path.height() - 1; l; 
--l6.21k
) {
1482
19.3k
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1483
13.1k
        // The branch node at l+1 is usable
1484
13.1k
        path.offset(l + 1) =
1485
13.1k
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1486
13.1k
        return pathFillFind(x);
1487
13.1k
      }
1488
6.21k
      path.pop();
1489
6.21k
    }
1490
463k
    // Is the level-1 Branch usable?
1491
463k
    
if (450k
!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)450k
) {
1492
342k
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1493
342k
      return pathFillFind(x);
1494
342k
    }
1495
1.90M
  }
1496
1.90M
1497
1.90M
  // We reached the root.
1498
1.90M
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1499
1.90M
  if (valid())
1500
1.49M
    pathFillFind(x);
1501
1.90M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeAdvanceTo(llvm::SlotIndex)
Line
Count
Source
1469
8
const_iterator::treeAdvanceTo(KeyT x) {
1470
8
  // Can we stay on the same leaf node?
1471
8
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1472
4
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1473
4
    return;
1474
4
  }
1475
4
1476
4
  // Drop the current leaf.
1477
4
  path.pop();
1478
4
1479
4
  // Search towards the root for a usable subtree.
1480
4
  if (path.height()) {
1481
0
    for (unsigned l = path.height() - 1; l; --l) {
1482
0
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1483
0
        // The branch node at l+1 is usable
1484
0
        path.offset(l + 1) =
1485
0
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1486
0
        return pathFillFind(x);
1487
0
      }
1488
0
      path.pop();
1489
0
    }
1490
0
    // Is the level-1 Branch usable?
1491
0
    if (!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)) {
1492
0
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1493
0
      return pathFillFind(x);
1494
0
    }
1495
4
  }
1496
4
1497
4
  // We reached the root.
1498
4
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1499
4
  if (valid())
1500
0
    pathFillFind(x);
1501
4
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeAdvanceTo(llvm::SlotIndex)
Line
Count
Source
1469
104k
const_iterator::treeAdvanceTo(KeyT x) {
1470
104k
  // Can we stay on the same leaf node?
1471
104k
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1472
94.9k
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1473
94.9k
    return;
1474
94.9k
  }
1475
9.70k
1476
9.70k
  // Drop the current leaf.
1477
9.70k
  path.pop();
1478
9.70k
1479
9.70k
  // Search towards the root for a usable subtree.
1480
9.70k
  if (path.height()) {
1481
277
    for (unsigned l = path.height() - 1; l; 
--l0
) {
1482
0
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1483
0
        // The branch node at l+1 is usable
1484
0
        path.offset(l + 1) =
1485
0
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1486
0
        return pathFillFind(x);
1487
0
      }
1488
0
      path.pop();
1489
0
    }
1490
277
    // Is the level-1 Branch usable?
1491
277
    if (!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)) {
1492
255
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1493
255
      return pathFillFind(x);
1494
255
    }
1495
9.45k
  }
1496
9.45k
1497
9.45k
  // We reached the root.
1498
9.45k
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1499
9.45k
  if (valid())
1500
7.85k
    pathFillFind(x);
1501
9.45k
}
1502
1503
//===----------------------------------------------------------------------===//
1504
//---                       IntervalMap::iterator                         ----//
1505
//===----------------------------------------------------------------------===//
1506
1507
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1508
class IntervalMap<KeyT, ValT, N, Traits>::iterator : public const_iterator {
1509
  friend class IntervalMap;
1510
1511
  using IdxPair = IntervalMapImpl::IdxPair;
1512
1513
12.6M
  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
1513
3.87k
  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
1513
10.6M
  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
1513
763k
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::iterator::iterator(llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >&)
Line
Count
Source
1513
1.24M
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
1514
1515
  void setNodeStop(unsigned Level, KeyT Stop);
1516
  bool insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop);
1517
  template <typename NodeT> bool overflow(unsigned Level);
1518
  void treeInsert(KeyT a, KeyT b, ValT y);
1519
  void eraseNode(unsigned Level);
1520
  void treeErase(bool UpdateRoot = true);
1521
  bool canCoalesceLeft(KeyT Start, ValT x);
1522
  bool canCoalesceRight(KeyT Stop, ValT x);
1523
1524
public:
1525
  /// iterator - Create null iterator.
1526
2.62M
  iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator()
Line
Count
Source
1526
2.51M
  iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator()
Line
Count
Source
1526
15
  iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator()
Line
Count
Source
1526
103k
  iterator() = default;
1527
1528
  /// setStart - Move the start of the current interval.
1529
  /// This may cause coalescing with the previous interval.
1530
  /// @param a New start key, must not overlap the previous interval.
1531
  void setStart(KeyT a);
1532
1533
  /// setStop - Move the end of the current interval.
1534
  /// This may cause coalescing with the following interval.
1535
  /// @param b New stop key, must not overlap the following interval.
1536
  void setStop(KeyT b);
1537
1538
  /// setValue - Change the mapped value of the current interval.
1539
  /// This may cause coalescing with the previous and following intervals.
1540
  /// @param x New value.
1541
  void setValue(ValT x);
1542
1543
  /// setStartUnchecked - Move the start of the current interval without
1544
  /// checking for coalescing or overlaps.
1545
  /// This should only be used when it is known that coalescing is not required.
1546
  /// @param a New start key.
1547
269
  void setStartUnchecked(KeyT a) { this->unsafeStart() = a; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStartUnchecked(llvm::SlotIndex)
Line
Count
Source
1547
269
  void setStartUnchecked(KeyT a) { this->unsafeStart() = a; }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStartUnchecked(llvm::SlotIndex)
1548
1549
  /// setStopUnchecked - Move the end of the current interval without checking
1550
  /// for coalescing or overlaps.
1551
  /// This should only be used when it is known that coalescing is not required.
1552
  /// @param b New stop key.
1553
217
  void setStopUnchecked(KeyT b) {
1554
217
    this->unsafeStop() = b;
1555
217
    // Update keys in branch nodes as well.
1556
217
    if (this->path.atLastEntry(this->path.height()))
1557
80
      setNodeStop(this->path.height(), b);
1558
217
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStopUnchecked(llvm::SlotIndex)
Line
Count
Source
1553
47
  void setStopUnchecked(KeyT b) {
1554
47
    this->unsafeStop() = b;
1555
47
    // Update keys in branch nodes as well.
1556
47
    if (this->path.atLastEntry(this->path.height()))
1557
46
      setNodeStop(this->path.height(), b);
1558
47
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStopUnchecked(llvm::SlotIndex)
Line
Count
Source
1553
170
  void setStopUnchecked(KeyT b) {
1554
170
    this->unsafeStop() = b;
1555
170
    // Update keys in branch nodes as well.
1556
170
    if (this->path.atLastEntry(this->path.height()))
1557
34
      setNodeStop(this->path.height(), b);
1558
170
  }
1559
1560
  /// setValueUnchecked - Change the mapped value of the current interval
1561
  /// without checking for coalescing.
1562
  /// @param x New value.
1563
910
  void setValueUnchecked(ValT x) { this->unsafeValue() = x; }
1564
1565
  /// insert - Insert mapping [a;b] -> y before the current position.
1566
  void insert(KeyT a, KeyT b, ValT y);
1567
1568
  /// erase - Erase the current interval.
1569
  void erase();
1570
1571
13.2M
  iterator &operator++() {
1572
13.2M
    const_iterator::operator++();
1573
13.2M
    return *this;
1574
13.2M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator++()
Line
Count
Source
1571
13.2M
  iterator &operator++() {
1572
13.2M
    const_iterator::operator++();
1573
13.2M
    return *this;
1574
13.2M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator++()
Line
Count
Source
1571
1.55k
  iterator &operator++() {
1572
1.55k
    const_iterator::operator++();
1573
1.55k
    return *this;
1574
1.55k
  }
1575
1576
  iterator operator++(int) {
1577
    iterator tmp = *this;
1578
    operator++();
1579
    return tmp;
1580
  }
1581
1582
3.98M
  iterator &operator--() {
1583
3.98M
    const_iterator::operator--();
1584
3.98M
    return *this;
1585
3.98M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator--()
Line
Count
Source
1582
3.94M
  iterator &operator--() {
1583
3.94M
    const_iterator::operator--();
1584
3.94M
    return *this;
1585
3.94M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator--()
Line
Count
Source
1582
12
  iterator &operator--() {
1583
12
    const_iterator::operator--();
1584
12
    return *this;
1585
12
  }
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::iterator::operator--()
Line
Count
Source
1582
38.5k
  iterator &operator--() {
1583
38.5k
    const_iterator::operator--();
1584
38.5k
    return *this;
1585
38.5k
  }
1586
1587
  iterator operator--(int) {
1588
    iterator tmp = *this;
1589
    operator--();
1590
    return tmp;
1591
  }
1592
};
1593
1594
/// canCoalesceLeft - Can the current interval coalesce to the left after
1595
/// changing start or value?
1596
/// @param Start New start of current interval.
1597
/// @param Value New value for current interval.
1598
/// @return True when updating the current interval would enable coalescing.
1599
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1600
bool IntervalMap<KeyT, ValT, N, Traits>::
1601
58
iterator::canCoalesceLeft(KeyT Start, ValT Value) {
1602
58
  using namespace IntervalMapImpl;
1603
58
  Path &P = this->path;
1604
58
  if (!this->branched()) {
1605
58
    unsigned i = P.leafOffset();
1606
58
    RootLeaf &Node = P.leaf<RootLeaf>();
1607
58
    return i && 
Node.value(i-1) == Value21
&&
1608
58
                
Traits::adjacent(Node.stop(i-1), Start)3
;
1609
58
  }
1610
0
  // Branched.
1611
0
  if (unsigned i = P.leafOffset()) {
1612
0
    Leaf &Node = P.leaf<Leaf>();
1613
0
    return Node.value(i-1) == Value && Traits::adjacent(Node.stop(i-1), Start);
1614
0
  } else if (NodeRef NR = P.getLeftSibling(P.height())) {
1615
0
    unsigned i = NR.size() - 1;
1616
0
    Leaf &Node = NR.get<Leaf>();
1617
0
    return Node.value(i) == Value && Traits::adjacent(Node.stop(i), Start);
1618
0
  }
1619
0
  return false;
1620
0
}
1621
1622
/// canCoalesceRight - Can the current interval coalesce to the right after
1623
/// changing stop or value?
1624
/// @param Stop New stop of current interval.
1625
/// @param Value New value for current interval.
1626
/// @return True when updating the current interval would enable coalescing.
1627
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1628
bool IntervalMap<KeyT, ValT, N, Traits>::
1629
58
iterator::canCoalesceRight(KeyT Stop, ValT Value) {
1630
58
  using namespace IntervalMapImpl;
1631
58
  Path &P = this->path;
1632
58
  unsigned i = P.leafOffset() + 1;
1633
58
  if (!this->branched()) {
1634
58
    if (i >= P.leafSize())
1635
46
      return false;
1636
12
    RootLeaf &Node = P.leaf<RootLeaf>();
1637
12
    return Node.value(i) == Value && 
Traits::adjacent(Stop, Node.start(i))0
;
1638
12
  }
1639
0
  // Branched.
1640
0
  if (i < P.leafSize()) {
1641
0
    Leaf &Node = P.leaf<Leaf>();
1642
0
    return Node.value(i) == Value && Traits::adjacent(Stop, Node.start(i));
1643
0
  } else if (NodeRef NR = P.getRightSibling(P.height())) {
1644
0
    Leaf &Node = NR.get<Leaf>();
1645
0
    return Node.value(0) == Value && Traits::adjacent(Stop, Node.start(0));
1646
0
  }
1647
0
  return false;
1648
0
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::canCoalesceRight(llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
1629
58
iterator::canCoalesceRight(KeyT Stop, ValT Value) {
1630
58
  using namespace IntervalMapImpl;
1631
58
  Path &P = this->path;
1632
58
  unsigned i = P.leafOffset() + 1;
1633
58
  if (!this->branched()) {
1634
58
    if (i >= P.leafSize())
1635
46
      return false;
1636
12
    RootLeaf &Node = P.leaf<RootLeaf>();
1637
12
    return Node.value(i) == Value && 
Traits::adjacent(Stop, Node.start(i))0
;
1638
12
  }
1639
0
  // Branched.
1640
0
  if (i < P.leafSize()) {
1641
0
    Leaf &Node = P.leaf<Leaf>();
1642
0
    return Node.value(i) == Value && Traits::adjacent(Stop, Node.start(i));
1643
0
  } else if (NodeRef NR = P.getRightSibling(P.height())) {
1644
0
    Leaf &Node = NR.get<Leaf>();
1645
0
    return Node.value(0) == Value && Traits::adjacent(Stop, Node.start(0));
1646
0
  }
1647
0
  return false;
1648
0
}
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::canCoalesceRight(llvm::SlotIndex, unsigned int)
1649
1650
/// setNodeStop - Update the stop key of the current node at level and above.
1651
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1652
void IntervalMap<KeyT, ValT, N, Traits>::
1653
3.71M
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1654
3.71M
  // There are no references to the root node, so nothing to update.
1655
3.71M
  if (!Level)
1656
46
    return;
1657
3.71M
  IntervalMapImpl::Path &P = this->path;
1658
3.71M
  // Update nodes pointing to the current node.
1659
4.06M
  while (--Level) {
1660
843k
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1661
843k
    if (!P.atLastEntry(Level))
1662
499k
      return;
1663
843k
  }
1664
3.71M
  // Update root separately since it has a different layout.
1665
3.71M
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1666
3.21M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setNodeStop(unsigned int, llvm::SlotIndex)
Line
Count
Source
1653
62
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1654
62
  // There are no references to the root node, so nothing to update.
1655
62
  if (!Level)
1656
46
    return;
1657
16
  IntervalMapImpl::Path &P = this->path;
1658
16
  // Update nodes pointing to the current node.
1659
16
  while (--Level) {
1660
0
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1661
0
    if (!P.atLastEntry(Level))
1662
0
      return;
1663
0
  }
1664
16
  // Update root separately since it has a different layout.
1665
16
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1666
16
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setNodeStop(unsigned int, llvm::SlotIndex)
Line
Count
Source
1653
3.58M
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1654
3.58M
  // There are no references to the root node, so nothing to update.
1655
3.58M
  if (!Level)
1656
0
    return;
1657
3.58M
  IntervalMapImpl::Path &P = this->path;
1658
3.58M
  // Update nodes pointing to the current node.
1659
3.92M
  while (--Level) {
1660
836k
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1661
836k
    if (!P.atLastEntry(Level))
1662
494k
      return;
1663
836k
  }
1664
3.58M
  // Update root separately since it has a different layout.
1665
3.58M
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1666
3.08M
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setNodeStop(unsigned int, llvm::SlotIndex)
Line
Count
Source
1653
133k
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1654
133k
  // There are no references to the root node, so nothing to update.
1655
133k
  if (!Level)
1656
0
    return;
1657
133k
  IntervalMapImpl::Path &P = this->path;
1658
133k
  // Update nodes pointing to the current node.
1659
135k
  while (--Level) {
1660
7.10k
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1661
7.10k
    if (!P.atLastEntry(Level))
1662
5.56k
      return;
1663
7.10k
  }
1664
133k
  // Update root separately since it has a different layout.
1665
133k
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1666
127k
}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::iterator::setNodeStop(unsigned int, long long)
Line
Count
Source
1653
395
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1654
395
  // There are no references to the root node, so nothing to update.
1655
395
  if (!Level)
1656
0
    return;
1657
395
  IntervalMapImpl::Path &P = this->path;
1658
395
  // Update nodes pointing to the current node.
1659
395
  while (--Level) {
1660
0
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1661
0
    if (!P.atLastEntry(Level))
1662
0
      return;
1663
0
  }
1664
395
  // Update root separately since it has a different layout.
1665
395
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1666
395
}
1667
1668
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1669
void IntervalMap<KeyT, ValT, N, Traits>::
1670
821
iterator::setStart(KeyT a) {
1671
821
  assert(Traits::nonEmpty(a, this->stop()) && "Cannot move start beyond stop");
1672
821
  KeyT &CurStart = this->unsafeStart();
1673
821
  if (!Traits::startLess(a, CurStart) || 
!canCoalesceLeft(a, this->value())0
) {
1674
821
    CurStart = a;
1675
821
    return;
1676
821
  }
1677
0
  // Coalesce with the interval to the left.
1678
0
  --*this;
1679
0
  a = this->start();
1680
0
  erase();
1681
0
  setStartUnchecked(a);
1682
0
}
1683
1684
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1685
void IntervalMap<KeyT, ValT, N, Traits>::
1686
170
iterator::setStop(KeyT b) {
1687
170
  assert(Traits::nonEmpty(this->start(), b) && "Cannot move stop beyond start");
1688
170
  if (Traits::startLess(b, this->stop()) ||
1689
170
      
!canCoalesceRight(b, this->value())0
) {
1690
170
    setStopUnchecked(b);
1691
170
    return;
1692
170
  }
1693
0
  // Coalesce with interval to the right.
1694
0
  KeyT a = this->start();
1695
0
  erase();
1696
0
  setStartUnchecked(a);
1697
0
}
1698
1699
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1700
void IntervalMap<KeyT, ValT, N, Traits>::
1701
58
iterator::setValue(ValT x) {
1702
58
  setValueUnchecked(x);
1703
58
  if (canCoalesceRight(this->stop(), x)) {
1704
0
    KeyT a = this->start();
1705
0
    erase();
1706
0
    setStartUnchecked(a);
1707
0
  }
1708
58
  if (canCoalesceLeft(this->start(), x)) {
1709
3
    --*this;
1710
3
    KeyT a = this->start();
1711
3
    erase();
1712
3
    setStartUnchecked(a);
1713
3
  }
1714
58
}
1715
1716
/// insertNode - insert a node before the current path at level.
1717
/// Leave the current path pointing at the new node.
1718
/// @param Level path index of the node to be inserted.
1719
/// @param Node The node to be inserted.
1720
/// @param Stop The last index in the new node.
1721
/// @return True if the tree height was increased.
1722
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1723
bool IntervalMap<KeyT, ValT, N, Traits>::
1724
376k
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1725
376k
  assert(Level && "Cannot insert next to the root");
1726
376k
  bool SplitRoot = false;
1727
376k
  IntervalMap &IM = *this->map;
1728
376k
  IntervalMapImpl::Path &P = this->path;
1729
376k
1730
376k
  if (Level == 1) {
1731
298k
    // Insert into the root branch node.
1732
298k
    if (IM.rootSize < RootBranch::Capacity) {
1733
291k
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1734
291k
      P.setSize(0, ++IM.rootSize);
1735
291k
      P.reset(Level);
1736
291k
      return SplitRoot;
1737
291k
    }
1738
6.48k
1739
6.48k
    // We need to split the root while keeping our position.
1740
6.48k
    SplitRoot = true;
1741
6.48k
    IdxPair Offset = IM.splitRoot(P.offset(0));
1742
6.48k
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1743
6.48k
1744
6.48k
    // Fall through to insert at the new higher level.
1745
6.48k
    ++Level;
1746
6.48k
  }
1747
376k
1748
376k
  // When inserting before end(), make sure we have a valid path.
1749
376k
  P.legalizeForInsert(--Level);
1750
84.7k
1751
84.7k
  // Insert into the branch node at Level-1.
1752
84.7k
  if (P.size(Level) == Branch::Capacity) {
1753
22.9k
    // Branch node is full, handle handle the overflow.
1754
22.9k
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1755
22.9k
    SplitRoot = overflow<Branch>(Level);
1756
22.9k
    Level += SplitRoot;
1757
22.9k
  }
1758
84.7k
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1759
84.7k
  P.setSize(Level, P.size(Level) + 1);
1760
84.7k
  if (P.atLastEntry(Level))
1761
740
    setNodeStop(Level, Stop);
1762
84.7k
  P.reset(Level + 1);
1763
84.7k
  return SplitRoot;
1764
376k
}
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
1724
370k
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1725
370k
  assert(Level && "Cannot insert next to the root");
1726
370k
  bool SplitRoot = false;
1727
370k
  IntervalMap &IM = *this->map;
1728
370k
  IntervalMapImpl::Path &P = this->path;
1729
370k
1730
370k
  if (Level == 1) {
1731
292k
    // Insert into the root branch node.
1732
292k
    if (IM.rootSize < RootBranch::Capacity) {
1733
286k
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1734
286k
      P.setSize(0, ++IM.rootSize);
1735
286k
      P.reset(Level);
1736
286k
      return SplitRoot;
1737
286k
    }
1738
6.42k
1739
6.42k
    // We need to split the root while keeping our position.
1740
6.42k
    SplitRoot = true;
1741
6.42k
    IdxPair Offset = IM.splitRoot(P.offset(0));
1742
6.42k
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1743
6.42k
1744
6.42k
    // Fall through to insert at the new higher level.
1745
6.42k
    ++Level;
1746
6.42k
  }
1747
370k
1748
370k
  // When inserting before end(), make sure we have a valid path.
1749
370k
  P.legalizeForInsert(--Level);
1750
84.3k
1751
84.3k
  // Insert into the branch node at Level-1.
1752
84.3k
  if (P.size(Level) == Branch::Capacity) {
1753
22.8k
    // Branch node is full, handle handle the overflow.
1754
22.8k
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1755
22.8k
    SplitRoot = overflow<Branch>(Level);
1756
22.8k
    Level += SplitRoot;
1757
22.8k
  }
1758
84.3k
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1759
84.3k
  P.setSize(Level, P.size(Level) + 1);
1760
84.3k
  if (P.atLastEntry(Level))
1761
735
    setNodeStop(Level, Stop);
1762
84.3k
  P.reset(Level + 1);
1763
84.3k
  return SplitRoot;
1764
370k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insertNode(unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
1724
5.69k
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1725
5.69k
  assert(Level && "Cannot insert next to the root");
1726
5.69k
  bool SplitRoot = false;
1727
5.69k
  IntervalMap &IM = *this->map;
1728
5.69k
  IntervalMapImpl::Path &P = this->path;
1729
5.69k
1730
5.69k
  if (Level == 1) {
1731
5.40k
    // Insert into the root branch node.
1732
5.40k
    if (IM.rootSize < RootBranch::Capacity) {
1733
5.34k
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1734
5.34k
      P.setSize(0, ++IM.rootSize);
1735
5.34k
      P.reset(Level);
1736
5.34k
      return SplitRoot;
1737
5.34k
    }
1738
58
1739
58
    // We need to split the root while keeping our position.
1740
58
    SplitRoot = true;
1741
58
    IdxPair Offset = IM.splitRoot(P.offset(0));
1742
58
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1743
58
1744
58
    // Fall through to insert at the new higher level.
1745
58
    ++Level;
1746
58
  }
1747
5.69k
1748
5.69k
  // When inserting before end(), make sure we have a valid path.
1749
5.69k
  P.legalizeForInsert(--Level);
1750
353
1751
353
  // Insert into the branch node at Level-1.
1752
353
  if (P.size(Level) == Branch::Capacity) {
1753
83
    // Branch node is full, handle handle the overflow.
1754
83
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1755
83
    SplitRoot = overflow<Branch>(Level);
1756
83
    Level += SplitRoot;
1757
83
  }
1758
353
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1759
353
  P.setSize(Level, P.size(Level) + 1);
1760
353
  if (P.atLastEntry(Level))
1761
5
    setNodeStop(Level, Stop);
1762
353
  P.reset(Level + 1);
1763
353
  return SplitRoot;
1764
5.69k
}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::iterator::insertNode(unsigned int, llvm::IntervalMapImpl::NodeRef, long long)
Line
Count
Source
1724
97
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1725
97
  assert(Level && "Cannot insert next to the root");
1726
97
  bool SplitRoot = false;
1727
97
  IntervalMap &IM = *this->map;
1728
97
  IntervalMapImpl::Path &P = this->path;
1729
97
1730
97
  if (Level == 1) {
1731
97
    // Insert into the root branch node.
1732
97
    if (IM.rootSize < RootBranch::Capacity) {
1733
97
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1734
97
      P.setSize(0, ++IM.rootSize);
1735
97
      P.reset(Level);
1736
97
      return SplitRoot;
1737
97
    }
1738
0
1739
0
    // We need to split the root while keeping our position.
1740
0
    SplitRoot = true;
1741
0
    IdxPair Offset = IM.splitRoot(P.offset(0));
1742
0
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1743
0
1744
0
    // Fall through to insert at the new higher level.
1745
0
    ++Level;
1746
0
  }
1747
97
1748
97
  // When inserting before end(), make sure we have a valid path.
1749
97
  P.legalizeForInsert(--Level);
1750
0
1751
0
  // Insert into the branch node at Level-1.
1752
0
  if (P.size(Level) == Branch::Capacity) {
1753
0
    // Branch node is full, handle handle the overflow.
1754
0
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1755
0
    SplitRoot = overflow<Branch>(Level);
1756
0
    Level += SplitRoot;
1757
0
  }
1758
0
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1759
0
  P.setSize(Level, P.size(Level) + 1);
1760
0
  if (P.atLastEntry(Level))
1761
0
    setNodeStop(Level, Stop);
1762
0
  P.reset(Level + 1);
1763
0
  return SplitRoot;
1764
97
}
1765
1766
// insert
1767
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1768
void IntervalMap<KeyT, ValT, N, Traits>::
1769
15.7M
iterator::insert(KeyT a, KeyT b, ValT y) {
1770
15.7M
  if (this->branched())
1771
4.58M
    return treeInsert(a, b, y);
1772
11.1M
  IntervalMap &IM = *this->map;
1773
11.1M
  IntervalMapImpl::Path &P = this->path;
1774
11.1M
1775
11.1M
  // Try simple root leaf insert.
1776
11.1M
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1777
11.1M
1778
11.1M
  // Was the root node insert successful?
1779
11.1M
  if (Size <= RootLeaf::Capacity) {
1780
10.8M
    P.setSize(0, IM.rootSize = Size);
1781
10.8M
    return;
1782
10.8M
  }
1783
309k
1784
309k
  // Root leaf node is full, we must branch.
1785
309k
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1786
309k
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1787
309k
1788
309k
  // Now it fits in the new leaf.
1789
309k
  treeInsert(a, b, y);
1790
309k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insert(llvm::SlotIndex, llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
1769
1.47k
iterator::insert(KeyT a, KeyT b, ValT y) {
1770
1.47k
  if (this->branched())
1771
34
    return treeInsert(a, b, y);
1772
1.43k
  IntervalMap &IM = *this->map;
1773
1.43k
  IntervalMapImpl::Path &P = this->path;
1774
1.43k
1775
1.43k
  // Try simple root leaf insert.
1776
1.43k
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1777
1.43k
1778
1.43k
  // Was the root node insert successful?
1779
1.43k
  if (Size <= RootLeaf::Capacity) {
1780
1.43k
    P.setSize(0, IM.rootSize = Size);
1781
1.43k
    return;
1782
1.43k
  }
1783
5
1784
5
  // Root leaf node is full, we must branch.
1785
5
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1786
5
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1787
5
1788
5
  // Now it fits in the new leaf.
1789
5
  treeInsert(a, b, y);
1790
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insert(llvm::SlotIndex, llvm::SlotIndex, llvm::LiveInterval*)
Line
Count
Source
1769
15.1M
iterator::insert(KeyT a, KeyT b, ValT y) {
1770
15.1M
  if (this->branched())
1771
3.99M
    return treeInsert(a, b, y);
1772
11.1M
  IntervalMap &IM = *this->map;
1773
11.1M
  IntervalMapImpl::Path &P = this->path;
1774
11.1M
1775
11.1M
  // Try simple root leaf insert.
1776
11.1M
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1777
11.1M
1778
11.1M
  // Was the root node insert successful?
1779
11.1M
  if (Size <= RootLeaf::Capacity) {
1780
10.8M
    P.setSize(0, IM.rootSize = Size);
1781
10.8M
    return;
1782
10.8M
  }
1783
296k
1784
296k
  // Root leaf node is full, we must branch.
1785
296k
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1786
296k
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1787
296k
1788
296k
  // Now it fits in the new leaf.
1789
296k
  treeInsert(a, b, y);
1790
296k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insert(llvm::SlotIndex, llvm::SlotIndex, unsigned int)
Line
Count
Source
1769
632k
iterator::insert(KeyT a, KeyT b, ValT y) {
1770
632k
  if (this->branched())
1771
588k
    return treeInsert(a, b, y);
1772
44.2k
  IntervalMap &IM = *this->map;
1773
44.2k
  IntervalMapImpl::Path &P = this->path;
1774
44.2k
1775
44.2k
  // Try simple root leaf insert.
1776
44.2k
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1777
44.2k
1778
44.2k
  // Was the root node insert successful?
1779
44.2k
  if (Size <= RootLeaf::Capacity) {
1780
31.5k
    P.setSize(0, IM.rootSize = Size);
1781
31.5k
    return;
1782
31.5k
  }
1783
12.7k
1784
12.7k
  // Root leaf node is full, we must branch.
1785
12.7k
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1786
12.7k
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1787
12.7k
1788
12.7k
  // Now it fits in the new leaf.
1789
12.7k
  treeInsert(a, b, y);
1790
12.7k
}
llvm::IntervalMap<long long, UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::iterator::insert(long long, long long, UnitT)
Line
Count
Source
1769
1.49k
iterator::insert(KeyT a, KeyT b, ValT y) {
1770
1.49k
  if (this->branched())
1771
1.24k
    return treeInsert(a, b, y);
1772
253
  IntervalMap &IM = *this->map;
1773
253
  IntervalMapImpl::Path &P = this->path;
1774
253
1775
253
  // Try simple root leaf insert.
1776
253
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1777
253
1778
253
  // Was the root node insert successful?
1779
253
  if (Size <= RootLeaf::Capacity) {
1780
148
    P.setSize(0, IM.rootSize = Size);
1781
148
    return;
1782
148
  }
1783
105
1784
105
  // Root leaf node is full, we must branch.
1785
105
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1786
105
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1787
105
1788
105
  // Now it fits in the new leaf.
1789
105
  treeInsert(a, b, y);
1790
105
}
1791
1792
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1793
void IntervalMap<KeyT, ValT, N, Traits>::
1794
4.89M
iterator::treeInsert(KeyT a, KeyT b, ValT y) {
1795
4.89M
  using namespace IntervalMapImpl;
1796
4.89M
  Path &P = this->path;
1797
4.89M
1798
4.89M
  if (!P.valid())
1799
924k
    P.legalizeForInsert(this->map->height);
1800
4.89M
1801
4.89M
  // Check if this insertion will extend the node to the left.
1802
4.89M
  if (P.leafOffset() == 0 && 
Traits::startLess(a, P.leaf<Leaf>().start(0))354k
) {
1803
354k
    // Node is growing to the left, will it affect a left sibling node?
1804
354k
    if (NodeRef Sib = P.getLeftSibling(P.height())) {
1805
265k
      Leaf &SibLeaf = Sib.get<Leaf>();
1806
265k
      unsigned SibOfs = Sib.size() - 1;
1807
265k
      if (SibLeaf.value(SibOfs) == y &&
1808
265k
          
Traits::adjacent(SibLeaf.stop(SibOfs), a)93.6k
) {
1809
56.8k
        // This insertion will coalesce with the last entry in SibLeaf. We can
1810
56.8k
        // handle it in two ways:
1811
56.8k
        //  1. Extend SibLeaf.stop to b and be done, or
1812
56.8k
        //  2. Extend a to SibLeaf, erase the SibLeaf entry and continue.
1813
56.8k
        // We prefer 1., but need 2 when coalescing to the right as well.
1814
56.8k
        Leaf &CurLeaf = P.leaf<Leaf>();
1815
56.8k
        P.moveLeft(P.height());
1816
56.8k
        if (Traits::stopLess(b, CurLeaf.start(0)) &&
1817
56.8k
            (y != CurLeaf.value(0) || 
!Traits::adjacent(b, CurLeaf.start(0))43.5k
)) {
1818
37.8k
          // Easy, just extend SibLeaf and we're done.
1819
37.8k
          setNodeStop(P.height(), SibLeaf.stop(SibOfs) = b);
1820
37.8k
          return;
1821
37.8k
        } else {
1822
18.9k
          // We have both left and right coalescing. Erase the old SibLeaf entry
1823
18.9k
          // and continue inserting the larger interval.
1824
18.9k
          a = SibLeaf.start(SibOfs);
1825
18.9k
          treeErase(/* UpdateRoot= */false);
1826
18.9k
        }
1827
56.8k
      }
1828
265k
    } else {
1829
89.1k
      // No left sibling means we are at begin(). Update cached bound.
1830
89.1k
      this->map->rootBranchStart() = a;
1831
89.1k
    }
1832
354k
  }
1833
4.89M
1834
4.89M
  // When we are inserting at the end of a leaf node, we must update stops.
1835
4.89M
  unsigned Size = P.leafSize();
1836
4.85M
  bool Grow = P.leafOffset() == Size;
1837
4.85M
  Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), Size, a, b, y);
1838
4.85M
1839
4.85M
  // Leaf insertion unsuccessful? Overflow and try again.
1840
4.85M
  if (Size > Leaf::Capacity) {
1841
1.07M
    overflow<Leaf>(P.height());
1842
1.07M
    Grow = P.leafOffset() == P.leafSize();
1843
1.07M
    Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), P.leafSize(), a, b, y);
1844
1.07M
    assert(Size <= Leaf::Capacity && "overflow() didn't make room");
1845
1.07M
  }
1846
4.85M
1847
4.85M
  // Inserted, update offset and leaf size.
1848
4.85M
  P.setSize(P.height(), Size);
1849
4.85M
1850
4.85M
  // Insert was the last node entry, update stops.
1851
4.85M
  if (Grow)
1852
1.10M
    setNodeStop(P.height(), b);
1853
4.85M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::treeInsert(llvm::SlotIndex, llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
1794
39
iterator::treeInsert(KeyT a, KeyT b, ValT y) {
1795
39
  using namespace IntervalMapImpl;
1796
39
  Path &P = this->path;
1797
39
1798
39
  if (!P.valid())
1799
11
    P.legalizeForInsert(this->map->height);
1800
39
1801
39
  // Check if this insertion will extend the node to the left.
1802
39
  if (P.leafOffset() == 0 && 
Traits::startLess(a, P.leaf<Leaf>().start(0))0
) {
1803
0
    // Node is growing to the left, will it affect a left sibling node?
1804
0
    if (NodeRef Sib = P.getLeftSibling(P.height())) {
1805
0
      Leaf &SibLeaf = Sib.get<Leaf>();
1806
0
      unsigned SibOfs = Sib.size() - 1;
1807
0
      if (SibLeaf.value(SibOfs) == y &&
1808
0
          Traits::adjacent(SibLeaf.stop(SibOfs), a)) {
1809
0
        // This insertion will coalesce with the last entry in SibLeaf. We can
1810
0
        // handle it in two ways:
1811
0
        //  1. Extend SibLeaf.stop to b and be done, or
1812
0
        //  2. Extend a to SibLeaf, erase the SibLeaf entry and continue.
1813
0
        // We prefer 1., but need 2 when coalescing to the right as well.
1814
0
        Leaf &CurLeaf = P.leaf<Leaf>();
1815
0
        P.moveLeft(P.height());
1816
0
        if (Traits::stopLess(b, CurLeaf.start(0)) &&
1817
0
            (y != CurLeaf.value(0) || !Traits::adjacent(b, CurLeaf.start(0)))) {
1818
0
          // Easy, just extend SibLeaf and we're done.
1819
0
          setNodeStop(P.height(), SibLeaf.stop(SibOfs) = b);
1820
0
          return;
1821
0
        } else {
1822
0
          // We have both left and right coalescing. Erase the old SibLeaf entry
1823
0
          // and continue inserting the larger interval.
1824
0
          a = SibLeaf.start(SibOfs);
1825
0
          treeErase(/* UpdateRoot= */false);
1826
0
        }
1827
0
      }
1828
0
    } else {
1829
0
      // No left sibling means we are at begin(). Update cached bound.
1830
0
      this->map->rootBranchStart() = a;
1831
0
    }
1832
0
  }
1833
39
1834
39
  // When we are inserting at the end of a leaf node, we must update stops.
1835
39
  unsigned Size = P.leafSize();
1836
39
  bool Grow = P.leafOffset() == Size;
1837
39
  Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), Size, a, b, y);
1838
39
1839
39
  // Leaf insertion unsuccessful? Overflow and try again.
1840
39
  if (Size > Leaf::Capacity) {
1841
0
    overflow<Leaf>(P.height());
1842
0
    Grow = P.leafOffset() == P.leafSize();
1843
0
    Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), P.leafSize(), a, b, y);
1844
0
    assert(Size <= Leaf::Capacity && "overflow() didn't make room");
1845
0
  }
1846
39
1847
39
  // Inserted, update offset and leaf size.
1848
39
  P.setSize(P.height(), Size);
1849
39
1850
39
  // Insert was the last node entry, update stops.
1851
39
  if (Grow)
1852
16
    setNodeStop(P.height(), b);
1853
39
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::treeInsert(llvm::SlotIndex, llvm::SlotIndex, llvm::LiveInterval*)
Line
Count
Source
1794
4.29M
iterator::treeInsert(KeyT a, KeyT b, ValT y) {
1795
4.29M
  using namespace IntervalMapImpl;
1796
4.29M
  Path &P = this->path;
1797
4.29M
1798
4.29M
  if (!P.valid())
1799
894k
    P.legalizeForInsert(this->map->height);
1800
4.29M
1801
4.29M
  // Check if this insertion will extend the node to the left.
1802
4.29M
  if (P.leafOffset() == 0 && 
Traits::startLess(a, P.leaf<Leaf>().start(0))282k
) {
1803
282k
    // Node is growing to the left, will it affect a left sibling node?
1804
282k
    if (NodeRef Sib = P.getLeftSibling(P.height())) {
1805
195k
      Leaf &SibLeaf = Sib.get<Leaf>();
1806
195k
      unsigned SibOfs = Sib.size() - 1;
1807
195k
      if (SibLeaf.value(SibOfs) == y &&
1808
195k
          
Traits::adjacent(SibLeaf.stop(SibOfs), a)23.6k
) {
1809
13.0k
        // This insertion will coalesce with the last entry in SibLeaf. We can
1810
13.0k
        // handle it in two ways:
1811
13.0k
        //  1. Extend SibLeaf.stop to b and be done, or
1812
13.0k
        //  2. Extend a to SibLeaf, erase the SibLeaf entry and continue.
1813
13.0k
        // We prefer 1., but need 2 when coalescing to the right as well.
1814
13.0k
        Leaf &CurLeaf = P.leaf<Leaf>();
1815
13.0k
        P.moveLeft(P.height());
1816
13.0k
        if (Traits::stopLess(b, CurLeaf.start(0)) &&
1817
13.0k
            (y != CurLeaf.value(0) || 
!Traits::adjacent(b, CurLeaf.start(0))0
)) {
1818
13.0k
          // Easy, just extend SibLeaf and we're done.
1819
13.0k
          setNodeStop(P.height(), SibLeaf.stop(SibOfs) = b);
1820
13.0k
          return;
1821
13.0k
        } else {
1822
0
          // We have both left and right coalescing. Erase the old SibLeaf entry
1823
0
          // and continue inserting the larger interval.
1824
0
          a = SibLeaf.start(SibOfs);
1825
0
          treeErase(/* UpdateRoot= */false);
1826
0
        }
1827
13.0k
      }
1828
195k
    } else {
1829
87.0k
      // No left sibling means we are at begin(). Update cached bound.
1830
87.0k
      this->map->rootBranchStart() = a;
1831
87.0k
    }
1832
282k
  }
1833
4.29M
1834
4.29M
  // When we are inserting at the end of a leaf node, we must update stops.
1835
4.29M
  unsigned Size = P.leafSize();
1836
4.28M
  bool