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#include "llvm/ADT/StringRef.h"
19
20namespace llvm {
21
22// This structure represents the information for a basic block pertaining to
23// the basic block sections profile.
24struct UniqueBBID {
25 unsigned BaseID;
26 unsigned CloneID;
27};
28
29// The prefetch symbol is emitted immediately after the call of the given index,
30// in block `BBID` (First call has an index of 1). Zero callsite index means the
31// start of the block.
36
37// This represents a prefetch hint to be injected at site `SiteID`, targeting
38// `TargetID` in function `TargetFunction`.
44
45// Provides DenseMapInfo for UniqueBBID.
46template <> struct DenseMapInfo<UniqueBBID> {
47 static inline UniqueBBID getEmptyKey() {
48 unsigned EmptyKey = DenseMapInfo<unsigned>::getEmptyKey();
49 return UniqueBBID{EmptyKey, EmptyKey};
50 }
51
52 static inline UniqueBBID getTombstoneKey() {
53 unsigned TombstoneKey = DenseMapInfo<unsigned>::getTombstoneKey();
54 return UniqueBBID{TombstoneKey, TombstoneKey};
55 }
56
61
62 static bool isEqual(const UniqueBBID &LHS, const UniqueBBID &RHS) {
63 return DenseMapInfo<unsigned>::isEqual(LHS.BaseID, RHS.BaseID) &&
64 DenseMapInfo<unsigned>::isEqual(LHS.CloneID, RHS.CloneID);
65 }
66};
67
68} // end namespace llvm
69
70#endif // LLVM_SUPPORT_UNIQUEBBID_H
This file defines DenseMapInfo traits for DenseMap.
Value * RHS
Value * LHS
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
This is an optimization pass for GlobalISel generic memory operations.
UniqueBBID BBID
Definition UniqueBBID.h:33
unsigned CallsiteIndex
Definition UniqueBBID.h:34
static bool isEqual(const UniqueBBID &LHS, const UniqueBBID &RHS)
Definition UniqueBBID.h:62
static UniqueBBID getEmptyKey()
Definition UniqueBBID.h:47
static unsigned getHashValue(const UniqueBBID &Val)
Definition UniqueBBID.h:57
static UniqueBBID getTombstoneKey()
Definition UniqueBBID.h:52
An information struct used to provide DenseMap with the various necessary components for a given valu...
StringRef TargetFunction
Definition UniqueBBID.h:41
CallsiteID TargetID
Definition UniqueBBID.h:42
CallsiteID SiteID
Definition UniqueBBID.h:40
unsigned BaseID
Definition UniqueBBID.h:25
unsigned CloneID
Definition UniqueBBID.h:26