LLVM 24.0.0git
llvm::AMDGPU::HWEvents Class Reference

Bit mask of hardware events. More...

#include "Target/AMDGPU/AMDGPUHWEvents.h"

Classes

class  const_iterator
 Iterates over the set bits of an HWEvent. More...

Public Types

enum  : value_type { NONE = 0 , ALL = ((HWEVENT_LAST_EVENT << 1) - 1) }
using value_type = uint64_t

Public Member Functions

constexpr HWEvents ()=default
constexpr HWEvents (value_type V)
constexpr unsigned size () const
constexpr bool any () const
constexpr bool none () const
constexpr value_type value () const
constexpr operator bool () const
constexpr bool contains (HWEvents Other) const
const_iterator begin () const
const_iterator end () const
constexpr HWEvents operator| (HWEvents Other) const
constexpr HWEvents operator& (HWEvents Other) const
constexpr HWEvents operator^ (HWEvents Other) const
constexpr HWEvents operator- (HWEvents Other) const
constexpr HWEvents operator~ () const
constexpr bool operator== (HWEvents Other) const
constexpr bool operator!= (HWEvents Other) const
constexpr HWEvents & operator|= (HWEvents Other)
constexpr HWEvents & operator&= (HWEvents Other)
constexpr HWEvents & operator^= (HWEvents Other)
constexpr HWEvents operator-= (HWEvents Other)
constexpr HWEvents operator& (value_type Other) const
 Overload both bitwise AND operators w/ the value_type to avoid an implicit conversion to HWEvent in this common pattern used to clear an event bit: Events & ~HWEvent::EVENT_TO_CLEAR.
constexpr HWEvents & operator&= (value_type Other)
LLVM_DUMP_METHOD void dump () const

Detailed Description

Bit mask of hardware events.

This is useful to manipulate events as hardware events rarely come alone. This class implements all the usual operators one would need to manipulate a bit mask, and also supports printing to a raw_ostream and iterating over all the set bits of the event mask.

This class behaves like a constexpr set of flags. None of the methods should be able to mutate the data unless they are assignment operators. Examples:

///   A |= B;   // Add flags (union).
///   A -= B;   // Remove flags (substraction).
///   A &= B;   // Intersection.
///   A ^= B;   // Bitwise XOR.
///   (bool)A;  // Check whether any bits are set; A.any() also works.
///   !A;       // Check if no bits are set; A.none() also works.
///   A.size(); // Check how many bits are set.
/// 

This type also provides certain stronger guarantees than a simple integer:

  • Default constructor initializes the mask to zero.
  • Constructor ensures undefined bits cannot be set.

Definition at line 50 of file AMDGPUHWEvents.h.

Member Typedef Documentation

◆ value_type

using llvm::AMDGPU::HWEvents::value_type = uint64_t

Definition at line 52 of file AMDGPUHWEvents.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : value_type
Enumerator
NONE 
ALL 

Definition at line 54 of file AMDGPUHWEvents.h.

Constructor & Destructor Documentation

◆ HWEvents() [1/2]

◆ HWEvents() [2/2]

llvm::AMDGPU::HWEvents::HWEvents ( value_type V)
inlineconstexpr

Definition at line 96 of file AMDGPUHWEvents.h.

References ALL, assert(), and llvm::AMDGPU::V.

Member Function Documentation

◆ any()

bool llvm::AMDGPU::HWEvents::any ( ) const
inlineconstexpr

Definition at line 101 of file AMDGPUHWEvents.h.

Referenced by operator bool().

◆ begin()

const_iterator llvm::AMDGPU::HWEvents::begin ( ) const
inline

Definition at line 111 of file AMDGPUHWEvents.h.

◆ contains()

bool llvm::AMDGPU::HWEvents::contains ( HWEvents Other) const
inlineconstexpr

Definition at line 107 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ dump()

LLVM_DUMP_METHOD void llvm::AMDGPU::HWEvents::dump ( ) const

Definition at line 20 of file AMDGPUHWEvents.cpp.

References llvm::dbgs(), and LLVM_DUMP_METHOD.

◆ end()

const_iterator llvm::AMDGPU::HWEvents::end ( ) const
inline

Definition at line 112 of file AMDGPUHWEvents.h.

◆ none()

bool llvm::AMDGPU::HWEvents::none ( ) const
inlineconstexpr

Definition at line 102 of file AMDGPUHWEvents.h.

◆ operator bool()

llvm::AMDGPU::HWEvents::operator bool ( ) const
inlineexplicitconstexpr

Definition at line 105 of file AMDGPUHWEvents.h.

References any().

◆ operator!=()

bool llvm::AMDGPU::HWEvents::operator!= ( HWEvents Other) const
inlineconstexpr

Definition at line 131 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator&() [1/2]

HWEvents llvm::AMDGPU::HWEvents::operator& ( HWEvents Other) const
inlineconstexpr

Definition at line 117 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator&() [2/2]

HWEvents llvm::AMDGPU::HWEvents::operator& ( value_type Other) const
inlineconstexpr

Overload both bitwise AND operators w/ the value_type to avoid an implicit conversion to HWEvent in this common pattern used to clear an event bit: Events & ~HWEvent::EVENT_TO_CLEAR.

If we had the implicit conversion to HWEvent, we'd assert because ~HWEvent::EVENT_TO_CLEAR has bits set outside of HWEvent::ALL.

Definition at line 156 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator&=() [1/2]

HWEvents & llvm::AMDGPU::HWEvents::operator&= ( HWEvents Other)
inlineconstexpr

Definition at line 137 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator&=() [2/2]

HWEvents & llvm::AMDGPU::HWEvents::operator&= ( value_type Other)
inlineconstexpr

Definition at line 157 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator-()

HWEvents llvm::AMDGPU::HWEvents::operator- ( HWEvents Other) const
inlineconstexpr

Definition at line 124 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator-=()

HWEvents llvm::AMDGPU::HWEvents::operator-= ( HWEvents Other)
inlineconstexpr

Definition at line 146 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator==()

bool llvm::AMDGPU::HWEvents::operator== ( HWEvents Other) const
inlineconstexpr

Definition at line 130 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator^()

HWEvents llvm::AMDGPU::HWEvents::operator^ ( HWEvents Other) const
inlineconstexpr

Definition at line 120 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator^=()

HWEvents & llvm::AMDGPU::HWEvents::operator^= ( HWEvents Other)
inlineconstexpr

Definition at line 141 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator|()

HWEvents llvm::AMDGPU::HWEvents::operator| ( HWEvents Other) const
inlineconstexpr

Definition at line 114 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator|=()

HWEvents & llvm::AMDGPU::HWEvents::operator|= ( HWEvents Other)
inlineconstexpr

Definition at line 133 of file AMDGPUHWEvents.h.

References HWEvents(), and llvm::AMDGPU::Other.

◆ operator~()

HWEvents llvm::AMDGPU::HWEvents::operator~ ( ) const
inlineconstexpr

Definition at line 128 of file AMDGPUHWEvents.h.

References ALL, and HWEvents().

◆ size()

unsigned llvm::AMDGPU::HWEvents::size ( ) const
inlineconstexpr

Definition at line 100 of file AMDGPUHWEvents.h.

References llvm::popcount().

◆ value()

value_type llvm::AMDGPU::HWEvents::value ( ) const
inlineconstexpr

The documentation for this class was generated from the following files: