Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/include/llvm/ADT/IndexedMap.h
Line
Count
Source
1
//===- llvm/ADT/IndexedMap.h - An index map implementation ------*- 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 an indexed map. The index map template takes two
11
// types. The first is the mapped type and the second is a functor
12
// that maps its argument to a size_t. On instantiation a "null" value
13
// can be provided to be used as a "does not exist" indicator in the
14
// map. A member function grow() is provided that given the value of
15
// the maximally indexed key (the argument of the functor) makes sure
16
// the map has enough space for it.
17
//
18
//===----------------------------------------------------------------------===//
19
20
#ifndef LLVM_ADT_INDEXEDMAP_H
21
#define LLVM_ADT_INDEXEDMAP_H
22
23
#include "llvm/ADT/SmallVector.h"
24
#include "llvm/ADT/STLExtras.h"
25
#include <cassert>
26
27
namespace llvm {
28
29
template <typename T, typename ToIndexT = identity<unsigned>>
30
  class IndexedMap {
31
    using IndexT = typename ToIndexT::argument_type;
32
    // Prefer SmallVector with zero inline storage over std::vector. IndexedMaps
33
    // can grow very large and SmallVector grows more efficiently as long as T
34
    // is trivially copyable.
35
    using StorageT = SmallVector<T, 0>;
36
37
    StorageT storage_;
38
    T nullVal_;
39
    ToIndexT toIndex_;
40
41
  public:
42
2.99M
    IndexedMap() : nullVal_(T()) {}
llvm::IndexedMap<llvm::LiveInterval*, llvm::VirtReg2IndexFunctor>::IndexedMap()
Line
Count
Source
42
34.8k
    IndexedMap() : nullVal_(T()) {}
llvm::IndexedMap<llvm::FunctionLoweringInfo::LiveOutInfo, llvm::VirtReg2IndexFunctor>::IndexedMap()
Line
Count
Source
42
35.1k
    IndexedMap() : nullVal_(T()) {}
RegAllocGreedy.cpp:llvm::IndexedMap<(anonymous namespace)::RAGreedy::RegInfo, llvm::VirtReg2IndexFunctor>::IndexedMap()
Line
Count
Source
42
31.8k
    IndexedMap() : nullVal_(T()) {}
llvm::IndexedMap<std::__1::pair<unsigned int, unsigned int>, llvm::VirtReg2IndexFunctor>::IndexedMap()
Line
Count
Source
42
661k
    IndexedMap() : nullVal_(T()) {}
llvm::IndexedMap<std::__1::pair<llvm::PointerUnion<llvm::TargetRegisterClass const*, llvm::RegisterBank const*>, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::IndexedMap()
Line
Count
Source
42
661k
    IndexedMap() : nullVal_(T()) {}
llvm::IndexedMap<llvm::LiveVariables::VarInfo, llvm::VirtReg2IndexFunctor>::IndexedMap()
Line
Count
Source
42
33.0k
    IndexedMap() : nullVal_(T()) {}
llvm::IndexedMap<std::__1::pair<llvm::VNInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*>, llvm::MBB2NumberFunctor>::IndexedMap()
Line
Count
Source
42
1.52M
    IndexedMap() : nullVal_(T()) {}
llvm::IndexedMap<unsigned int, llvm::identity<unsigned int> >::IndexedMap()
Line
Count
Source
42
857
    IndexedMap() : nullVal_(T()) {}
llvm::IndexedMap<llvm::SmallVector<llvm::ARMLegalizerInfo::FCmpLibcallInfo, 2u>, llvm::identity<unsigned int> >::IndexedMap()
Line
Count
Source
42
12.2k
    IndexedMap() : nullVal_(T()) {}
43
44
96.8k
    explicit IndexedMap(const T& val) : nullVal_(val) {}
llvm::IndexedMap<unsigned int, llvm::VirtReg2IndexFunctor>::IndexedMap(unsigned int const&)
Line
Count
Source
44
63.6k
    explicit IndexedMap(const T& val) : nullVal_(val) {}
llvm::IndexedMap<int, llvm::VirtReg2IndexFunctor>::IndexedMap(int const&)
Line
Count
Source
44
33.2k
    explicit IndexedMap(const T& val) : nullVal_(val) {}
45
46
910M
    typename StorageT::reference operator[](IndexT n) {
47
910M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
910M
      return storage_[toIndex_(n)];
49
910M
    }
llvm::IndexedMap<llvm::LiveInterval*, llvm::VirtReg2IndexFunctor>::operator[](unsigned int)
Line
Count
Source
46
249M
    typename StorageT::reference operator[](IndexT n) {
47
249M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
249M
      return storage_[toIndex_(n)];
49
249M
    }
llvm::IndexedMap<unsigned int, llvm::VirtReg2IndexFunctor>::operator[](unsigned int)
Line
Count
Source
46
11.8M
    typename StorageT::reference operator[](IndexT n) {
47
11.8M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
11.8M
      return storage_[toIndex_(n)];
49
11.8M
    }
llvm::IndexedMap<std::__1::pair<unsigned int, unsigned int>, llvm::VirtReg2IndexFunctor>::operator[](unsigned int)
Line
Count
Source
46
9.69M
    typename StorageT::reference operator[](IndexT n) {
47
9.69M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
9.69M
      return storage_[toIndex_(n)];
49
9.69M
    }
llvm::IndexedMap<std::__1::pair<llvm::PointerUnion<llvm::TargetRegisterClass const*, llvm::RegisterBank const*>, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::operator[](unsigned int)
Line
Count
Source
46
231M
    typename StorageT::reference operator[](IndexT n) {
47
231M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
231M
      return storage_[toIndex_(n)];
49
231M
    }
llvm::IndexedMap<llvm::FunctionLoweringInfo::LiveOutInfo, llvm::VirtReg2IndexFunctor>::operator[](unsigned int)
Line
Count
Source
46
6.54M
    typename StorageT::reference operator[](IndexT n) {
47
6.54M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
6.54M
      return storage_[toIndex_(n)];
49
6.54M
    }
llvm::IndexedMap<llvm::SmallVector<llvm::ARMLegalizerInfo::FCmpLibcallInfo, 2u>, llvm::identity<unsigned int> >::operator[](unsigned int)
Line
Count
Source
46
68.0k
    typename StorageT::reference operator[](IndexT n) {
47
68.0k
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
68.0k
      return storage_[toIndex_(n)];
49
68.0k
    }
llvm::IndexedMap<unsigned int, llvm::identity<unsigned int> >::operator[](unsigned int)
Line
Count
Source
46
15.4k
    typename StorageT::reference operator[](IndexT n) {
47
15.4k
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
15.4k
      return storage_[toIndex_(n)];
49
15.4k
    }
llvm::IndexedMap<std::__1::pair<llvm::VNInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*>, llvm::MBB2NumberFunctor>::operator[](llvm::MachineBasicBlock const*)
Line
Count
Source
46
106M
    typename StorageT::reference operator[](IndexT n) {
47
106M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
106M
      return storage_[toIndex_(n)];
49
106M
    }
llvm::IndexedMap<llvm::LiveVariables::VarInfo, llvm::VirtReg2IndexFunctor>::operator[](unsigned int)
Line
Count
Source
46
202M
    typename StorageT::reference operator[](IndexT n) {
47
202M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
202M
      return storage_[toIndex_(n)];
49
202M
    }
llvm::IndexedMap<int, llvm::VirtReg2IndexFunctor>::operator[](unsigned int)
Line
Count
Source
46
240k
    typename StorageT::reference operator[](IndexT n) {
47
240k
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
240k
      return storage_[toIndex_(n)];
49
240k
    }
RegAllocGreedy.cpp:llvm::IndexedMap<(anonymous namespace)::RAGreedy::RegInfo, llvm::VirtReg2IndexFunctor>::operator[](unsigned int)
Line
Count
Source
46
92.2M
    typename StorageT::reference operator[](IndexT n) {
47
92.2M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
48
92.2M
      return storage_[toIndex_(n)];
49
92.2M
    }
50
51
1.21G
    typename StorageT::const_reference operator[](IndexT n) const {
52
1.21G
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
53
1.21G
      return storage_[toIndex_(n)];
54
1.21G
    }
llvm::IndexedMap<unsigned int, llvm::VirtReg2IndexFunctor>::operator[](unsigned int) const
Line
Count
Source
51
92.7M
    typename StorageT::const_reference operator[](IndexT n) const {
52
92.7M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
53
92.7M
      return storage_[toIndex_(n)];
54
92.7M
    }
llvm::IndexedMap<llvm::SmallVector<llvm::ARMLegalizerInfo::FCmpLibcallInfo, 2u>, llvm::identity<unsigned int> >::operator[](unsigned int) const
Line
Count
Source
51
68
    typename StorageT::const_reference operator[](IndexT n) const {
52
68
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
53
68
      return storage_[toIndex_(n)];
54
68
    }
llvm::IndexedMap<unsigned int, llvm::identity<unsigned int> >::operator[](unsigned int) const
Line
Count
Source
51
4.13k
    typename StorageT::const_reference operator[](IndexT n) const {
52
4.13k
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
53
4.13k
      return storage_[toIndex_(n)];
54
4.13k
    }
RegAllocGreedy.cpp:llvm::IndexedMap<(anonymous namespace)::RAGreedy::RegInfo, llvm::VirtReg2IndexFunctor>::operator[](unsigned int) const
Line
Count
Source
51
31.4M
    typename StorageT::const_reference operator[](IndexT n) const {
52
31.4M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
53
31.4M
      return storage_[toIndex_(n)];
54
31.4M
    }
llvm::IndexedMap<std::__1::pair<llvm::PointerUnion<llvm::TargetRegisterClass const*, llvm::RegisterBank const*>, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::operator[](unsigned int) const
Line
Count
Source
51
852M
    typename StorageT::const_reference operator[](IndexT n) const {
52
852M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
53
852M
      return storage_[toIndex_(n)];
54
852M
    }
llvm::IndexedMap<std::__1::pair<unsigned int, unsigned int>, llvm::VirtReg2IndexFunctor>::operator[](unsigned int) const
Line
Count
Source
51
58.4M
    typename StorageT::const_reference operator[](IndexT n) const {
52
58.4M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
53
58.4M
      return storage_[toIndex_(n)];
54
58.4M
    }
llvm::IndexedMap<llvm::LiveInterval*, llvm::VirtReg2IndexFunctor>::operator[](unsigned int) const
Line
Count
Source
51
183M
    typename StorageT::const_reference operator[](IndexT n) const {
52
183M
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
53
183M
      return storage_[toIndex_(n)];
54
183M
    }
llvm::IndexedMap<int, llvm::VirtReg2IndexFunctor>::operator[](unsigned int) const
Line
Count
Source
51
337k
    typename StorageT::const_reference operator[](IndexT n) const {
52
337k
      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
53
337k
      return storage_[toIndex_(n)];
54
337k
    }
55
56
1.32M
    void reserve(typename StorageT::size_type s) {
57
1.32M
      storage_.reserve(s);
58
1.32M
    }
llvm::IndexedMap<std::__1::pair<unsigned int, unsigned int>, llvm::VirtReg2IndexFunctor>::reserve(unsigned long)
Line
Count
Source
56
661k
    void reserve(typename StorageT::size_type s) {
57
661k
      storage_.reserve(s);
58
661k
    }
llvm::IndexedMap<std::__1::pair<llvm::PointerUnion<llvm::TargetRegisterClass const*, llvm::RegisterBank const*>, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::reserve(unsigned long)
Line
Count
Source
56
661k
    void reserve(typename StorageT::size_type s) {
57
661k
      storage_.reserve(s);
58
661k
    }
59
60
114M
    void resize(typename StorageT::size_type s) {
61
114M
      storage_.resize(s, nullVal_);
62
114M
    }
llvm::IndexedMap<llvm::LiveInterval*, llvm::VirtReg2IndexFunctor>::resize(unsigned long)
Line
Count
Source
60
1.24M
    void resize(typename StorageT::size_type s) {
61
1.24M
      storage_.resize(s, nullVal_);
62
1.24M
    }
llvm::IndexedMap<llvm::FunctionLoweringInfo::LiveOutInfo, llvm::VirtReg2IndexFunctor>::resize(unsigned long)
Line
Count
Source
60
648k
    void resize(typename StorageT::size_type s) {
61
648k
      storage_.resize(s, nullVal_);
62
648k
    }
llvm::IndexedMap<llvm::LiveVariables::VarInfo, llvm::VirtReg2IndexFunctor>::resize(unsigned long)
Line
Count
Source
60
6.11M
    void resize(typename StorageT::size_type s) {
61
6.11M
      storage_.resize(s, nullVal_);
62
6.11M
    }
llvm::IndexedMap<unsigned int, llvm::identity<unsigned int> >::resize(unsigned long)
Line
Count
Source
60
857
    void resize(typename StorageT::size_type s) {
61
857
      storage_.resize(s, nullVal_);
62
857
    }
llvm::IndexedMap<std::__1::pair<llvm::VNInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*>, llvm::MBB2NumberFunctor>::resize(unsigned long)
Line
Count
Source
60
40.5M
    void resize(typename StorageT::size_type s) {
61
40.5M
      storage_.resize(s, nullVal_);
62
40.5M
    }
llvm::IndexedMap<unsigned int, llvm::VirtReg2IndexFunctor>::resize(unsigned long)
Line
Count
Source
60
3.89M
    void resize(typename StorageT::size_type s) {
61
3.89M
      storage_.resize(s, nullVal_);
62
3.89M
    }
RegAllocGreedy.cpp:llvm::IndexedMap<(anonymous namespace)::RAGreedy::RegInfo, llvm::VirtReg2IndexFunctor>::resize(unsigned long)
Line
Count
Source
60
1.45M
    void resize(typename StorageT::size_type s) {
61
1.45M
      storage_.resize(s, nullVal_);
62
1.45M
    }
llvm::IndexedMap<int, llvm::VirtReg2IndexFunctor>::resize(unsigned long)
Line
Count
Source
60
1.95M
    void resize(typename StorageT::size_type s) {
61
1.95M
      storage_.resize(s, nullVal_);
62
1.95M
    }
llvm::IndexedMap<std::__1::pair<unsigned int, unsigned int>, llvm::VirtReg2IndexFunctor>::resize(unsigned long)
Line
Count
Source
60
29.4M
    void resize(typename StorageT::size_type s) {
61
29.4M
      storage_.resize(s, nullVal_);
62
29.4M
    }
llvm::IndexedMap<std::__1::pair<llvm::PointerUnion<llvm::TargetRegisterClass const*, llvm::RegisterBank const*>, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::resize(unsigned long)
Line
Count
Source
60
29.4M
    void resize(typename StorageT::size_type s) {
61
29.4M
      storage_.resize(s, nullVal_);
62
29.4M
    }
llvm::IndexedMap<llvm::SmallVector<llvm::ARMLegalizerInfo::FCmpLibcallInfo, 2u>, llvm::identity<unsigned int> >::resize(unsigned long)
Line
Count
Source
60
4.86k
    void resize(typename StorageT::size_type s) {
61
4.86k
      storage_.resize(s, nullVal_);
62
4.86k
    }
63
64
6.85M
    void clear() {
65
6.85M
      storage_.clear();
66
6.85M
    }
llvm::IndexedMap<llvm::LiveVariables::VarInfo, llvm::VirtReg2IndexFunctor>::clear()
Line
Count
Source
64
594k
    void clear() {
65
594k
      storage_.clear();
66
594k
    }
llvm::IndexedMap<int, llvm::VirtReg2IndexFunctor>::clear()
Line
Count
Source
64
594k
    void clear() {
65
594k
      storage_.clear();
66
594k
    }
llvm::IndexedMap<unsigned int, llvm::VirtReg2IndexFunctor>::clear()
Line
Count
Source
64
1.76M
    void clear() {
65
1.76M
      storage_.clear();
66
1.76M
    }
llvm::IndexedMap<llvm::LiveInterval*, llvm::VirtReg2IndexFunctor>::clear()
Line
Count
Source
64
610k
    void clear() {
65
610k
      storage_.clear();
66
610k
    }
llvm::IndexedMap<std::__1::pair<llvm::PointerUnion<llvm::TargetRegisterClass const*, llvm::RegisterBank const*>, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::clear()
Line
Count
Source
64
1.09M
    void clear() {
65
1.09M
      storage_.clear();
66
1.09M
    }
RegAllocGreedy.cpp:llvm::IndexedMap<(anonymous namespace)::RAGreedy::RegInfo, llvm::VirtReg2IndexFunctor>::clear()
Line
Count
Source
64
1.76M
    void clear() {
65
1.76M
      storage_.clear();
66
1.76M
    }
llvm::IndexedMap<llvm::FunctionLoweringInfo::LiveOutInfo, llvm::VirtReg2IndexFunctor>::clear()
Line
Count
Source
64
436k
    void clear() {
65
436k
      storage_.clear();
66
436k
    }
67
68
244M
    void grow(IndexT n) {
69
244M
      unsigned NewSize = toIndex_(n) + 1;
70
244M
      if (NewSize > storage_.size())
71
66.2M
        resize(NewSize);
72
244M
    }
llvm::IndexedMap<std::__1::pair<llvm::PointerUnion<llvm::TargetRegisterClass const*, llvm::RegisterBank const*>, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::grow(unsigned int)
Line
Count
Source
68
29.4M
    void grow(IndexT n) {
69
29.4M
      unsigned NewSize = toIndex_(n) + 1;
70
29.4M
      if (NewSize > storage_.size())
71
29.4M
        resize(NewSize);
72
29.4M
    }
llvm::IndexedMap<llvm::LiveInterval*, llvm::VirtReg2IndexFunctor>::grow(unsigned int)
Line
Count
Source
68
18.0M
    void grow(IndexT n) {
69
18.0M
      unsigned NewSize = toIndex_(n) + 1;
70
18.0M
      if (NewSize > storage_.size())
71
631k
        resize(NewSize);
72
18.0M
    }
llvm::IndexedMap<llvm::FunctionLoweringInfo::LiveOutInfo, llvm::VirtReg2IndexFunctor>::grow(unsigned int)
Line
Count
Source
68
1.62M
    void grow(IndexT n) {
69
1.62M
      unsigned NewSize = toIndex_(n) + 1;
70
1.62M
      if (NewSize > storage_.size())
71
648k
        resize(NewSize);
72
1.62M
    }
llvm::IndexedMap<std::__1::pair<unsigned int, unsigned int>, llvm::VirtReg2IndexFunctor>::grow(unsigned int)
Line
Count
Source
68
29.4M
    void grow(IndexT n) {
69
29.4M
      unsigned NewSize = toIndex_(n) + 1;
70
29.4M
      if (NewSize > storage_.size())
71
29.4M
        resize(NewSize);
72
29.4M
    }
llvm::IndexedMap<unsigned int, llvm::identity<unsigned int> >::grow(unsigned int)
Line
Count
Source
68
857
    void grow(IndexT n) {
69
857
      unsigned NewSize = toIndex_(n) + 1;
70
857
      if (NewSize > storage_.size())
71
857
        resize(NewSize);
72
857
    }
llvm::IndexedMap<llvm::LiveVariables::VarInfo, llvm::VirtReg2IndexFunctor>::grow(unsigned int)
Line
Count
Source
68
155M
    void grow(IndexT n) {
69
155M
      unsigned NewSize = toIndex_(n) + 1;
70
155M
      if (NewSize > storage_.size())
71
6.11M
        resize(NewSize);
72
155M
    }
RegAllocGreedy.cpp:llvm::IndexedMap<(anonymous namespace)::RAGreedy::RegInfo, llvm::VirtReg2IndexFunctor>::grow(unsigned int)
Line
Count
Source
68
11.1M
    void grow(IndexT n) {
69
11.1M
      unsigned NewSize = toIndex_(n) + 1;
70
11.1M
      if (NewSize > storage_.size())
71
12.3k
        resize(NewSize);
72
11.1M
    }
73
74
189M
    bool inBounds(IndexT n) const {
75
189M
      return toIndex_(n) < storage_.size();
76
189M
    }
llvm::IndexedMap<llvm::LiveInterval*, llvm::VirtReg2IndexFunctor>::inBounds(unsigned int) const
Line
Count
Source
74
183M
    bool inBounds(IndexT n) const {
75
183M
      return toIndex_(n) < storage_.size();
76
183M
    }
llvm::IndexedMap<llvm::FunctionLoweringInfo::LiveOutInfo, llvm::VirtReg2IndexFunctor>::inBounds(unsigned int) const
Line
Count
Source
74
5.91M
    bool inBounds(IndexT n) const {
75
5.91M
      return toIndex_(n) < storage_.size();
76
5.91M
    }
RegAllocGreedy.cpp:llvm::IndexedMap<(anonymous namespace)::RAGreedy::RegInfo, llvm::VirtReg2IndexFunctor>::inBounds(unsigned int) const
Line
Count
Source
74
642
    bool inBounds(IndexT n) const {
75
642
      return toIndex_(n) < storage_.size();
76
642
    }
77
78
44.5M
    typename StorageT::size_type size() const {
79
44.5M
      return storage_.size();
80
44.5M
    }
llvm::IndexedMap<std::__1::pair<llvm::PointerUnion<llvm::TargetRegisterClass const*, llvm::RegisterBank const*>, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::size() const
Line
Count
Source
78
43.3M
    typename StorageT::size_type size() const {
79
43.3M
      return storage_.size();
80
43.3M
    }
llvm::IndexedMap<llvm::LiveInterval*, llvm::VirtReg2IndexFunctor>::size() const
Line
Count
Source
78
610k
    typename StorageT::size_type size() const {
79
610k
      return storage_.size();
80
610k
    }
llvm::IndexedMap<llvm::LiveVariables::VarInfo, llvm::VirtReg2IndexFunctor>::size() const
Line
Count
Source
78
594k
    typename StorageT::size_type size() const {
79
594k
      return storage_.size();
80
594k
    }
81
  };
82
83
} // end namespace llvm
84
85
#endif // LLVM_ADT_INDEXEDMAP_H