Coverage Report

Created: 2019-03-24 22:13

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/ADT/PointerSumType.h
Line
Count
Source (jump to first uncovered line)
1
//===- llvm/ADT/PointerSumType.h --------------------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_ADT_POINTERSUMTYPE_H
10
#define LLVM_ADT_POINTERSUMTYPE_H
11
12
#include "llvm/ADT/bit.h"
13
#include "llvm/ADT/DenseMapInfo.h"
14
#include "llvm/Support/PointerLikeTypeTraits.h"
15
#include <cassert>
16
#include <cstdint>
17
#include <type_traits>
18
19
namespace llvm {
20
21
/// A compile time pair of an integer tag and the pointer-like type which it
22
/// indexes within a sum type. Also allows the user to specify a particular
23
/// traits class for pointer types with custom behavior such as over-aligned
24
/// allocation.
25
template <uintptr_t N, typename PointerArgT,
26
          typename TraitsArgT = PointerLikeTypeTraits<PointerArgT>>
27
struct PointerSumTypeMember {
28
  enum { Tag = N };
29
  using PointerT = PointerArgT;
30
  using TraitsT = TraitsArgT;
31
};
32
33
namespace detail {
34
35
template <typename TagT, typename... MemberTs> struct PointerSumTypeHelper;
36
37
} // end namespace detail
38
39
/// A sum type over pointer-like types.
40
///
41
/// This is a normal tagged union across pointer-like types that uses the low
42
/// bits of the pointers to store the tag.
43
///
44
/// Each member of the sum type is specified by passing a \c
45
/// PointerSumTypeMember specialization in the variadic member argument list.
46
/// This allows the user to control the particular tag value associated with
47
/// a particular type, use the same type for multiple different tags, and
48
/// customize the pointer-like traits used for a particular member. Note that
49
/// these *must* be specializations of \c PointerSumTypeMember, no other type
50
/// will suffice, even if it provides a compatible interface.
51
///
52
/// This type implements all of the comparison operators and even hash table
53
/// support by comparing the underlying storage of the pointer values. It
54
/// doesn't support delegating to particular members for comparisons.
55
///
56
/// It also default constructs to a zero tag with a null pointer, whatever that
57
/// would be. This means that the zero value for the tag type is significant
58
/// and may be desirable to set to a state that is particularly desirable to
59
/// default construct.
60
///
61
/// Having a supported zero-valued tag also enables getting the address of a
62
/// pointer stored with that tag provided it is stored in its natural bit
63
/// representation. This works because in the case of a zero-valued tag, the
64
/// pointer's value is directly stored into this object and we can expose the
65
/// address of that internal storage. This is especially useful when building an
66
/// `ArrayRef` of a single pointer stored in a sum type.
67
///
68
/// There is no support for constructing or accessing with a dynamic tag as
69
/// that would fundamentally violate the type safety provided by the sum type.
70
0
template <typename TagT, typename... MemberTs> class PointerSumType {
71
  using HelperT = detail::PointerSumTypeHelper<TagT, MemberTs...>;
72
73
  // We keep both the raw value and the min tag value's pointer in a union. When
74
  // the minimum tag value is zero, this allows code below to cleanly expose the
75
  // address of the zero-tag pointer instead of just the zero-tag pointer
76
  // itself. This is especially useful when building `ArrayRef`s out of a single
77
  // pointer. However, we have to carefully access the union due to the active
78
  // member potentially changing. When we *store* a new value, we directly
79
  // access the union to allow us to store using the obvious types. However,
80
  // when we *read* a value, we copy the underlying storage out to avoid relying
81
  // on one member or the other being active.
82
0
  union StorageT {
83
    // Ensure we get a null default constructed value. We don't use a member
84
    // initializer because some compilers seem to not implement those correctly
85
    // for a union.
86
113M
    StorageT() : Value(0) {}
llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::StorageT::StorageT()
Line
Count
Source
86
46.4M
    StorageT() : Value(0) {}
llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::StorageT::StorageT()
Line
Count
Source
86
66.8M
    StorageT() : Value(0) {}
87
88
    uintptr_t Value;
89
90
    typename HelperT::template Lookup<HelperT::MinTag>::PointerT MinTagPointer;
91
  };
92
93
  StorageT Storage;
94
95
public:
96
113M
  constexpr PointerSumType() = default;
llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::PointerSumType()
Line
Count
Source
96
46.4M
  constexpr PointerSumType() = default;
llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::PointerSumType()
Line
Count
Source
96
66.8M
  constexpr PointerSumType() = default;
97
98
  /// A typed setter to a given tagged member of the sum type.
99
  template <TagT N>
100
38.4M
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
38.4M
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
38.4M
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
38.4M
           "Pointer is insufficiently aligned to store the discriminant!");
104
38.4M
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
38.4M
  }
void llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::set<(llvm::MemDepResult::DepType)3>(llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)3>::PointerT)
Line
Count
Source
100
25.5M
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
25.5M
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
25.5M
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
25.5M
           "Pointer is insufficiently aligned to store the discriminant!");
104
25.5M
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
25.5M
  }
void llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::set<(llvm::MemDepResult::DepType)1>(llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)1>::PointerT)
Line
Count
Source
100
2.23M
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
2.23M
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
2.23M
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
2.23M
           "Pointer is insufficiently aligned to store the discriminant!");
104
2.23M
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
2.23M
  }
void llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::set<(llvm::MemDepResult::DepType)2>(llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)2>::PointerT)
Line
Count
Source
100
555k
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
555k
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
555k
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
555k
           "Pointer is insufficiently aligned to store the discriminant!");
104
555k
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
555k
  }
void llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::set<(llvm::MemDepResult::DepType)0>(llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)0>::PointerT)
Line
Count
Source
100
362k
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
362k
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
362k
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
362k
           "Pointer is insufficiently aligned to store the discriminant!");
104
362k
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
362k
  }
void llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::set<(llvm::MachineInstr::ExtraInfoInlineKinds)1>(llvm::detail::PointerSumTypeHelper<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::Lookup<(llvm::MachineInstr::ExtraInfoInlineKinds)1>::PointerT)
Line
Count
Source
100
30
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
30
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
30
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
30
           "Pointer is insufficiently aligned to store the discriminant!");
104
30
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
30
  }
void llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::set<(llvm::MachineInstr::ExtraInfoInlineKinds)2>(llvm::detail::PointerSumTypeHelper<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::Lookup<(llvm::MachineInstr::ExtraInfoInlineKinds)2>::PointerT)
Line
Count
Source
100
55
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
55
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
55
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
55
           "Pointer is insufficiently aligned to store the discriminant!");
104
55
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
55
  }
void llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::set<(llvm::MachineInstr::ExtraInfoInlineKinds)3>(llvm::detail::PointerSumTypeHelper<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::Lookup<(llvm::MachineInstr::ExtraInfoInlineKinds)3>::PointerT)
Line
Count
Source
100
2.22M
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
2.22M
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
2.22M
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
2.22M
           "Pointer is insufficiently aligned to store the discriminant!");
104
2.22M
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
2.22M
  }
void llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::set<(llvm::MachineInstr::ExtraInfoInlineKinds)0>(llvm::detail::PointerSumTypeHelper<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::Lookup<(llvm::MachineInstr::ExtraInfoInlineKinds)0>::PointerT)
Line
Count
Source
100
7.53M
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
7.53M
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
7.53M
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
7.53M
           "Pointer is insufficiently aligned to store the discriminant!");
104
7.53M
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
7.53M
  }
106
107
  /// A typed constructor for a specific tagged member of the sum type.
108
  template <TagT N>
109
  static PointerSumType
110
28.7M
  create(typename HelperT::template Lookup<N>::PointerT Pointer) {
111
28.7M
    PointerSumType Result;
112
28.7M
    Result.set<N>(Pointer);
113
28.7M
    return Result;
114
28.7M
  }
llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > > llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::create<(llvm::MemDepResult::DepType)3>(llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)3>::PointerT)
Line
Count
Source
110
25.5M
  create(typename HelperT::template Lookup<N>::PointerT Pointer) {
111
25.5M
    PointerSumType Result;
112
25.5M
    Result.set<N>(Pointer);
113
25.5M
    return Result;
114
25.5M
  }
llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > > llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::create<(llvm::MemDepResult::DepType)1>(llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)1>::PointerT)
Line
Count
Source
110
2.23M
  create(typename HelperT::template Lookup<N>::PointerT Pointer) {
111
2.23M
    PointerSumType Result;
112
2.23M
    Result.set<N>(Pointer);
113
2.23M
    return Result;
114
2.23M
  }
llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > > llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::create<(llvm::MemDepResult::DepType)2>(llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)2>::PointerT)
Line
Count
Source
110
555k
  create(typename HelperT::template Lookup<N>::PointerT Pointer) {
111
555k
    PointerSumType Result;
112
555k
    Result.set<N>(Pointer);
113
555k
    return Result;
114
555k
  }
llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > > llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::create<(llvm::MemDepResult::DepType)0>(llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)0>::PointerT)
Line
Count
Source
110
362k
  create(typename HelperT::template Lookup<N>::PointerT Pointer) {
111
362k
    PointerSumType Result;
112
362k
    Result.set<N>(Pointer);
113
362k
    return Result;
114
362k
  }
115
116
  /// Clear the value to null with the min tag type.
117
174k
  void clear() { set<HelperT::MinTag>(nullptr); }
118
119
602M
  TagT getTag() const {
120
602M
    return static_cast<TagT>(getOpaqueValue() & HelperT::TagMask);
121
602M
  }
llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::getTag() const
Line
Count
Source
119
491M
  TagT getTag() const {
120
491M
    return static_cast<TagT>(getOpaqueValue() & HelperT::TagMask);
121
491M
  }
llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::getTag() const
Line
Count
Source
119
111M
  TagT getTag() const {
120
111M
    return static_cast<TagT>(getOpaqueValue() & HelperT::TagMask);
121
111M
  }
122
123
581M
  template <TagT N> bool is() const { return N == getTag(); }
bool llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::is<(llvm::MachineInstr::ExtraInfoInlineKinds)0>() const
Line
Count
Source
123
461M
  template <TagT N> bool is() const { return N == getTag(); }
bool llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::is<(llvm::MachineInstr::ExtraInfoInlineKinds)3>() const
Line
Count
Source
123
16.7M
  template <TagT N> bool is() const { return N == getTag(); }
bool llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::is<(llvm::MachineInstr::ExtraInfoInlineKinds)1>() const
Line
Count
Source
123
6.74M
  template <TagT N> bool is() const { return N == getTag(); }
bool llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::is<(llvm::MachineInstr::ExtraInfoInlineKinds)2>() const
Line
Count
Source
123
6.74M
  template <TagT N> bool is() const { return N == getTag(); }
bool llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::is<(llvm::MemDepResult::DepType)1>() const
Line
Count
Source
123
18.3M
  template <TagT N> bool is() const { return N == getTag(); }
bool llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::is<(llvm::MemDepResult::DepType)3>() const
Line
Count
Source
123
26.4M
  template <TagT N> bool is() const { return N == getTag(); }
bool llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::is<(llvm::MemDepResult::DepType)2>() const
Line
Count
Source
123
32.4M
  template <TagT N> bool is() const { return N == getTag(); }
bool llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::is<(llvm::MemDepResult::DepType)0>() const
Line
Count
Source
123
12.2M
  template <TagT N> bool is() const { return N == getTag(); }
124
125
259M
  template <TagT N> typename HelperT::template Lookup<N>::PointerT get() const {
126
259M
    void *P = is<N>() ? 
getVoidPtr()235M
:
nullptr23.4M
;
127
259M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(P);
128
259M
  }
llvm::detail::PointerSumTypeHelper<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::Lookup<(llvm::MachineInstr::ExtraInfoInlineKinds)0>::PointerT llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::get<(llvm::MachineInstr::ExtraInfoInlineKinds)0>() const
Line
Count
Source
125
229M
  template <TagT N> typename HelperT::template Lookup<N>::PointerT get() const {
126
229M
    void *P = is<N>() ? getVoidPtr() : 
nullptr0
;
127
229M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(P);
128
229M
  }
llvm::detail::PointerSumTypeHelper<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::Lookup<(llvm::MachineInstr::ExtraInfoInlineKinds)3>::PointerT llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::get<(llvm::MachineInstr::ExtraInfoInlineKinds)3>() const
Line
Count
Source
125
16.7M
  template <TagT N> typename HelperT::template Lookup<N>::PointerT get() const {
126
16.7M
    void *P = is<N>() ? 
getVoidPtr()6.74M
:
nullptr9.98M
;
127
16.7M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(P);
128
16.7M
  }
llvm::detail::PointerSumTypeHelper<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::Lookup<(llvm::MachineInstr::ExtraInfoInlineKinds)1>::PointerT llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::get<(llvm::MachineInstr::ExtraInfoInlineKinds)1>() const
Line
Count
Source
125
6.74M
  template <TagT N> typename HelperT::template Lookup<N>::PointerT get() const {
126
6.74M
    void *P = is<N>() ? 
getVoidPtr()30
:
nullptr6.74M
;
127
6.74M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(P);
128
6.74M
  }
llvm::detail::PointerSumTypeHelper<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::Lookup<(llvm::MachineInstr::ExtraInfoInlineKinds)2>::PointerT llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::get<(llvm::MachineInstr::ExtraInfoInlineKinds)2>() const
Line
Count
Source
125
6.74M
  template <TagT N> typename HelperT::template Lookup<N>::PointerT get() const {
126
6.74M
    void *P = is<N>() ? 
getVoidPtr()55
:
nullptr6.74M
;
127
6.74M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(P);
128
6.74M
  }
129
130
  template <TagT N>
131
40.7M
  typename HelperT::template Lookup<N>::PointerT cast() const {
132
40.7M
    assert(is<N>() && "This instance has a different active member.");
133
40.7M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(
134
40.7M
        getVoidPtr());
135
40.7M
  }
llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)3>::PointerT llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::cast<(llvm::MemDepResult::DepType)3>() const
Line
Count
Source
131
21.9M
  typename HelperT::template Lookup<N>::PointerT cast() const {
132
21.9M
    assert(is<N>() && "This instance has a different active member.");
133
21.9M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(
134
21.9M
        getVoidPtr());
135
21.9M
  }
llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)0>::PointerT llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::cast<(llvm::MemDepResult::DepType)0>() const
Line
Count
Source
131
3.32M
  typename HelperT::template Lookup<N>::PointerT cast() const {
132
3.32M
    assert(is<N>() && "This instance has a different active member.");
133
3.32M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(
134
3.32M
        getVoidPtr());
135
3.32M
  }
llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)1>::PointerT llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::cast<(llvm::MemDepResult::DepType)1>() const
Line
Count
Source
131
14.0M
  typename HelperT::template Lookup<N>::PointerT cast() const {
132
14.0M
    assert(is<N>() && "This instance has a different active member.");
133
14.0M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(
134
14.0M
        getVoidPtr());
135
14.0M
  }
llvm::detail::PointerSumTypeHelper<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::Lookup<(llvm::MemDepResult::DepType)2>::PointerT llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::cast<(llvm::MemDepResult::DepType)2>() const
Line
Count
Source
131
1.44M
  typename HelperT::template Lookup<N>::PointerT cast() const {
132
1.44M
    assert(is<N>() && "This instance has a different active member.");
133
1.44M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(
134
1.44M
        getVoidPtr());
135
1.44M
  }
136
137
  /// If the tag is zero and the pointer's value isn't changed when being
138
  /// stored, get the address of the stored value type-punned to the zero-tag's
139
  /// pointer type.
140
  typename HelperT::template Lookup<HelperT::MinTag>::PointerT const *
141
229M
  getAddrOfZeroTagPointer() const {
142
229M
    return const_cast<PointerSumType *>(this)->getAddrOfZeroTagPointer();
143
229M
  }
144
145
  /// If the tag is zero and the pointer's value isn't changed when being
146
  /// stored, get the address of the stored value type-punned to the zero-tag's
147
  /// pointer type.
148
  typename HelperT::template Lookup<HelperT::MinTag>::PointerT *
149
229M
  getAddrOfZeroTagPointer() {
150
229M
    static_assert(HelperT::MinTag == 0, "Non-zero minimum tag value!");
151
229M
    assert(is<HelperT::MinTag>() && "The active tag is not zero!");
152
229M
    // Store the initial value of the pointer when read out of our storage.
153
229M
    auto InitialPtr = get<HelperT::MinTag>();
154
229M
    // Now update the active member of the union to be the actual pointer-typed
155
229M
    // member so that accessing it indirectly through the returned address is
156
229M
    // valid.
157
229M
    Storage.MinTagPointer = InitialPtr;
158
229M
    // Finally, validate that this was a no-op as expected by reading it back
159
229M
    // out using the same underlying-storage read as above.
160
229M
    assert(InitialPtr == get<HelperT::MinTag>() &&
161
229M
           "Switching to typed storage changed the pointer returned!");
162
229M
    // Now we can correctly return an address to typed storage.
163
229M
    return &Storage.MinTagPointer;
164
229M
  }
165
166
418M
  explicit operator bool() const {
167
418M
    return getOpaqueValue() & HelperT::PointerMask;
168
418M
  }
169
  bool operator==(const PointerSumType &R) const {
170
    return getOpaqueValue() == R.getOpaqueValue();
171
  }
172
  bool operator!=(const PointerSumType &R) const {
173
    return getOpaqueValue() != R.getOpaqueValue();
174
  }
175
  bool operator<(const PointerSumType &R) const {
176
    return getOpaqueValue() < R.getOpaqueValue();
177
  }
178
  bool operator>(const PointerSumType &R) const {
179
    return getOpaqueValue() > R.getOpaqueValue();
180
  }
181
  bool operator<=(const PointerSumType &R) const {
182
    return getOpaqueValue() <= R.getOpaqueValue();
183
  }
184
  bool operator>=(const PointerSumType &R) const {
185
    return getOpaqueValue() >= R.getOpaqueValue();
186
  }
187
188
1.29G
  uintptr_t getOpaqueValue() const {
189
1.29G
    // Read the underlying storage of the union, regardless of the active
190
1.29G
    // member.
191
1.29G
    return bit_cast<uintptr_t>(Storage);
192
1.29G
  }
llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::getOpaqueValue() const
Line
Count
Source
188
1.14G
  uintptr_t getOpaqueValue() const {
189
1.14G
    // Read the underlying storage of the union, regardless of the active
190
1.14G
    // member.
191
1.14G
    return bit_cast<uintptr_t>(Storage);
192
1.14G
  }
llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::getOpaqueValue() const
Line
Count
Source
188
151M
  uintptr_t getOpaqueValue() const {
189
151M
    // Read the underlying storage of the union, regardless of the active
190
151M
    // member.
191
151M
    return bit_cast<uintptr_t>(Storage);
192
151M
  }
193
194
protected:
195
276M
  void *getVoidPtr() const {
196
276M
    return reinterpret_cast<void *>(getOpaqueValue() & HelperT::PointerMask);
197
276M
  }
llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::getVoidPtr() const
Line
Count
Source
195
235M
  void *getVoidPtr() const {
196
235M
    return reinterpret_cast<void *>(getOpaqueValue() & HelperT::PointerMask);
197
235M
  }
llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::getVoidPtr() const
Line
Count
Source
195
40.7M
  void *getVoidPtr() const {
196
40.7M
    return reinterpret_cast<void *>(getOpaqueValue() & HelperT::PointerMask);
197
40.7M
  }
198
};
199
200
namespace detail {
201
202
/// A helper template for implementing \c PointerSumType. It provides fast
203
/// compile-time lookup of the member from a particular tag value, along with
204
/// useful constants and compile time checking infrastructure..
205
template <typename TagT, typename... MemberTs>
206
struct PointerSumTypeHelper : MemberTs... {
207
  // First we use a trick to allow quickly looking up information about
208
  // a particular member of the sum type. This works because we arranged to
209
  // have this type derive from all of the member type templates. We can select
210
  // the matching member for a tag using type deduction during overload
211
  // resolution.
212
  template <TagT N, typename PointerT, typename TraitsT>
213
  static PointerSumTypeMember<N, PointerT, TraitsT>
214
  LookupOverload(PointerSumTypeMember<N, PointerT, TraitsT> *);
215
  template <TagT N> static void LookupOverload(...);
216
  template <TagT N> struct Lookup {
217
    // Compute a particular member type by resolving the lookup helper ovorload.
218
    using MemberT = decltype(
219
        LookupOverload<N>(static_cast<PointerSumTypeHelper *>(nullptr)));
220
221
    /// The Nth member's pointer type.
222
    using PointerT = typename MemberT::PointerT;
223
224
    /// The Nth member's traits type.
225
    using TraitsT = typename MemberT::TraitsT;
226
  };
227
228
  // Next we need to compute the number of bits available for the discriminant
229
  // by taking the min of the bits available for each member. Much of this
230
  // would be amazingly easier with good constexpr support.
231
  template <uintptr_t V, uintptr_t... Vs>
232
  struct Min : std::integral_constant<
233
                   uintptr_t, (V < Min<Vs...>::value ? V : Min<Vs...>::value)> {
234
  };
235
  template <uintptr_t V>
236
  struct Min<V> : std::integral_constant<uintptr_t, V> {};
237
  enum { NumTagBits = Min<MemberTs::TraitsT::NumLowBitsAvailable...>::value };
238
239
  // Also compute the smallest discriminant and various masks for convenience.
240
  constexpr static TagT MinTag =
241
      static_cast<TagT>(Min<MemberTs::Tag...>::value);
242
  enum : uint64_t {
243
    PointerMask = static_cast<uint64_t>(-1) << NumTagBits,
244
    TagMask = ~PointerMask
245
  };
246
247
  // Finally we need a recursive template to do static checks of each
248
  // member.
249
  template <typename MemberT, typename... InnerMemberTs>
250
  struct Checker : Checker<InnerMemberTs...> {
251
    static_assert(MemberT::Tag < (1 << NumTagBits),
252
                  "This discriminant value requires too many bits!");
253
  };
254
  template <typename MemberT> struct Checker<MemberT> : std::true_type {
255
    static_assert(MemberT::Tag < (1 << NumTagBits),
256
                  "This discriminant value requires too many bits!");
257
  };
258
  static_assert(Checker<MemberTs...>::value,
259
                "Each member must pass the checker.");
260
};
261
262
} // end namespace detail
263
264
// Teach DenseMap how to use PointerSumTypes as keys.
265
template <typename TagT, typename... MemberTs>
266
struct DenseMapInfo<PointerSumType<TagT, MemberTs...>> {
267
  using SumType = PointerSumType<TagT, MemberTs...>;
268
  using HelperT = detail::PointerSumTypeHelper<TagT, MemberTs...>;
269
  enum { SomeTag = HelperT::MinTag };
270
  using SomePointerT =
271
      typename HelperT::template Lookup<HelperT::MinTag>::PointerT;
272
  using SomePointerInfo = DenseMapInfo<SomePointerT>;
273
274
  static inline SumType getEmptyKey() {
275
    return SumType::create<SomeTag>(SomePointerInfo::getEmptyKey());
276
  }
277
278
  static inline SumType getTombstoneKey() {
279
    return SumType::create<SomeTag>(SomePointerInfo::getTombstoneKey());
280
  }
281
282
  static unsigned getHashValue(const SumType &Arg) {
283
    uintptr_t OpaqueValue = Arg.getOpaqueValue();
284
    return DenseMapInfo<uintptr_t>::getHashValue(OpaqueValue);
285
  }
286
287
  static bool isEqual(const SumType &LHS, const SumType &RHS) {
288
    return LHS == RHS;
289
  }
290
};
291
292
} // end namespace llvm
293
294
#endif // LLVM_ADT_POINTERSUMTYPE_H