[llvm-exegesis][NFC] Fix typo
[llvm-complete.git] / lib / DebugInfo / CodeView / EnumTables.cpp
blobef4e42f79ebc9f71650dad82f1f2b4a6367ac929
1 //===- EnumTables.cpp - Enum to string conversion tables ------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
10 #include "llvm/DebugInfo/CodeView/EnumTables.h"
11 #include "llvm/Support/ScopedPrinter.h"
12 #include <type_traits>
14 using namespace llvm;
15 using namespace codeview;
17 #define CV_ENUM_CLASS_ENT(enum_class, enum) \
18 { #enum, std::underlying_type < enum_class > ::type(enum_class::enum) }
20 #define CV_ENUM_ENT(ns, enum) \
21 { #enum, ns::enum }
23 static const EnumEntry<SymbolKind> SymbolTypeNames[] = {
24 #define CV_SYMBOL(enum, val) {#enum, enum},
25 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
26 #undef CV_SYMBOL
29 static const EnumEntry<TypeLeafKind> TypeLeafNames[] = {
30 #define CV_TYPE(name, val) {#name, name},
31 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
32 #undef CV_TYPE
35 static const EnumEntry<uint16_t> RegisterNames[] = {
36 #define CV_REGISTER(name, val) CV_ENUM_CLASS_ENT(RegisterId, name),
37 #include "llvm/DebugInfo/CodeView/CodeViewRegisters.def"
38 #undef CV_REGISTER
41 static const EnumEntry<uint32_t> PublicSymFlagNames[] = {
42 CV_ENUM_CLASS_ENT(PublicSymFlags, Code),
43 CV_ENUM_CLASS_ENT(PublicSymFlags, Function),
44 CV_ENUM_CLASS_ENT(PublicSymFlags, Managed),
45 CV_ENUM_CLASS_ENT(PublicSymFlags, MSIL),
48 static const EnumEntry<uint8_t> ProcSymFlagNames[] = {
49 CV_ENUM_CLASS_ENT(ProcSymFlags, HasFP),
50 CV_ENUM_CLASS_ENT(ProcSymFlags, HasIRET),
51 CV_ENUM_CLASS_ENT(ProcSymFlags, HasFRET),
52 CV_ENUM_CLASS_ENT(ProcSymFlags, IsNoReturn),
53 CV_ENUM_CLASS_ENT(ProcSymFlags, IsUnreachable),
54 CV_ENUM_CLASS_ENT(ProcSymFlags, HasCustomCallingConv),
55 CV_ENUM_CLASS_ENT(ProcSymFlags, IsNoInline),
56 CV_ENUM_CLASS_ENT(ProcSymFlags, HasOptimizedDebugInfo),
59 static const EnumEntry<uint16_t> LocalFlags[] = {
60 CV_ENUM_CLASS_ENT(LocalSymFlags, IsParameter),
61 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAddressTaken),
62 CV_ENUM_CLASS_ENT(LocalSymFlags, IsCompilerGenerated),
63 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAggregate),
64 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAggregated),
65 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAliased),
66 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAlias),
67 CV_ENUM_CLASS_ENT(LocalSymFlags, IsReturnValue),
68 CV_ENUM_CLASS_ENT(LocalSymFlags, IsOptimizedOut),
69 CV_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredGlobal),
70 CV_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredStatic),
73 static const EnumEntry<uint8_t> FrameCookieKinds[] = {
74 CV_ENUM_CLASS_ENT(FrameCookieKind, Copy),
75 CV_ENUM_CLASS_ENT(FrameCookieKind, XorStackPointer),
76 CV_ENUM_CLASS_ENT(FrameCookieKind, XorFramePointer),
77 CV_ENUM_CLASS_ENT(FrameCookieKind, XorR13),
80 static const EnumEntry<codeview::SourceLanguage> SourceLanguages[] = {
81 CV_ENUM_ENT(SourceLanguage, C), CV_ENUM_ENT(SourceLanguage, Cpp),
82 CV_ENUM_ENT(SourceLanguage, Fortran), CV_ENUM_ENT(SourceLanguage, Masm),
83 CV_ENUM_ENT(SourceLanguage, Pascal), CV_ENUM_ENT(SourceLanguage, Basic),
84 CV_ENUM_ENT(SourceLanguage, Cobol), CV_ENUM_ENT(SourceLanguage, Link),
85 CV_ENUM_ENT(SourceLanguage, Cvtres), CV_ENUM_ENT(SourceLanguage, Cvtpgd),
86 CV_ENUM_ENT(SourceLanguage, CSharp), CV_ENUM_ENT(SourceLanguage, VB),
87 CV_ENUM_ENT(SourceLanguage, ILAsm), CV_ENUM_ENT(SourceLanguage, Java),
88 CV_ENUM_ENT(SourceLanguage, JScript), CV_ENUM_ENT(SourceLanguage, MSIL),
89 CV_ENUM_ENT(SourceLanguage, HLSL), CV_ENUM_ENT(SourceLanguage, D),
92 static const EnumEntry<uint32_t> CompileSym2FlagNames[] = {
93 CV_ENUM_CLASS_ENT(CompileSym2Flags, EC),
94 CV_ENUM_CLASS_ENT(CompileSym2Flags, NoDbgInfo),
95 CV_ENUM_CLASS_ENT(CompileSym2Flags, LTCG),
96 CV_ENUM_CLASS_ENT(CompileSym2Flags, NoDataAlign),
97 CV_ENUM_CLASS_ENT(CompileSym2Flags, ManagedPresent),
98 CV_ENUM_CLASS_ENT(CompileSym2Flags, SecurityChecks),
99 CV_ENUM_CLASS_ENT(CompileSym2Flags, HotPatch),
100 CV_ENUM_CLASS_ENT(CompileSym2Flags, CVTCIL),
101 CV_ENUM_CLASS_ENT(CompileSym2Flags, MSILModule),
104 static const EnumEntry<uint32_t> CompileSym3FlagNames[] = {
105 CV_ENUM_CLASS_ENT(CompileSym3Flags, EC),
106 CV_ENUM_CLASS_ENT(CompileSym3Flags, NoDbgInfo),
107 CV_ENUM_CLASS_ENT(CompileSym3Flags, LTCG),
108 CV_ENUM_CLASS_ENT(CompileSym3Flags, NoDataAlign),
109 CV_ENUM_CLASS_ENT(CompileSym3Flags, ManagedPresent),
110 CV_ENUM_CLASS_ENT(CompileSym3Flags, SecurityChecks),
111 CV_ENUM_CLASS_ENT(CompileSym3Flags, HotPatch),
112 CV_ENUM_CLASS_ENT(CompileSym3Flags, CVTCIL),
113 CV_ENUM_CLASS_ENT(CompileSym3Flags, MSILModule),
114 CV_ENUM_CLASS_ENT(CompileSym3Flags, Sdl),
115 CV_ENUM_CLASS_ENT(CompileSym3Flags, PGO),
116 CV_ENUM_CLASS_ENT(CompileSym3Flags, Exp),
119 static const EnumEntry<uint32_t> FileChecksumNames[] = {
120 CV_ENUM_CLASS_ENT(FileChecksumKind, None),
121 CV_ENUM_CLASS_ENT(FileChecksumKind, MD5),
122 CV_ENUM_CLASS_ENT(FileChecksumKind, SHA1),
123 CV_ENUM_CLASS_ENT(FileChecksumKind, SHA256),
126 static const EnumEntry<unsigned> CPUTypeNames[] = {
127 CV_ENUM_CLASS_ENT(CPUType, Intel8080),
128 CV_ENUM_CLASS_ENT(CPUType, Intel8086),
129 CV_ENUM_CLASS_ENT(CPUType, Intel80286),
130 CV_ENUM_CLASS_ENT(CPUType, Intel80386),
131 CV_ENUM_CLASS_ENT(CPUType, Intel80486),
132 CV_ENUM_CLASS_ENT(CPUType, Pentium),
133 CV_ENUM_CLASS_ENT(CPUType, PentiumPro),
134 CV_ENUM_CLASS_ENT(CPUType, Pentium3),
135 CV_ENUM_CLASS_ENT(CPUType, MIPS),
136 CV_ENUM_CLASS_ENT(CPUType, MIPS16),
137 CV_ENUM_CLASS_ENT(CPUType, MIPS32),
138 CV_ENUM_CLASS_ENT(CPUType, MIPS64),
139 CV_ENUM_CLASS_ENT(CPUType, MIPSI),
140 CV_ENUM_CLASS_ENT(CPUType, MIPSII),
141 CV_ENUM_CLASS_ENT(CPUType, MIPSIII),
142 CV_ENUM_CLASS_ENT(CPUType, MIPSIV),
143 CV_ENUM_CLASS_ENT(CPUType, MIPSV),
144 CV_ENUM_CLASS_ENT(CPUType, M68000),
145 CV_ENUM_CLASS_ENT(CPUType, M68010),
146 CV_ENUM_CLASS_ENT(CPUType, M68020),
147 CV_ENUM_CLASS_ENT(CPUType, M68030),
148 CV_ENUM_CLASS_ENT(CPUType, M68040),
149 CV_ENUM_CLASS_ENT(CPUType, Alpha),
150 CV_ENUM_CLASS_ENT(CPUType, Alpha21164),
151 CV_ENUM_CLASS_ENT(CPUType, Alpha21164A),
152 CV_ENUM_CLASS_ENT(CPUType, Alpha21264),
153 CV_ENUM_CLASS_ENT(CPUType, Alpha21364),
154 CV_ENUM_CLASS_ENT(CPUType, PPC601),
155 CV_ENUM_CLASS_ENT(CPUType, PPC603),
156 CV_ENUM_CLASS_ENT(CPUType, PPC604),
157 CV_ENUM_CLASS_ENT(CPUType, PPC620),
158 CV_ENUM_CLASS_ENT(CPUType, PPCFP),
159 CV_ENUM_CLASS_ENT(CPUType, PPCBE),
160 CV_ENUM_CLASS_ENT(CPUType, SH3),
161 CV_ENUM_CLASS_ENT(CPUType, SH3E),
162 CV_ENUM_CLASS_ENT(CPUType, SH3DSP),
163 CV_ENUM_CLASS_ENT(CPUType, SH4),
164 CV_ENUM_CLASS_ENT(CPUType, SHMedia),
165 CV_ENUM_CLASS_ENT(CPUType, ARM3),
166 CV_ENUM_CLASS_ENT(CPUType, ARM4),
167 CV_ENUM_CLASS_ENT(CPUType, ARM4T),
168 CV_ENUM_CLASS_ENT(CPUType, ARM5),
169 CV_ENUM_CLASS_ENT(CPUType, ARM5T),
170 CV_ENUM_CLASS_ENT(CPUType, ARM6),
171 CV_ENUM_CLASS_ENT(CPUType, ARM_XMAC),
172 CV_ENUM_CLASS_ENT(CPUType, ARM_WMMX),
173 CV_ENUM_CLASS_ENT(CPUType, ARM7),
174 CV_ENUM_CLASS_ENT(CPUType, Omni),
175 CV_ENUM_CLASS_ENT(CPUType, Ia64),
176 CV_ENUM_CLASS_ENT(CPUType, Ia64_2),
177 CV_ENUM_CLASS_ENT(CPUType, CEE),
178 CV_ENUM_CLASS_ENT(CPUType, AM33),
179 CV_ENUM_CLASS_ENT(CPUType, M32R),
180 CV_ENUM_CLASS_ENT(CPUType, TriCore),
181 CV_ENUM_CLASS_ENT(CPUType, X64),
182 CV_ENUM_CLASS_ENT(CPUType, EBC),
183 CV_ENUM_CLASS_ENT(CPUType, Thumb),
184 CV_ENUM_CLASS_ENT(CPUType, ARMNT),
185 CV_ENUM_CLASS_ENT(CPUType, D3D11_Shader),
188 static const EnumEntry<uint32_t> FrameProcSymFlagNames[] = {
189 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasAlloca),
190 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasSetJmp),
191 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasLongJmp),
192 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasInlineAssembly),
193 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasExceptionHandling),
194 CV_ENUM_CLASS_ENT(FrameProcedureOptions, MarkedInline),
195 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasStructuredExceptionHandling),
196 CV_ENUM_CLASS_ENT(FrameProcedureOptions, Naked),
197 CV_ENUM_CLASS_ENT(FrameProcedureOptions, SecurityChecks),
198 CV_ENUM_CLASS_ENT(FrameProcedureOptions, AsynchronousExceptionHandling),
199 CV_ENUM_CLASS_ENT(FrameProcedureOptions, NoStackOrderingForSecurityChecks),
200 CV_ENUM_CLASS_ENT(FrameProcedureOptions, Inlined),
201 CV_ENUM_CLASS_ENT(FrameProcedureOptions, StrictSecurityChecks),
202 CV_ENUM_CLASS_ENT(FrameProcedureOptions, SafeBuffers),
203 CV_ENUM_CLASS_ENT(FrameProcedureOptions, EncodedLocalBasePointerMask),
204 CV_ENUM_CLASS_ENT(FrameProcedureOptions, EncodedParamBasePointerMask),
205 CV_ENUM_CLASS_ENT(FrameProcedureOptions, ProfileGuidedOptimization),
206 CV_ENUM_CLASS_ENT(FrameProcedureOptions, ValidProfileCounts),
207 CV_ENUM_CLASS_ENT(FrameProcedureOptions, OptimizedForSpeed),
208 CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfg),
209 CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfw),
212 static const EnumEntry<uint32_t> ModuleSubstreamKindNames[] = {
213 CV_ENUM_CLASS_ENT(DebugSubsectionKind, None),
214 CV_ENUM_CLASS_ENT(DebugSubsectionKind, Symbols),
215 CV_ENUM_CLASS_ENT(DebugSubsectionKind, Lines),
216 CV_ENUM_CLASS_ENT(DebugSubsectionKind, StringTable),
217 CV_ENUM_CLASS_ENT(DebugSubsectionKind, FileChecksums),
218 CV_ENUM_CLASS_ENT(DebugSubsectionKind, FrameData),
219 CV_ENUM_CLASS_ENT(DebugSubsectionKind, InlineeLines),
220 CV_ENUM_CLASS_ENT(DebugSubsectionKind, CrossScopeImports),
221 CV_ENUM_CLASS_ENT(DebugSubsectionKind, CrossScopeExports),
222 CV_ENUM_CLASS_ENT(DebugSubsectionKind, ILLines),
223 CV_ENUM_CLASS_ENT(DebugSubsectionKind, FuncMDTokenMap),
224 CV_ENUM_CLASS_ENT(DebugSubsectionKind, TypeMDTokenMap),
225 CV_ENUM_CLASS_ENT(DebugSubsectionKind, MergedAssemblyInput),
226 CV_ENUM_CLASS_ENT(DebugSubsectionKind, CoffSymbolRVA),
229 static const EnumEntry<uint16_t> ExportSymFlagNames[] = {
230 CV_ENUM_CLASS_ENT(ExportFlags, IsConstant),
231 CV_ENUM_CLASS_ENT(ExportFlags, IsData),
232 CV_ENUM_CLASS_ENT(ExportFlags, IsPrivate),
233 CV_ENUM_CLASS_ENT(ExportFlags, HasNoName),
234 CV_ENUM_CLASS_ENT(ExportFlags, HasExplicitOrdinal),
235 CV_ENUM_CLASS_ENT(ExportFlags, IsForwarder),
238 static const EnumEntry<uint8_t> ThunkOrdinalNames[] = {
239 CV_ENUM_CLASS_ENT(ThunkOrdinal, Standard),
240 CV_ENUM_CLASS_ENT(ThunkOrdinal, ThisAdjustor),
241 CV_ENUM_CLASS_ENT(ThunkOrdinal, Vcall),
242 CV_ENUM_CLASS_ENT(ThunkOrdinal, Pcode),
243 CV_ENUM_CLASS_ENT(ThunkOrdinal, UnknownLoad),
244 CV_ENUM_CLASS_ENT(ThunkOrdinal, TrampIncremental),
245 CV_ENUM_CLASS_ENT(ThunkOrdinal, BranchIsland),
248 static const EnumEntry<uint16_t> TrampolineNames[] = {
249 CV_ENUM_CLASS_ENT(TrampolineType, TrampIncremental),
250 CV_ENUM_CLASS_ENT(TrampolineType, BranchIsland),
253 static const EnumEntry<COFF::SectionCharacteristics>
254 ImageSectionCharacteristicNames[] = {
255 CV_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NOLOAD),
256 CV_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NO_PAD),
257 CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_CODE),
258 CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_INITIALIZED_DATA),
259 CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_UNINITIALIZED_DATA),
260 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_OTHER),
261 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_INFO),
262 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_REMOVE),
263 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_COMDAT),
264 CV_ENUM_ENT(COFF, IMAGE_SCN_GPREL),
265 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_PURGEABLE),
266 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_16BIT),
267 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_LOCKED),
268 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_PRELOAD),
269 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1BYTES),
270 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2BYTES),
271 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4BYTES),
272 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8BYTES),
273 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_16BYTES),
274 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_32BYTES),
275 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_64BYTES),
276 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_128BYTES),
277 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_256BYTES),
278 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_512BYTES),
279 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1024BYTES),
280 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2048BYTES),
281 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4096BYTES),
282 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8192BYTES),
283 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_NRELOC_OVFL),
284 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_DISCARDABLE),
285 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_CACHED),
286 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_PAGED),
287 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_SHARED),
288 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_EXECUTE),
289 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_READ),
290 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_WRITE)};
292 namespace llvm {
293 namespace codeview {
295 ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames() {
296 return makeArrayRef(SymbolTypeNames);
299 ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames() {
300 return makeArrayRef(TypeLeafNames);
303 ArrayRef<EnumEntry<uint16_t>> getRegisterNames() {
304 return makeArrayRef(RegisterNames);
307 ArrayRef<EnumEntry<uint32_t>> getPublicSymFlagNames() {
308 return makeArrayRef(PublicSymFlagNames);
311 ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames() {
312 return makeArrayRef(ProcSymFlagNames);
315 ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames() {
316 return makeArrayRef(LocalFlags);
319 ArrayRef<EnumEntry<uint8_t>> getFrameCookieKindNames() {
320 return makeArrayRef(FrameCookieKinds);
323 ArrayRef<EnumEntry<SourceLanguage>> getSourceLanguageNames() {
324 return makeArrayRef(SourceLanguages);
327 ArrayRef<EnumEntry<uint32_t>> getCompileSym2FlagNames() {
328 return makeArrayRef(CompileSym2FlagNames);
331 ArrayRef<EnumEntry<uint32_t>> getCompileSym3FlagNames() {
332 return makeArrayRef(CompileSym3FlagNames);
335 ArrayRef<EnumEntry<uint32_t>> getFileChecksumNames() {
336 return makeArrayRef(FileChecksumNames);
339 ArrayRef<EnumEntry<unsigned>> getCPUTypeNames() {
340 return makeArrayRef(CPUTypeNames);
343 ArrayRef<EnumEntry<uint32_t>> getFrameProcSymFlagNames() {
344 return makeArrayRef(FrameProcSymFlagNames);
347 ArrayRef<EnumEntry<uint16_t>> getExportSymFlagNames() {
348 return makeArrayRef(ExportSymFlagNames);
351 ArrayRef<EnumEntry<uint32_t>> getModuleSubstreamKindNames() {
352 return makeArrayRef(ModuleSubstreamKindNames);
355 ArrayRef<EnumEntry<uint8_t>> getThunkOrdinalNames() {
356 return makeArrayRef(ThunkOrdinalNames);
359 ArrayRef<EnumEntry<uint16_t>> getTrampolineNames() {
360 return makeArrayRef(TrampolineNames);
363 ArrayRef<EnumEntry<COFF::SectionCharacteristics>>
364 getImageSectionCharacteristicNames() {
365 return makeArrayRef(ImageSectionCharacteristicNames);
368 } // end namespace codeview
369 } // end namespace llvm