Index: llvm/trunk/include/llvm/IR/FixedMetadataKinds.def =================================================================== --- llvm/trunk/include/llvm/IR/FixedMetadataKinds.def +++ llvm/trunk/include/llvm/IR/FixedMetadataKinds.def @@ -0,0 +1,41 @@ +/*===-- FixedMetadataKinds.def - Fixed metadata kind IDs -------*- C++ -*-=== *\ +|* +|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +|* See https://llvm.org/LICENSE.txt for license information. +|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +|* +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_FIXED_MD_KIND +#error "LLVM_FIXED_MD_KIND(EnumID, Name, Value) is not defined." +#endif + +LLVM_FIXED_MD_KIND(MD_dbg, "dbg", 0) +LLVM_FIXED_MD_KIND(MD_tbaa, "tbaa", 1) +LLVM_FIXED_MD_KIND(MD_prof, "prof", 2) +LLVM_FIXED_MD_KIND(MD_fpmath, "fpmath", 3) +LLVM_FIXED_MD_KIND(MD_range, "range", 4) +LLVM_FIXED_MD_KIND(MD_tbaa_struct, "tbaa.struct", 5) +LLVM_FIXED_MD_KIND(MD_invariant_load, "invariant.load", 6) +LLVM_FIXED_MD_KIND(MD_alias_scope, "alias.scope", 7) +LLVM_FIXED_MD_KIND(MD_noalias, "noalias", 8) +LLVM_FIXED_MD_KIND(MD_nontemporal, "nontemporal", 9) +LLVM_FIXED_MD_KIND(MD_mem_parallel_loop_access, + "llvm.mem.parallel_loop_access", 10) +LLVM_FIXED_MD_KIND(MD_nonnull, "nonnull", 11) +LLVM_FIXED_MD_KIND(MD_dereferenceable, "dereferenceable", 12) +LLVM_FIXED_MD_KIND(MD_dereferenceable_or_null, "dereferenceable_or_null", 13) +LLVM_FIXED_MD_KIND(MD_make_implicit, "make.implicit", 14) +LLVM_FIXED_MD_KIND(MD_unpredictable, "unpredictable", 15) +LLVM_FIXED_MD_KIND(MD_invariant_group, "invariant.group", 16) +LLVM_FIXED_MD_KIND(MD_align, "align", 17) +LLVM_FIXED_MD_KIND(MD_loop, "llvm.loop", 18) +LLVM_FIXED_MD_KIND(MD_type, "type", 19) +LLVM_FIXED_MD_KIND(MD_section_prefix, "section_prefix", 20) +LLVM_FIXED_MD_KIND(MD_absolute_symbol, "absolute_symbol", 21) +LLVM_FIXED_MD_KIND(MD_associated, "associated", 22) +LLVM_FIXED_MD_KIND(MD_callees, "callees", 23) +LLVM_FIXED_MD_KIND(MD_irr_loop, "irr_loop", 24) +LLVM_FIXED_MD_KIND(MD_access_group, "llvm.access.group", 25) +LLVM_FIXED_MD_KIND(MD_callback, "callback", 26) +LLVM_FIXED_MD_KIND(MD_preserve_access_index, "llvm.preserve.access.index", 27) Index: llvm/trunk/include/llvm/IR/LLVMContext.h =================================================================== --- llvm/trunk/include/llvm/IR/LLVMContext.h +++ llvm/trunk/include/llvm/IR/LLVMContext.h @@ -72,34 +72,9 @@ // Pinned metadata names, which always have the same value. This is a // compile-time performance optimization, not a correctness optimization. enum : unsigned { - MD_dbg = 0, // "dbg" - MD_tbaa = 1, // "tbaa" - MD_prof = 2, // "prof" - MD_fpmath = 3, // "fpmath" - MD_range = 4, // "range" - MD_tbaa_struct = 5, // "tbaa.struct" - MD_invariant_load = 6, // "invariant.load" - MD_alias_scope = 7, // "alias.scope" - MD_noalias = 8, // "noalias", - MD_nontemporal = 9, // "nontemporal" - MD_mem_parallel_loop_access = 10, // "llvm.mem.parallel_loop_access" - MD_nonnull = 11, // "nonnull" - MD_dereferenceable = 12, // "dereferenceable" - MD_dereferenceable_or_null = 13, // "dereferenceable_or_null" - MD_make_implicit = 14, // "make.implicit" - MD_unpredictable = 15, // "unpredictable" - MD_invariant_group = 16, // "invariant.group" - MD_align = 17, // "align" - MD_loop = 18, // "llvm.loop" - MD_type = 19, // "type" - MD_section_prefix = 20, // "section_prefix" - MD_absolute_symbol = 21, // "absolute_symbol" - MD_associated = 22, // "associated" - MD_callees = 23, // "callees" - MD_irr_loop = 24, // "irr_loop" - MD_access_group = 25, // "llvm.access.group" - MD_callback = 26, // "callback" - MD_preserve_access_index = 27, // "llvm.preserve.*.access.index" +#define LLVM_FIXED_MD_KIND(EnumID, Name, Value) EnumID = Value, +#include "llvm/IR/FixedMetadataKinds.def" +#undef LLVM_FIXED_MD_KIND }; /// Known operand bundle tag IDs, which always have the same value. All Index: llvm/trunk/include/llvm/module.modulemap =================================================================== --- llvm/trunk/include/llvm/module.modulemap +++ llvm/trunk/include/llvm/module.modulemap @@ -253,6 +253,7 @@ textual header "IR/DebugInfoFlags.def" textual header "IR/Instruction.def" textual header "IR/Metadata.def" + textual header "IR/FixedMetadataKinds.def" textual header "IR/Value.def" textual header "IR/RuntimeLibcalls.def" } Index: llvm/trunk/lib/IR/LLVMContext.cpp =================================================================== --- llvm/trunk/lib/IR/LLVMContext.cpp +++ llvm/trunk/lib/IR/LLVMContext.cpp @@ -36,34 +36,9 @@ // Create the fixed metadata kinds. This is done in the same order as the // MD_* enum values so that they correspond. std::pair MDKinds[] = { - {MD_dbg, "dbg"}, - {MD_tbaa, "tbaa"}, - {MD_prof, "prof"}, - {MD_fpmath, "fpmath"}, - {MD_range, "range"}, - {MD_tbaa_struct, "tbaa.struct"}, - {MD_invariant_load, "invariant.load"}, - {MD_alias_scope, "alias.scope"}, - {MD_noalias, "noalias"}, - {MD_nontemporal, "nontemporal"}, - {MD_mem_parallel_loop_access, "llvm.mem.parallel_loop_access"}, - {MD_nonnull, "nonnull"}, - {MD_dereferenceable, "dereferenceable"}, - {MD_dereferenceable_or_null, "dereferenceable_or_null"}, - {MD_make_implicit, "make.implicit"}, - {MD_unpredictable, "unpredictable"}, - {MD_invariant_group, "invariant.group"}, - {MD_align, "align"}, - {MD_loop, "llvm.loop"}, - {MD_type, "type"}, - {MD_section_prefix, "section_prefix"}, - {MD_absolute_symbol, "absolute_symbol"}, - {MD_associated, "associated"}, - {MD_callees, "callees"}, - {MD_irr_loop, "irr_loop"}, - {MD_access_group, "llvm.access.group"}, - {MD_callback, "callback"}, - {MD_preserve_access_index, "llvm.preserve.access.index"}, +#define LLVM_FIXED_MD_KIND(EnumID, Name, Value) {EnumID, Name}, +#include "llvm/IR/FixedMetadataKinds.def" +#undef LLVM_FIXED_MD_KIND }; for (auto &MDKind : MDKinds) {