1//===- llvm/IR/Metadata.def - Metadata definitions --------------*- 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// Macros for running through all types of metadata.
10//
11//===----------------------------------------------------------------------===//
12
13#if !(defined HANDLE_METADATA || defined HANDLE_METADATA_LEAF || \
14 defined HANDLE_METADATA_BRANCH || defined HANDLE_MDNODE_LEAF || \
15 defined HANDLE_MDNODE_LEAF_UNIQUABLE || defined HANDLE_MDNODE_BRANCH || \
16 defined HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE || \
17 defined HANDLE_SPECIALIZED_MDNODE_LEAF || \
18 defined HANDLE_SPECIALIZED_MDNODE_BRANCH)
19#error "Missing macro definition of HANDLE_METADATA*"
20#endif
21
22// Handler for all types of metadata.
23#ifndef HANDLE_METADATA
24#define HANDLE_METADATA(CLASS)
25#endif
26
27// Handler for leaf nodes in the class hierarchy.
28#ifndef HANDLE_METADATA_LEAF
29#define HANDLE_METADATA_LEAF(CLASS) HANDLE_METADATA(CLASS)
30#endif
31
32// Handler for non-leaf nodes in the class hierarchy.
33#ifndef HANDLE_METADATA_BRANCH
34#define HANDLE_METADATA_BRANCH(CLASS) HANDLE_METADATA(CLASS)
35#endif
36
37// Handler for specialized and uniquable leaf nodes under MDNode. Defers to
38// HANDLE_MDNODE_LEAF_UNIQUABLE if it's defined, otherwise to
39// HANDLE_SPECIALIZED_MDNODE_LEAF.
40#ifndef HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE
41#ifdef HANDLE_MDNODE_LEAF_UNIQUABLE
42#define HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(CLASS) \
43 HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS)
44#else
45#define HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(CLASS) \
46 HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS)
47#endif
48#endif
49
50// Handler for leaf nodes under MDNode.
51#ifndef HANDLE_MDNODE_LEAF_UNIQUABLE
52#define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) HANDLE_MDNODE_LEAF(CLASS)
53#endif
54
55// Handler for leaf nodes under MDNode.
56#ifndef HANDLE_MDNODE_LEAF
57#define HANDLE_MDNODE_LEAF(CLASS) HANDLE_METADATA_LEAF(CLASS)
58#endif
59
60// Handler for non-leaf nodes under MDNode.
61#ifndef HANDLE_MDNODE_BRANCH
62#define HANDLE_MDNODE_BRANCH(CLASS) HANDLE_METADATA_BRANCH(CLASS)
63#endif
64
65// Handler for specialized leaf nodes under MDNode.
66#ifndef HANDLE_SPECIALIZED_MDNODE_LEAF
67#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) HANDLE_MDNODE_LEAF(CLASS)
68#endif
69
70// Handler for specialized non-leaf nodes under MDNode.
71#ifndef HANDLE_SPECIALIZED_MDNODE_BRANCH
72#define HANDLE_SPECIALIZED_MDNODE_BRANCH(CLASS) HANDLE_MDNODE_BRANCH(CLASS)
73#endif
74
75HANDLE_METADATA_LEAF(MDString)
76HANDLE_METADATA_BRANCH(ValueAsMetadata)
77HANDLE_METADATA_LEAF(ConstantAsMetadata)
78HANDLE_METADATA_LEAF(LocalAsMetadata)
79HANDLE_METADATA_LEAF(DistinctMDOperandPlaceholder)
80HANDLE_MDNODE_BRANCH(MDNode)
81HANDLE_MDNODE_LEAF_UNIQUABLE(MDTuple)
82HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DILocation)
83HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIExpression)
84HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIGlobalVariableExpression)
85HANDLE_SPECIALIZED_MDNODE_BRANCH(DINode)
86HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(GenericDINode)
87HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DISubrange)
88HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIEnumerator)
89HANDLE_SPECIALIZED_MDNODE_BRANCH(DIScope)
90HANDLE_SPECIALIZED_MDNODE_BRANCH(DIType)
91HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIBasicType)
92HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIDerivedType)
93HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DICompositeType)
94HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DISubroutineType)
95HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIFile)
96HANDLE_SPECIALIZED_MDNODE_LEAF(DICompileUnit)
97HANDLE_SPECIALIZED_MDNODE_BRANCH(DILocalScope)
98HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DISubprogram)
99HANDLE_SPECIALIZED_MDNODE_BRANCH(DILexicalBlockBase)
100HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DILexicalBlock)
101HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DILexicalBlockFile)
102HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DINamespace)
103HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIModule)
104HANDLE_SPECIALIZED_MDNODE_BRANCH(DITemplateParameter)
105HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DITemplateTypeParameter)
106HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DITemplateValueParameter)
107HANDLE_SPECIALIZED_MDNODE_BRANCH(DIVariable)
108HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIGlobalVariable)
109HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DILocalVariable)
110HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DILabel)
111HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIObjCProperty)
112HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIImportedEntity)
113HANDLE_SPECIALIZED_MDNODE_BRANCH(DIMacroNode)
114HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIMacro)
115HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIMacroFile)
116HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DICommonBlock)
117HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIArgList)
118HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIStringType)
119HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DIGenericSubrange)
120
121#undef HANDLE_METADATA
122#undef HANDLE_METADATA_LEAF
123#undef HANDLE_METADATA_BRANCH
124#undef HANDLE_MDNODE_LEAF
125#undef HANDLE_MDNODE_LEAF_UNIQUABLE
126#undef HANDLE_MDNODE_BRANCH
127#undef HANDLE_SPECIALIZED_MDNODE_LEAF
128#undef HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE
129#undef HANDLE_SPECIALIZED_MDNODE_BRANCH
130