LLVM  5.0.0
HexagonMCCodeEmitter.cpp
Go to the documentation of this file.
1 //===-- HexagonMCCodeEmitter.cpp - Hexagon Target Descriptions ------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
11 #include "Hexagon.h"
16 #include "llvm/ADT/Statistic.h"
17 #include "llvm/MC/MCCodeEmitter.h"
18 #include "llvm/MC/MCContext.h"
19 #include "llvm/MC/MCExpr.h"
20 #include "llvm/MC/MCInst.h"
21 #include "llvm/MC/MCInstrInfo.h"
22 #include "llvm/MC/MCRegisterInfo.h"
24 #include "llvm/Support/Debug.h"
27 
28 #define DEBUG_TYPE "mccodeemitter"
29 
30 using namespace llvm;
31 using namespace Hexagon;
32 
33 STATISTIC(MCNumEmitted, "Number of MC instructions emitted");
34 
36  MCContext &aMCT)
37  : MCT(aMCT), MCII(aMII), Addend(new unsigned(0)),
38  Extended(new bool(false)), CurrentBundle(new MCInst const *),
39  CurrentIndex(new size_t(0)) {}
40 
42  MCInst const &MCB,
43  MCInst const &MCI) const {
44  bool Duplex = HexagonMCInstrInfo::isDuplex(MCII, MCI);
45  if (*CurrentIndex == 0) {
47  assert(!Duplex);
48  assert(*CurrentIndex != Last);
50  }
51  }
52  if (*CurrentIndex == 1) {
54  assert(!Duplex);
55  assert(*CurrentIndex != Last);
57  }
58  }
59  if (Duplex) {
60  assert(*CurrentIndex == Last);
62  }
63  if(*CurrentIndex == Last)
66 }
67 
68 /// EncodeInstruction - Emit the bundle
71  const MCSubtargetInfo &STI) const {
72  MCInst &HMB = const_cast<MCInst &>(MI);
73 
75  DEBUG(dbgs() << "Encoding bundle\n";);
76  *Addend = 0;
77  *Extended = false;
78  *CurrentBundle = &MI;
79  *CurrentIndex = 0;
80  size_t Last = HexagonMCInstrInfo::bundleSize(HMB) - 1;
81  for (auto &I : HexagonMCInstrInfo::bundleInstructions(HMB)) {
82  MCInst &HMI = const_cast<MCInst &>(*I.getInst());
83  verifyInstructionPredicates(HMI,
84  computeAvailableFeatures(STI.getFeatureBits()));
85 
86  EncodeSingleInstruction(HMI, OS, Fixups, STI,
87  parseBits(Last, HMB, HMI));
88  *Extended = HexagonMCInstrInfo::isImmext(HMI);
89  *Addend += HEXAGON_INSTR_SIZE;
90  ++*CurrentIndex;
91  }
92  return;
93 }
94 
95 static bool RegisterMatches(unsigned Consumer, unsigned Producer,
96  unsigned Producer2) {
97  if (Consumer == Producer)
98  return true;
99  if (Consumer == Producer2)
100  return true;
101  // Calculate if we're a single vector consumer referencing a double producer
102  if (Producer >= Hexagon::W0 && Producer <= Hexagon::W15)
103  if (Consumer >= Hexagon::V0 && Consumer <= Hexagon::V31)
104  return ((Consumer - Hexagon::V0) >> 1) == (Producer - Hexagon::W0);
105  return false;
106 }
107 
108 /// EncodeSingleInstruction - Emit a single
111  const MCSubtargetInfo &STI, uint32_t Parse) const {
113  uint64_t Binary;
114 
115  // Pseudo instructions don't get encoded and shouldn't be here
116  // in the first place!
117  assert(!HexagonMCInstrInfo::getDesc(MCII, MI).isPseudo() &&
118  "pseudo-instruction found");
119  DEBUG(dbgs() << "Encoding insn"
120  " `" << HexagonMCInstrInfo::getName(MCII, MI) << "'"
121  "\n");
122 
123  Binary = getBinaryCodeForInstr(MI, Fixups, STI);
124  // Check for unimplemented instructions. Immediate extenders
125  // are encoded as zero, so they need to be accounted for.
126  if (!Binary &&
127  MI.getOpcode() != DuplexIClass0 &&
128  MI.getOpcode() != A4_ext) {
129  DEBUG(dbgs() << "Unimplemented inst: "
130  " `" << HexagonMCInstrInfo::getName(MCII, MI) << "'"
131  "\n");
132  llvm_unreachable("Unimplemented Instruction");
133  }
134  Binary |= Parse;
135 
136  // if we need to emit a duplexed instruction
137  if (MI.getOpcode() >= Hexagon::DuplexIClass0 &&
138  MI.getOpcode() <= Hexagon::DuplexIClassF) {
140  "Emitting duplex without duplex parse bits");
141  unsigned dupIClass = MI.getOpcode() - Hexagon::DuplexIClass0;
142  // 29 is the bit position.
143  // 0b1110 =0xE bits are masked off and down shifted by 1 bit.
144  // Last bit is moved to bit position 13
145  Binary = ((dupIClass & 0xE) << (29 - 1)) | ((dupIClass & 0x1) << 13);
146 
147  const MCInst *subInst0 = MI.getOperand(0).getInst();
148  const MCInst *subInst1 = MI.getOperand(1).getInst();
149 
150  // get subinstruction slot 0
151  unsigned subInstSlot0Bits = getBinaryCodeForInstr(*subInst0, Fixups, STI);
152  // get subinstruction slot 1
153  unsigned subInstSlot1Bits = getBinaryCodeForInstr(*subInst1, Fixups, STI);
154 
155  Binary |= subInstSlot0Bits | (subInstSlot1Bits << 16);
156  }
157  support::endian::Writer<support::little>(OS).write<uint32_t>(Binary);
158  ++MCNumEmitted;
159 }
160 
161 namespace {
162 void raise_relocation_error(unsigned bits, unsigned kind) {
163  std::string Text;
164  {
165  llvm::raw_string_ostream Stream(Text);
166  Stream << "Unrecognized relocation combination bits: " << bits
167  << " kind: " << kind;
168  }
169  report_fatal_error(Text);
170 }
171 }
172 
173 /// getFixupNoBits - Some insns are not extended and thus have no
174 /// bits. These cases require a more brute force method for determining
175 /// the correct relocation.
176 Hexagon::Fixups HexagonMCCodeEmitter::getFixupNoBits(
177  MCInstrInfo const &MCII, const MCInst &MI, const MCOperand &MO,
178  const MCSymbolRefExpr::VariantKind kind) const {
179  const MCInstrDesc &MCID = HexagonMCInstrInfo::getDesc(MCII, MI);
180  unsigned insnType = llvm::HexagonMCInstrInfo::getType(MCII, MI);
181 
182  if (insnType == HexagonII::TypeEXTENDER) {
183  switch (kind) {
206 
208  auto Insts = HexagonMCInstrInfo::bundleInstructions(**CurrentBundle);
209  for (auto I = Insts.begin(), N = Insts.end(); I != N; ++I) {
210  if (I->getInst() == &MI) {
211  const MCInst &NextI = *(I+1)->getInst();
212  const MCInstrDesc &D = HexagonMCInstrInfo::getDesc(MCII, NextI);
213  if (D.isBranch() || D.isCall() ||
217  }
218  }
219  raise_relocation_error(0, kind);
220  }
221  default:
222  raise_relocation_error(0, kind);
223  }
224  } else if (MCID.isBranch())
226 
227  switch (MCID.getOpcode()) {
228  case Hexagon::HI:
229  case Hexagon::A2_tfrih:
230  switch (kind) {
249  default:
250  raise_relocation_error(0, kind);
251  }
252 
253  case Hexagon::LO:
254  case Hexagon::A2_tfril:
255  switch (kind) {
274  default:
275  raise_relocation_error(0, kind);
276  }
277 
278  // The only relocs left should be GP relative:
279  default:
280  if (MCID.mayStore() || MCID.mayLoad()) {
281  for (const MCPhysReg *ImpUses = MCID.getImplicitUses(); *ImpUses;
282  ++ImpUses) {
283  if (*ImpUses != Hexagon::GP)
284  continue;
285  switch (HexagonMCInstrInfo::getAccessSize(MCII, MI)) {
294  default:
295  raise_relocation_error(0, kind);
296  }
297  }
298  }
299  raise_relocation_error(0, kind);
300  }
301  llvm_unreachable("Relocation exit not taken");
302 }
303 
304 namespace llvm {
305 extern const MCInstrDesc HexagonInsts[];
306 }
307 
308 namespace {
309  bool isPCRel (unsigned Kind) {
310  switch(Kind){
329  return true;
330  default:
331  return false;
332  }
333  }
334 }
335 
336 unsigned HexagonMCCodeEmitter::getExprOpValue(const MCInst &MI,
337  const MCOperand &MO,
338  const MCExpr *ME,
340  const MCSubtargetInfo &STI) const
341 
342 {
343  if (isa<HexagonMCExpr>(ME))
344  ME = &HexagonMCInstrInfo::getExpr(*ME);
345  int64_t Value;
346  if (ME->evaluateAsAbsolute(Value))
347  return Value;
348  assert(ME->getKind() == MCExpr::SymbolRef ||
349  ME->getKind() == MCExpr::Binary);
350  if (ME->getKind() == MCExpr::Binary) {
351  MCBinaryExpr const *Binary = cast<MCBinaryExpr>(ME);
352  getExprOpValue(MI, MO, Binary->getLHS(), Fixups, STI);
353  getExprOpValue(MI, MO, Binary->getRHS(), Fixups, STI);
354  return 0;
355  }
358  const MCSymbolRefExpr *MCSRE = static_cast<const MCSymbolRefExpr *>(ME);
359  const MCInstrDesc &MCID = HexagonMCInstrInfo::getDesc(MCII, MI);
360  unsigned bits = HexagonMCInstrInfo::getExtentBits(MCII, MI) -
362  const MCSymbolRefExpr::VariantKind kind = MCSRE->getKind();
363 
364  DEBUG(dbgs() << "----------------------------------------\n");
365  DEBUG(dbgs() << "Opcode Name: " << HexagonMCInstrInfo::getName(MCII, MI)
366  << "\n");
367  DEBUG(dbgs() << "Opcode: " << MCID.getOpcode() << "\n");
368  DEBUG(dbgs() << "Relocation bits: " << bits << "\n");
369  DEBUG(dbgs() << "Addend: " << *Addend << "\n");
370  DEBUG(dbgs() << "----------------------------------------\n");
371 
372  switch (bits) {
373  default:
374  raise_relocation_error(bits, kind);
375  case 32:
376  switch (kind) {
378  FixupKind = *Extended ? Hexagon::fixup_Hexagon_DTPREL_32_6_X
380  break;
382  FixupKind = *Extended ? Hexagon::fixup_Hexagon_GOT_32_6_X
384  break;
386  FixupKind = *Extended ? Hexagon::fixup_Hexagon_GOTREL_32_6_X
388  break;
390  FixupKind = *Extended ? Hexagon::fixup_Hexagon_GD_GOT_32_6_X
392  break;
394  FixupKind = *Extended ? Hexagon::fixup_Hexagon_IE_32_6_X
396  break;
398  FixupKind = *Extended ? Hexagon::fixup_Hexagon_IE_GOT_32_6_X
400  break;
402  FixupKind = *Extended ? Hexagon::fixup_Hexagon_LD_GOT_32_6_X
404  break;
407  break;
409  FixupKind =
411  break;
413  FixupKind = *Extended ? Hexagon::fixup_Hexagon_TPREL_32_6_X
415  break;
416  default:
417  raise_relocation_error(bits, kind);
418  }
419  break;
420 
421  case 22:
422  switch (kind) {
424  FixupKind = *Extended ? Hexagon::fixup_Hexagon_GD_PLT_B22_PCREL_X
426  break;
428  FixupKind = *Extended ? Hexagon::fixup_Hexagon_LD_PLT_B22_PCREL_X
430  break;
432  FixupKind = *Extended ? Hexagon::fixup_Hexagon_B22_PCREL_X
434  break;
437  break;
438  default:
439  raise_relocation_error(bits, kind);
440  }
441  break;
442 
443  case 16:
444  if (*Extended) {
445  switch (kind) {
448  break;
451  break;
454  break;
457  break;
459  FixupKind = Hexagon::fixup_Hexagon_IE_16_X;
460  break;
463  break;
466  break;
468  FixupKind = Hexagon::fixup_Hexagon_16_X;
469  break;
472  break;
473  default:
474  raise_relocation_error(bits, kind);
475  }
476  } else
477  switch (kind) {
480  FixupKind = Hexagon::fixup_Hexagon_27_REG;
481  else
482  if (MCID.mayStore() || MCID.mayLoad()) {
483  for (const MCPhysReg *ImpUses = MCID.getImplicitUses(); *ImpUses;
484  ++ImpUses) {
485  if (*ImpUses != Hexagon::GP)
486  continue;
487  switch (HexagonMCInstrInfo::getAccessSize(MCII, MI)) {
489  FixupKind = fixup_Hexagon_GPREL16_0;
490  break;
492  FixupKind = fixup_Hexagon_GPREL16_1;
493  break;
495  FixupKind = fixup_Hexagon_GPREL16_2;
496  break;
498  FixupKind = fixup_Hexagon_GPREL16_3;
499  break;
500  default:
501  raise_relocation_error(bits, kind);
502  }
503  }
504  } else
505  raise_relocation_error(bits, kind);
506  break;
507  }
510  break;
512  if (MCID.getOpcode() == Hexagon::HI)
514  else
516  break;
519  break;
522  break;
524  FixupKind = Hexagon::fixup_Hexagon_HI16;
525  break;
528  break;
531  break;
533  FixupKind = Hexagon::fixup_Hexagon_LO16;
534  break;
537  break;
538  default:
539  raise_relocation_error(bits, kind);
540  }
541  break;
542 
543  case 15:
544  switch (kind) {
546  FixupKind = *Extended ? Hexagon::fixup_Hexagon_B15_PCREL_X
548  break;
549  default:
550  raise_relocation_error(bits, kind);
551  }
552  break;
553 
554  case 13:
555  switch (kind) {
558  break;
559  default:
560  raise_relocation_error(bits, kind);
561  }
562  break;
563 
564  case 12:
565  if (*Extended)
566  switch (kind) {
567  // There isn't a GOT_12_X, both 11_X and 16_X resolve to 6/26
570  break;
573  break;
575  FixupKind = Hexagon::fixup_Hexagon_12_X;
576  break;
577  default:
578  raise_relocation_error(bits, kind);
579  }
580  else
581  raise_relocation_error(bits, kind);
582  break;
583 
584  case 11:
585  if (*Extended)
586  switch (kind) {
589  break;
592  break;
595  break;
598  break;
601  break;
604  break;
607  break;
610  break;
612  FixupKind = Hexagon::fixup_Hexagon_11_X;
613  break;
616  break;
617  default:
618  raise_relocation_error(bits, kind);
619  }
620  else {
621  switch (kind) {
624  break;
625  default:
626  raise_relocation_error(bits, kind);
627  }
628  }
629  break;
630 
631  case 10:
632  if (*Extended) {
633  switch (kind) {
635  FixupKind = Hexagon::fixup_Hexagon_10_X;
636  break;
637  default:
638  raise_relocation_error(bits, kind);
639  }
640  } else
641  raise_relocation_error(bits, kind);
642  break;
643 
644  case 9:
645  if (MCID.isBranch() ||
647  FixupKind = *Extended ? Hexagon::fixup_Hexagon_B9_PCREL_X
649  else if (*Extended)
650  FixupKind = Hexagon::fixup_Hexagon_9_X;
651  else
652  raise_relocation_error(bits, kind);
653  break;
654 
655  case 8:
656  if (*Extended)
657  FixupKind = Hexagon::fixup_Hexagon_8_X;
658  else
659  raise_relocation_error(bits, kind);
660  break;
661 
662  case 7:
663  if (MCID.isBranch() ||
665  FixupKind = *Extended ? Hexagon::fixup_Hexagon_B7_PCREL_X
667  else if (*Extended)
668  FixupKind = Hexagon::fixup_Hexagon_7_X;
669  else
670  raise_relocation_error(bits, kind);
671  break;
672 
673  case 6:
674  if (*Extended) {
675  switch (kind) {
678  break;
679  // This is part of an extender, GOT_11 is a
680  // Word32_U6 unsigned/truncated reloc.
683  break;
686  break;
689  break;
692  break;
694  FixupKind = Hexagon::fixup_Hexagon_6_X;
695  break;
696  default:
697  raise_relocation_error(bits, kind);
698  }
699  } else
700  raise_relocation_error(bits, kind);
701  break;
702 
703  case 0:
704  FixupKind = getFixupNoBits(MCII, MI, MO, kind);
705  break;
706  }
707 
708  MCExpr const *FixupExpression =
709  (*Addend > 0 && isPCRel(FixupKind))
711  MCConstantExpr::create(*Addend, MCT), MCT)
712  : MO.getExpr();
713 
714  MCFixup fixup = MCFixup::create(*Addend, FixupExpression,
715  MCFixupKind(FixupKind), MI.getLoc());
716  Fixups.push_back(fixup);
717  // All of the information is in the fixup.
718  return 0;
719 }
720 
721 unsigned
723  SmallVectorImpl<MCFixup> &Fixups,
724  MCSubtargetInfo const &STI) const {
725 #ifndef NDEBUG
726  size_t OperandNumber = ~0U;
727  for (unsigned i = 0, n = MI.getNumOperands(); i < n; ++i)
728  if (&MI.getOperand(i) == &MO) {
729  OperandNumber = i;
730  break;
731  }
732  assert((OperandNumber != ~0U) && "Operand not found");
733 #endif
734 
735  if (HexagonMCInstrInfo::isNewValue(MCII, MI) &&
736  &MO == &MI.getOperand(HexagonMCInstrInfo::getNewValueOp(MCII, MI))) {
737  // Calculate the new value distance to the associated producer
738  MCOperand const &MCO =
740  unsigned SOffset = 0;
741  unsigned VOffset = 0;
742  unsigned Register = MCO.getReg();
743  unsigned Register1;
744  unsigned Register2;
745  auto Instructions = HexagonMCInstrInfo::bundleInstructions(**CurrentBundle);
746  auto i = Instructions.begin() + *CurrentIndex - 1;
747  for (;; --i) {
748  assert(i != Instructions.begin() - 1 && "Couldn't find producer");
749  MCInst const &Inst = *i->getInst();
751  continue;
752  ++SOffset;
753  if (HexagonMCInstrInfo::isVector(MCII, Inst))
754  // Vector instructions don't count scalars
755  ++VOffset;
756  Register1 =
759  : static_cast<unsigned>(Hexagon::NoRegister);
760  Register2 =
763  : static_cast<unsigned>(Hexagon::NoRegister);
764  if (!RegisterMatches(Register, Register1, Register2))
765  // This isn't the register we're looking for
766  continue;
767  if (!HexagonMCInstrInfo::isPredicated(MCII, Inst))
768  // Producer is unpredicated
769  break;
771  "Unpredicated consumer depending on predicated producer");
772  if (HexagonMCInstrInfo::isPredicatedTrue(MCII, Inst) ==
774  // Producer predicate sense matched ours
775  break;
776  }
777  // Hexagon PRM 10.11 Construct Nt from distance
778  unsigned Offset =
779  HexagonMCInstrInfo::isVector(MCII, MI) ? VOffset : SOffset;
780  Offset <<= 1;
781  Offset |=
782  HexagonMCInstrInfo::SubregisterBit(Register, Register1, Register2);
783  return Offset;
784  }
785  assert(!MO.isImm());
786  if (MO.isReg()) {
787  unsigned Reg = MO.getReg();
791  return MCT.getRegisterInfo()->getEncodingValue(Reg);
792  }
793 
794  return getExprOpValue(MI, MO, MO.getExpr(), Fixups, STI);
795 }
796 
798  MCRegisterInfo const &MRI,
799  MCContext &MCT) {
800  return new HexagonMCCodeEmitter(MII, MCT);
801 }
802 
803 #define ENABLE_INSTR_PREDICATE_VERIFIER
804 #include "HexagonGenMCCodeEmitter.inc"
bool isDuplex(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned short getNewValueOp(MCInstrInfo const &MCII, MCInst const &MCI)
STATISTIC(NumFunctions,"Total number of functions")
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:103
bool isReg() const
Definition: MCInst.h:58
bool mayStore() const
Return true if this instruction could possibly modify memory.
Definition: MCInstrDesc.h:393
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:163
ExprKind getKind() const
Definition: MCExpr.h:73
bool isBundle(MCInst const &MCI)
uint64_t getBinaryCodeForInstr(MCInst const &MI, SmallVectorImpl< MCFixup > &Fixups, MCSubtargetInfo const &STI) const
demanded bits
uint32_t parseBits(size_t Last, MCInst const &MCB, MCInst const &MCI) const
bool isSubInstruction(MCInst const &MCI)
bool isOuterLoop(MCInst const &MCI)
static Lanai::Fixups FixupKind(const MCExpr *Expr)
bool isNewValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn expects newly produced value.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:66
MCCodeEmitter * createHexagonMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &MCT)
bool isImmext(MCInst const &MCI)
void EncodeSingleInstruction(const MCInst &MI, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI, uint32_t Parse) const
EncodeSingleInstruction - Emit a single.
MCOperand const & getNewValueOperand2(MCInstrInfo const &MCII, MCInst const &MCI)
bool isBranch() const
Returns true if this is a conditional, unconditional, or indirect branch.
Definition: MCInstrDesc.h:270
bool isCall() const
Return true if the instruction is a call.
Definition: MCInstrDesc.h:251
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:36
const MCInstrDesc HexagonInsts[]
Reg
All possible values of the reg field in the ModR/M byte.
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:165
iterator_range< Hexagon::PacketIterator > bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI)
bool s27_2_reloc(MCExpr const &Expr)
StringRef getName(MCInstrInfo const &MCII, MCInst const &MCI)
Context object for machine code objects.
Definition: MCContext.h:59
unsigned getReg() const
Returns the register number.
Definition: MCInst.h:65
bool hasNewValue2(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn produces a second value.
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:443
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:159
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
bool isImm() const
Definition: MCInst.h:59
void encodeInstruction(MCInst const &MI, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups, MCSubtargetInfo const &STI) const override
EncodeInstruction - Emit the bundle.
const MCExpr * getExpr() const
Definition: MCInst.h:96
Function Alias Analysis false
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
Definition: MCExpr.h:546
unsigned const MachineRegisterInfo * MRI
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:22
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:23
MCExpr const & getExpr(MCExpr const &Expr)
SMLoc getLoc() const
Definition: MCInst.h:171
Definition for classes that emit Hexagon machine code from MCInsts.
Binary assembler expressions.
Definition: MCExpr.h:399
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
Definition: MCFixup.h:82
unsigned SubregisterBit(unsigned Consumer, unsigned Producer, unsigned Producer2)
unsigned getOpcode() const
Return the opcode number for this descriptor.
Definition: MCInstrDesc.h:203
void fixup(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
Adjusts a value to fix up the immediate of an LDI Rd, K instruction.
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
Promote Memory to Register
Definition: Mem2Reg.cpp:101
const size_t N
bool mayLoad() const
Return true if this instruction could possibly read memory.
Definition: MCInstrDesc.h:387
HexagonII::MemAccessSize getAccessSize(MCInstrInfo const &MCII, MCInst const &MCI)
const FeatureBitset & getFeatureBits() const
getFeatureBits - Return the feature bits.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
unsigned getOpcode() const
Definition: MCInst.h:168
bool isPredicated(MCInstrInfo const &MCII, MCInst const &MCI)
HexagonMCCodeEmitter(MCInstrInfo const &aMII, MCContext &aMCT)
llvm_unreachable("Unknown RegBank!")
const MCRegisterInfo * getRegisterInfo() const
Definition: MCContext.h:285
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
Definition: MCExpr.h:549
unsigned getNumOperands() const
Definition: MCInst.h:175
#define I(x, y, z)
Definition: MD5.cpp:58
MCSubtargetInfo - Generic base class for all target subtargets.
const MCInst * getInst() const
Definition: MCInst.h:106
References to labels and assigned expressions.
Definition: MCExpr.h:41
MCInstrDesc const & getDesc(MCInstrInfo const &MCII, MCInst const &MCI)
const MCPhysReg * getImplicitUses() const
Return a list of registers that are potentially read by any instance of this machine instruction...
Definition: MCInstrDesc.h:512
size_t bundleSize(MCInst const &MCI)
const unsigned Kind
VariantKind getKind() const
Definition: MCExpr.h:320
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isInnerLoop(MCInst const &MCI)
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:463
#define HEXAGON_INSTR_SIZE
Definition: Hexagon.h:30
aarch64 promote const
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
LLVM Value Representation.
Definition: Value.h:73
static bool RegisterMatches(unsigned Consumer, unsigned Producer, unsigned Producer2)
Binary expressions.
Definition: MCExpr.h:39
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
#define DEBUG(X)
Definition: Debug.h:118
unsigned getDuplexRegisterNumbering(unsigned Reg)
IRTranslator LLVM IR MI
bool hasNewValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn produces a value.
unsigned getType(MCInstrInfo const &MCII, MCInst const &MCI)
Return the Hexagon ISA class for the insn.
unsigned getExtentAlignment(MCInstrInfo const &MCII, MCInst const &MCI)
Instances of this class represent operands of the MCInst class.
Definition: MCInst.h:35
bool isPredicatedTrue(MCInstrInfo const &MCII, MCInst const &MCI)
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
Definition: MCExpr.cpp:159
#define D
Definition: LargeTest.cpp:26
unsigned getMachineOpValue(MCInst const &MI, MCOperand const &MO, SmallVectorImpl< MCFixup > &Fixups, MCSubtargetInfo const &STI) const
Return binary encoding of operand.
const MCOperand & getOperand(unsigned i) const
Definition: MCInst.h:173
MCOperand const & getNewValueOperand(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned getExtentBits(MCInstrInfo const &MCII, MCInst const &MCI)