LLVM 22.0.0git
HexagonDisassembler.cpp
Go to the documentation of this file.
1//===- HexagonDisassembler.cpp - Disassembler for Hexagon ISA -------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
14#include "llvm/ADT/ArrayRef.h"
15#include "llvm/MC/MCContext.h"
16#include "llvm/MC/MCDecoder.h"
19#include "llvm/MC/MCExpr.h"
20#include "llvm/MC/MCInst.h"
21#include "llvm/MC/MCInstrInfo.h"
26#include "llvm/Support/Endian.h"
29#include <cassert>
30#include <cstddef>
31#include <cstdint>
32#include <memory>
33
34#define DEBUG_TYPE "hexagon-disassembler"
35
36using namespace llvm;
37using namespace Hexagon;
38
40
41namespace {
42
43/// Hexagon disassembler for all Hexagon platforms.
44class HexagonDisassembler : public MCDisassembler {
45public:
46 std::unique_ptr<MCInstrInfo const> const MCII;
47 mutable std::unique_ptr<MCInst> CurrentBundle;
48 mutable MCInst const *CurrentExtender;
49
50 HexagonDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx,
51 MCInstrInfo const *MCII)
52 : MCDisassembler(STI, Ctx), MCII(MCII), CurrentBundle(nullptr),
53 CurrentExtender(nullptr) {}
54
55 DecodeStatus getSingleInstruction(MCInst &Instr, MCInst &MCB,
57 raw_ostream &CStream, bool &Complete) const;
60 raw_ostream &CStream) const override;
61
64 raw_ostream &CStream) const override;
65
66 void remapInstruction(MCInst &Instr) const;
67
68private:
69 bool makeBundle(ArrayRef<uint8_t> Bytes, uint64_t Address,
70 uint64_t &BytesToSkip, raw_ostream &CS) const;
71
72 void resetBundle() const {
73 CurrentBundle.reset();
74 CurrentInstruction = nullptr;
75 }
76
77 mutable MCOperand *CurrentInstruction = nullptr;
78};
79
80static uint64_t fullValue(HexagonDisassembler const &Disassembler, MCInst &MI,
81 int64_t Value) {
82 MCInstrInfo MCII = *Disassembler.MCII;
83 if (!Disassembler.CurrentExtender ||
85 return Value;
86 unsigned Alignment = HexagonMCInstrInfo::getExtentAlignment(MCII, MI);
87 uint32_t Lower6 = static_cast<uint32_t>(Value >> Alignment) & 0x3f;
88 int64_t Bits;
89 bool Success =
90 Disassembler.CurrentExtender->getOperand(0).getExpr()->evaluateAsAbsolute(
91 Bits);
93 (void)Success;
94 uint64_t Upper26 = static_cast<uint64_t>(Bits);
95 uint64_t Operand = Upper26 | Lower6;
96 return Operand;
97}
98static HexagonDisassembler const &disassembler(const MCDisassembler *Decoder) {
99 return *static_cast<HexagonDisassembler const *>(Decoder);
100}
101template <size_t T>
102static void signedDecoder(MCInst &MI, unsigned tmp,
103 const MCDisassembler *Decoder) {
104 HexagonDisassembler const &Disassembler = disassembler(Decoder);
105 int64_t FullValue = fullValue(Disassembler, MI, SignExtend64<T>(tmp));
106 int64_t Extended = SignExtend64<32>(FullValue);
107 HexagonMCInstrInfo::addConstant(MI, Extended, Disassembler.getContext());
108}
109}
110
111// Forward declare these because the auto-generated code will reference them.
112// Definitions are further down.
113
114static DecodeStatus DecodeIntRegsRegisterClass(MCInst &Inst, unsigned RegNo,
115 uint64_t Address,
116 const MCDisassembler *Decoder);
117static DecodeStatus
118DecodeGeneralSubRegsRegisterClass(MCInst &Inst, unsigned RegNo,
119 uint64_t Address,
120 const MCDisassembler *Decoder);
121static DecodeStatus
122DecodeIntRegsLow8RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address,
123 const MCDisassembler *Decoder);
124static DecodeStatus DecodeHvxVRRegisterClass(MCInst &Inst, unsigned RegNo,
125 uint64_t Address,
126 const MCDisassembler *Decoder);
127static DecodeStatus
128DecodeDoubleRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address,
129 const MCDisassembler *Decoder);
130static DecodeStatus
132 uint64_t Address,
133 const MCDisassembler *Decoder);
134static DecodeStatus DecodeHvxWRRegisterClass(MCInst &Inst, unsigned RegNo,
135 uint64_t Address,
136 const MCDisassembler *Decoder);
137static DecodeStatus DecodeHvxVQRRegisterClass(MCInst &Inst, unsigned RegNo,
138 uint64_t Address,
139 const MCDisassembler *Decoder);
140static DecodeStatus DecodePredRegsRegisterClass(MCInst &Inst, unsigned RegNo,
141 uint64_t Address,
142 const MCDisassembler *Decoder);
143static DecodeStatus DecodeHvxQRRegisterClass(MCInst &Inst, unsigned RegNo,
144 uint64_t Address,
145 const MCDisassembler *Decoder);
146static DecodeStatus DecodeCtrRegsRegisterClass(MCInst &Inst, unsigned RegNo,
147 uint64_t Address,
148 const MCDisassembler *Decoder);
149static DecodeStatus DecodeGuestRegsRegisterClass(MCInst &Inst, unsigned RegNo,
150 uint64_t Address,
151 const MCDisassembler *Decoder);
152static DecodeStatus DecodeSysRegsRegisterClass(MCInst &Inst, unsigned RegNo,
153 uint64_t Address,
154 const MCDisassembler *Decoder);
155static DecodeStatus DecodeModRegsRegisterClass(MCInst &Inst, unsigned RegNo,
156 uint64_t Address,
157 const MCDisassembler *Decoder);
158static DecodeStatus DecodeCtrRegs64RegisterClass(MCInst &Inst, unsigned RegNo,
159 uint64_t Address,
160 const MCDisassembler *Decoder);
161static DecodeStatus
162DecodeGuestRegs64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address,
163 const MCDisassembler *Decoder);
164static DecodeStatus DecodeSysRegs64RegisterClass(MCInst &Inst, unsigned RegNo,
165 uint64_t Address,
166 const MCDisassembler *Decoder);
167
168static DecodeStatus unsignedImmDecoder(MCInst &MI, unsigned tmp,
169 uint64_t Address,
170 const MCDisassembler *Decoder);
171static DecodeStatus s32_0ImmDecoder(MCInst &MI, unsigned tmp,
172 uint64_t /*Address*/,
173 const MCDisassembler *Decoder);
174static DecodeStatus brtargetDecoder(MCInst &MI, unsigned tmp, uint64_t Address,
175 const MCDisassembler *Decoder);
176#include "HexagonDepDecoders.inc"
177#include "HexagonGenDisassemblerTables.inc"
178
180 const MCSubtargetInfo &STI,
181 MCContext &Ctx) {
182 return new HexagonDisassembler(STI, Ctx, T.createMCInstrInfo());
183}
184
189}
190
191bool HexagonDisassembler::makeBundle(ArrayRef<uint8_t> Bytes, uint64_t Address,
192 uint64_t &BytesToSkip,
193 raw_ostream &CS) const {
194 bool Complete = false;
195 DecodeStatus Result = DecodeStatus::Success;
196
197 CurrentBundle.reset(new MCInst);
198 CurrentBundle->setOpcode(Hexagon::BUNDLE);
199 CurrentBundle->addOperand(MCOperand::createImm(0));
200 while (Result == Success && !Complete) {
201 if (Bytes.size() < HEXAGON_INSTR_SIZE)
202 return false;
203 MCInst *Inst = getContext().createMCInst();
204 Result = getSingleInstruction(*Inst, *CurrentBundle, Bytes, Address, CS,
205 Complete);
206 CurrentBundle->addOperand(MCOperand::createInst(Inst));
207 BytesToSkip += HEXAGON_INSTR_SIZE;
208 Bytes = Bytes.slice(HEXAGON_INSTR_SIZE);
209 }
210 if (Result == MCDisassembler::Fail)
211 return false;
212 if (BytesToSkip > HEXAGON_MAX_PACKET_SIZE)
213 return false;
214
215 const auto ArchSTI = Hexagon_MC::getArchSubtarget(&STI);
216 const auto STI_ = (ArchSTI != nullptr) ? *ArchSTI : STI;
217 HexagonMCChecker Checker(getContext(), *MCII, STI_, *CurrentBundle,
218 *getContext().getRegisterInfo(), false);
219 if (!Checker.check())
220 return false;
221 remapInstruction(*CurrentBundle);
222 return true;
223}
224
225DecodeStatus HexagonDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
226 ArrayRef<uint8_t> Bytes,
227 uint64_t Address,
228 raw_ostream &CS) const {
229 CommentStream = &CS;
230
231 Size = 0;
232 uint64_t BytesToSkip = 0;
233
234 if (!CurrentBundle) {
235 if (!makeBundle(Bytes, Address, BytesToSkip, CS)) {
236 Size = BytesToSkip;
237 resetBundle();
239 }
240 CurrentInstruction = (CurrentBundle->begin() + 1);
241 }
242
243 MI = *(CurrentInstruction->getInst());
245 if (++CurrentInstruction == CurrentBundle->end())
246 resetBundle();
248}
249
250DecodeStatus HexagonDisassembler::getInstructionBundle(MCInst &MI,
251 uint64_t &Size,
252 ArrayRef<uint8_t> Bytes,
253 uint64_t Address,
254 raw_ostream &CS) const {
255 CommentStream = &CS;
256 Size = 0;
257 uint64_t BytesToSkip = 0;
258 assert(!CurrentBundle);
259
260 if (!makeBundle(Bytes, Address, BytesToSkip, CS)) {
261 Size = BytesToSkip;
262 resetBundle();
264 }
265
266 MI = *CurrentBundle;
268 resetBundle();
269
270 return Success;
271}
272
273void HexagonDisassembler::remapInstruction(MCInst &Instr) const {
274 for (auto I: HexagonMCInstrInfo::bundleInstructions(Instr)) {
275 auto &MI = const_cast<MCInst &>(*I.getInst());
276 switch (MI.getOpcode()) {
277 case Hexagon::S2_allocframe:
278 if (MI.getOperand(0).getReg() == Hexagon::R29) {
279 MI.setOpcode(Hexagon::S6_allocframe_to_raw);
280 MI.erase(MI.begin () + 1);
281 MI.erase(MI.begin ());
282 }
283 break;
284 case Hexagon::L2_deallocframe:
285 if (MI.getOperand(0).getReg() == Hexagon::D15 &&
286 MI.getOperand(1).getReg() == Hexagon::R30) {
287 MI.setOpcode(L6_deallocframe_map_to_raw);
288 MI.erase(MI.begin () + 1);
289 MI.erase(MI.begin ());
290 }
291 break;
292 case Hexagon::L4_return:
293 if (MI.getOperand(0).getReg() == Hexagon::D15 &&
294 MI.getOperand(1).getReg() == Hexagon::R30) {
295 MI.setOpcode(L6_return_map_to_raw);
296 MI.erase(MI.begin () + 1);
297 MI.erase(MI.begin ());
298 }
299 break;
300 case Hexagon::L4_return_t:
301 if (MI.getOperand(0).getReg() == Hexagon::D15 &&
302 MI.getOperand(2).getReg() == Hexagon::R30) {
303 MI.setOpcode(L4_return_map_to_raw_t);
304 MI.erase(MI.begin () + 2);
305 MI.erase(MI.begin ());
306 }
307 break;
308 case Hexagon::L4_return_f:
309 if (MI.getOperand(0).getReg() == Hexagon::D15 &&
310 MI.getOperand(2).getReg() == Hexagon::R30) {
311 MI.setOpcode(L4_return_map_to_raw_f);
312 MI.erase(MI.begin () + 2);
313 MI.erase(MI.begin ());
314 }
315 break;
316 case Hexagon::L4_return_tnew_pt:
317 if (MI.getOperand(0).getReg() == Hexagon::D15 &&
318 MI.getOperand(2).getReg() == Hexagon::R30) {
319 MI.setOpcode(L4_return_map_to_raw_tnew_pt);
320 MI.erase(MI.begin () + 2);
321 MI.erase(MI.begin ());
322 }
323 break;
324 case Hexagon::L4_return_fnew_pt:
325 if (MI.getOperand(0).getReg() == Hexagon::D15 &&
326 MI.getOperand(2).getReg() == Hexagon::R30) {
327 MI.setOpcode(L4_return_map_to_raw_fnew_pt);
328 MI.erase(MI.begin () + 2);
329 MI.erase(MI.begin ());
330 }
331 break;
332 case Hexagon::L4_return_tnew_pnt:
333 if (MI.getOperand(0).getReg() == Hexagon::D15 &&
334 MI.getOperand(2).getReg() == Hexagon::R30) {
335 MI.setOpcode(L4_return_map_to_raw_tnew_pnt);
336 MI.erase(MI.begin () + 2);
337 MI.erase(MI.begin ());
338 }
339 break;
340 case Hexagon::L4_return_fnew_pnt:
341 if (MI.getOperand(0).getReg() == Hexagon::D15 &&
342 MI.getOperand(2).getReg() == Hexagon::R30) {
343 MI.setOpcode(L4_return_map_to_raw_fnew_pnt);
344 MI.erase(MI.begin () + 2);
345 MI.erase(MI.begin ());
346 }
347 break;
348 }
349 }
350}
351
352static void adjustDuplex(MCInst &MI, MCContext &Context) {
353 switch (MI.getOpcode()) {
354 case Hexagon::SA1_setin1:
355 MI.insert(MI.begin() + 1,
357 break;
358 case Hexagon::SA1_dec:
359 MI.insert(MI.begin() + 2,
361 break;
362 default:
363 break;
364 }
365}
366
367DecodeStatus HexagonDisassembler::getSingleInstruction(MCInst &MI, MCInst &MCB,
368 ArrayRef<uint8_t> Bytes,
369 uint64_t Address,
370 raw_ostream &cs,
371 bool &Complete) const {
372 assert(Bytes.size() >= HEXAGON_INSTR_SIZE);
373
375
376 auto BundleSize = HexagonMCInstrInfo::bundleSize(MCB);
379 if (BundleSize == 0)
381 else if (BundleSize == 1)
383 else
384 return DecodeStatus::Fail;
385 }
386
387 CurrentExtender = HexagonMCInstrInfo::extenderForIndex(
389
390 DecodeStatus Result = DecodeStatus::Fail;
393 unsigned duplexIClass;
394 uint8_t const *DecodeLow, *DecodeHigh;
395 duplexIClass = ((Instruction >> 28) & 0xe) | ((Instruction >> 13) & 0x1);
396 switch (duplexIClass) {
397 default:
399 case 0:
400 DecodeLow = DecoderTableSUBINSN_L132;
401 DecodeHigh = DecoderTableSUBINSN_L132;
402 break;
403 case 1:
404 DecodeLow = DecoderTableSUBINSN_L232;
405 DecodeHigh = DecoderTableSUBINSN_L132;
406 break;
407 case 2:
408 DecodeLow = DecoderTableSUBINSN_L232;
409 DecodeHigh = DecoderTableSUBINSN_L232;
410 break;
411 case 3:
412 DecodeLow = DecoderTableSUBINSN_A32;
413 DecodeHigh = DecoderTableSUBINSN_A32;
414 break;
415 case 4:
416 DecodeLow = DecoderTableSUBINSN_L132;
417 DecodeHigh = DecoderTableSUBINSN_A32;
418 break;
419 case 5:
420 DecodeLow = DecoderTableSUBINSN_L232;
421 DecodeHigh = DecoderTableSUBINSN_A32;
422 break;
423 case 6:
424 DecodeLow = DecoderTableSUBINSN_S132;
425 DecodeHigh = DecoderTableSUBINSN_A32;
426 break;
427 case 7:
428 DecodeLow = DecoderTableSUBINSN_S232;
429 DecodeHigh = DecoderTableSUBINSN_A32;
430 break;
431 case 8:
432 DecodeLow = DecoderTableSUBINSN_S132;
433 DecodeHigh = DecoderTableSUBINSN_L132;
434 break;
435 case 9:
436 DecodeLow = DecoderTableSUBINSN_S132;
437 DecodeHigh = DecoderTableSUBINSN_L232;
438 break;
439 case 10:
440 DecodeLow = DecoderTableSUBINSN_S132;
441 DecodeHigh = DecoderTableSUBINSN_S132;
442 break;
443 case 11:
444 DecodeLow = DecoderTableSUBINSN_S232;
445 DecodeHigh = DecoderTableSUBINSN_S132;
446 break;
447 case 12:
448 DecodeLow = DecoderTableSUBINSN_S232;
449 DecodeHigh = DecoderTableSUBINSN_L132;
450 break;
451 case 13:
452 DecodeLow = DecoderTableSUBINSN_S232;
453 DecodeHigh = DecoderTableSUBINSN_L232;
454 break;
455 case 14:
456 DecodeLow = DecoderTableSUBINSN_S232;
457 DecodeHigh = DecoderTableSUBINSN_S232;
458 break;
459 }
460 MI.setOpcode(Hexagon::DuplexIClass0 + duplexIClass);
461 MCInst *MILow = getContext().createMCInst();
462 MCInst *MIHigh = getContext().createMCInst();
463 auto TmpExtender = CurrentExtender;
464 CurrentExtender =
465 nullptr; // constant extenders in duplex must always be in slot 1
466 Result = decodeInstruction(DecodeLow, *MILow, Instruction & 0x1fff, Address,
467 this, STI);
468 CurrentExtender = TmpExtender;
469 if (Result != DecodeStatus::Success)
470 return DecodeStatus::Fail;
471 adjustDuplex(*MILow, getContext());
472 Result = decodeInstruction(
473 DecodeHigh, *MIHigh, (Instruction >> 16) & 0x1fff, Address, this, STI);
474 if (Result != DecodeStatus::Success)
475 return DecodeStatus::Fail;
476 adjustDuplex(*MIHigh, getContext());
477 MCOperand OPLow = MCOperand::createInst(MILow);
478 MCOperand OPHigh = MCOperand::createInst(MIHigh);
479 MI.addOperand(OPLow);
480 MI.addOperand(OPHigh);
481 Complete = true;
482 } else {
485 Complete = true;
486
487 if (CurrentExtender != nullptr)
488 Result = decodeInstruction(DecoderTableMustExtend32, MI, Instruction,
489 Address, this, STI);
490
491 if (Result != MCDisassembler::Success)
492 Result = decodeInstruction(DecoderTable32, MI, Instruction, Address, this,
493 STI);
494
495 if (Result != MCDisassembler::Success &&
496 STI.hasFeature(Hexagon::ExtensionHVX))
497 Result = decodeInstruction(DecoderTableEXT_mmvec32, MI, Instruction,
498 Address, this, STI);
499
500 }
501
502 switch (MI.getOpcode()) {
503 case Hexagon::J4_cmpeqn1_f_jumpnv_nt:
504 case Hexagon::J4_cmpeqn1_f_jumpnv_t:
505 case Hexagon::J4_cmpeqn1_fp0_jump_nt:
506 case Hexagon::J4_cmpeqn1_fp0_jump_t:
507 case Hexagon::J4_cmpeqn1_fp1_jump_nt:
508 case Hexagon::J4_cmpeqn1_fp1_jump_t:
509 case Hexagon::J4_cmpeqn1_t_jumpnv_nt:
510 case Hexagon::J4_cmpeqn1_t_jumpnv_t:
511 case Hexagon::J4_cmpeqn1_tp0_jump_nt:
512 case Hexagon::J4_cmpeqn1_tp0_jump_t:
513 case Hexagon::J4_cmpeqn1_tp1_jump_nt:
514 case Hexagon::J4_cmpeqn1_tp1_jump_t:
515 case Hexagon::J4_cmpgtn1_f_jumpnv_nt:
516 case Hexagon::J4_cmpgtn1_f_jumpnv_t:
517 case Hexagon::J4_cmpgtn1_fp0_jump_nt:
518 case Hexagon::J4_cmpgtn1_fp0_jump_t:
519 case Hexagon::J4_cmpgtn1_fp1_jump_nt:
520 case Hexagon::J4_cmpgtn1_fp1_jump_t:
521 case Hexagon::J4_cmpgtn1_t_jumpnv_nt:
522 case Hexagon::J4_cmpgtn1_t_jumpnv_t:
523 case Hexagon::J4_cmpgtn1_tp0_jump_nt:
524 case Hexagon::J4_cmpgtn1_tp0_jump_t:
525 case Hexagon::J4_cmpgtn1_tp1_jump_nt:
526 case Hexagon::J4_cmpgtn1_tp1_jump_t:
527 MI.insert(MI.begin() + 1,
529 break;
530 case Hexagon::Y4_crswap10:
531 MI.addOperand(MCOperand::createReg(Hexagon::SGP1_0));
532 break;
533 default:
534 break;
535 }
536
539 MCOperand &MCO = MI.getOperand(OpIndex);
540 assert(MCO.isReg() && "New value consumers must be registers");
541 unsigned Register =
542 getContext().getRegisterInfo()->getEncodingValue(MCO.getReg());
543 if ((Register & 0x6) == 0)
544 // HexagonPRM 10.11 Bit 1-2 == 0 is reserved
546 unsigned Lookback = (Register & 0x6) >> 1;
547 unsigned Offset = 1;
549 bool PrevVector = false;
551 auto i = Instructions.end() - 1;
552 for (auto n = Instructions.begin() - 1;; --i, ++Offset) {
553 if (i == n)
554 // Couldn't find producer
556 bool CurrentVector = HexagonMCInstrInfo::isVector(*MCII, *i->getInst());
557 if (Vector && !CurrentVector)
558 // Skip scalars when calculating distances for vectors
559 ++Lookback;
560 if (HexagonMCInstrInfo::isImmext(*i->getInst()) && (Vector == PrevVector))
561 ++Lookback;
562 PrevVector = CurrentVector;
563 if (Offset == Lookback)
564 break;
565 }
566 auto const &Inst = *i->getInst();
567 bool SubregBit = (Register & 0x1) != 0;
568 if (HexagonMCInstrInfo::hasNewValue2(*MCII, Inst)) {
569 // If subreg bit is set we're selecting the second produced newvalue
571 SubregBit
574 assert(Producer != Hexagon::NoRegister);
575 MCO.setReg(Producer);
576 } else if (HexagonMCInstrInfo::hasNewValue(*MCII, Inst)) {
579
580 if (HexagonMCInstrInfo::IsVecRegPair(Producer)) {
581 const bool Rev = HexagonMCInstrInfo::IsReverseVecRegPair(Producer);
582 const unsigned ProdPairIndex =
583 Rev ? Producer - Hexagon::WR0 : Producer - Hexagon::W0;
584 if (Rev)
585 SubregBit = !SubregBit;
586 Producer = (ProdPairIndex << 1) + SubregBit + Hexagon::V0;
587 } else if (SubregBit)
588 // Hexagon PRM 10.11 New-value operands
589 // Nt[0] is reserved and should always be encoded as zero.
591 assert(Producer != Hexagon::NoRegister);
592 MCO.setReg(Producer);
593 } else
595 }
596
597 if (CurrentExtender != nullptr) {
598 MCInst const &Inst = HexagonMCInstrInfo::isDuplex(*MCII, MI)
599 ? *MI.getOperand(1).getInst()
600 : MI;
601 if (!HexagonMCInstrInfo::isExtendable(*MCII, Inst) &&
602 !HexagonMCInstrInfo::isExtended(*MCII, Inst))
604 }
605 return Result;
606}
607
608static DecodeStatus DecodeRegisterClass(MCInst &Inst, unsigned RegNo,
609 ArrayRef<MCPhysReg> Table) {
610 if (RegNo < Table.size()) {
611 Inst.addOperand(MCOperand::createReg(Table[RegNo]));
613 }
614
616}
617
618static DecodeStatus
619DecodeIntRegsLow8RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address,
620 const MCDisassembler *Decoder) {
621 return DecodeIntRegsRegisterClass(Inst, RegNo, Address, Decoder);
622}
623
624static DecodeStatus DecodeIntRegsRegisterClass(MCInst &Inst, unsigned RegNo,
625 uint64_t Address,
626 const MCDisassembler *Decoder) {
627 static const MCPhysReg IntRegDecoderTable[] = {
628 Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3, Hexagon::R4,
629 Hexagon::R5, Hexagon::R6, Hexagon::R7, Hexagon::R8, Hexagon::R9,
630 Hexagon::R10, Hexagon::R11, Hexagon::R12, Hexagon::R13, Hexagon::R14,
631 Hexagon::R15, Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19,
632 Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23, Hexagon::R24,
633 Hexagon::R25, Hexagon::R26, Hexagon::R27, Hexagon::R28, Hexagon::R29,
634 Hexagon::R30, Hexagon::R31};
635
636 return DecodeRegisterClass(Inst, RegNo, IntRegDecoderTable);
637}
638
639static DecodeStatus
641 uint64_t Address,
642 const MCDisassembler *Decoder) {
643 static const MCPhysReg GeneralSubRegDecoderTable[] = {
644 Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3,
645 Hexagon::R4, Hexagon::R5, Hexagon::R6, Hexagon::R7,
646 Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19,
647 Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23,
648 };
649
650 return DecodeRegisterClass(Inst, RegNo, GeneralSubRegDecoderTable);
651}
652
653static DecodeStatus DecodeHvxVRRegisterClass(MCInst &Inst, unsigned RegNo,
654 uint64_t /*Address*/,
655 const MCDisassembler *Decoder) {
656 static const MCPhysReg HvxVRDecoderTable[] = {
657 Hexagon::V0, Hexagon::V1, Hexagon::V2, Hexagon::V3, Hexagon::V4,
658 Hexagon::V5, Hexagon::V6, Hexagon::V7, Hexagon::V8, Hexagon::V9,
659 Hexagon::V10, Hexagon::V11, Hexagon::V12, Hexagon::V13, Hexagon::V14,
660 Hexagon::V15, Hexagon::V16, Hexagon::V17, Hexagon::V18, Hexagon::V19,
661 Hexagon::V20, Hexagon::V21, Hexagon::V22, Hexagon::V23, Hexagon::V24,
662 Hexagon::V25, Hexagon::V26, Hexagon::V27, Hexagon::V28, Hexagon::V29,
663 Hexagon::V30, Hexagon::V31};
664
665 return DecodeRegisterClass(Inst, RegNo, HvxVRDecoderTable);
666}
667
668static DecodeStatus
670 uint64_t /*Address*/,
671 const MCDisassembler *Decoder) {
672 static const MCPhysReg DoubleRegDecoderTable[] = {
673 Hexagon::D0, Hexagon::D1, Hexagon::D2, Hexagon::D3,
674 Hexagon::D4, Hexagon::D5, Hexagon::D6, Hexagon::D7,
675 Hexagon::D8, Hexagon::D9, Hexagon::D10, Hexagon::D11,
676 Hexagon::D12, Hexagon::D13, Hexagon::D14, Hexagon::D15};
677
678 return DecodeRegisterClass(Inst, RegNo >> 1, DoubleRegDecoderTable);
679}
680
681static DecodeStatus
683 uint64_t /*Address*/,
684 const MCDisassembler *Decoder) {
685 static const MCPhysReg GeneralDoubleLow8RegDecoderTable[] = {
686 Hexagon::D0, Hexagon::D1, Hexagon::D2, Hexagon::D3,
687 Hexagon::D8, Hexagon::D9, Hexagon::D10, Hexagon::D11};
688
689 return DecodeRegisterClass(Inst, RegNo, GeneralDoubleLow8RegDecoderTable);
690}
691
692static DecodeStatus DecodeHvxWRRegisterClass(MCInst &Inst, unsigned RegNo,
693 uint64_t /*Address*/,
694 const MCDisassembler *Decoder) {
695 static const MCPhysReg HvxWRDecoderTable[] = {
696 Hexagon::W0, Hexagon::WR0, Hexagon::W1, Hexagon::WR1, Hexagon::W2,
697 Hexagon::WR2, Hexagon::W3, Hexagon::WR3, Hexagon::W4, Hexagon::WR4,
698 Hexagon::W5, Hexagon::WR5, Hexagon::W6, Hexagon::WR6, Hexagon::W7,
699 Hexagon::WR7, Hexagon::W8, Hexagon::WR8, Hexagon::W9, Hexagon::WR9,
700 Hexagon::W10, Hexagon::WR10, Hexagon::W11, Hexagon::WR11, Hexagon::W12,
701 Hexagon::WR12, Hexagon::W13, Hexagon::WR13, Hexagon::W14, Hexagon::WR14,
702 Hexagon::W15, Hexagon::WR15,
703 };
704
705 return DecodeRegisterClass(Inst, RegNo, HvxWRDecoderTable);
706}
707
708LLVM_ATTRIBUTE_UNUSED // Suppress warning temporarily.
709 static DecodeStatus
710 DecodeHvxVQRRegisterClass(MCInst &Inst, unsigned RegNo,
711 uint64_t /*Address*/,
712 const MCDisassembler *Decoder) {
713 static const MCPhysReg HvxVQRDecoderTable[] = {
714 Hexagon::VQ0, Hexagon::VQ1, Hexagon::VQ2, Hexagon::VQ3,
715 Hexagon::VQ4, Hexagon::VQ5, Hexagon::VQ6, Hexagon::VQ7};
716
717 return DecodeRegisterClass(Inst, RegNo >> 2, HvxVQRDecoderTable);
718}
719
721 uint64_t /*Address*/,
722 const MCDisassembler *Decoder) {
723 static const MCPhysReg PredRegDecoderTable[] = {Hexagon::P0, Hexagon::P1,
724 Hexagon::P2, Hexagon::P3};
725
726 return DecodeRegisterClass(Inst, RegNo, PredRegDecoderTable);
727}
728
729static DecodeStatus DecodeHvxQRRegisterClass(MCInst &Inst, unsigned RegNo,
730 uint64_t /*Address*/,
731 const MCDisassembler *Decoder) {
732 static const MCPhysReg HvxQRDecoderTable[] = {Hexagon::Q0, Hexagon::Q1,
733 Hexagon::Q2, Hexagon::Q3};
734
735 return DecodeRegisterClass(Inst, RegNo, HvxQRDecoderTable);
736}
737
738static DecodeStatus DecodeCtrRegsRegisterClass(MCInst &Inst, unsigned RegNo,
739 uint64_t /*Address*/,
740 const MCDisassembler *Decoder) {
741 using namespace Hexagon;
742
743 static const MCPhysReg CtrlRegDecoderTable[] = {
744 /* 0 */ SA0, LC0, SA1, LC1,
745 /* 4 */ P3_0, C5, M0, M1,
746 /* 8 */ USR, PC, UGP, GP,
747 /* 12 */ CS0, CS1, UPCYCLELO, UPCYCLEHI,
748 /* 16 */ FRAMELIMIT, FRAMEKEY, PKTCOUNTLO, PKTCOUNTHI,
749 /* 20 */ 0, 0, 0, 0,
750 /* 24 */ 0, 0, 0, 0,
751 /* 28 */ 0, 0, UTIMERLO, UTIMERHI
752 };
753
754 if (RegNo >= std::size(CtrlRegDecoderTable))
756
757 static_assert(NoRegister == 0, "Expecting NoRegister to be 0");
758 if (CtrlRegDecoderTable[RegNo] == NoRegister)
760
761 unsigned Register = CtrlRegDecoderTable[RegNo];
764}
765
766static DecodeStatus
767DecodeCtrRegs64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t /*Address*/,
768 const MCDisassembler *Decoder) {
769 using namespace Hexagon;
770
771 static const MCPhysReg CtrlReg64DecoderTable[] = {
772 /* 0 */ C1_0, 0, C3_2, 0,
773 /* 4 */ C5_4, 0, C7_6, 0,
774 /* 8 */ C9_8, 0, C11_10, 0,
775 /* 12 */ CS, 0, UPCYCLE, 0,
776 /* 16 */ C17_16, 0, PKTCOUNT, 0,
777 /* 20 */ 0, 0, 0, 0,
778 /* 24 */ 0, 0, 0, 0,
779 /* 28 */ 0, 0, UTIMER, 0
780 };
781
782 if (RegNo >= std::size(CtrlReg64DecoderTable))
784
785 static_assert(NoRegister == 0, "Expecting NoRegister to be 0");
786 if (CtrlReg64DecoderTable[RegNo] == NoRegister)
788
789 unsigned Register = CtrlReg64DecoderTable[RegNo];
792}
793
794static DecodeStatus DecodeModRegsRegisterClass(MCInst &Inst, unsigned RegNo,
795 uint64_t /*Address*/,
796 const MCDisassembler *Decoder) {
797 unsigned Register = 0;
798 switch (RegNo) {
799 case 0:
800 Register = Hexagon::M0;
801 break;
802 case 1:
803 Register = Hexagon::M1;
804 break;
805 default:
807 }
810}
811
813 uint64_t /*Address*/,
814 const MCDisassembler *Decoder) {
815 HexagonDisassembler const &Disassembler = disassembler(Decoder);
816 int64_t FullValue = fullValue(Disassembler, MI, tmp);
817 assert(FullValue >= 0 && "Negative in unsigned decoder");
818 HexagonMCInstrInfo::addConstant(MI, FullValue, Disassembler.getContext());
820}
821
822static DecodeStatus s32_0ImmDecoder(MCInst &MI, unsigned tmp,
823 uint64_t /*Address*/,
824 const MCDisassembler *Decoder) {
825 HexagonDisassembler const &Disassembler = disassembler(Decoder);
826 unsigned Bits = HexagonMCInstrInfo::getExtentBits(*Disassembler.MCII, MI);
827 tmp = SignExtend64(tmp, Bits);
828 signedDecoder<32>(MI, tmp, Decoder);
830}
831
832// custom decoder for various jump/call immediates
833static DecodeStatus brtargetDecoder(MCInst &MI, unsigned tmp, uint64_t Address,
834 const MCDisassembler *Decoder) {
835 HexagonDisassembler const &Disassembler = disassembler(Decoder);
836 unsigned Bits = HexagonMCInstrInfo::getExtentBits(*Disassembler.MCII, MI);
837 // r13_2 is not extendable, so if there are no extent bits, it's r13_2
838 if (Bits == 0)
839 Bits = 15;
840 uint64_t FullValue = fullValue(Disassembler, MI, SignExtend64(tmp, Bits));
841 uint32_t Extended = FullValue + Address;
842 if (!Disassembler.tryAddingSymbolicOperand(MI, Extended, Address, true, 0, 0,
843 4))
844 HexagonMCInstrInfo::addConstant(MI, Extended, Disassembler.getContext());
846}
847
848static const uint16_t SysRegDecoderTable[] = {
849 Hexagon::SGP0, Hexagon::SGP1, Hexagon::STID,
850 Hexagon::ELR, Hexagon::BADVA0, Hexagon::BADVA1,
851 Hexagon::SSR, Hexagon::CCR, Hexagon::HTID,
852 Hexagon::BADVA, Hexagon::IMASK, Hexagon::S11,
853 Hexagon::S12, Hexagon::S13, Hexagon::S14,
854 Hexagon::S15, Hexagon::EVB, Hexagon::MODECTL,
855 Hexagon::SYSCFG, Hexagon::S19, Hexagon::S20,
856 Hexagon::VID, Hexagon::S22, Hexagon::S23,
857 Hexagon::S24, Hexagon::S25, Hexagon::S26,
858 Hexagon::CFGBASE, Hexagon::DIAG, Hexagon::REV,
859 Hexagon::PCYCLELO, Hexagon::PCYCLEHI, Hexagon::ISDBST,
860 Hexagon::ISDBCFG0, Hexagon::ISDBCFG1, Hexagon::S35,
861 Hexagon::BRKPTPC0, Hexagon::BRKPTCFG0, Hexagon::BRKPTPC1,
862 Hexagon::BRKPTCFG1, Hexagon::ISDBMBXIN, Hexagon::ISDBMBXOUT,
863 Hexagon::ISDBEN, Hexagon::ISDBGPR, Hexagon::S44,
864 Hexagon::S45, Hexagon::S46, Hexagon::S47,
865 Hexagon::PMUCNT0, Hexagon::PMUCNT1, Hexagon::PMUCNT2,
866 Hexagon::PMUCNT3, Hexagon::PMUEVTCFG, Hexagon::PMUCFG,
867 Hexagon::S54, Hexagon::S55, Hexagon::S56,
868 Hexagon::S57, Hexagon::S58, Hexagon::S59,
869 Hexagon::S60, Hexagon::S61, Hexagon::S62,
870 Hexagon::S63, Hexagon::S64, Hexagon::S65,
871 Hexagon::S66, Hexagon::S67, Hexagon::S68,
872 Hexagon::S69, Hexagon::S70, Hexagon::S71,
873 Hexagon::S72, Hexagon::S73, Hexagon::S74,
874 Hexagon::S75, Hexagon::S76, Hexagon::S77,
875 Hexagon::S78, Hexagon::S79, Hexagon::S80,
876};
877
878static DecodeStatus DecodeSysRegsRegisterClass(MCInst &Inst, unsigned RegNo,
879 uint64_t /*Address*/,
880 const MCDisassembler *Decoder) {
881 if (RegNo >= std::size(SysRegDecoderTable))
883
884 if (SysRegDecoderTable[RegNo] == Hexagon::NoRegister)
886
887 unsigned Register = SysRegDecoderTable[RegNo];
890}
891
893 Hexagon::SGP1_0, Hexagon::S3_2, Hexagon::S5_4, Hexagon::S7_6,
894 Hexagon::S9_8, Hexagon::S11_10, Hexagon::S13_12, Hexagon::S15_14,
895 Hexagon::S17_16, Hexagon::S19_18, Hexagon::S21_20, Hexagon::S23_22,
896 Hexagon::S25_24, Hexagon::S27_26, Hexagon::S29_28, Hexagon::S31_30,
897 Hexagon::S33_32, Hexagon::S35_34, Hexagon::S37_36, Hexagon::S39_38,
898 Hexagon::S41_40, Hexagon::S43_42, Hexagon::S45_44, Hexagon::S47_46,
899 Hexagon::S49_48, Hexagon::S51_50, Hexagon::S53_52, Hexagon::S55_54,
900 Hexagon::S57_56, Hexagon::S59_58, Hexagon::S61_60, Hexagon::S63_62,
901 Hexagon::S65_64, Hexagon::S67_66, Hexagon::S69_68, Hexagon::S71_70,
902 Hexagon::S73_72, Hexagon::S75_74, Hexagon::S77_76, Hexagon::S79_78,
903};
904
905static DecodeStatus
906DecodeSysRegs64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t /*Address*/,
907 const MCDisassembler *Decoder) {
908 RegNo = RegNo >> 1;
909 if (RegNo >= std::size(SysReg64DecoderTable))
911
912 if (SysReg64DecoderTable[RegNo] == Hexagon::NoRegister)
914
915 unsigned Register = SysReg64DecoderTable[RegNo];
918}
919
920static DecodeStatus
921DecodeGuestRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t /*Address*/,
922 const MCDisassembler *Decoder) {
923 using namespace Hexagon;
924
925 static const MCPhysReg GuestRegDecoderTable[] = {
926 /* 0 */ GELR, GSR, GOSP, G3,
927 /* 4 */ G4, G5, G6, G7,
928 /* 8 */ G8, G9, G10, G11,
929 /* 12 */ G12, G13, G14, G15,
930 /* 16 */ GPMUCNT4, GPMUCNT5, GPMUCNT6, GPMUCNT7,
931 /* 20 */ G20, G21, G22, G23,
932 /* 24 */ GPCYCLELO, GPCYCLEHI, GPMUCNT0, GPMUCNT1,
933 /* 28 */ GPMUCNT2, GPMUCNT3, G30, G31
934 };
935
936 if (RegNo >= std::size(GuestRegDecoderTable))
938 if (GuestRegDecoderTable[RegNo] == Hexagon::NoRegister)
940
941 unsigned Register = GuestRegDecoderTable[RegNo];
944}
945
946static DecodeStatus
948 uint64_t /*Address*/,
949 const MCDisassembler *Decoder) {
950 using namespace Hexagon;
951
952 static const MCPhysReg GuestReg64DecoderTable[] = {
953 /* 0 */ G1_0, 0, G3_2, 0,
954 /* 4 */ G5_4, 0, G7_6, 0,
955 /* 8 */ G9_8, 0, G11_10, 0,
956 /* 12 */ G13_12, 0, G15_14, 0,
957 /* 16 */ G17_16, 0, G19_18, 0,
958 /* 20 */ G21_20, 0, G23_22, 0,
959 /* 24 */ G25_24, 0, G27_26, 0,
960 /* 28 */ G29_28, 0, G31_30, 0
961 };
962
963 if (RegNo >= std::size(GuestReg64DecoderTable))
965 if (GuestReg64DecoderTable[RegNo] == Hexagon::NoRegister)
967
968 unsigned Register = GuestReg64DecoderTable[RegNo];
971}
#define Success
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI
Definition: Compiler.h:213
#define LLVM_ATTRIBUTE_UNUSED
Definition: Compiler.h:298
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:132
uint64_t Size
static DecodeStatus DecodeIntRegsLow8RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGuestRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCtrRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus brtargetDecoder(MCInst &MI, unsigned tmp, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodePredRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonDisassembler()
static DecodeStatus s32_0ImmDecoder(MCInst &MI, unsigned tmp, uint64_t, const MCDisassembler *Decoder)
static DecodeStatus DecodeHvxVQRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus unsignedImmDecoder(MCInst &MI, unsigned tmp, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeHvxVRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static MCDisassembler * createHexagonDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
static DecodeStatus DecodeSysRegs64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeModRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static const uint16_t SysReg64DecoderTable[]
static void adjustDuplex(MCInst &MI, MCContext &Context)
static DecodeStatus DecodeRegisterClass(MCInst &Inst, unsigned RegNo, ArrayRef< MCPhysReg > Table)
static DecodeStatus DecodeSysRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeDoubleRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static const uint16_t SysRegDecoderTable[]
static DecodeStatus DecodeGeneralSubRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeHvxWRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeIntRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeHvxQRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCtrRegs64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGeneralDoubleLow8RegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGuestRegs64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
#define HEXAGON_MAX_PACKET_SIZE
#define HEXAGON_INSTR_SIZE
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition: MD5.cpp:58
unsigned OpIndex
static constexpr unsigned IntRegDecoderTable[]
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:147
const T * data() const
Definition: ArrayRef.h:144
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
Definition: ArrayRef.h:191
Check for a valid bundle.
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition: MCExpr.cpp:212
Context object for machine code objects.
Definition: MCContext.h:83
Superclass for all disassemblers.
virtual DecodeStatus getInstructionBundle(MCInst &Instr, uint64_t &Size, ArrayRef< uint8_t > Bytes, uint64_t Address, raw_ostream &CStream) const
Returns the disassembly of an instruction bundle for VLIW architectures like Hexagon.
DecodeStatus
Ternary decode status.
virtual DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size, ArrayRef< uint8_t > Bytes, uint64_t Address, raw_ostream &CStream) const =0
Returns the disassembly of a single instruction.
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:188
void addOperand(const MCOperand Op)
Definition: MCInst.h:215
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:27
Instances of this class represent operands of the MCInst class.
Definition: MCInst.h:40
static MCOperand createExpr(const MCExpr *Val)
Definition: MCInst.h:166
static MCOperand createReg(MCRegister Reg)
Definition: MCInst.h:138
static MCOperand createImm(int64_t Val)
Definition: MCInst.h:145
void setReg(MCRegister Reg)
Set the register number.
Definition: MCInst.h:79
bool isReg() const
Definition: MCInst.h:65
MCRegister getReg() const
Returns the register number.
Definition: MCInst.h:73
static MCOperand createInst(const MCInst *Val)
Definition: MCInst.h:173
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
Generic base class for all target subtargets.
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
Target - Wrapper for Target specific information.
LLVM Value Representation.
Definition: Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
void addConstant(MCInst &MI, uint64_t Value, MCContext &Context)
bool IsReverseVecRegPair(MCRegister VecReg)
size_t bundleSize(MCInst const &MCI)
bool isDuplex(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned getExtentBits(MCInstrInfo const &MCII, MCInst const &MCI)
bool isNewValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn expects newly produced value.
unsigned short getNewValueOp(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned short getExtendableOp(MCInstrInfo const &MCII, MCInst const &MCI)
bool IsVecRegPair(MCRegister VecReg)
iterator_range< Hexagon::PacketIterator > bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI)
bool isExtendable(MCInstrInfo const &MCII, MCInst const &MCI)
MCInst const * extenderForIndex(MCInst const &MCB, size_t Index)
bool isImmext(MCInst const &MCI)
MCOperand const & getNewValueOperand(MCInstrInfo const &MCII, MCInst const &MCI)
bool hasNewValue2(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn produces a second value.
unsigned getExtentAlignment(MCInstrInfo const &MCII, MCInst const &MCI)
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
MCOperand const & getNewValueOperand2(MCInstrInfo const &MCII, MCInst const &MCI)
bool isExtended(MCInstrInfo const &MCII, MCInst const &MCI)
bool hasNewValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn produces a value.
MCSubtargetInfo const * getArchSubtarget(MCSubtargetInfo const *STI)
uint32_t read32le(const void *P)
Definition: Endian.h:429
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:477
Target & getTheHexagonTarget()
unsigned M1(unsigned Val)
Definition: VE.h:377
unsigned M0(unsigned Val)
Definition: VE.h:376
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
Definition: MathExtras.h:577
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.