summaryrefslogtreecommitdiffstats
path: root/tools/llvm-readobj/ARMAttributeParser.h
blob: c2862513b751dd202d1f4661b730091114ae90d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//===--- ARMAttributeParser.h - ARM Attribute Information Printer ---------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_READOBJ_ARMATTRIBUTE_PARSER_H
#define LLVM_READOBJ_ARMATTRIBUTE_PARSER_H

#include "StreamWriter.h"
#include "llvm/Support/ARMBuildAttributes.h"

namespace llvm {
class StringRef;

class ARMAttributeParser {
  StreamWriter &SW;

  struct DisplayHandler {
    ARMBuildAttrs::AttrType Attribute;
    void (ARMAttributeParser::*Routine)(ARMBuildAttrs::AttrType,
                                        const uint8_t *, uint32_t &);
  };
  static const DisplayHandler DisplayRoutines[];

  uint64_t ParseInteger(const uint8_t *Data, uint32_t &Offset);
  StringRef ParseString(const uint8_t *Data, uint32_t &Offset);

  void IntegerAttribute(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                        uint32_t &Offset);
  void StringAttribute(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                       uint32_t &Offset);

  void PrintAttribute(unsigned Tag, unsigned Value, StringRef ValueDesc);

  void CPU_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                uint32_t &Offset);
  void CPU_arch_profile(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                        uint32_t &Offset);
  void ARM_ISA_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                   uint32_t &Offset);
  void THUMB_ISA_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                     uint32_t &Offset);
  void FP_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
               uint32_t &Offset);
  void WMMX_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                 uint32_t &Offset);
  void Advanced_SIMD_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                          uint32_t &Offset);
  void PCS_config(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                  uint32_t &Offset);
  void ABI_PCS_R9_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                      uint32_t &Offset);
  void ABI_PCS_RW_data(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                       uint32_t &Offset);
  void ABI_PCS_RO_data(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                       uint32_t &Offset);
  void ABI_PCS_GOT_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                       uint32_t &Offset);
  void ABI_PCS_wchar_t(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                       uint32_t &Offset);
  void ABI_FP_rounding(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                       uint32_t &Offset);
  void ABI_FP_denormal(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                       uint32_t &Offset);
  void ABI_FP_exceptions(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                         uint32_t &Offset);
  void ABI_FP_user_exceptions(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                              uint32_t &Offset);
  void ABI_FP_number_model(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                           uint32_t &Offset);
  void ABI_align_needed(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                        uint32_t &Offset);
  void ABI_align_preserved(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                           uint32_t &Offset);
  void ABI_enum_size(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                     uint32_t &Offset);
  void ABI_HardFP_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                      uint32_t &Offset);
  void ABI_VFP_args(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                    uint32_t &Offset);
  void ABI_WMMX_args(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                     uint32_t &Offset);
  void ABI_optimization_goals(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                              uint32_t &Offset);
  void ABI_FP_optimization_goals(ARMBuildAttrs::AttrType Tag,
                                 const uint8_t *Data, uint32_t &Offset);
  void compatibility(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                     uint32_t &Offset);
  void CPU_unaligned_access(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                            uint32_t &Offset);
  void FP_HP_extension(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                       uint32_t &Offset);
  void ABI_FP_16bit_format(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                           uint32_t &Offset);
  void MPextension_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                       uint32_t &Offset);
  void DIV_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
               uint32_t &Offset);
  void T2EE_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                uint32_t &Offset);
  void Virtualization_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                          uint32_t &Offset);
  void nodefaults(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                  uint32_t &Offset);

  void ParseAttributeList(const uint8_t *Data, uint32_t &Offset,
                          uint32_t Length);
  void ParseIndexList(const uint8_t *Data, uint32_t &Offset,
                      SmallVectorImpl<uint8_t> &IndexList);
  void ParseSubsection(const uint8_t *Data, uint32_t Length);
public:
  ARMAttributeParser(StreamWriter &SW) : SW(SW) {}

  void Parse(ArrayRef<uint8_t> Section);
};

}

#endif