Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
PPCMCCodeEmitter.cpp
Go to the documentation of this file.
1//===-- PPCMCCodeEmitter.cpp - Convert PPC code to machine code -----------===//
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//
9// This file implements the PPCMCCodeEmitter class.
10//
11//===----------------------------------------------------------------------===//
12
13#include "PPCMCCodeEmitter.h"
15#include "PPCMCAsmInfo.h"
16#include "PPCMCTargetDesc.h"
18#include "llvm/ADT/Statistic.h"
19#include "llvm/MC/MCExpr.h"
20#include "llvm/MC/MCFixup.h"
21#include "llvm/MC/MCInstrDesc.h"
27#include <cassert>
28#include <cstdint>
29
30using namespace llvm;
31
32#define DEBUG_TYPE "mccodeemitter"
33
34STATISTIC(MCNumEmitted, "Number of MC instructions emitted");
35
37 MCContext &Ctx) {
38 return new PPCMCCodeEmitter(MCII, Ctx);
39}
40
42 const MCExpr *Value, uint16_t Kind) {
43 bool PCRel = false;
44 switch (Kind) {
49 PCRel = true;
50 }
51 Fixups.push_back(MCFixup::create(Offset, Value, Kind, PCRel));
52}
53
55getDirectBrEncoding(const MCInst &MI, unsigned OpNo,
57 const MCSubtargetInfo &STI) const {
58 const MCOperand &MO = MI.getOperand(OpNo);
59
60 if (MO.isReg() || MO.isImm())
61 return getMachineOpValue(MI, MO, Fixups, STI);
62
63 // Add a fixup for the branch target.
65 Fixups, 0, MO.getExpr(),
67 return 0;
68}
69
70/// Check if Opcode corresponds to a call instruction that should be marked
71/// with the NOTOC relocation.
73 unsigned Opcode = MI.getOpcode();
74 if (!MCII.get(Opcode).isCall())
75 return false;
76
77 switch (Opcode) {
78 default:
79#ifndef NDEBUG
80 llvm_unreachable("Unknown call opcode");
81#endif
82 return false;
83 case PPC::BL8_NOTOC:
84 case PPC::BL8_NOTOC_TLS:
85 case PPC::BL8_NOTOC_RM:
86 return true;
87#ifndef NDEBUG
88 case PPC::BL8:
89 case PPC::BL:
90 case PPC::BL8_TLS:
91 case PPC::BL_TLS:
92 case PPC::BLA8:
93 case PPC::BLA:
94 case PPC::BCCL:
95 case PPC::BCCLA:
96 case PPC::BCL:
97 case PPC::BCLn:
98 case PPC::BL8_NOP:
99 case PPC::BL_NOP:
100 case PPC::BL8_NOP_TLS:
101 case PPC::BLA8_NOP:
102 case PPC::BCTRL8:
103 case PPC::BCTRL:
104 case PPC::BCCCTRL8:
105 case PPC::BCCCTRL:
106 case PPC::BCCTRL8:
107 case PPC::BCCTRL:
108 case PPC::BCCTRL8n:
109 case PPC::BCCTRLn:
110 case PPC::BL8_RM:
111 case PPC::BLA8_RM:
112 case PPC::BL8_NOP_RM:
113 case PPC::BLA8_NOP_RM:
114 case PPC::BCTRL8_RM:
115 case PPC::BCTRL8_LDinto_toc:
116 case PPC::BCTRL8_LDinto_toc_RM:
117 case PPC::BL8_TLS_:
118 case PPC::TCRETURNdi8:
119 case PPC::TCRETURNai8:
120 case PPC::TCRETURNri8:
121 case PPC::TAILBCTR8:
122 case PPC::TAILB8:
123 case PPC::TAILBA8:
124 case PPC::BCLalways:
125 case PPC::BLRL:
126 case PPC::BCCLRL:
127 case PPC::BCLRL:
128 case PPC::BCLRLn:
129 case PPC::BDZL:
130 case PPC::BDNZL:
131 case PPC::BDZLA:
132 case PPC::BDNZLA:
133 case PPC::BDZLp:
134 case PPC::BDNZLp:
135 case PPC::BDZLAp:
136 case PPC::BDNZLAp:
137 case PPC::BDZLm:
138 case PPC::BDNZLm:
139 case PPC::BDZLAm:
140 case PPC::BDNZLAm:
141 case PPC::BDZLRL:
142 case PPC::BDNZLRL:
143 case PPC::BDZLRLp:
144 case PPC::BDNZLRLp:
145 case PPC::BDZLRLm:
146 case PPC::BDNZLRLm:
147 case PPC::BL_RM:
148 case PPC::BLA_RM:
149 case PPC::BL_NOP_RM:
150 case PPC::BCTRL_RM:
151 case PPC::TCRETURNdi:
152 case PPC::TCRETURNai:
153 case PPC::TCRETURNri:
154 case PPC::BCTRL_LWZinto_toc:
155 case PPC::BCTRL_LWZinto_toc_RM:
156 case PPC::TAILBCTR:
157 case PPC::TAILB:
158 case PPC::TAILBA:
159 return false;
160#endif
161 }
162}
163
164unsigned PPCMCCodeEmitter::getCondBrEncoding(const MCInst &MI, unsigned OpNo,
166 const MCSubtargetInfo &STI) const {
167 const MCOperand &MO = MI.getOperand(OpNo);
168 if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups, STI);
169
170 // Add a fixup for the branch target.
171 addFixup(Fixups, 0, MO.getExpr(), PPC::fixup_ppc_brcond14);
172 return 0;
173}
174
176getAbsDirectBrEncoding(const MCInst &MI, unsigned OpNo,
178 const MCSubtargetInfo &STI) const {
179 const MCOperand &MO = MI.getOperand(OpNo);
180 if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups, STI);
181
182 // Add a fixup for the branch target.
183 addFixup(Fixups, 0, MO.getExpr(), PPC::fixup_ppc_br24abs);
184 return 0;
185}
186
188getAbsCondBrEncoding(const MCInst &MI, unsigned OpNo,
190 const MCSubtargetInfo &STI) const {
191 const MCOperand &MO = MI.getOperand(OpNo);
192 if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups, STI);
193
194 // Add a fixup for the branch target.
196 return 0;
197}
198
199unsigned
202 const MCSubtargetInfo &STI) const {
203 assert(MI.getOperand(OpNo).isReg() && "Operand should be a register");
204 unsigned RegBits = getMachineOpValue(MI, MI.getOperand(OpNo), Fixups, STI)
205 << 1;
206 return RegBits;
207}
208
209unsigned PPCMCCodeEmitter::getImm16Encoding(const MCInst &MI, unsigned OpNo,
211 const MCSubtargetInfo &STI) const {
212 const MCOperand &MO = MI.getOperand(OpNo);
213 if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups, STI);
214
215 // Add a fixup for the immediate field.
216 addFixup(Fixups, IsLittleEndian ? 0 : 2, MO.getExpr(), PPC::fixup_ppc_half16);
217 return 0;
218}
219
222 const MCSubtargetInfo &STI,
223 MCFixupKind Fixup) const {
224 const MCOperand &MO = MI.getOperand(OpNo);
225 assert(!MO.isReg() && "Not expecting a register for this operand.");
226 if (MO.isImm())
227 return getMachineOpValue(MI, MO, Fixups, STI);
228
229 // Add a fixup for the immediate field.
230 addFixup(Fixups, 0, MO.getExpr(), Fixup);
231 return 0;
232}
233
237 const MCSubtargetInfo &STI) const {
238 return getImm34Encoding(MI, OpNo, Fixups, STI, PPC::fixup_ppc_imm34);
239}
240
244 const MCSubtargetInfo &STI) const {
245 return getImm34Encoding(MI, OpNo, Fixups, STI, PPC::fixup_ppc_pcrel34);
246}
247
248unsigned PPCMCCodeEmitter::getDispRIEncoding(const MCInst &MI, unsigned OpNo,
250 const MCSubtargetInfo &STI) const {
251 const MCOperand &MO = MI.getOperand(OpNo);
252 if (MO.isImm())
253 return getMachineOpValue(MI, MO, Fixups, STI) & 0xFFFF;
254
255 // Add a fixup for the displacement field.
256 addFixup(Fixups, IsLittleEndian ? 0 : 2, MO.getExpr(), PPC::fixup_ppc_half16);
257 return 0;
258}
259
260unsigned
263 const MCSubtargetInfo &STI) const {
264 const MCOperand &MO = MI.getOperand(OpNo);
265 if (MO.isImm())
266 return ((getMachineOpValue(MI, MO, Fixups, STI) >> 2) & 0x3FFF);
267
268 // Add a fixup for the displacement field.
269 addFixup(Fixups, IsLittleEndian ? 0 : 2, MO.getExpr(),
271 return 0;
272}
273
274unsigned
277 const MCSubtargetInfo &STI) const {
278 const MCOperand &MO = MI.getOperand(OpNo);
279 if (MO.isImm()) {
280 assert(!(MO.getImm() % 16) &&
281 "Expecting an immediate that is a multiple of 16");
282 return ((getMachineOpValue(MI, MO, Fixups, STI) >> 4) & 0xFFF);
283 }
284
285 // Otherwise add a fixup for the displacement field.
286 addFixup(Fixups, IsLittleEndian ? 0 : 2, MO.getExpr(),
288 return 0;
289}
290
291unsigned
294 const MCSubtargetInfo &STI) const {
295 // Encode imm for the hash load/store to stack for the ROP Protection
296 // instructions.
297 const MCOperand &MO = MI.getOperand(OpNo);
298
299 assert(MO.isImm() && "Expecting an immediate operand.");
300 assert(!(MO.getImm() % 8) && "Expecting offset to be 8 byte aligned.");
301
302 unsigned DX = (MO.getImm() >> 3) & 0x3F;
303 return DX;
304}
305
309 const MCSubtargetInfo &STI) const {
310 // Encode the displacement part of pc-relative memri34, which is an imm34.
311 // The 34 bit immediate can fall into one of three cases:
312 // 1) It is a relocation to be filled in by the linker represented as:
313 // (MCExpr::SymbolRef)
314 // 2) It is a relocation + SignedOffset represented as:
315 // (MCExpr::Binary(MCExpr::SymbolRef + MCExpr::Constant))
316 // 3) It is a known value at compile time.
317
318 // If this is not a MCExpr then we are in case 3) and we are dealing with
319 // a value known at compile time, not a relocation.
320 const MCOperand &MO = MI.getOperand(OpNo);
321 if (!MO.isExpr())
322 return (getMachineOpValue(MI, MO, Fixups, STI)) & 0x3FFFFFFFFUL;
323
324 // At this point in the function it is known that MO is of type MCExpr.
325 // Therefore we are dealing with either case 1) a symbol ref or
326 // case 2) a symbol ref plus a constant.
327 const MCExpr *Expr = MO.getExpr();
328 switch (Expr->getKind()) {
329 default:
330 llvm_unreachable("Unsupported MCExpr for getMemRI34PCRelEncoding.");
331 case MCExpr::SymbolRef: {
332 // Relocation alone.
333 const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(Expr);
334 (void)SRE;
335 // Currently these are the only valid PCRelative Relocations.
338 SRE->getSpecifier()) &&
339 "specifier must be S_PCREL, S_GOT_PCREL, S_GOT_TLSGD_PCREL, "
340 "S_GOT_TLSLD_PCREL, or S_GOT_TPREL_PCREL");
341 // Generate the fixup for the relocation.
342 addFixup(Fixups, 0, Expr, PPC::fixup_ppc_pcrel34);
343 // Put zero in the location of the immediate. The linker will fill in the
344 // correct value based on the relocation.
345 return 0;
346 }
347 case MCExpr::Binary: {
348 // Relocation plus some offset.
349 const MCBinaryExpr *BE = cast<MCBinaryExpr>(Expr);
351 "Binary expression opcode must be an add.");
352
353 const MCExpr *LHS = BE->getLHS();
354 const MCExpr *RHS = BE->getRHS();
355
356 // Need to check in both directions. Reloc+Offset and Offset+Reloc.
357 if (LHS->getKind() != MCExpr::SymbolRef)
358 std::swap(LHS, RHS);
359
360 if (LHS->getKind() != MCExpr::SymbolRef ||
361 RHS->getKind() != MCExpr::Constant)
362 llvm_unreachable("Expecting to have one constant and one relocation.");
363
364 const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(LHS);
365 (void)SRE;
366 assert(isInt<34>(cast<MCConstantExpr>(RHS)->getValue()) &&
367 "Value must fit in 34 bits.");
368
369 // Currently these are the only valid PCRelative Relocations.
372 "VariantKind must be VK_PCREL or VK_GOT_PCREL");
373 // Generate the fixup for the relocation.
374 addFixup(Fixups, 0, Expr, PPC::fixup_ppc_pcrel34);
375 // Put zero in the location of the immediate. The linker will fill in the
376 // correct value based on the relocation.
377 return 0;
378 }
379 }
380}
381
385 const MCSubtargetInfo &STI) const {
386 // Encode the displacement part of a memri34.
387 const MCOperand &MO = MI.getOperand(OpNo);
388 return (getMachineOpValue(MI, MO, Fixups, STI)) & 0x3FFFFFFFFUL;
389}
390
391unsigned
394 const MCSubtargetInfo &STI) const {
395 // Encode imm as a dispSPE8, which has the low 5-bits of (imm / 8).
396 const MCOperand &MO = MI.getOperand(OpNo);
397 assert(MO.isImm());
398 return getMachineOpValue(MI, MO, Fixups, STI) >> 3;
399}
400
401unsigned
404 const MCSubtargetInfo &STI) const {
405 // Encode imm as a dispSPE8, which has the low 5-bits of (imm / 4).
406 const MCOperand &MO = MI.getOperand(OpNo);
407 assert(MO.isImm());
408 return getMachineOpValue(MI, MO, Fixups, STI) >> 2;
409}
410
411unsigned
414 const MCSubtargetInfo &STI) const {
415 // Encode imm as a dispSPE8, which has the low 5-bits of (imm / 2).
416 const MCOperand &MO = MI.getOperand(OpNo);
417 assert(MO.isImm());
418 return getMachineOpValue(MI, MO, Fixups, STI) >> 1;
419}
420
421unsigned PPCMCCodeEmitter::getTLSRegEncoding(const MCInst &MI, unsigned OpNo,
423 const MCSubtargetInfo &STI) const {
424 const MCOperand &MO = MI.getOperand(OpNo);
425 if (MO.isReg()) return getMachineOpValue(MI, MO, Fixups, STI);
426
427 // Add a fixup for the TLS register, which simply provides a relocation
428 // hint to the linker that this statement is part of a relocation sequence.
429 // Return the thread-pointer register's encoding. Add a one byte displacement
430 // if using PC relative memops.
431 const MCExpr *Expr = MO.getExpr();
432 const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(Expr);
433 bool IsPCRel = getSpecifier(SRE) == PPC::S_TLS_PCREL;
434 addFixup(Fixups, IsPCRel ? 1 : 0, Expr, PPC::fixup_ppc_nofixup);
435 const Triple &TT = STI.getTargetTriple();
436 bool isPPC64 = TT.isPPC64();
437 return CTX.getRegisterInfo()->getEncodingValue(isPPC64 ? PPC::X13 : PPC::R2);
438}
439
440unsigned PPCMCCodeEmitter::getTLSCallEncoding(const MCInst &MI, unsigned OpNo,
442 const MCSubtargetInfo &STI) const {
443 // For special TLS calls, we need two fixups; one for the branch target
444 // (__tls_get_addr), which we create via getDirectBrEncoding as usual,
445 // and one for the TLSGD or TLSLD symbol, which is emitted here.
446 const MCOperand &MO = MI.getOperand(OpNo+1);
447 addFixup(Fixups, 0, MO.getExpr(), PPC::fixup_ppc_nofixup);
448 return getDirectBrEncoding(MI, OpNo, Fixups, STI);
449}
450
452get_crbitm_encoding(const MCInst &MI, unsigned OpNo,
454 const MCSubtargetInfo &STI) const {
455 const MCOperand &MO = MI.getOperand(OpNo);
456 assert((MI.getOpcode() == PPC::MTOCRF || MI.getOpcode() == PPC::MTOCRF8 ||
457 MI.getOpcode() == PPC::MFOCRF || MI.getOpcode() == PPC::MFOCRF8) &&
458 (MO.getReg() >= PPC::CR0 && MO.getReg() <= PPC::CR7));
459 return 0x80 >> CTX.getRegisterInfo()->getEncodingValue(MO.getReg());
460}
461
462// Get the index for this operand in this instruction. This is needed for
463// computing the register number in PPC::getRegNumForOperand() for
464// any instructions that use a different numbering scheme for registers in
465// different operands.
466static unsigned getOpIdxForMO(const MCInst &MI, const MCOperand &MO) {
467 for (unsigned i = 0; i < MI.getNumOperands(); i++) {
468 const MCOperand &Op = MI.getOperand(i);
469 if (&Op == &MO)
470 return i;
471 }
472 llvm_unreachable("This operand is not part of this instruction");
473 return ~0U; // Silence any warnings about no return.
474}
475
477getMachineOpValue(const MCInst &MI, const MCOperand &MO,
479 const MCSubtargetInfo &STI) const {
480 if (MO.isReg()) {
481 // MTOCRF/MFOCRF should go through get_crbitm_encoding for the CR operand.
482 // The GPR operand should come through here though.
483 assert((MI.getOpcode() != PPC::MTOCRF && MI.getOpcode() != PPC::MTOCRF8 &&
484 MI.getOpcode() != PPC::MFOCRF && MI.getOpcode() != PPC::MFOCRF8) ||
485 MO.getReg() < PPC::CR0 || MO.getReg() > PPC::CR7);
486 unsigned OpNo = getOpIdxForMO(MI, MO);
487 MCRegister Reg =
488 PPC::getRegNumForOperand(MCII.get(MI.getOpcode()), MO.getReg(), OpNo);
489 return CTX.getRegisterInfo()->getEncodingValue(Reg);
490 }
491
492 assert(MO.isImm() &&
493 "Relocation required in an instruction that we cannot encode!");
494 return MO.getImm();
495}
496
500 const MCSubtargetInfo &STI) const {
501 uint64_t Bits = getBinaryCodeForInstr(MI, Fixups, STI);
502
503 // Output the constant in big/little endian byte order.
504 unsigned Size = getInstSizeInBytes(MI);
507 switch (Size) {
508 case 0:
509 break;
510 case 4:
512 break;
513 case 8:
514 // If we emit a pair of instructions, the first one is
515 // always in the top 32 bits, even on little-endian.
516 support::endian::write<uint32_t>(CB, Bits >> 32, E);
518 break;
519 default:
520 llvm_unreachable("Invalid instruction size");
521 }
522
523 ++MCNumEmitted; // Keep track of the # of mi's emitted.
524}
525
526// Get the number of bytes used to encode the given MCInst.
528 unsigned Opcode = MI.getOpcode();
529 const MCInstrDesc &Desc = MCII.get(Opcode);
530 return Desc.getSize();
531}
532
534 return MCII.get(MI.getOpcode()).TSFlags & PPCII::Prefixed;
535}
536
537#include "PPCGenMCCodeEmitter.inc"
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
IRTranslator LLVM IR MI
static unsigned getOpIdxForMO(const MCInst &MI, const MCOperand &MO)
PowerPC TLS Dynamic Call Fixup
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Definition Statistic.h:171
Binary assembler expressions.
Definition MCExpr.h:299
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
Definition MCExpr.h:446
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
Definition MCExpr.h:449
Opcode getOpcode() const
Get the kind of this binary expression.
Definition MCExpr.h:443
@ Add
Addition.
Definition MCExpr.h:302
MCCodeEmitter - Generic instruction encoding interface.
Context object for machine code objects.
Definition MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
@ Constant
Constant expressions.
Definition MCExpr.h:42
@ SymbolRef
References to labels and assigned expressions.
Definition MCExpr.h:43
@ Binary
Binary expressions.
Definition MCExpr.h:41
ExprKind getKind() const
Definition MCExpr.h:85
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, bool PCRel=false)
Consider bit fields if we need more flags.
Definition MCFixup.h:86
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Describe properties that are true of each instruction in the target description file.
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
int64_t getImm() const
Definition MCInst.h:84
bool isImm() const
Definition MCInst.h:66
bool isReg() const
Definition MCInst.h:65
MCRegister getReg() const
Returns the register number.
Definition MCInst.h:73
const MCExpr * getExpr() const
Definition MCInst.h:118
bool isExpr() const
Definition MCInst.h:69
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:33
Generic base class for all target subtargets.
const Triple & getTargetTriple() const
Represent a reference to a symbol from inside an expression.
Definition MCExpr.h:190
uint16_t getSpecifier() const
Definition MCExpr.h:233
unsigned getDispSPE2Encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
unsigned getAbsDirectBrEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
uint64_t getImm34EncodingNoPCRel(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
unsigned getDispRIHashEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
uint64_t getDispRI34Encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
unsigned getDirectBrEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
unsigned getDispRIXEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
unsigned getDispSPE8Encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
void encodeInstruction(const MCInst &MI, SmallVectorImpl< char > &CB, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const override
Encode the given Inst to bytes and append to CB.
unsigned getTLSRegEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
bool isNoTOCCallInstr(const MCInst &MI) const
Check if Opcode corresponds to a call instruction that should be marked with the NOTOC relocation.
unsigned getDispRIX16Encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
uint64_t getDispRI34PCRelEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
bool isPrefixedInstruction(const MCInst &MI) const
unsigned getDispSPE4Encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
unsigned getAbsCondBrEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
unsigned getDispRIEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
uint64_t getImm34EncodingPCRel(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
uint64_t getMachineOpValue(const MCInst &MI, const MCOperand &MO, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
getMachineOpValue - Return binary encoding of operand.
unsigned getImm16Encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
unsigned getVSRpEvenEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
uint64_t getBinaryCodeForInstr(const MCInst &MI, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
uint64_t getImm34Encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI, MCFixupKind Fixup) const
unsigned getInstSizeInBytes(const MCInst &MI) const
unsigned getCondBrEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
unsigned getTLSCallEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
unsigned get_crbitm_encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
LLVM Value Representation.
Definition Value.h:75
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ Prefixed
This instruction is prefixed.
MCRegister getRegNumForOperand(const MCInstrDesc &Desc, MCRegister Reg, unsigned OpNo)
getRegNumForOperand - some operands use different numbering schemes for the same registers.
@ fixup_ppc_brcond14abs
14-bit absolute relocation for conditional branches.
@ fixup_ppc_half16
A 16-bit fixup corresponding to lo16(_foo) or ha16(_foo) for instrs like 'li' or 'addis'.
@ fixup_ppc_br24_notoc
@ fixup_ppc_brcond14
14-bit PC relative relocation for conditional branches.
@ fixup_ppc_half16dq
A 16-bit fixup corresponding to lo16(_foo) with implied 3 zero bits for instrs like 'lxv'.
@ fixup_ppc_half16ds
A 14-bit fixup corresponding to lo16(_foo) with implied 2 zero bits for instrs like 'std'.
@ fixup_ppc_nofixup
Not a true fixup, but ties a symbol to a call to __tls_get_addr for the TLS general and local dynamic...
@ fixup_ppc_br24abs
24-bit absolute relocation for direct branches like 'ba' and 'bla'.
@ S_GOT_TLSGD_PCREL
@ S_GOT_TPREL_PCREL
@ S_GOT_TLSLD_PCREL
void write(void *memory, value_type value, endianness endian)
Write a value to memory with a particular endianness.
Definition Endian.h:92
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:477
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
Definition MathExtras.h:174
Op::Description Desc
uint16_t MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition MCFixup.h:22
static void addFixup(SmallVectorImpl< MCFixup > &Fixups, uint32_t Offset, const MCExpr *Value, uint16_t Kind)
DWARFExpression::Operation Op
MCCodeEmitter * createPPCMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:565
static uint16_t getSpecifier(const MCSymbolRefExpr *SRE)
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition STLExtras.h:1877
endianness
Definition bit.h:71
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:853