LLVM  10.0.0svn
XCOFFYAML.cpp
Go to the documentation of this file.
1 //===-- XCOFFYAML.cpp - XCOFF YAMLIO implementation -------------*- 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 defines classes for handling the YAML representation of XCOFF.
10 //
11 //===----------------------------------------------------------------------===//
12 
15 #include <string.h>
16 
17 namespace llvm {
18 namespace XCOFFYAML {
19 
20 Object::Object() { memset(&Header, 0, sizeof(Header)); }
21 
22 } // namespace XCOFFYAML
23 
24 namespace yaml {
25 
26 void ScalarEnumerationTraits<XCOFF::StorageClass>::enumeration(
27  IO &IO, XCOFF::StorageClass &Value) {
28 #define ECase(X) IO.enumCase(Value, #X, XCOFF::X)
29  ECase(C_NULL);
30  ECase(C_AUTO);
31  ECase(C_EXT);
32  ECase(C_STAT);
33  ECase(C_REG);
34  ECase(C_EXTDEF);
35  ECase(C_LABEL);
36  ECase(C_ULABEL);
37  ECase(C_MOS);
38  ECase(C_ARG);
39  ECase(C_STRTAG);
40  ECase(C_MOU);
41  ECase(C_UNTAG);
42  ECase(C_TPDEF);
44  ECase(C_ENTAG);
45  ECase(C_MOE);
47  ECase(C_FIELD);
48  ECase(C_BLOCK);
49  ECase(C_FCN);
50  ECase(C_EOS);
51  ECase(C_FILE);
52  ECase(C_LINE);
53  ECase(C_ALIAS);
54  ECase(C_HIDDEN);
55  ECase(C_HIDEXT);
56  ECase(C_BINCL);
57  ECase(C_EINCL);
58  ECase(C_INFO);
60  ECase(C_DWARF);
61  ECase(C_GSYM);
62  ECase(C_LSYM);
63  ECase(C_PSYM);
64  ECase(C_RSYM);
65  ECase(C_RPSYM);
66  ECase(C_STSYM);
67  ECase(C_TCSYM);
68  ECase(C_BCOMM);
69  ECase(C_ECOML);
70  ECase(C_ECOMM);
71  ECase(C_DECL);
72  ECase(C_ENTRY);
73  ECase(C_FUN);
74  ECase(C_BSTAT);
75  ECase(C_ESTAT);
76  ECase(C_GTLS);
77  ECase(C_STTLS);
78  ECase(C_EFCN);
79 #undef ECase
80 }
81 
83  IO &IO, XCOFFYAML::FileHeader &FileHdr) {
84  IO.mapRequired("MagicNumber", FileHdr.Magic);
85  IO.mapRequired("NumberOfSections", FileHdr.NumberOfSections);
86  IO.mapRequired("CreationTime", FileHdr.TimeStamp);
87  IO.mapRequired("OffsetToSymbolTable", FileHdr.SymbolTableOffset);
88  IO.mapRequired("EntriesInSymbolTable", FileHdr.NumberOfSymTableEntries);
89  IO.mapRequired("AuxiliaryHeaderSize", FileHdr.AuxHeaderSize);
90  IO.mapRequired("Flags", FileHdr.Flags);
91 }
92 
94  IO.mapRequired("Name", S.SymbolName);
95  IO.mapRequired("Value", S.Value);
96  IO.mapRequired("Section", S.SectionName);
97  IO.mapRequired("Type", S.Type);
98  IO.mapRequired("StorageClass", S.StorageClass);
99  IO.mapRequired("NumberOfAuxEntries", S.NumberOfAuxEntries);
100 }
101 
103  IO.mapTag("!XCOFF", true);
104  IO.mapRequired("FileHeader", Obj.Header);
105  IO.mapRequired("Symbols", Obj.Symbols);
106 }
107 
108 } // namespace yaml
109 } // namespace llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:23
StorageClass
Definition: XCOFF.h:76
std::vector< Symbol > Symbols
Definition: XCOFFYAML.h:43
llvm::yaml::Hex16 Type
Definition: XCOFFYAML.h:36
uint8_t NumberOfAuxEntries
Definition: XCOFFYAML.h:38
#define ECase(X)
XCOFF::StorageClass StorageClass
Definition: XCOFFYAML.h:37
LLVM Value Representation.
Definition: Value.h:73
llvm::yaml::Hex32 SymbolTableOffset
Definition: XCOFFYAML.h:26
llvm::yaml::Hex16 Flags
Definition: XCOFFYAML.h:29
llvm::yaml::Hex16 Magic
Definition: XCOFFYAML.h:23
llvm::yaml::Hex32 Value
Definition: XCOFFYAML.h:34