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// This represents a prefetch hint to be injected at site `SiteID`, targeting
37// `TargetID` in function `TargetFunction`.
43
44// Provides DenseMapInfo for UniqueBBID.
45template <> struct DenseMapInfo<UniqueBBID> {
46 static inline UniqueBBID getEmptyKey() {
47 unsigned EmptyKey = DenseMapInfo<unsigned>::getEmptyKey();
48 return UniqueBBID{EmptyKey, EmptyKey};
49 }
50
51 static inline UniqueBBID getTombstoneKey() {
52 unsigned TombstoneKey = DenseMapInfo<unsigned>::getTombstoneKey();
53 return UniqueBBID{TombstoneKey, TombstoneKey};
54 }
55
60
61 static bool isEqual(const UniqueBBID &LHS, const UniqueBBID &RHS) {
62 return DenseMapInfo<unsigned>::isEqual(LHS.BaseID, RHS.BaseID) &&
63 DenseMapInfo<unsigned>::isEqual(LHS.CloneID, RHS.CloneID);
64 }
65};
66
67} // end namespace llvm
68
69#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:32
unsigned CallsiteIndex
Definition UniqueBBID.h:33
static bool isEqual(const UniqueBBID &LHS, const UniqueBBID &RHS)
Definition UniqueBBID.h:61
static UniqueBBID getEmptyKey()
Definition UniqueBBID.h:46
static unsigned getHashValue(const UniqueBBID &Val)
Definition UniqueBBID.h:56
static UniqueBBID getTombstoneKey()
Definition UniqueBBID.h:51
An information struct used to provide DenseMap with the various necessary components for a given valu...
StringRef TargetFunction
Definition UniqueBBID.h:40
CallsiteID TargetID
Definition UniqueBBID.h:41
CallsiteID SiteID
Definition UniqueBBID.h:39
unsigned BaseID
Definition UniqueBBID.h:24
unsigned CloneID
Definition UniqueBBID.h:25