LLVM 23.0.0git
UniqueBBID.h
Go to the documentation of this file.
1//===- llvm/Support/UniqueBBID.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// This file contains a structure that uniquely identifies a basic block within
10// a function.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_SUPPORT_UNIQUEBBID_H
15#define LLVM_SUPPORT_UNIQUEBBID_H
16
18
19namespace llvm {
20
21// This structure represents the information for a basic block pertaining to
22// the basic block sections profile.
23struct UniqueBBID {
24 unsigned BaseID;
25 unsigned CloneID;
26};
27
28// The prefetch symbol is emitted immediately after the call of the given index,
29// in block `BBID` (First call has an index of 1). Zero callsite index means the
30// start of the block.
35
36// Provides DenseMapInfo for UniqueBBID.
37template <> struct DenseMapInfo<UniqueBBID> {
38 static inline UniqueBBID getEmptyKey() {
39 unsigned EmptyKey = DenseMapInfo<unsigned>::getEmptyKey();
40 return UniqueBBID{EmptyKey, EmptyKey};
41 }
42
43 static inline UniqueBBID getTombstoneKey() {
44 unsigned TombstoneKey = DenseMapInfo<unsigned>::getTombstoneKey();
45 return UniqueBBID{TombstoneKey, TombstoneKey};
46 }
47
52
53 static bool isEqual(const UniqueBBID &LHS, const UniqueBBID &RHS) {
54 return DenseMapInfo<unsigned>::isEqual(LHS.BaseID, RHS.BaseID) &&
55 DenseMapInfo<unsigned>::isEqual(LHS.CloneID, RHS.CloneID);
56 }
57};
58
59} // end namespace llvm
60
61#endif // LLVM_SUPPORT_UNIQUEBBID_H
This file defines DenseMapInfo traits for DenseMap.
Value * RHS
Value * LHS
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
UniqueBBID BBID
Definition UniqueBBID.h:32
unsigned CallsiteIndex
Definition UniqueBBID.h:33
static bool isEqual(const UniqueBBID &LHS, const UniqueBBID &RHS)
Definition UniqueBBID.h:53
static UniqueBBID getEmptyKey()
Definition UniqueBBID.h:38
static unsigned getHashValue(const UniqueBBID &Val)
Definition UniqueBBID.h:48
static UniqueBBID getTombstoneKey()
Definition UniqueBBID.h:43
An information struct used to provide DenseMap with the various necessary components for a given valu...
unsigned BaseID
Definition UniqueBBID.h:24
unsigned CloneID
Definition UniqueBBID.h:25