llvm.org GIT mirror llvm / 93a4a6e
[ARM] Moved ARMAttributeParser to Support Moved ARMAttributeParser out of llvm-readobj and into the support library. Differential Revision: https://reviews.llvm.org/D28227 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291896 91177308-0d34-0410-b5e6-96231b3b80d8 Sam Parker 3 years ago
7 changed file(s) with 810 addition(s) and 810 deletion(s). Raw diff Collapse all Expand all
0 //===--- ARMAttributeParser.h - ARM Attribute Information Printer ---------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_SUPPORT_ARMATTRIBUTEPARSER_H
10 #define LLVM_SUPPORT_ARMATTRIBUTEPARSER_H
11
12 #include "ARMBuildAttributes.h"
13 #include "ScopedPrinter.h"
14
15 namespace llvm {
16 class StringRef;
17
18 class ARMAttributeParser {
19 ScopedPrinter &SW;
20
21 struct DisplayHandler {
22 ARMBuildAttrs::AttrType Attribute;
23 void (ARMAttributeParser::*Routine)(ARMBuildAttrs::AttrType,
24 const uint8_t *, uint32_t &);
25 };
26 static const DisplayHandler DisplayRoutines[];
27
28 uint64_t ParseInteger(const uint8_t *Data, uint32_t &Offset);
29 StringRef ParseString(const uint8_t *Data, uint32_t &Offset);
30
31 void IntegerAttribute(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
32 uint32_t &Offset);
33 void StringAttribute(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
34 uint32_t &Offset);
35
36 void PrintAttribute(unsigned Tag, unsigned Value, StringRef ValueDesc);
37
38 void CPU_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
39 uint32_t &Offset);
40 void CPU_arch_profile(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
41 uint32_t &Offset);
42 void ARM_ISA_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
43 uint32_t &Offset);
44 void THUMB_ISA_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
45 uint32_t &Offset);
46 void FP_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
47 uint32_t &Offset);
48 void WMMX_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
49 uint32_t &Offset);
50 void Advanced_SIMD_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
51 uint32_t &Offset);
52 void PCS_config(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
53 uint32_t &Offset);
54 void ABI_PCS_R9_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
55 uint32_t &Offset);
56 void ABI_PCS_RW_data(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
57 uint32_t &Offset);
58 void ABI_PCS_RO_data(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
59 uint32_t &Offset);
60 void ABI_PCS_GOT_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
61 uint32_t &Offset);
62 void ABI_PCS_wchar_t(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
63 uint32_t &Offset);
64 void ABI_FP_rounding(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
65 uint32_t &Offset);
66 void ABI_FP_denormal(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
67 uint32_t &Offset);
68 void ABI_FP_exceptions(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
69 uint32_t &Offset);
70 void ABI_FP_user_exceptions(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
71 uint32_t &Offset);
72 void ABI_FP_number_model(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
73 uint32_t &Offset);
74 void ABI_align_needed(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
75 uint32_t &Offset);
76 void ABI_align_preserved(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
77 uint32_t &Offset);
78 void ABI_enum_size(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
79 uint32_t &Offset);
80 void ABI_HardFP_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
81 uint32_t &Offset);
82 void ABI_VFP_args(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
83 uint32_t &Offset);
84 void ABI_WMMX_args(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
85 uint32_t &Offset);
86 void ABI_optimization_goals(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
87 uint32_t &Offset);
88 void ABI_FP_optimization_goals(ARMBuildAttrs::AttrType Tag,
89 const uint8_t *Data, uint32_t &Offset);
90 void compatibility(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
91 uint32_t &Offset);
92 void CPU_unaligned_access(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
93 uint32_t &Offset);
94 void FP_HP_extension(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
95 uint32_t &Offset);
96 void ABI_FP_16bit_format(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
97 uint32_t &Offset);
98 void MPextension_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
99 uint32_t &Offset);
100 void DIV_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
101 uint32_t &Offset);
102 void DSP_extension(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
103 uint32_t &Offset);
104 void T2EE_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
105 uint32_t &Offset);
106 void Virtualization_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
107 uint32_t &Offset);
108 void nodefaults(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
109 uint32_t &Offset);
110
111 void ParseAttributeList(const uint8_t *Data, uint32_t &Offset,
112 uint32_t Length);
113 void ParseIndexList(const uint8_t *Data, uint32_t &Offset,
114 SmallVectorImpl &IndexList);
115 void ParseSubsection(const uint8_t *Data, uint32_t Length);
116 public:
117 ARMAttributeParser(ScopedPrinter &SW) : SW(SW) {}
118
119 void Parse(ArrayRef Section);
120 };
121
122 }
123
124 #endif
125
0 //===--- ARMAttributeParser.cpp - ARM Attribute Information Printer -------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/ADT/STLExtras.h"
10 #include "llvm/ADT/StringExtras.h"
11 #include "llvm/Support/ARMAttributeParser.h"
12 #include "llvm/Support/LEB128.h"
13 #include "llvm/Support/ScopedPrinter.h"
14
15 using namespace llvm;
16 using namespace llvm::ARMBuildAttrs;
17
18
19 static const EnumEntry TagNames[] = {
20 { "Tag_File", ARMBuildAttrs::File },
21 { "Tag_Section", ARMBuildAttrs::Section },
22 { "Tag_Symbol", ARMBuildAttrs::Symbol },
23 };
24
25 namespace llvm {
26 #define ATTRIBUTE_HANDLER(Attr_) \
27 { ARMBuildAttrs::Attr_, &ARMAttributeParser::Attr_ }
28
29 const ARMAttributeParser::DisplayHandler
30 ARMAttributeParser::DisplayRoutines[] = {
31 { ARMBuildAttrs::CPU_raw_name, &ARMAttributeParser::StringAttribute, },
32 { ARMBuildAttrs::CPU_name, &ARMAttributeParser::StringAttribute },
33 ATTRIBUTE_HANDLER(CPU_arch),
34 ATTRIBUTE_HANDLER(CPU_arch_profile),
35 ATTRIBUTE_HANDLER(ARM_ISA_use),
36 ATTRIBUTE_HANDLER(THUMB_ISA_use),
37 ATTRIBUTE_HANDLER(FP_arch),
38 ATTRIBUTE_HANDLER(WMMX_arch),
39 ATTRIBUTE_HANDLER(Advanced_SIMD_arch),
40 ATTRIBUTE_HANDLER(PCS_config),
41 ATTRIBUTE_HANDLER(ABI_PCS_R9_use),
42 ATTRIBUTE_HANDLER(ABI_PCS_RW_data),
43 ATTRIBUTE_HANDLER(ABI_PCS_RO_data),
44 ATTRIBUTE_HANDLER(ABI_PCS_GOT_use),
45 ATTRIBUTE_HANDLER(ABI_PCS_wchar_t),
46 ATTRIBUTE_HANDLER(ABI_FP_rounding),
47 ATTRIBUTE_HANDLER(ABI_FP_denormal),
48 ATTRIBUTE_HANDLER(ABI_FP_exceptions),
49 ATTRIBUTE_HANDLER(ABI_FP_user_exceptions),
50 ATTRIBUTE_HANDLER(ABI_FP_number_model),
51 ATTRIBUTE_HANDLER(ABI_align_needed),
52 ATTRIBUTE_HANDLER(ABI_align_preserved),
53 ATTRIBUTE_HANDLER(ABI_enum_size),
54 ATTRIBUTE_HANDLER(ABI_HardFP_use),
55 ATTRIBUTE_HANDLER(ABI_VFP_args),
56 ATTRIBUTE_HANDLER(ABI_WMMX_args),
57 ATTRIBUTE_HANDLER(ABI_optimization_goals),
58 ATTRIBUTE_HANDLER(ABI_FP_optimization_goals),
59 ATTRIBUTE_HANDLER(compatibility),
60 ATTRIBUTE_HANDLER(CPU_unaligned_access),
61 ATTRIBUTE_HANDLER(FP_HP_extension),
62 ATTRIBUTE_HANDLER(ABI_FP_16bit_format),
63 ATTRIBUTE_HANDLER(MPextension_use),
64 ATTRIBUTE_HANDLER(DIV_use),
65 ATTRIBUTE_HANDLER(DSP_extension),
66 ATTRIBUTE_HANDLER(T2EE_use),
67 ATTRIBUTE_HANDLER(Virtualization_use),
68 ATTRIBUTE_HANDLER(nodefaults)
69 };
70
71 #undef ATTRIBUTE_HANDLER
72
73 uint64_t ARMAttributeParser::ParseInteger(const uint8_t *Data,
74 uint32_t &Offset) {
75 unsigned Length;
76 uint64_t Value = decodeULEB128(Data + Offset, &Length);
77 Offset = Offset + Length;
78 return Value;
79 }
80
81 StringRef ARMAttributeParser::ParseString(const uint8_t *Data,
82 uint32_t &Offset) {
83 const char *String = reinterpret_cast(Data + Offset);
84 size_t Length = std::strlen(String);
85 Offset = Offset + Length + 1;
86 return StringRef(String, Length);
87 }
88
89 void ARMAttributeParser::IntegerAttribute(AttrType Tag, const uint8_t *Data,
90 uint32_t &Offset) {
91 SW.printNumber(ARMBuildAttrs::AttrTypeAsString(Tag),
92 ParseInteger(Data, Offset));
93 }
94
95 void ARMAttributeParser::StringAttribute(AttrType Tag, const uint8_t *Data,
96 uint32_t &Offset) {
97 StringRef TagName = ARMBuildAttrs::AttrTypeAsString(Tag, /*TagPrefix*/false);
98
99 DictScope AS(SW, "Attribute");
100 SW.printNumber("Tag", Tag);
101 if (!TagName.empty())
102 SW.printString("TagName", TagName);
103 SW.printString("Value", ParseString(Data, Offset));
104 }
105
106 void ARMAttributeParser::PrintAttribute(unsigned Tag, unsigned Value,
107 StringRef ValueDesc) {
108 StringRef TagName = ARMBuildAttrs::AttrTypeAsString(Tag, /*TagPrefix*/false);
109
110 DictScope AS(SW, "Attribute");
111 SW.printNumber("Tag", Tag);
112 SW.printNumber("Value", Value);
113 if (!TagName.empty())
114 SW.printString("TagName", TagName);
115 if (!ValueDesc.empty())
116 SW.printString("Description", ValueDesc);
117 }
118
119 void ARMAttributeParser::CPU_arch(AttrType Tag, const uint8_t *Data,
120 uint32_t &Offset) {
121 static const char *const Strings[] = {
122 "Pre-v4", "ARM v4", "ARM v4T", "ARM v5T", "ARM v5TE", "ARM v5TEJ", "ARM v6",
123 "ARM v6KZ", "ARM v6T2", "ARM v6K", "ARM v7", "ARM v6-M", "ARM v6S-M",
124 "ARM v7E-M", "ARM v8"
125 };
126
127 uint64_t Value = ParseInteger(Data, Offset);
128 StringRef ValueDesc =
129 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
130 PrintAttribute(Tag, Value, ValueDesc);
131 }
132
133 void ARMAttributeParser::CPU_arch_profile(AttrType Tag, const uint8_t *Data,
134 uint32_t &Offset) {
135 uint64_t Encoded = ParseInteger(Data, Offset);
136
137 StringRef Profile;
138 switch (Encoded) {
139 default: Profile = "Unknown"; break;
140 case 'A': Profile = "Application"; break;
141 case 'R': Profile = "Real-time"; break;
142 case 'M': Profile = "Microcontroller"; break;
143 case 'S': Profile = "Classic"; break;
144 case 0: Profile = "None"; break;
145 }
146
147 PrintAttribute(Tag, Encoded, Profile);
148 }
149
150 void ARMAttributeParser::ARM_ISA_use(AttrType Tag, const uint8_t *Data,
151 uint32_t &Offset) {
152 static const char *const Strings[] = { "Not Permitted", "Permitted" };
153
154 uint64_t Value = ParseInteger(Data, Offset);
155 StringRef ValueDesc =
156 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
157 PrintAttribute(Tag, Value, ValueDesc);
158 }
159
160 void ARMAttributeParser::THUMB_ISA_use(AttrType Tag, const uint8_t *Data,
161 uint32_t &Offset) {
162 static const char *const Strings[] = { "Not Permitted", "Thumb-1", "Thumb-2" };
163
164 uint64_t Value = ParseInteger(Data, Offset);
165 StringRef ValueDesc =
166 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
167 PrintAttribute(Tag, Value, ValueDesc);
168 }
169
170 void ARMAttributeParser::FP_arch(AttrType Tag, const uint8_t *Data,
171 uint32_t &Offset) {
172 static const char *const Strings[] = {
173 "Not Permitted", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16", "VFPv4",
174 "VFPv4-D16", "ARMv8-a FP", "ARMv8-a FP-D16"
175 };
176
177 uint64_t Value = ParseInteger(Data, Offset);
178 StringRef ValueDesc =
179 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
180 PrintAttribute(Tag, Value, ValueDesc);
181 }
182
183 void ARMAttributeParser::WMMX_arch(AttrType Tag, const uint8_t *Data,
184 uint32_t &Offset) {
185 static const char *const Strings[] = { "Not Permitted", "WMMXv1", "WMMXv2" };
186
187 uint64_t Value = ParseInteger(Data, Offset);
188 StringRef ValueDesc =
189 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
190 PrintAttribute(Tag, Value, ValueDesc);
191 }
192
193 void ARMAttributeParser::Advanced_SIMD_arch(AttrType Tag, const uint8_t *Data,
194 uint32_t &Offset) {
195 static const char *const Strings[] = {
196 "Not Permitted", "NEONv1", "NEONv2+FMA", "ARMv8-a NEON", "ARMv8.1-a NEON"
197 };
198
199 uint64_t Value = ParseInteger(Data, Offset);
200 StringRef ValueDesc =
201 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
202 PrintAttribute(Tag, Value, ValueDesc);
203 }
204
205 void ARMAttributeParser::PCS_config(AttrType Tag, const uint8_t *Data,
206 uint32_t &Offset) {
207 static const char *const Strings[] = {
208 "None", "Bare Platform", "Linux Application", "Linux DSO", "Palm OS 2004",
209 "Reserved (Palm OS)", "Symbian OS 2004", "Reserved (Symbian OS)"
210 };
211
212 uint64_t Value = ParseInteger(Data, Offset);
213 StringRef ValueDesc =
214 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
215 PrintAttribute(Tag, Value, ValueDesc);
216 }
217
218 void ARMAttributeParser::ABI_PCS_R9_use(AttrType Tag, const uint8_t *Data,
219 uint32_t &Offset) {
220 static const char *const Strings[] = { "v6", "Static Base", "TLS", "Unused" };
221
222 uint64_t Value = ParseInteger(Data, Offset);
223 StringRef ValueDesc =
224 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
225 PrintAttribute(Tag, Value, ValueDesc);
226 }
227
228 void ARMAttributeParser::ABI_PCS_RW_data(AttrType Tag, const uint8_t *Data,
229 uint32_t &Offset) {
230 static const char *const Strings[] = {
231 "Absolute", "PC-relative", "SB-relative", "Not Permitted"
232 };
233
234 uint64_t Value = ParseInteger(Data, Offset);
235 StringRef ValueDesc =
236 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
237 PrintAttribute(Tag, Value, ValueDesc);
238 }
239
240 void ARMAttributeParser::ABI_PCS_RO_data(AttrType Tag, const uint8_t *Data,
241 uint32_t &Offset) {
242 static const char *const Strings[] = {
243 "Absolute", "PC-relative", "Not Permitted"
244 };
245
246 uint64_t Value = ParseInteger(Data, Offset);
247 StringRef ValueDesc =
248 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
249 PrintAttribute(Tag, Value, ValueDesc);
250 }
251
252 void ARMAttributeParser::ABI_PCS_GOT_use(AttrType Tag, const uint8_t *Data,
253 uint32_t &Offset) {
254 static const char *const Strings[] = {
255 "Not Permitted", "Direct", "GOT-Indirect"
256 };
257
258 uint64_t Value = ParseInteger(Data, Offset);
259 StringRef ValueDesc =
260 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
261 PrintAttribute(Tag, Value, ValueDesc);
262 }
263
264 void ARMAttributeParser::ABI_PCS_wchar_t(AttrType Tag, const uint8_t *Data,
265 uint32_t &Offset) {
266 static const char *const Strings[] = {
267 "Not Permitted", "Unknown", "2-byte", "Unknown", "4-byte"
268 };
269
270 uint64_t Value = ParseInteger(Data, Offset);
271 StringRef ValueDesc =
272 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
273 PrintAttribute(Tag, Value, ValueDesc);
274 }
275
276 void ARMAttributeParser::ABI_FP_rounding(AttrType Tag, const uint8_t *Data,
277 uint32_t &Offset) {
278 static const char *const Strings[] = { "IEEE-754", "Runtime" };
279
280 uint64_t Value = ParseInteger(Data, Offset);
281 StringRef ValueDesc =
282 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
283 PrintAttribute(Tag, Value, ValueDesc);
284 }
285
286 void ARMAttributeParser::ABI_FP_denormal(AttrType Tag, const uint8_t *Data,
287 uint32_t &Offset) {
288 static const char *const Strings[] = {
289 "Unsupported", "IEEE-754", "Sign Only"
290 };
291
292 uint64_t Value = ParseInteger(Data, Offset);
293 StringRef ValueDesc =
294 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
295 PrintAttribute(Tag, Value, ValueDesc);
296 }
297
298 void ARMAttributeParser::ABI_FP_exceptions(AttrType Tag, const uint8_t *Data,
299 uint32_t &Offset) {
300 static const char *const Strings[] = { "Not Permitted", "IEEE-754" };
301
302 uint64_t Value = ParseInteger(Data, Offset);
303 StringRef ValueDesc =
304 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
305 PrintAttribute(Tag, Value, ValueDesc);
306 }
307
308 void ARMAttributeParser::ABI_FP_user_exceptions(AttrType Tag,
309 const uint8_t *Data,
310 uint32_t &Offset) {
311 static const char *const Strings[] = { "Not Permitted", "IEEE-754" };
312
313 uint64_t Value = ParseInteger(Data, Offset);
314 StringRef ValueDesc =
315 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
316 PrintAttribute(Tag, Value, ValueDesc);
317 }
318
319 void ARMAttributeParser::ABI_FP_number_model(AttrType Tag, const uint8_t *Data,
320 uint32_t &Offset) {
321 static const char *const Strings[] = {
322 "Not Permitted", "Finite Only", "RTABI", "IEEE-754"
323 };
324
325 uint64_t Value = ParseInteger(Data, Offset);
326 StringRef ValueDesc =
327 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
328 PrintAttribute(Tag, Value, ValueDesc);
329 }
330
331 void ARMAttributeParser::ABI_align_needed(AttrType Tag, const uint8_t *Data,
332 uint32_t &Offset) {
333 static const char *const Strings[] = {
334 "Not Permitted", "8-byte alignment", "4-byte alignment", "Reserved"
335 };
336
337 uint64_t Value = ParseInteger(Data, Offset);
338
339 std::string Description;
340 if (Value < array_lengthof(Strings))
341 Description = std::string(Strings[Value]);
342 else if (Value <= 12)
343 Description = std::string("8-byte alignment, ") + utostr(1ULL << Value)
344 + std::string("-byte extended alignment");
345 else
346 Description = "Invalid";
347
348 PrintAttribute(Tag, Value, Description);
349 }
350
351 void ARMAttributeParser::ABI_align_preserved(AttrType Tag, const uint8_t *Data,
352 uint32_t &Offset) {
353 static const char *const Strings[] = {
354 "Not Required", "8-byte data alignment", "8-byte data and code alignment",
355 "Reserved"
356 };
357
358 uint64_t Value = ParseInteger(Data, Offset);
359
360 std::string Description;
361 if (Value < array_lengthof(Strings))
362 Description = std::string(Strings[Value]);
363 else if (Value <= 12)
364 Description = std::string("8-byte stack alignment, ") +
365 utostr(1ULL << Value) + std::string("-byte data alignment");
366 else
367 Description = "Invalid";
368
369 PrintAttribute(Tag, Value, Description);
370 }
371
372 void ARMAttributeParser::ABI_enum_size(AttrType Tag, const uint8_t *Data,
373 uint32_t &Offset) {
374 static const char *const Strings[] = {
375 "Not Permitted", "Packed", "Int32", "External Int32"
376 };
377
378 uint64_t Value = ParseInteger(Data, Offset);
379 StringRef ValueDesc =
380 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
381 PrintAttribute(Tag, Value, ValueDesc);
382 }
383
384 void ARMAttributeParser::ABI_HardFP_use(AttrType Tag, const uint8_t *Data,
385 uint32_t &Offset) {
386 static const char *const Strings[] = {
387 "Tag_FP_arch", "Single-Precision", "Reserved", "Tag_FP_arch (deprecated)"
388 };
389
390 uint64_t Value = ParseInteger(Data, Offset);
391 StringRef ValueDesc =
392 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
393 PrintAttribute(Tag, Value, ValueDesc);
394 }
395
396 void ARMAttributeParser::ABI_VFP_args(AttrType Tag, const uint8_t *Data,
397 uint32_t &Offset) {
398 static const char *const Strings[] = {
399 "AAPCS", "AAPCS VFP", "Custom", "Not Permitted"
400 };
401
402 uint64_t Value = ParseInteger(Data, Offset);
403 StringRef ValueDesc =
404 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
405 PrintAttribute(Tag, Value, ValueDesc);
406 }
407
408 void ARMAttributeParser::ABI_WMMX_args(AttrType Tag, const uint8_t *Data,
409 uint32_t &Offset) {
410 static const char *const Strings[] = { "AAPCS", "iWMMX", "Custom" };
411
412 uint64_t Value = ParseInteger(Data, Offset);
413 StringRef ValueDesc =
414 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
415 PrintAttribute(Tag, Value, ValueDesc);
416 }
417
418 void ARMAttributeParser::ABI_optimization_goals(AttrType Tag,
419 const uint8_t *Data,
420 uint32_t &Offset) {
421 static const char *const Strings[] = {
422 "None", "Speed", "Aggressive Speed", "Size", "Aggressive Size", "Debugging",
423 "Best Debugging"
424 };
425
426 uint64_t Value = ParseInteger(Data, Offset);
427 StringRef ValueDesc =
428 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
429 PrintAttribute(Tag, Value, ValueDesc);
430 }
431
432 void ARMAttributeParser::ABI_FP_optimization_goals(AttrType Tag,
433 const uint8_t *Data,
434 uint32_t &Offset) {
435 static const char *const Strings[] = {
436 "None", "Speed", "Aggressive Speed", "Size", "Aggressive Size", "Accuracy",
437 "Best Accuracy"
438 };
439
440 uint64_t Value = ParseInteger(Data, Offset);
441 StringRef ValueDesc =
442 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
443 PrintAttribute(Tag, Value, ValueDesc);
444 }
445
446 void ARMAttributeParser::compatibility(AttrType Tag, const uint8_t *Data,
447 uint32_t &Offset) {
448 uint64_t Integer = ParseInteger(Data, Offset);
449 StringRef String = ParseString(Data, Offset);
450
451 DictScope AS(SW, "Attribute");
452 SW.printNumber("Tag", Tag);
453 SW.startLine() << "Value: " << Integer << ", " << String << '\n';
454 SW.printString("TagName", AttrTypeAsString(Tag, /*TagPrefix*/false));
455 switch (Integer) {
456 case 0:
457 SW.printString("Description", StringRef("No Specific Requirements"));
458 break;
459 case 1:
460 SW.printString("Description", StringRef("AEABI Conformant"));
461 break;
462 default:
463 SW.printString("Description", StringRef("AEABI Non-Conformant"));
464 break;
465 }
466 }
467
468 void ARMAttributeParser::CPU_unaligned_access(AttrType Tag, const uint8_t *Data,
469 uint32_t &Offset) {
470 static const char *const Strings[] = { "Not Permitted", "v6-style" };
471
472 uint64_t Value = ParseInteger(Data, Offset);
473 StringRef ValueDesc =
474 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
475 PrintAttribute(Tag, Value, ValueDesc);
476 }
477
478 void ARMAttributeParser::FP_HP_extension(AttrType Tag, const uint8_t *Data,
479 uint32_t &Offset) {
480 static const char *const Strings[] = { "If Available", "Permitted" };
481
482 uint64_t Value = ParseInteger(Data, Offset);
483 StringRef ValueDesc =
484 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
485 PrintAttribute(Tag, Value, ValueDesc);
486 }
487
488 void ARMAttributeParser::ABI_FP_16bit_format(AttrType Tag, const uint8_t *Data,
489 uint32_t &Offset) {
490 static const char *const Strings[] = { "Not Permitted", "IEEE-754", "VFPv3" };
491
492 uint64_t Value = ParseInteger(Data, Offset);
493 StringRef ValueDesc =
494 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
495 PrintAttribute(Tag, Value, ValueDesc);
496 }
497
498 void ARMAttributeParser::MPextension_use(AttrType Tag, const uint8_t *Data,
499 uint32_t &Offset) {
500 static const char *const Strings[] = { "Not Permitted", "Permitted" };
501
502 uint64_t Value = ParseInteger(Data, Offset);
503 StringRef ValueDesc =
504 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
505 PrintAttribute(Tag, Value, ValueDesc);
506 }
507
508 void ARMAttributeParser::DIV_use(AttrType Tag, const uint8_t *Data,
509 uint32_t &Offset) {
510 static const char *const Strings[] = {
511 "If Available", "Not Permitted", "Permitted"
512 };
513
514 uint64_t Value = ParseInteger(Data, Offset);
515 StringRef ValueDesc =
516 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
517 PrintAttribute(Tag, Value, ValueDesc);
518 }
519
520 void ARMAttributeParser::DSP_extension(AttrType Tag, const uint8_t *Data,
521 uint32_t &Offset) {
522 static const char *const Strings[] = { "Not Permitted", "Permitted" };
523
524 uint64_t Value = ParseInteger(Data, Offset);
525 StringRef ValueDesc =
526 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
527 PrintAttribute(Tag, Value, ValueDesc);
528 }
529
530 void ARMAttributeParser::T2EE_use(AttrType Tag, const uint8_t *Data,
531 uint32_t &Offset) {
532 static const char *const Strings[] = { "Not Permitted", "Permitted" };
533
534 uint64_t Value = ParseInteger(Data, Offset);
535 StringRef ValueDesc =
536 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
537 PrintAttribute(Tag, Value, ValueDesc);
538 }
539
540 void ARMAttributeParser::Virtualization_use(AttrType Tag, const uint8_t *Data,
541 uint32_t &Offset) {
542 static const char *const Strings[] = {
543 "Not Permitted", "TrustZone", "Virtualization Extensions",
544 "TrustZone + Virtualization Extensions"
545 };
546
547 uint64_t Value = ParseInteger(Data, Offset);
548 StringRef ValueDesc =
549 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
550 PrintAttribute(Tag, Value, ValueDesc);
551 }
552
553 void ARMAttributeParser::nodefaults(AttrType Tag, const uint8_t *Data,
554 uint32_t &Offset) {
555 uint64_t Value = ParseInteger(Data, Offset);
556 PrintAttribute(Tag, Value, "Unspecified Tags UNDEFINED");
557 }
558
559 void ARMAttributeParser::ParseIndexList(const uint8_t *Data, uint32_t &Offset,
560 SmallVectorImpl &IndexList) {
561 for (;;) {
562 unsigned Length;
563 uint64_t Value = decodeULEB128(Data + Offset, &Length);
564 Offset = Offset + Length;
565 if (Value == 0)
566 break;
567 IndexList.push_back(Value);
568 }
569 }
570
571 void ARMAttributeParser::ParseAttributeList(const uint8_t *Data,
572 uint32_t &Offset, uint32_t Length) {
573 while (Offset < Length) {
574 unsigned Length;
575 uint64_t Tag = decodeULEB128(Data + Offset, &Length);
576 Offset += Length;
577
578 bool Handled = false;
579 for (unsigned AHI = 0, AHE = array_lengthof(DisplayRoutines);
580 AHI != AHE && !Handled; ++AHI) {
581 if (DisplayRoutines[AHI].Attribute == Tag) {
582 (this->*DisplayRoutines[AHI].Routine)(ARMBuildAttrs::AttrType(Tag),
583 Data, Offset);
584 Handled = true;
585 break;
586 }
587 }
588 if (!Handled) {
589 if (Tag < 32) {
590 errs() << "unhandled AEABI Tag " << Tag
591 << " (" << ARMBuildAttrs::AttrTypeAsString(Tag) << ")\n";
592 continue;
593 }
594
595 if (Tag % 2 == 0)
596 IntegerAttribute(ARMBuildAttrs::AttrType(Tag), Data, Offset);
597 else
598 StringAttribute(ARMBuildAttrs::AttrType(Tag), Data, Offset);
599 }
600 }
601 }
602
603 void ARMAttributeParser::ParseSubsection(const uint8_t *Data, uint32_t Length) {
604 uint32_t Offset = sizeof(uint32_t); /* SectionLength */
605
606 SW.printNumber("SectionLength", Length);
607
608 const char *VendorName = reinterpret_cast(Data + Offset);
609 size_t VendorNameLength = std::strlen(VendorName);
610 SW.printString("Vendor", StringRef(VendorName, VendorNameLength));
611 Offset = Offset + VendorNameLength + 1;
612
613 if (StringRef(VendorName, VendorNameLength).lower() != "aeabi")
614 return;
615
616 while (Offset < Length) {
617 /// Tag_File | Tag_Section | Tag_Symbol uleb128:byte-size
618 uint8_t Tag = Data[Offset];
619 SW.printEnum("Tag", Tag, makeArrayRef(TagNames));
620 Offset = Offset + sizeof(Tag);
621
622 uint32_t Size =
623 *reinterpret_cast(Data + Offset);
624 SW.printNumber("Size", Size);
625 Offset = Offset + sizeof(Size);
626
627 if (Size > Length) {
628 errs() << "subsection length greater than section length\n";
629 return;
630 }
631
632 StringRef ScopeName, IndexName;
633 SmallVector Indicies;
634 switch (Tag) {
635 case ARMBuildAttrs::File:
636 ScopeName = "FileAttributes";
637 break;
638 case ARMBuildAttrs::Section:
639 ScopeName = "SectionAttributes";
640 IndexName = "Sections";
641 ParseIndexList(Data, Offset, Indicies);
642 break;
643 case ARMBuildAttrs::Symbol:
644 ScopeName = "SymbolAttributes";
645 IndexName = "Symbols";
646 ParseIndexList(Data, Offset, Indicies);
647 break;
648 default:
649 errs() << "unrecognised tag: 0x" << utohexstr(Tag) << '\n';
650 return;
651 }
652
653 DictScope ASS(SW, ScopeName);
654
655 if (!Indicies.empty())
656 SW.printList(IndexName, Indicies);
657
658 ParseAttributeList(Data, Offset, Length);
659 }
660 }
661
662 void ARMAttributeParser::Parse(ArrayRef Section) {
663 size_t Offset = 1;
664 unsigned SectionNumber = 0;
665
666 while (Offset < Section.size()) {
667 uint32_t SectionLength =
668 *reinterpret_cast(Section.data() + Offset);
669
670 SW.startLine() << "Section " << ++SectionNumber << " {\n";
671 SW.indent();
672
673 ParseSubsection(Section.data() + Offset, SectionLength);
674 Offset = Offset + SectionLength;
675
676 SW.unindent();
677 SW.startLine() << "}\n";
678 }
679 }
680 }
681
3030 APInt.cpp
3131 APSInt.cpp
3232 ARMBuildAttrs.cpp
33 ARMAttributeParser.cpp
3334 ARMWinEH.cpp
3435 Allocator.cpp
3536 BlockFrequency.cpp
+0
-682
tools/llvm-readobj/ARMAttributeParser.cpp less more
None //===--- ARMAttributeParser.cpp - ARM Attribute Information Printer -------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "ARMAttributeParser.h"
10 #include "llvm/ADT/STLExtras.h"
11 #include "llvm/ADT/StringExtras.h"
12 #include "llvm/Support/LEB128.h"
13 #include "llvm/Support/ScopedPrinter.h"
14
15 using namespace llvm;
16 using namespace llvm::ARMBuildAttrs;
17
18
19 static const EnumEntry TagNames[] = {
20 { "Tag_File", ARMBuildAttrs::File },
21 { "Tag_Section", ARMBuildAttrs::Section },
22 { "Tag_Symbol", ARMBuildAttrs::Symbol },
23 };
24
25 namespace llvm {
26 #define ATTRIBUTE_HANDLER(Attr_) \
27 { ARMBuildAttrs::Attr_, &ARMAttributeParser::Attr_ }
28
29 const ARMAttributeParser::DisplayHandler
30 ARMAttributeParser::DisplayRoutines[] = {
31 { ARMBuildAttrs::CPU_raw_name, &ARMAttributeParser::StringAttribute, },
32 { ARMBuildAttrs::CPU_name, &ARMAttributeParser::StringAttribute },
33 ATTRIBUTE_HANDLER(CPU_arch),
34 ATTRIBUTE_HANDLER(CPU_arch_profile),
35 ATTRIBUTE_HANDLER(ARM_ISA_use),
36 ATTRIBUTE_HANDLER(THUMB_ISA_use),
37 ATTRIBUTE_HANDLER(FP_arch),
38 ATTRIBUTE_HANDLER(WMMX_arch),
39 ATTRIBUTE_HANDLER(Advanced_SIMD_arch),
40 ATTRIBUTE_HANDLER(PCS_config),
41 ATTRIBUTE_HANDLER(ABI_PCS_R9_use),
42 ATTRIBUTE_HANDLER(ABI_PCS_RW_data),
43 ATTRIBUTE_HANDLER(ABI_PCS_RO_data),
44 ATTRIBUTE_HANDLER(ABI_PCS_GOT_use),
45 ATTRIBUTE_HANDLER(ABI_PCS_wchar_t),
46 ATTRIBUTE_HANDLER(ABI_FP_rounding),
47 ATTRIBUTE_HANDLER(ABI_FP_denormal),
48 ATTRIBUTE_HANDLER(ABI_FP_exceptions),
49 ATTRIBUTE_HANDLER(ABI_FP_user_exceptions),
50 ATTRIBUTE_HANDLER(ABI_FP_number_model),
51 ATTRIBUTE_HANDLER(ABI_align_needed),
52 ATTRIBUTE_HANDLER(ABI_align_preserved),
53 ATTRIBUTE_HANDLER(ABI_enum_size),
54 ATTRIBUTE_HANDLER(ABI_HardFP_use),
55 ATTRIBUTE_HANDLER(ABI_VFP_args),
56 ATTRIBUTE_HANDLER(ABI_WMMX_args),
57 ATTRIBUTE_HANDLER(ABI_optimization_goals),
58 ATTRIBUTE_HANDLER(ABI_FP_optimization_goals),
59 ATTRIBUTE_HANDLER(compatibility),
60 ATTRIBUTE_HANDLER(CPU_unaligned_access),
61 ATTRIBUTE_HANDLER(FP_HP_extension),
62 ATTRIBUTE_HANDLER(ABI_FP_16bit_format),
63 ATTRIBUTE_HANDLER(MPextension_use),
64 ATTRIBUTE_HANDLER(DIV_use),
65 ATTRIBUTE_HANDLER(DSP_extension),
66 ATTRIBUTE_HANDLER(T2EE_use),
67 ATTRIBUTE_HANDLER(Virtualization_use),
68 ATTRIBUTE_HANDLER(nodefaults)
69 };
70
71 #undef ATTRIBUTE_HANDLER
72
73 uint64_t ARMAttributeParser::ParseInteger(const uint8_t *Data,
74 uint32_t &Offset) {
75 unsigned Length;
76 uint64_t Value = decodeULEB128(Data + Offset, &Length);
77 Offset = Offset + Length;
78 return Value;
79 }
80
81 StringRef ARMAttributeParser::ParseString(const uint8_t *Data,
82 uint32_t &Offset) {
83 const char *String = reinterpret_cast(Data + Offset);
84 size_t Length = std::strlen(String);
85 Offset = Offset + Length + 1;
86 return StringRef(String, Length);
87 }
88
89 void ARMAttributeParser::IntegerAttribute(AttrType Tag, const uint8_t *Data,
90 uint32_t &Offset) {
91 SW.printNumber(ARMBuildAttrs::AttrTypeAsString(Tag),
92 ParseInteger(Data, Offset));
93 }
94
95 void ARMAttributeParser::StringAttribute(AttrType Tag, const uint8_t *Data,
96 uint32_t &Offset) {
97 StringRef TagName = ARMBuildAttrs::AttrTypeAsString(Tag, /*TagPrefix*/false);
98
99 DictScope AS(SW, "Attribute");
100 SW.printNumber("Tag", Tag);
101 if (!TagName.empty())
102 SW.printString("TagName", TagName);
103 SW.printString("Value", ParseString(Data, Offset));
104 }
105
106 void ARMAttributeParser::PrintAttribute(unsigned Tag, unsigned Value,
107 StringRef ValueDesc) {
108 StringRef TagName = ARMBuildAttrs::AttrTypeAsString(Tag, /*TagPrefix*/false);
109
110 DictScope AS(SW, "Attribute");
111 SW.printNumber("Tag", Tag);
112 SW.printNumber("Value", Value);
113 if (!TagName.empty())
114 SW.printString("TagName", TagName);
115 if (!ValueDesc.empty())
116 SW.printString("Description", ValueDesc);
117 }
118
119 void ARMAttributeParser::CPU_arch(AttrType Tag, const uint8_t *Data,
120 uint32_t &Offset) {
121 static const char *const Strings[] = {
122 "Pre-v4", "ARM v4", "ARM v4T", "ARM v5T", "ARM v5TE", "ARM v5TEJ", "ARM v6",
123 "ARM v6KZ", "ARM v6T2", "ARM v6K", "ARM v7", "ARM v6-M", "ARM v6S-M",
124 "ARM v7E-M", "ARM v8"
125 };
126
127 uint64_t Value = ParseInteger(Data, Offset);
128 StringRef ValueDesc =
129 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
130 PrintAttribute(Tag, Value, ValueDesc);
131 }
132
133 void ARMAttributeParser::CPU_arch_profile(AttrType Tag, const uint8_t *Data,
134 uint32_t &Offset) {
135 uint64_t Encoded = ParseInteger(Data, Offset);
136
137 StringRef Profile;
138 switch (Encoded) {
139 default: Profile = "Unknown"; break;
140 case 'A': Profile = "Application"; break;
141 case 'R': Profile = "Real-time"; break;
142 case 'M': Profile = "Microcontroller"; break;
143 case 'S': Profile = "Classic"; break;
144 case 0: Profile = "None"; break;
145 }
146
147 PrintAttribute(Tag, Encoded, Profile);
148 }
149
150 void ARMAttributeParser::ARM_ISA_use(AttrType Tag, const uint8_t *Data,
151 uint32_t &Offset) {
152 static const char *const Strings[] = { "Not Permitted", "Permitted" };
153
154 uint64_t Value = ParseInteger(Data, Offset);
155 StringRef ValueDesc =
156 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
157 PrintAttribute(Tag, Value, ValueDesc);
158 }
159
160 void ARMAttributeParser::THUMB_ISA_use(AttrType Tag, const uint8_t *Data,
161 uint32_t &Offset) {
162 static const char *const Strings[] = { "Not Permitted", "Thumb-1", "Thumb-2" };
163
164 uint64_t Value = ParseInteger(Data, Offset);
165 StringRef ValueDesc =
166 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
167 PrintAttribute(Tag, Value, ValueDesc);
168 }
169
170 void ARMAttributeParser::FP_arch(AttrType Tag, const uint8_t *Data,
171 uint32_t &Offset) {
172 static const char *const Strings[] = {
173 "Not Permitted", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16", "VFPv4",
174 "VFPv4-D16", "ARMv8-a FP", "ARMv8-a FP-D16"
175 };
176
177 uint64_t Value = ParseInteger(Data, Offset);
178 StringRef ValueDesc =
179 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
180 PrintAttribute(Tag, Value, ValueDesc);
181 }
182
183 void ARMAttributeParser::WMMX_arch(AttrType Tag, const uint8_t *Data,
184 uint32_t &Offset) {
185 static const char *const Strings[] = { "Not Permitted", "WMMXv1", "WMMXv2" };
186
187 uint64_t Value = ParseInteger(Data, Offset);
188 StringRef ValueDesc =
189 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
190 PrintAttribute(Tag, Value, ValueDesc);
191 }
192
193 void ARMAttributeParser::Advanced_SIMD_arch(AttrType Tag, const uint8_t *Data,
194 uint32_t &Offset) {
195 static const char *const Strings[] = {
196 "Not Permitted", "NEONv1", "NEONv2+FMA", "ARMv8-a NEON", "ARMv8.1-a NEON"
197 };
198
199 uint64_t Value = ParseInteger(Data, Offset);
200 StringRef ValueDesc =
201 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
202 PrintAttribute(Tag, Value, ValueDesc);
203 }
204
205 void ARMAttributeParser::PCS_config(AttrType Tag, const uint8_t *Data,
206 uint32_t &Offset) {
207 static const char *const Strings[] = {
208 "None", "Bare Platform", "Linux Application", "Linux DSO", "Palm OS 2004",
209 "Reserved (Palm OS)", "Symbian OS 2004", "Reserved (Symbian OS)"
210 };
211
212 uint64_t Value = ParseInteger(Data, Offset);
213 StringRef ValueDesc =
214 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
215 PrintAttribute(Tag, Value, ValueDesc);
216 }
217
218 void ARMAttributeParser::ABI_PCS_R9_use(AttrType Tag, const uint8_t *Data,
219 uint32_t &Offset) {
220 static const char *const Strings[] = { "v6", "Static Base", "TLS", "Unused" };
221
222 uint64_t Value = ParseInteger(Data, Offset);
223 StringRef ValueDesc =
224 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
225 PrintAttribute(Tag, Value, ValueDesc);
226 }
227
228 void ARMAttributeParser::ABI_PCS_RW_data(AttrType Tag, const uint8_t *Data,
229 uint32_t &Offset) {
230 static const char *const Strings[] = {
231 "Absolute", "PC-relative", "SB-relative", "Not Permitted"
232 };
233
234 uint64_t Value = ParseInteger(Data, Offset);
235 StringRef ValueDesc =
236 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
237 PrintAttribute(Tag, Value, ValueDesc);
238 }
239
240 void ARMAttributeParser::ABI_PCS_RO_data(AttrType Tag, const uint8_t *Data,
241 uint32_t &Offset) {
242 static const char *const Strings[] = {
243 "Absolute", "PC-relative", "Not Permitted"
244 };
245
246 uint64_t Value = ParseInteger(Data, Offset);
247 StringRef ValueDesc =
248 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
249 PrintAttribute(Tag, Value, ValueDesc);
250 }
251
252 void ARMAttributeParser::ABI_PCS_GOT_use(AttrType Tag, const uint8_t *Data,
253 uint32_t &Offset) {
254 static const char *const Strings[] = {
255 "Not Permitted", "Direct", "GOT-Indirect"
256 };
257
258 uint64_t Value = ParseInteger(Data, Offset);
259 StringRef ValueDesc =
260 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
261 PrintAttribute(Tag, Value, ValueDesc);
262 }
263
264 void ARMAttributeParser::ABI_PCS_wchar_t(AttrType Tag, const uint8_t *Data,
265 uint32_t &Offset) {
266 static const char *const Strings[] = {
267 "Not Permitted", "Unknown", "2-byte", "Unknown", "4-byte"
268 };
269
270 uint64_t Value = ParseInteger(Data, Offset);
271 StringRef ValueDesc =
272 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
273 PrintAttribute(Tag, Value, ValueDesc);
274 }
275
276 void ARMAttributeParser::ABI_FP_rounding(AttrType Tag, const uint8_t *Data,
277 uint32_t &Offset) {
278 static const char *const Strings[] = { "IEEE-754", "Runtime" };
279
280 uint64_t Value = ParseInteger(Data, Offset);
281 StringRef ValueDesc =
282 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
283 PrintAttribute(Tag, Value, ValueDesc);
284 }
285
286 void ARMAttributeParser::ABI_FP_denormal(AttrType Tag, const uint8_t *Data,
287 uint32_t &Offset) {
288 static const char *const Strings[] = {
289 "Unsupported", "IEEE-754", "Sign Only"
290 };
291
292 uint64_t Value = ParseInteger(Data, Offset);
293 StringRef ValueDesc =
294 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
295 PrintAttribute(Tag, Value, ValueDesc);
296 }
297
298 void ARMAttributeParser::ABI_FP_exceptions(AttrType Tag, const uint8_t *Data,
299 uint32_t &Offset) {
300 static const char *const Strings[] = { "Not Permitted", "IEEE-754" };
301
302 uint64_t Value = ParseInteger(Data, Offset);
303 StringRef ValueDesc =
304 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
305 PrintAttribute(Tag, Value, ValueDesc);
306 }
307
308 void ARMAttributeParser::ABI_FP_user_exceptions(AttrType Tag,
309 const uint8_t *Data,
310 uint32_t &Offset) {
311 static const char *const Strings[] = { "Not Permitted", "IEEE-754" };
312
313 uint64_t Value = ParseInteger(Data, Offset);
314 StringRef ValueDesc =
315 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
316 PrintAttribute(Tag, Value, ValueDesc);
317 }
318
319 void ARMAttributeParser::ABI_FP_number_model(AttrType Tag, const uint8_t *Data,
320 uint32_t &Offset) {
321 static const char *const Strings[] = {
322 "Not Permitted", "Finite Only", "RTABI", "IEEE-754"
323 };
324
325 uint64_t Value = ParseInteger(Data, Offset);
326 StringRef ValueDesc =
327 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
328 PrintAttribute(Tag, Value, ValueDesc);
329 }
330
331 void ARMAttributeParser::ABI_align_needed(AttrType Tag, const uint8_t *Data,
332 uint32_t &Offset) {
333 static const char *const Strings[] = {
334 "Not Permitted", "8-byte alignment", "4-byte alignment", "Reserved"
335 };
336
337 uint64_t Value = ParseInteger(Data, Offset);
338
339 std::string Description;
340 if (Value < array_lengthof(Strings))
341 Description = std::string(Strings[Value]);
342 else if (Value <= 12)
343 Description = std::string("8-byte alignment, ") + utostr(1ULL << Value)
344 + std::string("-byte extended alignment");
345 else
346 Description = "Invalid";
347
348 PrintAttribute(Tag, Value, Description);
349 }
350
351 void ARMAttributeParser::ABI_align_preserved(AttrType Tag, const uint8_t *Data,
352 uint32_t &Offset) {
353 static const char *const Strings[] = {
354 "Not Required", "8-byte data alignment", "8-byte data and code alignment",
355 "Reserved"
356 };
357
358 uint64_t Value = ParseInteger(Data, Offset);
359
360 std::string Description;
361 if (Value < array_lengthof(Strings))
362 Description = std::string(Strings[Value]);
363 else if (Value <= 12)
364 Description = std::string("8-byte stack alignment, ") +
365 utostr(1ULL << Value) + std::string("-byte data alignment");
366 else
367 Description = "Invalid";
368
369 PrintAttribute(Tag, Value, Description);
370 }
371
372 void ARMAttributeParser::ABI_enum_size(AttrType Tag, const uint8_t *Data,
373 uint32_t &Offset) {
374 static const char *const Strings[] = {
375 "Not Permitted", "Packed", "Int32", "External Int32"
376 };
377
378 uint64_t Value = ParseInteger(Data, Offset);
379 StringRef ValueDesc =
380 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
381 PrintAttribute(Tag, Value, ValueDesc);
382 }
383
384 void ARMAttributeParser::ABI_HardFP_use(AttrType Tag, const uint8_t *Data,
385 uint32_t &Offset) {
386 static const char *const Strings[] = {
387 "Tag_FP_arch", "Single-Precision", "Reserved", "Tag_FP_arch (deprecated)"
388 };
389
390 uint64_t Value = ParseInteger(Data, Offset);
391 StringRef ValueDesc =
392 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
393 PrintAttribute(Tag, Value, ValueDesc);
394 }
395
396 void ARMAttributeParser::ABI_VFP_args(AttrType Tag, const uint8_t *Data,
397 uint32_t &Offset) {
398 static const char *const Strings[] = {
399 "AAPCS", "AAPCS VFP", "Custom", "Not Permitted"
400 };
401
402 uint64_t Value = ParseInteger(Data, Offset);
403 StringRef ValueDesc =
404 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
405 PrintAttribute(Tag, Value, ValueDesc);
406 }
407
408 void ARMAttributeParser::ABI_WMMX_args(AttrType Tag, const uint8_t *Data,
409 uint32_t &Offset) {
410 static const char *const Strings[] = { "AAPCS", "iWMMX", "Custom" };
411
412 uint64_t Value = ParseInteger(Data, Offset);
413 StringRef ValueDesc =
414 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
415 PrintAttribute(Tag, Value, ValueDesc);
416 }
417
418 void ARMAttributeParser::ABI_optimization_goals(AttrType Tag,
419 const uint8_t *Data,
420 uint32_t &Offset) {
421 static const char *const Strings[] = {
422 "None", "Speed", "Aggressive Speed", "Size", "Aggressive Size", "Debugging",
423 "Best Debugging"
424 };
425
426 uint64_t Value = ParseInteger(Data, Offset);
427 StringRef ValueDesc =
428 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
429 PrintAttribute(Tag, Value, ValueDesc);
430 }
431
432 void ARMAttributeParser::ABI_FP_optimization_goals(AttrType Tag,
433 const uint8_t *Data,
434 uint32_t &Offset) {
435 static const char *const Strings[] = {
436 "None", "Speed", "Aggressive Speed", "Size", "Aggressive Size", "Accuracy",
437 "Best Accuracy"
438 };
439
440 uint64_t Value = ParseInteger(Data, Offset);
441 StringRef ValueDesc =
442 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
443 PrintAttribute(Tag, Value, ValueDesc);
444 }
445
446 void ARMAttributeParser::compatibility(AttrType Tag, const uint8_t *Data,
447 uint32_t &Offset) {
448 uint64_t Integer = ParseInteger(Data, Offset);
449 StringRef String = ParseString(Data, Offset);
450
451 DictScope AS(SW, "Attribute");
452 SW.printNumber("Tag", Tag);
453 SW.startLine() << "Value: " << Integer << ", " << String << '\n';
454 SW.printString("TagName", AttrTypeAsString(Tag, /*TagPrefix*/false));
455 switch (Integer) {
456 case 0:
457 SW.printString("Description", StringRef("No Specific Requirements"));
458 break;
459 case 1:
460 SW.printString("Description", StringRef("AEABI Conformant"));
461 break;
462 default:
463 SW.printString("Description", StringRef("AEABI Non-Conformant"));
464 break;
465 }
466 }
467
468 void ARMAttributeParser::CPU_unaligned_access(AttrType Tag, const uint8_t *Data,
469 uint32_t &Offset) {
470 static const char *const Strings[] = { "Not Permitted", "v6-style" };
471
472 uint64_t Value = ParseInteger(Data, Offset);
473 StringRef ValueDesc =
474 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
475 PrintAttribute(Tag, Value, ValueDesc);
476 }
477
478 void ARMAttributeParser::FP_HP_extension(AttrType Tag, const uint8_t *Data,
479 uint32_t &Offset) {
480 static const char *const Strings[] = { "If Available", "Permitted" };
481
482 uint64_t Value = ParseInteger(Data, Offset);
483 StringRef ValueDesc =
484 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
485 PrintAttribute(Tag, Value, ValueDesc);
486 }
487
488 void ARMAttributeParser::ABI_FP_16bit_format(AttrType Tag, const uint8_t *Data,
489 uint32_t &Offset) {
490 static const char *const Strings[] = { "Not Permitted", "IEEE-754", "VFPv3" };
491
492 uint64_t Value = ParseInteger(Data, Offset);
493 StringRef ValueDesc =
494 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
495 PrintAttribute(Tag, Value, ValueDesc);
496 }
497
498 void ARMAttributeParser::MPextension_use(AttrType Tag, const uint8_t *Data,
499 uint32_t &Offset) {
500 static const char *const Strings[] = { "Not Permitted", "Permitted" };
501
502 uint64_t Value = ParseInteger(Data, Offset);
503 StringRef ValueDesc =
504 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
505 PrintAttribute(Tag, Value, ValueDesc);
506 }
507
508 void ARMAttributeParser::DIV_use(AttrType Tag, const uint8_t *Data,
509 uint32_t &Offset) {
510 static const char *const Strings[] = {
511 "If Available", "Not Permitted", "Permitted"
512 };
513
514 uint64_t Value = ParseInteger(Data, Offset);
515 StringRef ValueDesc =
516 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
517 PrintAttribute(Tag, Value, ValueDesc);
518 }
519
520 void ARMAttributeParser::DSP_extension(AttrType Tag, const uint8_t *Data,
521 uint32_t &Offset) {
522 static const char *const Strings[] = { "Not Permitted", "Permitted" };
523
524 uint64_t Value = ParseInteger(Data, Offset);
525 StringRef ValueDesc =
526 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
527 PrintAttribute(Tag, Value, ValueDesc);
528 }
529
530 void ARMAttributeParser::T2EE_use(AttrType Tag, const uint8_t *Data,
531 uint32_t &Offset) {
532 static const char *const Strings[] = { "Not Permitted", "Permitted" };
533
534 uint64_t Value = ParseInteger(Data, Offset);
535 StringRef ValueDesc =
536 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
537 PrintAttribute(Tag, Value, ValueDesc);
538 }
539
540 void ARMAttributeParser::Virtualization_use(AttrType Tag, const uint8_t *Data,
541 uint32_t &Offset) {
542 static const char *const Strings[] = {
543 "Not Permitted", "TrustZone", "Virtualization Extensions",
544 "TrustZone + Virtualization Extensions"
545 };
546
547 uint64_t Value = ParseInteger(Data, Offset);
548 StringRef ValueDesc =
549 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
550 PrintAttribute(Tag, Value, ValueDesc);
551 }
552
553 void ARMAttributeParser::nodefaults(AttrType Tag, const uint8_t *Data,
554 uint32_t &Offset) {
555 uint64_t Value = ParseInteger(Data, Offset);
556 PrintAttribute(Tag, Value, "Unspecified Tags UNDEFINED");
557 }
558
559 void ARMAttributeParser::ParseIndexList(const uint8_t *Data, uint32_t &Offset,
560 SmallVectorImpl &IndexList) {
561 for (;;) {
562 unsigned Length;
563 uint64_t Value = decodeULEB128(Data + Offset, &Length);
564 Offset = Offset + Length;
565 if (Value == 0)
566 break;
567 IndexList.push_back(Value);
568 }
569 }
570
571 void ARMAttributeParser::ParseAttributeList(const uint8_t *Data,
572 uint32_t &Offset, uint32_t Length) {
573 while (Offset < Length) {
574 unsigned Length;
575 uint64_t Tag = decodeULEB128(Data + Offset, &Length);
576 Offset += Length;
577
578 bool Handled = false;
579 for (unsigned AHI = 0, AHE = array_lengthof(DisplayRoutines);
580 AHI != AHE && !Handled; ++AHI) {
581 if (DisplayRoutines[AHI].Attribute == Tag) {
582 (this->*DisplayRoutines[AHI].Routine)(ARMBuildAttrs::AttrType(Tag),
583 Data, Offset);
584 Handled = true;
585 break;
586 }
587 }
588 if (!Handled) {
589 if (Tag < 32) {
590 errs() << "unhandled AEABI Tag " << Tag
591 << " (" << ARMBuildAttrs::AttrTypeAsString(Tag) << ")\n";
592 continue;
593 }
594
595 if (Tag % 2 == 0)
596 IntegerAttribute(ARMBuildAttrs::AttrType(Tag), Data, Offset);
597 else
598 StringAttribute(ARMBuildAttrs::AttrType(Tag), Data, Offset);
599 }
600 }
601 }
602
603 void ARMAttributeParser::ParseSubsection(const uint8_t *Data, uint32_t Length) {
604 uint32_t Offset = sizeof(uint32_t); /* SectionLength */
605
606 SW.printNumber("SectionLength", Length);
607
608 const char *VendorName = reinterpret_cast(Data + Offset);
609 size_t VendorNameLength = std::strlen(VendorName);
610 SW.printString("Vendor", StringRef(VendorName, VendorNameLength));
611 Offset = Offset + VendorNameLength + 1;
612
613 if (StringRef(VendorName, VendorNameLength).lower() != "aeabi")
614 return;
615
616 while (Offset < Length) {
617 /// Tag_File | Tag_Section | Tag_Symbol uleb128:byte-size
618 uint8_t Tag = Data[Offset];
619 SW.printEnum("Tag", Tag, makeArrayRef(TagNames));
620 Offset = Offset + sizeof(Tag);
621
622 uint32_t Size =
623 *reinterpret_cast(Data + Offset);
624 SW.printNumber("Size", Size);
625 Offset = Offset + sizeof(Size);
626
627 if (Size > Length) {
628 errs() << "subsection length greater than section length\n";
629 return;
630 }
631
632 StringRef ScopeName, IndexName;
633 SmallVector Indicies;
634 switch (Tag) {
635 case ARMBuildAttrs::File:
636 ScopeName = "FileAttributes";
637 break;
638 case ARMBuildAttrs::Section:
639 ScopeName = "SectionAttributes";
640 IndexName = "Sections";
641 ParseIndexList(Data, Offset, Indicies);
642 break;
643 case ARMBuildAttrs::Symbol:
644 ScopeName = "SymbolAttributes";
645 IndexName = "Symbols";
646 ParseIndexList(Data, Offset, Indicies);
647 break;
648 default:
649 errs() << "unrecognised tag: 0x" << utohexstr(Tag) << '\n';
650 return;
651 }
652
653 DictScope ASS(SW, ScopeName);
654
655 if (!Indicies.empty())
656 SW.printList(IndexName, Indicies);
657
658 ParseAttributeList(Data, Offset, Length);
659 }
660 }
661
662 void ARMAttributeParser::Parse(ArrayRef Section) {
663 size_t Offset = 1;
664 unsigned SectionNumber = 0;
665
666 while (Offset < Section.size()) {
667 uint32_t SectionLength =
668 *reinterpret_cast(Section.data() + Offset);
669
670 SW.startLine() << "Section " << ++SectionNumber << " {\n";
671 SW.indent();
672
673 ParseSubsection(Section.data() + Offset, SectionLength);
674 Offset = Offset + SectionLength;
675
676 SW.unindent();
677 SW.startLine() << "}\n";
678 }
679 }
680 }
681
+0
-126
tools/llvm-readobj/ARMAttributeParser.h less more
None //===--- ARMAttributeParser.h - ARM Attribute Information Printer ---------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_TOOLS_LLVM_READOBJ_ARMATTRIBUTEPARSER_H
10 #define LLVM_TOOLS_LLVM_READOBJ_ARMATTRIBUTEPARSER_H
11
12 #include "llvm/Support/ARMBuildAttributes.h"
13 #include "llvm/Support/ScopedPrinter.h"
14
15 namespace llvm {
16 class StringRef;
17
18 class ARMAttributeParser {
19 ScopedPrinter &SW;
20
21 struct DisplayHandler {
22 ARMBuildAttrs::AttrType Attribute;
23 void (ARMAttributeParser::*Routine)(ARMBuildAttrs::AttrType,
24 const uint8_t *, uint32_t &);
25 };
26 static const DisplayHandler DisplayRoutines[];
27
28 uint64_t ParseInteger(const uint8_t *Data, uint32_t &Offset);
29 StringRef ParseString(const uint8_t *Data, uint32_t &Offset);
30
31 void IntegerAttribute(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
32 uint32_t &Offset);
33 void StringAttribute(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
34 uint32_t &Offset);
35
36 void PrintAttribute(unsigned Tag, unsigned Value, StringRef ValueDesc);
37
38 void CPU_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
39 uint32_t &Offset);
40 void CPU_arch_profile(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
41 uint32_t &Offset);
42 void ARM_ISA_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
43 uint32_t &Offset);
44 void THUMB_ISA_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
45 uint32_t &Offset);
46 void FP_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
47 uint32_t &Offset);
48 void WMMX_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
49 uint32_t &Offset);
50 void Advanced_SIMD_arch(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
51 uint32_t &Offset);
52 void PCS_config(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
53 uint32_t &Offset);
54 void ABI_PCS_R9_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
55 uint32_t &Offset);
56 void ABI_PCS_RW_data(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
57 uint32_t &Offset);
58 void ABI_PCS_RO_data(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
59 uint32_t &Offset);
60 void ABI_PCS_GOT_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
61 uint32_t &Offset);
62 void ABI_PCS_wchar_t(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
63 uint32_t &Offset);
64 void ABI_FP_rounding(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
65 uint32_t &Offset);
66 void ABI_FP_denormal(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
67 uint32_t &Offset);
68 void ABI_FP_exceptions(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
69 uint32_t &Offset);
70 void ABI_FP_user_exceptions(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
71 uint32_t &Offset);
72 void ABI_FP_number_model(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
73 uint32_t &Offset);
74 void ABI_align_needed(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
75 uint32_t &Offset);
76 void ABI_align_preserved(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
77 uint32_t &Offset);
78 void ABI_enum_size(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
79 uint32_t &Offset);
80 void ABI_HardFP_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
81 uint32_t &Offset);
82 void ABI_VFP_args(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
83 uint32_t &Offset);
84 void ABI_WMMX_args(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
85 uint32_t &Offset);
86 void ABI_optimization_goals(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
87 uint32_t &Offset);
88 void ABI_FP_optimization_goals(ARMBuildAttrs::AttrType Tag,
89 const uint8_t *Data, uint32_t &Offset);
90 void compatibility(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
91 uint32_t &Offset);
92 void CPU_unaligned_access(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
93 uint32_t &Offset);
94 void FP_HP_extension(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
95 uint32_t &Offset);
96 void ABI_FP_16bit_format(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
97 uint32_t &Offset);
98 void MPextension_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
99 uint32_t &Offset);
100 void DIV_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
101 uint32_t &Offset);
102 void DSP_extension(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
103 uint32_t &Offset);
104 void T2EE_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
105 uint32_t &Offset);
106 void Virtualization_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
107 uint32_t &Offset);
108 void nodefaults(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
109 uint32_t &Offset);
110
111 void ParseAttributeList(const uint8_t *Data, uint32_t &Offset,
112 uint32_t Length);
113 void ParseIndexList(const uint8_t *Data, uint32_t &Offset,
114 SmallVectorImpl &IndexList);
115 void ParseSubsection(const uint8_t *Data, uint32_t Length);
116 public:
117 ARMAttributeParser(ScopedPrinter &SW) : SW(SW) {}
118
119 void Parse(ArrayRef Section);
120 };
121
122 }
123
124 #endif
125
66 )
77
88 add_llvm_tool(llvm-readobj
9 ARMAttributeParser.cpp
109 ARMWinEHPrinter.cpp
1110 COFFDumper.cpp
1211 COFFImportDumper.cpp
1111 ///
1212 //===----------------------------------------------------------------------===//
1313
14 #include "ARMAttributeParser.h"
1514 #include "ARMEHABIPrinter.h"
1615 #include "Error.h"
1716 #include "ObjDumper.h"
2120 #include "llvm/ADT/SmallString.h"
2221 #include "llvm/ADT/StringExtras.h"
2322 #include "llvm/Object/ELFObjectFile.h"
23 #include "llvm/Support/ARMAttributeParser.h"
2424 #include "llvm/Support/ARMBuildAttributes.h"
2525 #include "llvm/Support/Compiler.h"
2626 #include "llvm/Support/Format.h"