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) 83HANDLE_CONSTANT_EXCLUDE_LLVM_C_API(NoCFIValue) 84HANDLE_CONSTANT(ConstantPtrAuth) 85 86// ConstantAggregate. 87HANDLE_CONSTANT(ConstantArray) 88HANDLE_CONSTANT(ConstantStruct) 89HANDLE_CONSTANT(ConstantVector) 90 91// ConstantData. 92HANDLE_CONSTANT(UndefValue) 93HANDLE_CONSTANT(PoisonValue) 94HANDLE_CONSTANT(ConstantAggregateZero) 95HANDLE_CONSTANT(ConstantDataArray) 96HANDLE_CONSTANT(ConstantDataVector) 97HANDLE_CONSTANT(ConstantInt) 98HANDLE_CONSTANT(ConstantFP) 99HANDLE_CONSTANT(ConstantTargetNone) 100HANDLE_CONSTANT(ConstantPointerNull) 101HANDLE_CONSTANT(ConstantTokenNone) 102 103HANDLE_CONSTANT_MARKER(ConstantFirstVal, Function) 104HANDLE_CONSTANT_MARKER(ConstantLastVal, ConstantTokenNone) 105HANDLE_CONSTANT_MARKER(ConstantDataFirstVal, UndefValue) 106HANDLE_CONSTANT_MARKER(ConstantDataLastVal, ConstantTokenNone) 107HANDLE_CONSTANT_MARKER(ConstantAggregateFirstVal, ConstantArray) 108HANDLE_CONSTANT_MARKER(ConstantAggregateLastVal, ConstantVector) 109 110HANDLE_VALUE(Argument) 111HANDLE_VALUE(BasicBlock) 112 113 114HANDLE_METADATA_VALUE(MetadataAsValue) 115HANDLE_INLINE_ASM_VALUE(InlineAsm) 116 117// FIXME: It's awkward that Value.def knows about classes in Analysis. While 118// this doesn't introduce a strict link or include dependency, we should remove 119// the circular dependency eventually. 120HANDLE_MEMORY_VALUE(MemoryUse) 121HANDLE_MEMORY_VALUE(MemoryDef) 122HANDLE_MEMORY_VALUE(MemoryPhi) 123 124HANDLE_INSTRUCTION(Instruction) 125// Enum values starting at InstructionVal are used for Instructions; 126// don't add new values here! 127 128#undef HANDLE_MEMORY_VALUE 129#undef HANDLE_GLOBAL_VALUE 130#undef HANDLE_CONSTANT 131#undef HANDLE_INSTRUCTION 132#undef HANDLE_METADATA_VALUE 133#undef HANDLE_INLINE_ASM_VALUE 134#undef HANDLE_VALUE 135#undef HANDLE_CONSTANT_MARKER 136#undef HANDLE_CONSTANT_EXCLUDE_LLVM_C_API 137#undef LLVM_C_API 138