1//===-------- llvm/IR/Value.def - File that describes Values ---v-*- 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 descriptions of the various LLVM values. This is
10// used as a central place for enumerating the different values.
11//
12//===----------------------------------------------------------------------===//
13
14// NOTE: NO INCLUDE GUARD DESIRED!
15
16// Provide definitions of macros so that users of this file do not have to
17// define everything to use it...
18//
19#if !(defined HANDLE_GLOBAL_VALUE || defined HANDLE_CONSTANT || \
20 defined HANDLE_INSTRUCTION || defined HANDLE_INLINE_ASM_VALUE || \
21 defined HANDLE_METADATA_VALUE || defined HANDLE_VALUE || \
22 defined HANDLE_CONSTANT_MARKER || defined HANDLE_MEMORY_VALUE)
23#error "Missing macro definition of HANDLE_VALUE*"
24#endif
25
26// If the LLVM_C_API macro is set, then values handled via HANDLE_*_EXCLUDE_LLVM_C_API will not be expanded in areas the HANDLE_* macro is used. If it is not set, then HANDLE_*_EXCLUDE_LLVM_C_API values are handled normally as their HANDLE_* counterparts.
27#ifndef LLVM_C_API
28#define LLVM_C_API 0
29#endif
30
31#ifndef HANDLE_MEMORY_VALUE
32#define HANDLE_MEMORY_VALUE(ValueName) HANDLE_VALUE(ValueName)
33#endif
34
35#ifndef HANDLE_GLOBAL_VALUE
36#define HANDLE_GLOBAL_VALUE(ValueName) HANDLE_CONSTANT(ValueName)
37#endif
38
39#ifndef HANDLE_CONSTANT
40#define HANDLE_CONSTANT(ValueName) HANDLE_VALUE(ValueName)
41#endif
42
43#ifndef HANDLE_INSTRUCTION
44#define HANDLE_INSTRUCTION(ValueName) HANDLE_VALUE(ValueName)
45#endif
46
47#ifndef HANDLE_INLINE_ASM_VALUE
48#define HANDLE_INLINE_ASM_VALUE(ValueName) HANDLE_VALUE(ValueName)
49#endif
50
51#ifndef HANDLE_METADATA_VALUE
52#define HANDLE_METADATA_VALUE(ValueName) HANDLE_VALUE(ValueName)
53#endif
54
55#ifndef HANDLE_VALUE
56#define HANDLE_VALUE(ValueName)
57#endif
58
59#ifndef HANDLE_CONSTANT_MARKER
60#define HANDLE_CONSTANT_MARKER(MarkerName, ValueName)
61#endif
62
63#ifndef HANDLE_CONSTANT_EXCLUDE_LLVM_C_API
64#define HANDLE_CONSTANT_EXCLUDE_LLVM_C_API(ValueName) HANDLE_CONSTANT(ValueName)
65#endif
66
67#if LLVM_C_API
68#undef HANDLE_CONSTANT_EXCLUDE_LLVM_C_API
69#define HANDLE_CONSTANT_EXCLUDE_LLVM_C_API(ValueName)
70#endif
71
72// Having constant first makes the range check for isa<Constant> faster
73// and smaller by one operation.
74
75// Constant
76HANDLE_GLOBAL_VALUE(Function)
77HANDLE_GLOBAL_VALUE(GlobalAlias)
78HANDLE_GLOBAL_VALUE(GlobalIFunc)
79HANDLE_GLOBAL_VALUE(GlobalVariable)
80HANDLE_CONSTANT(BlockAddress)
81HANDLE_CONSTANT(ConstantExpr)
82HANDLE_CONSTANT_EXCLUDE_LLVM_C_API(DSOLocalEquivalent)
83
84// ConstantAggregate.
85HANDLE_CONSTANT(ConstantArray)
86HANDLE_CONSTANT(ConstantStruct)
87HANDLE_CONSTANT(ConstantVector)
88
89// ConstantData.
90HANDLE_CONSTANT(UndefValue)
91HANDLE_CONSTANT(PoisonValue)
92HANDLE_CONSTANT(ConstantAggregateZero)
93HANDLE_CONSTANT(ConstantDataArray)
94HANDLE_CONSTANT(ConstantDataVector)
95HANDLE_CONSTANT(ConstantInt)
96HANDLE_CONSTANT(ConstantFP)
97HANDLE_CONSTANT(ConstantPointerNull)
98HANDLE_CONSTANT(ConstantTokenNone)
99
100HANDLE_CONSTANT_MARKER(ConstantFirstVal, Function)
101HANDLE_CONSTANT_MARKER(ConstantLastVal, ConstantTokenNone)
102HANDLE_CONSTANT_MARKER(ConstantDataFirstVal, UndefValue)
103HANDLE_CONSTANT_MARKER(ConstantDataLastVal, ConstantTokenNone)
104HANDLE_CONSTANT_MARKER(ConstantAggregateFirstVal, ConstantArray)
105HANDLE_CONSTANT_MARKER(ConstantAggregateLastVal, ConstantVector)
106
107HANDLE_VALUE(Argument)
108HANDLE_VALUE(BasicBlock)
109
110
111HANDLE_METADATA_VALUE(MetadataAsValue)
112HANDLE_INLINE_ASM_VALUE(InlineAsm)
113
114// FIXME: It's awkward that Value.def knows about classes in Analysis. While
115// this doesn't introduce a strict link or include dependency, we should remove
116// the circular dependency eventually.
117HANDLE_MEMORY_VALUE(MemoryUse)
118HANDLE_MEMORY_VALUE(MemoryDef)
119HANDLE_MEMORY_VALUE(MemoryPhi)
120
121HANDLE_INSTRUCTION(Instruction)
122// Enum values starting at InstructionVal are used for Instructions;
123// don't add new values here!
124
125#undef HANDLE_MEMORY_VALUE
126#undef HANDLE_GLOBAL_VALUE
127#undef HANDLE_CONSTANT
128#undef HANDLE_INSTRUCTION
129#undef HANDLE_METADATA_VALUE
130#undef HANDLE_INLINE_ASM_VALUE
131#undef HANDLE_VALUE
132#undef HANDLE_CONSTANT_MARKER
133#undef HANDLE_CONSTANT_EXCLUDE_LLVM_C_API
134#undef LLVM_C_API
135