Coverage Report

Created: 2018-09-25 17:16

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