Value.def 4.3 KB

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