75 Value = (int64_t)Value / 4;
78 Ctx->reportError(Fixup.
getLoc(),
"out of range PC16 fixup");
85 Value = (int64_t)Value / 4;
87 if (!isInt<19>(Value) && Ctx) {
88 Ctx->reportError(Fixup.
getLoc(),
"out of range PC19 fixup");
106 Value = ((Value + 0x8000) >> 16) & 0xffff;
110 Value = ((Value + 0x80008000LL) >> 32) & 0xffff;
114 Value = ((Value + 0x800080008000LL) >> 48) & 0xffff;
122 Value = (int64_t) Value / 2;
124 if (!isInt<7>(Value) && Ctx) {
125 Ctx->reportError(Fixup.
getLoc(),
"out of range PC7 fixup");
132 Value = (int64_t) Value / 2;
134 if (!isInt<10>(Value) && Ctx) {
135 Ctx->reportError(Fixup.
getLoc(),
"out of range PC10 fixup");
142 Value = (int64_t)Value / 2;
145 Ctx->reportError(Fixup.
getLoc(),
"out of range PC16 fixup");
151 Value = (int64_t)Value / 8;
153 if (!isInt<18>(Value) && Ctx) {
154 Ctx->reportError(Fixup.
getLoc(),
"out of range PC18 fixup");
160 if ((Value & 7) && Ctx) {
161 Ctx->reportError(Fixup.
getLoc(),
"out of range PC18 fixup");
164 Value = (int64_t)Value / 8;
166 if (!isInt<18>(Value) && Ctx) {
167 Ctx->reportError(Fixup.
getLoc(),
"out of range PC18 fixup");
173 Value = (int64_t) Value / 4;
175 if (!isInt<21>(Value) && Ctx) {
176 Ctx->reportError(Fixup.
getLoc(),
"out of range PC21 fixup");
182 Value = (int64_t) Value / 4;
184 if (!isInt<26>(Value) && Ctx) {
185 Ctx->reportError(Fixup.
getLoc(),
"out of range PC26 fixup");
191 Value = (int64_t)Value / 2;
193 if (!isInt<26>(Value) && Ctx) {
194 Ctx->reportFatalError(Fixup.
getLoc(),
"out of range PC26 fixup");
200 Value = (int64_t)Value / 2;
202 if (!isInt<21>(Value) && Ctx) {
203 Ctx->reportError(Fixup.
getLoc(),
"out of range PC21 fixup");
230 assert(i <= 3 &&
"Index out of range!");
232 return (1 - i / 2) * 2 + i % 2;
239 unsigned DataSize, uint64_t
Value,
240 bool IsPCRel)
const {
254 switch ((
unsigned)
Kind) {
275 for (
unsigned i = 0;
i != NumBytes; ++
i) {
278 : (FullSize - 1 -
i);
279 CurVal |= (uint64_t)((uint8_t)Data[Offset + Idx]) << (
i*8);
282 uint64_t
Mask = ((uint64_t)(-1) >>
284 CurVal |= Value &
Mask;
287 for (
unsigned i = 0;
i != NumBytes; ++
i) {
290 : (FullSize - 1 -
i);
291 Data[Offset + Idx] = (uint8_t)((CurVal >> (
i*8)) & 0xff);
309 {
"fixup_Mips_NONE", 0, 0, 0 },
310 {
"fixup_Mips_16", 0, 16, 0 },
311 {
"fixup_Mips_32", 0, 32, 0 },
312 {
"fixup_Mips_REL32", 0, 32, 0 },
313 {
"fixup_Mips_26", 0, 26, 0 },
314 {
"fixup_Mips_HI16", 0, 16, 0 },
315 {
"fixup_Mips_LO16", 0, 16, 0 },
316 {
"fixup_Mips_GPREL16", 0, 16, 0 },
317 {
"fixup_Mips_LITERAL", 0, 16, 0 },
318 {
"fixup_Mips_GOT", 0, 16, 0 },
320 {
"fixup_Mips_CALL16", 0, 16, 0 },
321 {
"fixup_Mips_GPREL32", 0, 32, 0 },
322 {
"fixup_Mips_SHIFT5", 6, 5, 0 },
323 {
"fixup_Mips_SHIFT6", 6, 5, 0 },
324 {
"fixup_Mips_64", 0, 64, 0 },
325 {
"fixup_Mips_TLSGD", 0, 16, 0 },
326 {
"fixup_Mips_GOTTPREL", 0, 16, 0 },
327 {
"fixup_Mips_TPREL_HI", 0, 16, 0 },
328 {
"fixup_Mips_TPREL_LO", 0, 16, 0 },
329 {
"fixup_Mips_TLSLDM", 0, 16, 0 },
330 {
"fixup_Mips_DTPREL_HI", 0, 16, 0 },
331 {
"fixup_Mips_DTPREL_LO", 0, 16, 0 },
333 {
"fixup_Mips_GPOFF_HI", 0, 16, 0 },
334 {
"fixup_Mips_GPOFF_LO", 0, 16, 0 },
335 {
"fixup_Mips_GOT_PAGE", 0, 16, 0 },
336 {
"fixup_Mips_GOT_OFST", 0, 16, 0 },
337 {
"fixup_Mips_GOT_DISP", 0, 16, 0 },
338 {
"fixup_Mips_HIGHER", 0, 16, 0 },
339 {
"fixup_Mips_HIGHEST", 0, 16, 0 },
340 {
"fixup_Mips_GOT_HI16", 0, 16, 0 },
341 {
"fixup_Mips_GOT_LO16", 0, 16, 0 },
342 {
"fixup_Mips_CALL_HI16", 0, 16, 0 },
343 {
"fixup_Mips_CALL_LO16", 0, 16, 0 },
350 {
"fixup_MICROMIPS_26_S1", 0, 26, 0 },
351 {
"fixup_MICROMIPS_HI16", 0, 16, 0 },
352 {
"fixup_MICROMIPS_LO16", 0, 16, 0 },
353 {
"fixup_MICROMIPS_GOT16", 0, 16, 0 },
361 {
"fixup_MICROMIPS_CALL16", 0, 16, 0 },
362 {
"fixup_MICROMIPS_GOT_DISP", 0, 16, 0 },
363 {
"fixup_MICROMIPS_GOT_PAGE", 0, 16, 0 },
364 {
"fixup_MICROMIPS_GOT_OFST", 0, 16, 0 },
365 {
"fixup_MICROMIPS_TLS_GD", 0, 16, 0 },
366 {
"fixup_MICROMIPS_TLS_LDM", 0, 16, 0 },
367 {
"fixup_MICROMIPS_TLS_DTPREL_HI16", 0, 16, 0 },
368 {
"fixup_MICROMIPS_TLS_DTPREL_LO16", 0, 16, 0 },
369 {
"fixup_MICROMIPS_TLS_TPREL_HI16", 0, 16, 0 },
370 {
"fixup_MICROMIPS_TLS_TPREL_LO16", 0, 16, 0 },
371 {
"fixup_Mips_SUB", 0, 64, 0 },
372 {
"fixup_MICROMIPS_SUB", 0, 64, 0 }
380 {
"fixup_Mips_NONE", 0, 0, 0 },
381 {
"fixup_Mips_16", 16, 16, 0 },
382 {
"fixup_Mips_32", 0, 32, 0 },
383 {
"fixup_Mips_REL32", 0, 32, 0 },
384 {
"fixup_Mips_26", 6, 26, 0 },
385 {
"fixup_Mips_HI16", 16, 16, 0 },
386 {
"fixup_Mips_LO16", 16, 16, 0 },
387 {
"fixup_Mips_GPREL16", 16, 16, 0 },
388 {
"fixup_Mips_LITERAL", 16, 16, 0 },
389 {
"fixup_Mips_GOT", 16, 16, 0 },
391 {
"fixup_Mips_CALL16", 16, 16, 0 },
392 {
"fixup_Mips_GPREL32", 0, 32, 0 },
393 {
"fixup_Mips_SHIFT5", 21, 5, 0 },
394 {
"fixup_Mips_SHIFT6", 21, 5, 0 },
395 {
"fixup_Mips_64", 0, 64, 0 },
396 {
"fixup_Mips_TLSGD", 16, 16, 0 },
397 {
"fixup_Mips_GOTTPREL", 16, 16, 0 },
398 {
"fixup_Mips_TPREL_HI", 16, 16, 0 },
399 {
"fixup_Mips_TPREL_LO", 16, 16, 0 },
400 {
"fixup_Mips_TLSLDM", 16, 16, 0 },
401 {
"fixup_Mips_DTPREL_HI", 16, 16, 0 },
402 {
"fixup_Mips_DTPREL_LO", 16, 16, 0 },
404 {
"fixup_Mips_GPOFF_HI", 16, 16, 0 },
405 {
"fixup_Mips_GPOFF_LO", 16, 16, 0 },
406 {
"fixup_Mips_GOT_PAGE", 16, 16, 0 },
407 {
"fixup_Mips_GOT_OFST", 16, 16, 0 },
408 {
"fixup_Mips_GOT_DISP", 16, 16, 0 },
409 {
"fixup_Mips_HIGHER", 16, 16, 0 },
410 {
"fixup_Mips_HIGHEST", 16, 16, 0 },
411 {
"fixup_Mips_GOT_HI16", 16, 16, 0 },
412 {
"fixup_Mips_GOT_LO16", 16, 16, 0 },
413 {
"fixup_Mips_CALL_HI16", 16, 16, 0 },
414 {
"fixup_Mips_CALL_LO16", 16, 16, 0 },
421 {
"fixup_MICROMIPS_26_S1", 6, 26, 0 },
422 {
"fixup_MICROMIPS_HI16", 16, 16, 0 },
423 {
"fixup_MICROMIPS_LO16", 16, 16, 0 },
424 {
"fixup_MICROMIPS_GOT16", 16, 16, 0 },
432 {
"fixup_MICROMIPS_CALL16", 16, 16, 0 },
433 {
"fixup_MICROMIPS_GOT_DISP", 16, 16, 0 },
434 {
"fixup_MICROMIPS_GOT_PAGE", 16, 16, 0 },
435 {
"fixup_MICROMIPS_GOT_OFST", 16, 16, 0 },
436 {
"fixup_MICROMIPS_TLS_GD", 16, 16, 0 },
437 {
"fixup_MICROMIPS_TLS_LDM", 16, 16, 0 },
438 {
"fixup_MICROMIPS_TLS_DTPREL_HI16", 16, 16, 0 },
439 {
"fixup_MICROMIPS_TLS_DTPREL_LO16", 16, 16, 0 },
440 {
"fixup_MICROMIPS_TLS_TPREL_HI16", 16, 16, 0 },
441 {
"fixup_MICROMIPS_TLS_TPREL_LO16", 16, 16, 0 },
442 {
"fixup_Mips_SUB", 0, 64, 0 },
443 {
"fixup_MICROMIPS_SUB", 0, 64, 0 }
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
static bool needsMMLEByteOrder(unsigned Kind)
void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize, uint64_t Value, bool IsPCRel) const override
ApplyFixup - Apply the Value for given Fixup into the provided data fragment, at the offset specified...
void WriteZeros(unsigned N)
A eight-byte dtp relative fixup.
This represents an "assembler immediate".
static unsigned adjustFixupValue(const MCFixup &Fixup, uint64_t Value, MCContext *Ctx=nullptr)
MCAsmBackend * createMipsAsmBackendEL64(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
constexpr bool isInt< 16 >(int64_t x)
MCContext & getContext() const
Defines the object file and target independent interfaces used by the assembler backend to write nati...
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Is this fixup kind PCrelative? This is used by the assembler backend to evaluate fixup values in a ta...
MCAsmBackend * createMipsAsmBackendEB32(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFixup &Fixup, const MCFragment *DF, const MCValue &Target, uint64_t &Value, bool &IsResolved) override
processFixupValue - Target hook to process the literal value of a fixup if necessary.
Encapsulates the layout of an assembly file at a particular point in time.
const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const override
Get information on a fixup kind.
A four-byte tp relative fixup.
LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(const T &Value) const
unsigned getNumFixupKinds() const override
Get the number of target specific fixup kinds.
Context object for machine code objects.
A four-byte gp relative fixup.
bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override
WriteNopData - Write an (optimal) nop sequence of Count bytes to the given output.
uint32_t getOffset() const
MCAsmBackend * createMipsAsmBackendEL32(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
A switch()-like statement whose cases are string literals.
A four-byte dtp relative fixup.
unsigned const MachineRegisterInfo * MRI
MCObjectWriter * createObjectWriter(raw_pwrite_stream &OS) const override
Create a new MCObjectWriter instance for use by the assembler backend to emit the final object file...
MCFixupKind
Extensible enumeration to represent the type of a fixup.
virtual Optional< MCFixupKind > getFixupKind(StringRef Name) const
Map a relocation name used in .reloc to a fixup kind.
A eight-byte tp relative fixup.
MCFixupKind getKind() const
MCObjectWriter * createMipsELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI, bool IsLittleEndian, bool Is64Bit)
Triple - Helper class for working with autoconf configuration names.
unsigned TargetSize
The number of bits written by this fixup.
Target - Wrapper for Target specific information.
Optional< MCFixupKind > getFixupKind(StringRef Name) const override
Map a relocation name used in .reloc to a fixup kind.
MCAsmBackend * createMipsAsmBackendEB64(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
Target independent information on a fixup kind.
An abstract base class for streams implementations that also support a pwrite operation.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
Generic interface to target specific assembler backends.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
StringRef - Represent a constant reference to a string, i.e.
static unsigned calculateMMLEIndex(unsigned i)
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.