llvm.org GIT mirror llvm / f70f3d4
Support: Delete {aligned_,}{u,}{little,big}8_t The byte has no endianness, so these types don't make sense. uint8_t should be used instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217631 91177308-0d34-0410-b5e6-96231b3b80d8 Rui Ueyama 5 years ago
7 changed file(s) with 60 addition(s) and 81 deletion(s). Raw diff Collapse all Expand all
214214
215215 support::ulittle16_t Type;
216216
217 support::ulittle8_t StorageClass;
218 support::ulittle8_t NumberOfAuxSymbols;
217 uint8_t StorageClass;
218 uint8_t NumberOfAuxSymbols;
219219 };
220220
221221 typedef coff_symbol coff_symbol16;
361361 support::ulittle16_t NumberOfLinenumbers;
362362 support::ulittle32_t CheckSum;
363363 support::ulittle16_t Number;
364 support::ulittle8_t Selection;
364 uint8_t Selection;
365365 };
366366
367367 struct coff_aux_clr_token {
368 support::ulittle8_t AuxType;
369 support::ulittle8_t Reserved;
368 uint8_t AuxType;
369 uint8_t Reserved;
370370 support::ulittle32_t SymbolTableIndex;
371371 };
372372
352352 return makeArrayRef(&Data[Offset], EpilogueCount());
353353 }
354354
355 ArrayRef<support::ulittle8_t> UnwindByteCode() const {
355 ArrayRef<uint8_t> UnwindByteCode() const {
356356 const size_t Offset = HeaderWords(*this)
357357 + (E() ? 0 : EpilogueCount());
358 const support::ulittle8_t *ByteCode =
359 reinterpret_cast(&Data[Offset]);
358 const uint8_t *ByteCode =
359 reinterpret_cast(&Data[Offset]);
360360 return makeArrayRef(ByteCode, CodeWords() * sizeof(uint32_t));
361361 }
362362
379379 }
380380
381381 #endif
382
116116 } // end namespace detail
117117
118118 typedef detail::packed_endian_specific_integral
119 ulittle8_t;
120 typedef detail::packed_endian_specific_integral
121119 ulittle16_t;
122120 typedef detail::packed_endian_specific_integral
123121 ulittle32_t;
124122 typedef detail::packed_endian_specific_integral
125123 ulittle64_t;
126124
127 typedef detail::packed_endian_specific_integral
128 little8_t;
129125 typedef detail::packed_endian_specific_integral
130126 little16_t;
131127 typedef detail::packed_endian_specific_integral
134130 little64_t;
135131
136132 typedef detail::packed_endian_specific_integral
137 aligned_ulittle8_t;
138 typedef detail::packed_endian_specific_integral
139133 aligned_ulittle16_t;
140134 typedef detail::packed_endian_specific_integral
141135 aligned_ulittle32_t;
142136 typedef detail::packed_endian_specific_integral
143137 aligned_ulittle64_t;
144138
145 typedef detail::packed_endian_specific_integral
146 aligned_little8_t;
147139 typedef detail::packed_endian_specific_integral
148140 aligned_little16_t;
149141 typedef detail::packed_endian_specific_integral
152144 aligned_little64_t;
153145
154146 typedef detail::packed_endian_specific_integral
155 ubig8_t;
156 typedef detail::packed_endian_specific_integral
157147 ubig16_t;
158148 typedef detail::packed_endian_specific_integral
159149 ubig32_t;
160150 typedef detail::packed_endian_specific_integral
161151 ubig64_t;
162152
163 typedef detail::packed_endian_specific_integral
164 big8_t;
165153 typedef detail::packed_endian_specific_integral
166154 big16_t;
167155 typedef detail::packed_endian_specific_integral
170158 big64_t;
171159
172160 typedef detail::packed_endian_specific_integral
173 aligned_ubig8_t;
174 typedef detail::packed_endian_specific_integral
175161 aligned_ubig16_t;
176162 typedef detail::packed_endian_specific_integral
177163 aligned_ubig32_t;
178164 typedef detail::packed_endian_specific_integral
179165 aligned_ubig64_t;
180166
181 typedef detail::packed_endian_specific_integral
182 aligned_big8_t;
183167 typedef detail::packed_endian_specific_integral
184168 aligned_big16_t;
185169 typedef detail::packed_endian_specific_integral
3939 /// or part thereof.
4040 union UnwindCode {
4141 struct {
42 support::ulittle8_t CodeOffset;
43 support::ulittle8_t UnwindOpAndOpInfo;
42 uint8_t CodeOffset;
43 uint8_t UnwindOpAndOpInfo;
4444 } u;
4545 support::ulittle16_t FrameOffset;
4646
7373
7474 /// UnwindInfo - An entry in the exception table.
7575 struct UnwindInfo {
76 support::ulittle8_t VersionAndFlags;
77 support::ulittle8_t PrologSize;
78 support::ulittle8_t NumCodes;
79 support::ulittle8_t FrameRegisterAndOffset;
76 uint8_t VersionAndFlags;
77 uint8_t PrologSize;
78 uint8_t NumCodes;
79 uint8_t FrameRegisterAndOffset;
8080 UnwindCode UnwindCodes[1];
8181
8282 uint8_t getVersion() const {
2424 using namespace llvm;
2525 using namespace object;
2626
27 using support::ulittle8_t;
2827 using support::ulittle16_t;
2928 using support::ulittle32_t;
3029 using support::little16_t;
232232 return readobj_error::unknown_symbol;
233233 }
234234
235 bool Decoder::opcode_0xxxxxxx(const ulittle8_t *OC, unsigned &Offset,
235 bool Decoder::opcode_0xxxxxxx(const uint8_t *OC, unsigned &Offset,
236236 unsigned Length, bool Prologue) {
237237 uint8_t Imm = OC[Offset] & 0x7f;
238238 SW.startLine() << format("0x%02x ; %s sp, #(%u * 4)\n",
243243 return false;
244244 }
245245
246 bool Decoder::opcode_10Lxxxxx(const ulittle8_t *OC, unsigned &Offset,
246 bool Decoder::opcode_10Lxxxxx(const uint8_t *OC, unsigned &Offset,
247247 unsigned Length, bool Prologue) {
248248 unsigned Link = (OC[Offset] & 0x20) >> 5;
249249 uint16_t RegisterMask = (Link << (Prologue ? 14 : 15))
262262 return false;
263263 }
264264
265 bool Decoder::opcode_1100xxxx(const ulittle8_t *OC, unsigned &Offset,
265 bool Decoder::opcode_1100xxxx(const uint8_t *OC, unsigned &Offset,
266266 unsigned Length, bool Prologue) {
267267 if (Prologue)
268268 SW.startLine() << format("0x%02x ; mov r%u, sp\n",
274274 return false;
275275 }
276276
277 bool Decoder::opcode_11010Lxx(const ulittle8_t *OC, unsigned &Offset,
277 bool Decoder::opcode_11010Lxx(const uint8_t *OC, unsigned &Offset,
278278 unsigned Length, bool Prologue) {
279279 unsigned Link = (OC[Offset] & 0x4) >> 3;
280280 unsigned Count = (OC[Offset] & 0x3);
291291 return false;
292292 }
293293
294 bool Decoder::opcode_11011Lxx(const ulittle8_t *OC, unsigned &Offset,
294 bool Decoder::opcode_11011Lxx(const uint8_t *OC, unsigned &Offset,
295295 unsigned Length, bool Prologue) {
296296 unsigned Link = (OC[Offset] & 0x4) >> 2;
297297 unsigned Count = (OC[Offset] & 0x3) + 4;
308308 return false;
309309 }
310310
311 bool Decoder::opcode_11100xxx(const ulittle8_t *OC, unsigned &Offset,
311 bool Decoder::opcode_11100xxx(const uint8_t *OC, unsigned &Offset,
312312 unsigned Length, bool Prologue) {
313313 unsigned High = (OC[Offset] & 0x7);
314314 uint32_t VFPMask = (((1 << (High + 1)) - 1) << 8);
322322 return false;
323323 }
324324
325 bool Decoder::opcode_111010xx(const ulittle8_t *OC, unsigned &Offset,
325 bool Decoder::opcode_111010xx(const uint8_t *OC, unsigned &Offset,
326326 unsigned Length, bool Prologue) {
327327 uint16_t Imm = ((OC[Offset + 0] & 0x03) << 8) | ((OC[Offset + 1] & 0xff) << 0);
328328
335335 return false;
336336 }
337337
338 bool Decoder::opcode_1110110L(const ulittle8_t *OC, unsigned &Offset,
338 bool Decoder::opcode_1110110L(const uint8_t *OC, unsigned &Offset,
339339 unsigned Length, bool Prologue) {
340340 uint8_t GPRMask = ((OC[Offset + 0] & 0x01) << (Prologue ? 14 : 15))
341341 | ((OC[Offset + 1] & 0xff) << 0);
349349 return false;
350350 }
351351
352 bool Decoder::opcode_11101110(const ulittle8_t *OC, unsigned &Offset,
352 bool Decoder::opcode_11101110(const uint8_t *OC, unsigned &Offset,
353353 unsigned Length, bool Prologue) {
354354 assert(!Prologue && "may not be used in prologue");
355355
365365 return false;
366366 }
367367
368 bool Decoder::opcode_11101111(const ulittle8_t *OC, unsigned &Offset,
368 bool Decoder::opcode_11101111(const uint8_t *OC, unsigned &Offset,
369369 unsigned Length, bool Prologue) {
370370 assert(!Prologue && "may not be used in prologue");
371371
381381 return false;
382382 }
383383
384 bool Decoder::opcode_11110101(const ulittle8_t *OC, unsigned &Offset,
384 bool Decoder::opcode_11110101(const uint8_t *OC, unsigned &Offset,
385385 unsigned Length, bool Prologue) {
386386 unsigned Start = (OC[Offset + 1] & 0xf0) >> 4;
387387 unsigned End = (OC[Offset + 1] & 0x0f) >> 0;
396396 return false;
397397 }
398398
399 bool Decoder::opcode_11110110(const ulittle8_t *OC, unsigned &Offset,
399 bool Decoder::opcode_11110110(const uint8_t *OC, unsigned &Offset,
400400 unsigned Length, bool Prologue) {
401401 unsigned Start = (OC[Offset + 1] & 0xf0) >> 4;
402402 unsigned End = (OC[Offset + 1] & 0x0f) >> 0;
411411 return false;
412412 }
413413
414 bool Decoder::opcode_11110111(const ulittle8_t *OC, unsigned &Offset,
414 bool Decoder::opcode_11110111(const uint8_t *OC, unsigned &Offset,
415415 unsigned Length, bool Prologue) {
416416 uint32_t Imm = (OC[Offset + 1] << 8) | (OC[Offset + 2] << 0);
417417
424424 return false;
425425 }
426426
427 bool Decoder::opcode_11111000(const ulittle8_t *OC, unsigned &Offset,
427 bool Decoder::opcode_11111000(const uint8_t *OC, unsigned &Offset,
428428 unsigned Length, bool Prologue) {
429429 uint32_t Imm = (OC[Offset + 1] << 16)
430430 | (OC[Offset + 2] << 8)
439439 return false;
440440 }
441441
442 bool Decoder::opcode_11111001(const ulittle8_t *OC, unsigned &Offset,
442 bool Decoder::opcode_11111001(const uint8_t *OC, unsigned &Offset,
443443 unsigned Length, bool Prologue) {
444444 uint32_t Imm = (OC[Offset + 1] << 8) | (OC[Offset + 2] << 0);
445445
452452 return false;
453453 }
454454
455 bool Decoder::opcode_11111010(const ulittle8_t *OC, unsigned &Offset,
455 bool Decoder::opcode_11111010(const uint8_t *OC, unsigned &Offset,
456456 unsigned Length, bool Prologue) {
457457 uint32_t Imm = (OC[Offset + 1] << 16)
458458 | (OC[Offset + 2] << 8)
467467 return false;
468468 }
469469
470 bool Decoder::opcode_11111011(const ulittle8_t *OC, unsigned &Offset,
470 bool Decoder::opcode_11111011(const uint8_t *OC, unsigned &Offset,
471471 unsigned Length, bool Prologue) {
472472 SW.startLine() << format("0x%02x ; nop\n", OC[Offset]);
473473 ++Offset;
474474 return false;
475475 }
476476
477 bool Decoder::opcode_11111100(const ulittle8_t *OC, unsigned &Offset,
477 bool Decoder::opcode_11111100(const uint8_t *OC, unsigned &Offset,
478478 unsigned Length, bool Prologue) {
479479 SW.startLine() << format("0x%02x ; nop.w\n", OC[Offset]);
480480 ++Offset;
481481 return false;
482482 }
483483
484 bool Decoder::opcode_11111101(const ulittle8_t *OC, unsigned &Offset,
484 bool Decoder::opcode_11111101(const uint8_t *OC, unsigned &Offset,
485485 unsigned Length, bool Prologue) {
486486 SW.startLine() << format("0x%02x ; b\n", OC[Offset]);
487487 ++Offset;
488488 return true;
489489 }
490490
491 bool Decoder::opcode_11111110(const ulittle8_t *OC, unsigned &Offset,
491 bool Decoder::opcode_11111110(const uint8_t *OC, unsigned &Offset,
492492 unsigned Length, bool Prologue) {
493493 SW.startLine() << format("0x%02x ; b.w\n", OC[Offset]);
494494 ++Offset;
495495 return true;
496496 }
497497
498 bool Decoder::opcode_11111111(const ulittle8_t *OC, unsigned &Offset,
498 bool Decoder::opcode_11111111(const uint8_t *OC, unsigned &Offset,
499499 unsigned Length, bool Prologue) {
500500 ++Offset;
501501 return true;
502502 }
503503
504 void Decoder::decodeOpcodes(ArrayReflittle8_t> Opcodes, unsigned Offset,
504 void Decoder::decodeOpcodes(ArrayRefint8_t> Opcodes, unsigned Offset,
505505 bool Prologue) {
506506 assert((!Prologue || Offset == 0) && "prologue should always use offset 0");
507507
545545 static_cast(XData.CodeWords() * sizeof(uint32_t)));
546546
547547 if (XData.E()) {
548 ArrayReflittle8_t> UC = XData.UnwindByteCode();
548 ArrayRefint8_t> UC = XData.UnwindByteCode();
549549 if (!XData.F()) {
550550 ListScope PS(SW, "Prologue");
551551 decodeOpcodes(UC, 0, /*Prologue=*/true);
740740 }
741741 }
742742 }
743
2727 struct RingEntry {
2828 uint8_t Mask;
2929 uint8_t Value;
30 bool (Decoder::*Routine)(const support::ulittle8_t *, unsigned &, unsigned,
31 bool);
30 bool (Decoder::*Routine)(const uint8_t *, unsigned &, unsigned, bool);
3231 };
3332 static const RingEntry Ring[];
3433
35 bool opcode_0xxxxxxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
34 bool opcode_0xxxxxxx(const uint8_t *Opcodes, unsigned &Offset,
3635 unsigned Length, bool Prologue);
37 bool opcode_10Lxxxxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
36 bool opcode_10Lxxxxx(const uint8_t *Opcodes, unsigned &Offset,
3837 unsigned Length, bool Prologue);
39 bool opcode_1100xxxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
38 bool opcode_1100xxxx(const uint8_t *Opcodes, unsigned &Offset,
4039 unsigned Length, bool Prologue);
41 bool opcode_11010Lxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
40 bool opcode_11010Lxx(const uint8_t *Opcodes, unsigned &Offset,
4241 unsigned Length, bool Prologue);
43 bool opcode_11011Lxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
42 bool opcode_11011Lxx(const uint8_t *Opcodes, unsigned &Offset,
4443 unsigned Length, bool Prologue);
45 bool opcode_11100xxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
44 bool opcode_11100xxx(const uint8_t *Opcodes, unsigned &Offset,
4645 unsigned Length, bool Prologue);
47 bool opcode_111010xx(const support::ulittle8_t *Opcodes, unsigned &Offset,
46 bool opcode_111010xx(const uint8_t *Opcodes, unsigned &Offset,
4847 unsigned Length, bool Prologue);
49 bool opcode_1110110L(const support::ulittle8_t *Opcodes, unsigned &Offset,
48 bool opcode_1110110L(const uint8_t *Opcodes, unsigned &Offset,
5049 unsigned Length, bool Prologue);
51 bool opcode_11101110(const support::ulittle8_t *Opcodes, unsigned &Offset,
50 bool opcode_11101110(const uint8_t *Opcodes, unsigned &Offset,
5251 unsigned Length, bool Prologue);
53 bool opcode_11101111(const support::ulittle8_t *Opcodes, unsigned &Offset,
52 bool opcode_11101111(const uint8_t *Opcodes, unsigned &Offset,
5453 unsigned Length, bool Prologue);
55 bool opcode_11110101(const support::ulittle8_t *Opcodes, unsigned &Offset,
54 bool opcode_11110101(const uint8_t *Opcodes, unsigned &Offset,
5655 unsigned Length, bool Prologue);
57 bool opcode_11110110(const support::ulittle8_t *Opcodes, unsigned &Offset,
56 bool opcode_11110110(const uint8_t *Opcodes, unsigned &Offset,
5857 unsigned Length, bool Prologue);
59 bool opcode_11110111(const support::ulittle8_t *Opcodes, unsigned &Offset,
58 bool opcode_11110111(const uint8_t *Opcodes, unsigned &Offset,
6059 unsigned Length, bool Prologue);
61 bool opcode_11111000(const support::ulittle8_t *Opcodes, unsigned &Offset,
60 bool opcode_11111000(const uint8_t *Opcodes, unsigned &Offset,
6261 unsigned Length, bool Prologue);
63 bool opcode_11111001(const support::ulittle8_t *Opcodes, unsigned &Offset,
62 bool opcode_11111001(const uint8_t *Opcodes, unsigned &Offset,
6463 unsigned Length, bool Prologue);
65 bool opcode_11111010(const support::ulittle8_t *Opcodes, unsigned &Offset,
64 bool opcode_11111010(const uint8_t *Opcodes, unsigned &Offset,
6665 unsigned Length, bool Prologue);
67 bool opcode_11111011(const support::ulittle8_t *Opcodes, unsigned &Offset,
66 bool opcode_11111011(const uint8_t *Opcodes, unsigned &Offset,
6867 unsigned Length, bool Prologue);
69 bool opcode_11111100(const support::ulittle8_t *Opcodes, unsigned &Offset,
68 bool opcode_11111100(const uint8_t *Opcodes, unsigned &Offset,
7069 unsigned Length, bool Prologue);
71 bool opcode_11111101(const support::ulittle8_t *Opcodes, unsigned &Offset,
70 bool opcode_11111101(const uint8_t *Opcodes, unsigned &Offset,
7271 unsigned Length, bool Prologue);
73 bool opcode_11111110(const support::ulittle8_t *Opcodes, unsigned &Offset,
72 bool opcode_11111110(const uint8_t *Opcodes, unsigned &Offset,
7473 unsigned Length, bool Prologue);
75 bool opcode_11111111(const support::ulittle8_t *Opcodes, unsigned &Offset,
74 bool opcode_11111111(const uint8_t *Opcodes, unsigned &Offset,
7675 unsigned Length, bool Prologue);
7776
78 void decodeOpcodes(ArrayRef<support::ulittle8_t> Opcodes, unsigned Offset,
77 void decodeOpcodes(ArrayRef<uint8_t> Opcodes, unsigned Offset,
7978 bool Prologue);
8079
8180 void printRegisters(const std::pair &RegisterMask);
115114 }
116115
117116 #endif
118