9f5dbb701badad1c14ebb83b8487821852a661ed
[oota-llvm.git] / include / llvm / CodeGen / MIRYamlMapping.h
1 //===- MIRYAMLMapping.h - Describes the mapping between MIR and YAML ------===//
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 //===----------------------------------------------------------------------===//
9 //
10 // The MIR serialization library is currently a work in progress. It can't
11 // serialize machine functions at this time.
12 //
13 // This file implements the mapping between various MIR data structures and
14 // their corresponding YAML representation.
15 //
16 //===----------------------------------------------------------------------===//
17
18 #ifndef LLVM_LIB_CODEGEN_MIRYAMLMAPPING_H
19 #define LLVM_LIB_CODEGEN_MIRYAMLMAPPING_H
20
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/Support/YAMLTraits.h"
23
24 namespace llvm {
25 namespace yaml {
26
27 struct MachineFunction {
28   StringRef Name;
29   unsigned Alignment;
30   bool ExposesReturnsTwice;
31   bool HasInlineAsm;
32
33   MachineFunction() {
34     Alignment = 0;
35     ExposesReturnsTwice = false;
36     HasInlineAsm = false;
37   }
38 };
39
40 template <> struct MappingTraits<MachineFunction> {
41   static void mapping(IO &YamlIO, MachineFunction &MF) {
42     YamlIO.mapRequired("name", MF.Name);
43     YamlIO.mapOptional("alignment", MF.Alignment);
44     YamlIO.mapOptional("exposesReturnsTwice", MF.ExposesReturnsTwice);
45     YamlIO.mapOptional("hasInlineAsm", MF.HasInlineAsm);
46   }
47 };
48
49 } // end namespace yaml
50 } // end namespace llvm
51
52 #endif