1 //===--- ARMAttributeParser.h - ARM Attribute Information Printer ---------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_SUPPORT_ARMATTRIBUTEPARSER_H
10 #define LLVM_SUPPORT_ARMATTRIBUTEPARSER_H
12 #include "ARMBuildAttributes.h"
13 #include "ScopedPrinter.h"
20 class ARMAttributeParser
{
23 std::map
<unsigned, unsigned> Attributes
;
25 struct DisplayHandler
{
26 ARMBuildAttrs::AttrType Attribute
;
27 void (ARMAttributeParser::*Routine
)(ARMBuildAttrs::AttrType
,
28 const uint8_t *, uint32_t &);
30 static const DisplayHandler DisplayRoutines
[];
32 uint64_t ParseInteger(const uint8_t *Data
, uint32_t &Offset
);
33 StringRef
ParseString(const uint8_t *Data
, uint32_t &Offset
);
35 void IntegerAttribute(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
37 void StringAttribute(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
40 void PrintAttribute(unsigned Tag
, unsigned Value
, StringRef ValueDesc
);
42 void CPU_arch(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
44 void CPU_arch_profile(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
46 void ARM_ISA_use(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
48 void THUMB_ISA_use(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
50 void FP_arch(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
52 void WMMX_arch(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
54 void Advanced_SIMD_arch(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
56 void MVE_arch(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
58 void PCS_config(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
60 void ABI_PCS_R9_use(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
62 void ABI_PCS_RW_data(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
64 void ABI_PCS_RO_data(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
66 void ABI_PCS_GOT_use(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
68 void ABI_PCS_wchar_t(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
70 void ABI_FP_rounding(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
72 void ABI_FP_denormal(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
74 void ABI_FP_exceptions(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
76 void ABI_FP_user_exceptions(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
78 void ABI_FP_number_model(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
80 void ABI_align_needed(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
82 void ABI_align_preserved(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
84 void ABI_enum_size(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
86 void ABI_HardFP_use(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
88 void ABI_VFP_args(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
90 void ABI_WMMX_args(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
92 void ABI_optimization_goals(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
94 void ABI_FP_optimization_goals(ARMBuildAttrs::AttrType Tag
,
95 const uint8_t *Data
, uint32_t &Offset
);
96 void compatibility(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
98 void CPU_unaligned_access(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
100 void FP_HP_extension(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
102 void ABI_FP_16bit_format(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
104 void MPextension_use(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
106 void DIV_use(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
108 void DSP_extension(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
110 void T2EE_use(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
112 void Virtualization_use(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
114 void nodefaults(ARMBuildAttrs::AttrType Tag
, const uint8_t *Data
,
117 void ParseAttributeList(const uint8_t *Data
, uint32_t &Offset
,
119 void ParseIndexList(const uint8_t *Data
, uint32_t &Offset
,
120 SmallVectorImpl
<uint8_t> &IndexList
);
121 void ParseSubsection(const uint8_t *Data
, uint32_t Length
);
123 ARMAttributeParser(ScopedPrinter
*SW
) : SW(SW
) {}
125 ARMAttributeParser() : SW(nullptr) { }
127 void Parse(ArrayRef
<uint8_t> Section
, bool isLittle
);
129 bool hasAttribute(unsigned Tag
) const {
130 return Attributes
.count(Tag
);
133 unsigned getAttributeValue(unsigned Tag
) const {
134 return Attributes
.find(Tag
)->second
;