1//===---- llvm/MDBuilder.h - Builder for LLVM metadata ----------*- C++ -*-===// 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 7//===----------------------------------------------------------------------===// 9// This file defines the MDBuilder class, which is used as a convenient way to 10// create LLVM metadata with a consistent and simplified interface. 12//===----------------------------------------------------------------------===// 14#ifndef LLVM_IR_MDBUILDER_H 15#define LLVM_IR_MDBUILDER_H 30classConstantAsMetadata;
42 /// Return the given string as metadata. 45 /// Return the given constant as metadata. 48//===------------------------------------------------------------------===// 50//===------------------------------------------------------------------===// 52 /// Return metadata with the given settings. The special value 0.0 53 /// for the Accuracy parameter indicates the default (maximal precision) 57//===------------------------------------------------------------------===// 59//===------------------------------------------------------------------===// 61 /// Return metadata containing two branch weights. 62 /// @param TrueWeight the weight of the true branch 63 /// @param FalseWeight the weight of the false branch 64 /// @param Do these weights come from __builtin_expect* 66bool IsExpected =
false);
68 /// Return metadata containing two branch weights, with significant bias 69 /// towards `true` destination. 72 /// Return metadata containing two branch weights, with significant bias 73 /// towards `false` destination. 76 /// Return metadata containing a number of branch weights. 77 /// @param Weights the weights of all the branches 78 /// @param Do these weights come from __builtin_expect* 80bool IsExpected =
false);
82 /// Return metadata specifying that a branch or switch is unpredictable. 85 /// Return metadata containing the entry \p Count for a function, a boolean 86 /// \Synthetic indicating whether the counts were synthetized, and the 87 /// GUIDs stored in \p Imports that need to be imported for sample PGO, to 88 /// enable the same inlines as the profiled optimized binary 92 /// Return metadata containing the section prefix for a function. 95 /// Return metadata containing the pseudo probe descriptor for a function. 98 /// Return metadata containing llvm statistics. 102//===------------------------------------------------------------------===// 104//===------------------------------------------------------------------===// 106 /// Return metadata describing the range [Lo, Hi). 109 /// Return metadata describing the range [Lo, Hi). 112//===------------------------------------------------------------------===// 114//===------------------------------------------------------------------===// 116 /// Return metadata indicating the possible callees of indirect 120//===------------------------------------------------------------------===// 122//===------------------------------------------------------------------===// 124 /// Return metadata describing a callback (see llvm::AbstractCallSite). 126bool VarArgsArePassed);
128 /// Merge the new callback encoding \p NewCB into \p ExistingCallbacks. 131 /// Return metadata feeding to the CodeGen about how to generate a function 132 /// prologue for the "function" santizier. 135//===------------------------------------------------------------------===// 136// PC sections metadata. 137//===------------------------------------------------------------------===// 139 /// A pair of PC section name with auxilliary constant data. 140usingPCSection = std::pair<StringRef, SmallVector<Constant *>>;
142 /// Return metadata for PC sections. 145//===------------------------------------------------------------------===// 147//===------------------------------------------------------------------===// 150 /// Return metadata appropriate for a AA root node (scope or TBAA). 151 /// Each returned node is distinct from all other metadata and will never 152 /// be identified (uniqued) with anything else. 157 /// Return metadata appropriate for a TBAA root node. Each returned 158 /// node is distinct from all other metadata and will never be identified 159 /// (uniqued) with anything else. 164 /// Return metadata appropriate for an alias scope domain node. 165 /// Each returned node is distinct from all other metadata and will never 166 /// be identified (uniqued) with anything else. 171 /// Return metadata appropriate for an alias scope root node. 172 /// Each returned node is distinct from all other metadata and will never 173 /// be identified (uniqued) with anything else. 179 /// Return metadata appropriate for a TBAA root node with the given 180 /// name. This may be identified (uniqued) with other roots with the same 184 /// Return metadata appropriate for an alias scope domain node with 185 /// the given name. This may be identified (uniqued) with other roots with 189 /// Return metadata appropriate for an alias scope node with 190 /// the given name. This may be identified (uniqued) with other scopes with 191 /// the same name and domain. 194 /// Return metadata for a non-root TBAA node with the given name, 195 /// parent in the TBAA tree, and value for 'pointsToConstantMemory'. 207 /// Return metadata for a tbaa.struct node with the given 208 /// struct field descriptions. 211 /// Return metadata for a TBAA struct node in the type DAG 212 /// with the given name, a list of pairs (offset, field type in the type DAG). 215ArrayRef<std::pair<MDNode *, uint64_t>> Fields);
217 /// Return metadata for a TBAA scalar type node with the 218 /// given name, an offset and a parent in the TBAA type DAG. 222 /// Return metadata for a TBAA tag node with the given 223 /// base type, access type and offset relative to the base type. 227 /// Return metadata for a TBAA type node in the TBAA type DAG with the 228 /// given parent type, size in bytes, type identifier and a list of fields. 233 /// Return metadata for a TBAA access tag with the given base type, 234 /// final access type, offset of the access relative to the base type, size of 235 /// the access and flag indicating whether the accessed object can be 236 /// considered immutable for the purposes of the TBAA analysis. 239bool IsImmutable =
false);
241 /// Return mutable version of the given mutable or immutable TBAA 245 /// Return metadata containing an irreducible loop header weight. 249}
// end namespace llvm static bool isConstant(const MachineInstr &MI)
AMDGPU Lower Kernel Arguments
dxil translate DXIL Translate Metadata
This file defines the DenseSet and SmallDenseSet classes.
This file defines the SmallVector class.
Class for arbitrary precision integers.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is an important base class in LLVM.
Implements a dense probed hash-table based set.
This is an important class for using LLVM in a threaded context.
MDNode * createTBAAAccessTag(MDNode *BaseType, MDNode *AccessType, uint64_t Offset, uint64_t Size, bool IsImmutable=false)
Return metadata for a TBAA access tag with the given base type, final access type,...
MDNode * createCallbackEncoding(unsigned CalleeArgNo, ArrayRef< int > Arguments, bool VarArgsArePassed)
Return metadata describing a callback (see llvm::AbstractCallSite).
MDNode * createAnonymousAARoot(StringRef Name=StringRef(), MDNode *Extra=nullptr)
Return metadata appropriate for a AA root node (scope or TBAA).
MDNode * createFunctionEntryCount(uint64_t Count, bool Synthetic, const DenseSet< GlobalValue::GUID > *Imports)
Return metadata containing the entry Count for a function, a boolean \Synthetic indicating whether th...
MDNode * createAnonymousAliasScope(MDNode *Domain, StringRef Name=StringRef())
Return metadata appropriate for an alias scope root node.
MDNode * createPseudoProbeDesc(uint64_t GUID, uint64_t Hash, StringRef FName)
Return metadata containing the pseudo probe descriptor for a function.
ConstantAsMetadata * createConstant(Constant *C)
Return the given constant as metadata.
MDNode * createFPMath(float Accuracy)
Return metadata with the given settings.
MDNode * createPCSections(ArrayRef< PCSection > Sections)
Return metadata for PC sections.
MDNode * createTBAANode(StringRef Name, MDNode *Parent, bool isConstant=false)
Return metadata for a non-root TBAA node with the given name, parent in the TBAA tree,...
MDNode * createTBAARoot(StringRef Name)
Return metadata appropriate for a TBAA root node with the given name.
MDNode * createBranchWeights(uint32_t TrueWeight, uint32_t FalseWeight, bool IsExpected=false)
Return metadata containing two branch weights.
MDString * createString(StringRef Str)
Return the given string as metadata.
MDNode * createAnonymousTBAARoot()
Return metadata appropriate for a TBAA root node.
MDNode * createTBAAScalarTypeNode(StringRef Name, MDNode *Parent, uint64_t Offset=0)
Return metadata for a TBAA scalar type node with the given name, an offset and a parent in the TBAA t...
MDNode * createIrrLoopHeaderWeight(uint64_t Weight)
Return metadata containing an irreducible loop header weight.
MDNode * createFunctionSectionPrefix(StringRef Prefix)
Return metadata containing the section prefix for a function.
MDNode * createUnpredictable()
Return metadata specifying that a branch or switch is unpredictable.
MDNode * createTBAAStructTypeNode(StringRef Name, ArrayRef< std::pair< MDNode *, uint64_t > > Fields)
Return metadata for a TBAA struct node in the type DAG with the given name, a list of pairs (offset,...
MDNode * createCallees(ArrayRef< Function * > Callees)
Return metadata indicating the possible callees of indirect calls.
MDNode * createAliasScopeDomain(StringRef Name)
Return metadata appropriate for an alias scope domain node with the given name.
std::pair< StringRef, SmallVector< Constant * > > PCSection
A pair of PC section name with auxilliary constant data.
MDNode * createRange(const APInt &Lo, const APInt &Hi)
Return metadata describing the range [Lo, Hi).
MDNode * createLikelyBranchWeights()
Return metadata containing two branch weights, with significant bias towards true destination.
MDNode * createTBAAStructNode(ArrayRef< TBAAStructField > Fields)
Return metadata for a tbaa.struct node with the given struct field descriptions.
MDBuilder(LLVMContext &context)
MDNode * mergeCallbackEncodings(MDNode *ExistingCallbacks, MDNode *NewCB)
Merge the new callback encoding NewCB into ExistingCallbacks.
MDNode * createMutableTBAAAccessTag(MDNode *Tag)
Return mutable version of the given mutable or immutable TBAA access tag.
MDNode * createLLVMStats(ArrayRef< std::pair< StringRef, uint64_t > > LLVMStatsVec)
Return metadata containing llvm statistics.
MDNode * createRTTIPointerPrologue(Constant *PrologueSig, Constant *RTTI)
Return metadata feeding to the CodeGen about how to generate a function prologue for the "function" s...
MDNode * createAnonymousAliasScopeDomain(StringRef Name=StringRef())
Return metadata appropriate for an alias scope domain node.
MDNode * createUnlikelyBranchWeights()
Return metadata containing two branch weights, with significant bias towards false destination.
MDNode * createAliasScope(StringRef Name, MDNode *Domain)
Return metadata appropriate for an alias scope node with the given name.
MDNode * createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType, uint64_t Offset, bool IsConstant=false)
Return metadata for a TBAA tag node with the given base type, access type and offset relative to the ...
MDNode * createTBAATypeNode(MDNode *Parent, uint64_t Size, Metadata *Id, ArrayRef< TBAAStructField > Fields=ArrayRef< TBAAStructField >())
Return metadata for a TBAA type node in the TBAA type DAG with the given parent type,...
Root of the metadata hierarchy.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
ArrayRef(const T &OneElt) -> ArrayRef< T >
TBAAStructField(uint64_t Offset, uint64_t Size, MDNode *Type)