Coverage Report

Created: 2019-07-24 05:18

/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
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
  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
111M
    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.6M
    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
64.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
111M
  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.6M
  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
64.8M
  constexpr PointerSumType() = default;
97
98
  /// A typed setter to a given tagged member of the sum type.
99
  template <TagT N>
100
38.3M
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
38.3M
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
38.3M
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
38.3M
           "Pointer is insufficiently aligned to store the discriminant!");
104
38.3M
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
38.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)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
560k
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
560k
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
560k
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
560k
           "Pointer is insufficiently aligned to store the discriminant!");
104
560k
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
560k
  }
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.24M
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
2.24M
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
2.24M
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
2.24M
           "Pointer is insufficiently aligned to store the discriminant!");
104
2.24M
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
2.24M
  }
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.7M
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
25.7M
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
25.7M
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
25.7M
           "Pointer is insufficiently aligned to store the discriminant!");
104
25.7M
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
25.7M
  }
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
365k
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
365k
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
365k
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
365k
           "Pointer is insufficiently aligned to store the discriminant!");
104
365k
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
365k
  }
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
33
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
33
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
33
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
33
           "Pointer is insufficiently aligned to store the discriminant!");
104
33
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
33
  }
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.19M
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
2.19M
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
2.19M
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
2.19M
           "Pointer is insufficiently aligned to store the discriminant!");
104
2.19M
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
2.19M
  }
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.20M
  void set(typename HelperT::template Lookup<N>::PointerT Pointer) {
101
7.20M
    void *V = HelperT::template Lookup<N>::TraitsT::getAsVoidPointer(Pointer);
102
7.20M
    assert((reinterpret_cast<uintptr_t>(V) & HelperT::TagMask) == 0 &&
103
7.20M
           "Pointer is insufficiently aligned to store the discriminant!");
104
7.20M
    Storage.Value = reinterpret_cast<uintptr_t>(V) | N;
105
7.20M
  }
106
107
  /// A typed constructor for a specific tagged member of the sum type.
108
  template <TagT N>
109
  static PointerSumType
110
28.9M
  create(typename HelperT::template Lookup<N>::PointerT Pointer) {
111
28.9M
    PointerSumType Result;
112
28.9M
    Result.set<N>(Pointer);
113
28.9M
    return Result;
114
28.9M
  }
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
560k
  create(typename HelperT::template Lookup<N>::PointerT Pointer) {
111
560k
    PointerSumType Result;
112
560k
    Result.set<N>(Pointer);
113
560k
    return Result;
114
560k
  }
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.24M
  create(typename HelperT::template Lookup<N>::PointerT Pointer) {
111
2.24M
    PointerSumType Result;
112
2.24M
    Result.set<N>(Pointer);
113
2.24M
    return Result;
114
2.24M
  }
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.7M
  create(typename HelperT::template Lookup<N>::PointerT Pointer) {
111
25.7M
    PointerSumType Result;
112
25.7M
    Result.set<N>(Pointer);
113
25.7M
    return Result;
114
25.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)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
365k
  create(typename HelperT::template Lookup<N>::PointerT Pointer) {
111
365k
    PointerSumType Result;
112
365k
    Result.set<N>(Pointer);
113
365k
    return Result;
114
365k
  }
115
116
  /// Clear the value to null with the min tag type.
117
136k
  void clear() { set<HelperT::MinTag>(nullptr); }
118
119
576M
  TagT getTag() const {
120
576M
    return static_cast<TagT>(getOpaqueValue() & HelperT::TagMask);
121
576M
  }
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
103M
  TagT getTag() const {
120
103M
    return static_cast<TagT>(getOpaqueValue() & HelperT::TagMask);
121
103M
  }
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
472M
  TagT getTag() const {
120
472M
    return static_cast<TagT>(getOpaqueValue() & HelperT::TagMask);
121
472M
  }
122
123
562M
  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)2>() const
Line
Count
Source
123
32.6M
  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.5M
  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(); }
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
442M
  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.6M
  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.60M
  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.60M
  template <TagT N> bool is() const { return N == getTag(); }
124
125
249M
  template <TagT N> typename HelperT::template Lookup<N>::PointerT get() const {
126
249M
    void *P = is<N>() ? 
getVoidPtr()226M
:
nullptr22.9M
;
127
249M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(P);
128
249M
  }
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
219M
  template <TagT N> typename HelperT::template Lookup<N>::PointerT get() const {
126
18.4E
    void *P = is<N>() ? 
getVoidPtr()219M
: nullptr;
127
219M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(P);
128
219M
  }
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.6M
  template <TagT N> typename HelperT::template Lookup<N>::PointerT get() const {
126
16.6M
    void *P = is<N>() ? 
getVoidPtr()6.92M
:
nullptr9.75M
;
127
16.6M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(P);
128
16.6M
  }
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.60M
  template <TagT N> typename HelperT::template Lookup<N>::PointerT get() const {
126
6.60M
    void *P = is<N>() ? 
getVoidPtr()33
:
nullptr6.60M
;
127
6.60M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(P);
128
6.60M
  }
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.60M
  template <TagT N> typename HelperT::template Lookup<N>::PointerT get() const {
126
6.60M
    void *P = is<N>() ? 
getVoidPtr()55
:
nullptr6.60M
;
127
6.60M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(P);
128
6.60M
  }
129
130
  template <TagT N>
131
33.3M
  typename HelperT::template Lookup<N>::PointerT cast() const {
132
33.3M
    assert(is<N>() && "This instance has a different active member.");
133
33.3M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(
134
33.3M
        getVoidPtr());
135
33.3M
  }
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
22.0M
  typename HelperT::template Lookup<N>::PointerT cast() const {
132
22.0M
    assert(is<N>() && "This instance has a different active member.");
133
22.0M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(
134
22.0M
        getVoidPtr());
135
22.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)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.34M
  typename HelperT::template Lookup<N>::PointerT cast() const {
132
3.34M
    assert(is<N>() && "This instance has a different active member.");
133
3.34M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(
134
3.34M
        getVoidPtr());
135
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
131
6.52M
  typename HelperT::template Lookup<N>::PointerT cast() const {
132
6.52M
    assert(is<N>() && "This instance has a different active member.");
133
6.52M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(
134
6.52M
        getVoidPtr());
135
6.52M
  }
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.45M
  typename HelperT::template Lookup<N>::PointerT cast() const {
132
1.45M
    assert(is<N>() && "This instance has a different active member.");
133
1.45M
    return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(
134
1.45M
        getVoidPtr());
135
1.45M
  }
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
219M
  getAddrOfZeroTagPointer() const {
142
219M
    return const_cast<PointerSumType *>(this)->getAddrOfZeroTagPointer();
143
219M
  }
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
219M
  getAddrOfZeroTagPointer() {
150
219M
    static_assert(HelperT::MinTag == 0, "Non-zero minimum tag value!");
151
219M
    assert(is<HelperT::MinTag>() && "The active tag is not zero!");
152
219M
    // Store the initial value of the pointer when read out of our storage.
153
219M
    auto InitialPtr = get<HelperT::MinTag>();
154
219M
    // Now update the active member of the union to be the actual pointer-typed
155
219M
    // member so that accessing it indirectly through the returned address is
156
219M
    // valid.
157
219M
    Storage.MinTagPointer = InitialPtr;
158
219M
    // Finally, validate that this was a no-op as expected by reading it back
159
219M
    // out using the same underlying-storage read as above.
160
219M
    assert(InitialPtr == get<HelperT::MinTag>() &&
161
219M
           "Switching to typed storage changed the pointer returned!");
162
219M
    // Now we can correctly return an address to typed storage.
163
219M
    return &Storage.MinTagPointer;
164
219M
  }
165
166
413M
  explicit operator bool() const {
167
413M
    return getOpaqueValue() & HelperT::PointerMask;
168
413M
  }
169
0
  bool operator==(const PointerSumType &R) const {
170
0
    return getOpaqueValue() == R.getOpaqueValue();
171
0
  }
172
0
  bool operator!=(const PointerSumType &R) const {
173
0
    return getOpaqueValue() != R.getOpaqueValue();
174
0
  }
175
0
  bool operator<(const PointerSumType &R) const {
176
0
    return getOpaqueValue() < R.getOpaqueValue();
177
0
  }
178
0
  bool operator>(const PointerSumType &R) const {
179
0
    return getOpaqueValue() > R.getOpaqueValue();
180
0
  }
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.25G
  uintptr_t getOpaqueValue() const {
189
1.25G
    // Read the underlying storage of the union, regardless of the active
190
1.25G
    // member.
191
1.25G
    return bit_cast<uintptr_t>(Storage);
192
1.25G
  }
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
137M
  uintptr_t getOpaqueValue() const {
189
137M
    // Read the underlying storage of the union, regardless of the active
190
137M
    // member.
191
137M
    return bit_cast<uintptr_t>(Storage);
192
137M
  }
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.11G
  uintptr_t getOpaqueValue() const {
189
1.11G
    // Read the underlying storage of the union, regardless of the active
190
1.11G
    // member.
191
1.11G
    return bit_cast<uintptr_t>(Storage);
192
1.11G
  }
193
194
protected:
195
259M
  void *getVoidPtr() const {
196
259M
    return reinterpret_cast<void *>(getOpaqueValue() & HelperT::PointerMask);
197
259M
  }
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
33.3M
  void *getVoidPtr() const {
196
33.3M
    return reinterpret_cast<void *>(getOpaqueValue() & HelperT::PointerMask);
197
33.3M
  }
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
226M
  void *getVoidPtr() const {
196
226M
    return reinterpret_cast<void *>(getOpaqueValue() & HelperT::PointerMask);
197
226M
  }
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