LLVM 20.0.0git
AVRAsmBackend.cpp
Go to the documentation of this file.
1//===-- AVRAsmBackend.cpp - AVR Asm Backend ------------------------------===//
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 AVRAsmBackend class.
10//
11//===----------------------------------------------------------------------===//
12
18#include "llvm/MC/MCAssembler.h"
19#include "llvm/MC/MCContext.h"
22#include "llvm/MC/MCExpr.h"
26#include "llvm/MC/MCValue.h"
30
31// FIXME: we should be doing checks to make sure asm operands
32// are not out of bounds.
33
34namespace adjust {
35
36using namespace llvm;
37
38static void signed_width(unsigned Width, uint64_t Value,
39 std::string Description, const MCFixup &Fixup,
40 MCContext *Ctx = nullptr) {
41 if (!isIntN(Width, Value)) {
42 std::string Diagnostic = "out of range " + Description;
43
44 int64_t Min = minIntN(Width);
45 int64_t Max = maxIntN(Width);
46
47 Diagnostic += " (expected an integer in the range " + std::to_string(Min) +
48 " to " + std::to_string(Max) + ")";
49
50 if (Ctx) {
51 Ctx->reportError(Fixup.getLoc(), Diagnostic);
52 } else {
53 llvm_unreachable(Diagnostic.c_str());
54 }
55 }
56}
57
58static void unsigned_width(unsigned Width, uint64_t Value,
59 std::string Description, const MCFixup &Fixup,
60 MCContext *Ctx = nullptr) {
61 if (!isUIntN(Width, Value)) {
62 std::string Diagnostic = "out of range " + Description;
63
64 int64_t Max = maxUIntN(Width);
65
66 Diagnostic +=
67 " (expected an integer in the range 0 to " + std::to_string(Max) + ")";
68
69 if (Ctx) {
70 Ctx->reportError(Fixup.getLoc(), Diagnostic);
71 } else {
72 llvm_unreachable(Diagnostic.c_str());
73 }
74 }
75}
76
77/// Adjusts the value of a branch target before fixup application.
78static void adjustBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
79 MCContext *Ctx = nullptr) {
80 // We have one extra bit of precision because the value is rightshifted by
81 // one.
82 unsigned_width(Size + 1, Value, std::string("branch target"), Fixup, Ctx);
83
84 // Rightshifts the value by one.
86}
87
88/// Adjusts the value of a relative branch target before fixup application.
89static void adjustRelativeBranch(unsigned Size, const MCFixup &Fixup,
90 uint64_t &Value, MCContext *Ctx = nullptr) {
91 // We have one extra bit of precision because the value is rightshifted by
92 // one.
93 signed_width(Size + 1, Value, std::string("branch target"), Fixup, Ctx);
94
95 // Rightshifts the value by one.
97}
98
99/// 22-bit absolute fixup.
100///
101/// Resolves to:
102/// 1001 kkkk 010k kkkk kkkk kkkk 111k kkkk
103///
104/// Offset of 0 (so the result is left shifted by 3 bits before application).
105static void fixup_call(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
106 MCContext *Ctx = nullptr) {
108
109 auto top = Value & (0xf00000 << 6); // the top four bits
110 auto middle = Value & (0x1ffff << 5); // the middle 13 bits
111 auto bottom = Value & 0x1f; // end bottom 5 bits
112
113 Value = (top << 6) | (middle << 3) | (bottom << 0);
114}
115
116/// 7-bit PC-relative fixup.
117///
118/// Resolves to:
119/// 0000 00kk kkkk k000
120/// Offset of 0 (so the result is left shifted by 3 bits before application).
121static void fixup_7_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
122 MCContext *Ctx = nullptr) {
124
125 // Because the value may be negative, we must mask out the sign bits
126 Value &= 0x7f;
127}
128
129/// 12-bit PC-relative fixup.
130/// Yes, the fixup is 12 bits even though the name says otherwise.
131///
132/// Resolves to:
133/// 0000 kkkk kkkk kkkk
134/// Offset of 0 (so the result isn't left-shifted before application).
135static void fixup_13_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
136 MCContext *Ctx = nullptr) {
138
139 // Because the value may be negative, we must mask out the sign bits
140 Value &= 0xfff;
141}
142
143/// 6-bit fixup for the immediate operand of the STD/LDD family of
144/// instructions.
145///
146/// Resolves to:
147/// 10q0 qq10 0000 1qqq
148static void fixup_6(const MCFixup &Fixup, uint64_t &Value,
149 MCContext *Ctx = nullptr) {
150 unsigned_width(6, Value, std::string("immediate"), Fixup, Ctx);
151
152 Value = ((Value & 0x20) << 8) | ((Value & 0x18) << 7) | (Value & 0x07);
153}
154
155/// 6-bit fixup for the immediate operand of the ADIW family of
156/// instructions.
157///
158/// Resolves to:
159/// 0000 0000 kk00 kkkk
161 MCContext *Ctx = nullptr) {
162 unsigned_width(6, Value, std::string("immediate"), Fixup, Ctx);
163
164 Value = ((Value & 0x30) << 2) | (Value & 0x0f);
165}
166
167/// 5-bit port number fixup on the SBIC family of instructions.
168///
169/// Resolves to:
170/// 0000 0000 AAAA A000
172 MCContext *Ctx = nullptr) {
173 unsigned_width(5, Value, std::string("port number"), Fixup, Ctx);
174
175 Value &= 0x1f;
176
177 Value <<= 3;
178}
179
180/// 6-bit port number fixup on the `IN` family of instructions.
181///
182/// Resolves to:
183/// 1011 0AAd dddd AAAA
185 MCContext *Ctx = nullptr) {
186 unsigned_width(6, Value, std::string("port number"), Fixup, Ctx);
187
188 Value = ((Value & 0x30) << 5) | (Value & 0x0f);
189}
190
191/// 7-bit data space address fixup for the LDS/STS instructions on AVRTiny.
192///
193/// Resolves to:
194/// 1010 ikkk dddd kkkk
196 MCContext *Ctx = nullptr) {
197 unsigned_width(7, Value, std::string("immediate"), Fixup, Ctx);
198 Value = ((Value & 0x70) << 8) | (Value & 0x0f);
199}
200
201/// Adjusts a program memory address.
202/// This is a simple right-shift.
203static void pm(uint64_t &Value) { Value >>= 1; }
204
205/// Fixups relating to the LDI instruction.
206namespace ldi {
207
208/// Adjusts a value to fix up the immediate of an `LDI Rd, K` instruction.
209///
210/// Resolves to:
211/// 0000 KKKK 0000 KKKK
212/// Offset of 0 (so the result isn't left-shifted before application).
213static void fixup(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
214 MCContext *Ctx = nullptr) {
215 uint64_t upper = Value & 0xf0;
216 uint64_t lower = Value & 0x0f;
217
218 Value = (upper << 4) | lower;
219}
220
221static void neg(uint64_t &Value) { Value *= -1; }
222
223static void lo8(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
224 MCContext *Ctx = nullptr) {
225 Value &= 0xff;
226 ldi::fixup(Size, Fixup, Value, Ctx);
227}
228
229static void hi8(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
230 MCContext *Ctx = nullptr) {
231 Value = (Value & 0xff00) >> 8;
232 ldi::fixup(Size, Fixup, Value, Ctx);
233}
234
235static void hh8(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
236 MCContext *Ctx = nullptr) {
237 Value = (Value & 0xff0000) >> 16;
238 ldi::fixup(Size, Fixup, Value, Ctx);
239}
240
241static void ms8(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
242 MCContext *Ctx = nullptr) {
243 Value = (Value & 0xff000000) >> 24;
244 ldi::fixup(Size, Fixup, Value, Ctx);
245}
246
247} // namespace ldi
248} // namespace adjust
249
250namespace llvm {
251
252// Prepare value for the target space for it
254 const MCValue &Target, uint64_t &Value,
255 MCContext *Ctx) const {
256 // The size of the fixup in bits.
258
259 unsigned Kind = Fixup.getKind();
260 switch (Kind) {
261 default:
262 llvm_unreachable("unhandled fixup");
265 break;
268 break;
269 case AVR::fixup_call:
271 break;
272 case AVR::fixup_ldi:
274 break;
277 break;
282 break;
285 break;
290 break;
293 if (Kind == AVR::fixup_hh8_ldi_pm)
295
297 break;
300 break;
301
304 if (Kind == AVR::fixup_lo8_ldi_pm_neg)
306
309 break;
312 if (Kind == AVR::fixup_hi8_ldi_pm_neg)
314
317 break;
320 if (Kind == AVR::fixup_hh8_ldi_pm_neg)
322
325 break;
329 break;
330 case AVR::fixup_16:
331 adjust::unsigned_width(16, Value, std::string("port number"), Fixup, Ctx);
332
333 Value &= 0xffff;
334 break;
335 case AVR::fixup_16_pm:
336 Value >>= 1; // Flash addresses are always shifted.
337 adjust::unsigned_width(16, Value, std::string("port number"), Fixup, Ctx);
338
339 Value &= 0xffff;
340 break;
341
342 case AVR::fixup_6:
344 break;
347 break;
348
349 case AVR::fixup_port5:
351 break;
352
353 case AVR::fixup_port6:
355 break;
356
359 break;
360
361 // Fixups which do not require adjustments.
362 case FK_Data_1:
363 case FK_Data_2:
364 case FK_Data_4:
365 case FK_Data_8:
366 break;
367
368 case FK_GPRel_4:
369 llvm_unreachable("don't know how to adjust this fixup");
370 break;
371 }
372}
373
374std::unique_ptr<MCObjectTargetWriter>
377}
378
380 const MCValue &Target,
382 bool IsResolved,
383 const MCSubtargetInfo *STI) const {
384 if (Fixup.getKind() >= FirstLiteralRelocationKind)
385 return;
386 adjustFixupValue(Fixup, Target, Value, &Asm.getContext());
387 if (Value == 0)
388 return; // Doesn't change encoding.
389
391
392 // The number of bits in the fixup mask
393 auto NumBits = Info.TargetSize + Info.TargetOffset;
394 auto NumBytes = (NumBits / 8) + ((NumBits % 8) == 0 ? 0 : 1);
395
396 // Shift the value into position.
397 Value <<= Info.TargetOffset;
398
399 unsigned Offset = Fixup.getOffset();
400 assert(Offset + NumBytes <= Data.size() && "Invalid fixup offset!");
401
402 // For each byte of the fragment that the fixup touches, mask in the
403 // bits from the fixup value.
404 for (unsigned i = 0; i < NumBytes; ++i) {
405 uint8_t mask = (((Value >> (i * 8)) & 0xff));
406 Data[Offset + i] |= mask;
407 }
408}
409
410std::optional<MCFixupKind> AVRAsmBackend::getFixupKind(StringRef Name) const {
411 unsigned Type;
413#define ELF_RELOC(X, Y) .Case(#X, Y)
414#include "llvm/BinaryFormat/ELFRelocs/AVR.def"
415#undef ELF_RELOC
416 .Case("BFD_RELOC_NONE", ELF::R_AVR_NONE)
417 .Case("BFD_RELOC_16", ELF::R_AVR_16)
418 .Case("BFD_RELOC_32", ELF::R_AVR_32)
419 .Default(-1u);
420 if (Type != -1u)
421 return static_cast<MCFixupKind>(FirstLiteralRelocationKind + Type);
422 return std::nullopt;
423}
424
426 // NOTE: Many AVR fixups work on sets of non-contignous bits. We work around
427 // this by saying that the fixup is the size of the entire instruction.
428 const static MCFixupKindInfo Infos[AVR::NumTargetFixupKinds] = {
429 // This table *must* be in same the order of fixup_* kinds in
430 // AVRFixupKinds.h.
431 //
432 // name offset bits flags
433 {"fixup_32", 0, 32, 0},
434
435 {"fixup_7_pcrel", 3, 7, MCFixupKindInfo::FKF_IsPCRel},
436 {"fixup_13_pcrel", 0, 12, MCFixupKindInfo::FKF_IsPCRel},
437
438 {"fixup_16", 0, 16, 0},
439 {"fixup_16_pm", 0, 16, 0},
440
441 {"fixup_ldi", 0, 8, 0},
442
443 {"fixup_lo8_ldi", 0, 8, 0},
444 {"fixup_hi8_ldi", 0, 8, 0},
445 {"fixup_hh8_ldi", 0, 8, 0},
446 {"fixup_ms8_ldi", 0, 8, 0},
447
448 {"fixup_lo8_ldi_neg", 0, 8, 0},
449 {"fixup_hi8_ldi_neg", 0, 8, 0},
450 {"fixup_hh8_ldi_neg", 0, 8, 0},
451 {"fixup_ms8_ldi_neg", 0, 8, 0},
452
453 {"fixup_lo8_ldi_pm", 0, 8, 0},
454 {"fixup_hi8_ldi_pm", 0, 8, 0},
455 {"fixup_hh8_ldi_pm", 0, 8, 0},
456
457 {"fixup_lo8_ldi_pm_neg", 0, 8, 0},
458 {"fixup_hi8_ldi_pm_neg", 0, 8, 0},
459 {"fixup_hh8_ldi_pm_neg", 0, 8, 0},
460
461 {"fixup_call", 0, 22, 0},
462
463 {"fixup_6", 0, 16, 0}, // non-contiguous
464 {"fixup_6_adiw", 0, 6, 0},
465
466 {"fixup_lo8_ldi_gs", 0, 8, 0},
467 {"fixup_hi8_ldi_gs", 0, 8, 0},
468
469 {"fixup_8", 0, 8, 0},
470 {"fixup_8_lo8", 0, 8, 0},
471 {"fixup_8_hi8", 0, 8, 0},
472 {"fixup_8_hlo8", 0, 8, 0},
473
474 {"fixup_diff8", 0, 8, 0},
475 {"fixup_diff16", 0, 16, 0},
476 {"fixup_diff32", 0, 32, 0},
477
478 {"fixup_lds_sts_16", 0, 16, 0},
479
480 {"fixup_port6", 0, 16, 0}, // non-contiguous
481 {"fixup_port5", 3, 5, 0},
482 };
483
484 // Fixup kinds from .reloc directive are like R_AVR_NONE. They do not require
485 // any extra processing.
486 if (Kind >= FirstLiteralRelocationKind)
488
489 if (Kind < FirstTargetFixupKind)
491
492 assert(unsigned(Kind - FirstTargetFixupKind) < getNumFixupKinds() &&
493 "Invalid kind!");
494
495 return Infos[Kind - FirstTargetFixupKind];
496}
497
499 const MCSubtargetInfo *STI) const {
500 // If the count is not 2-byte aligned, we must be writing data into the text
501 // section (otherwise we have unaligned instructions, and thus have far
502 // bigger problems), so just write zeros instead.
503 assert((Count % 2) == 0 && "NOP instructions must be 2 bytes");
504
505 OS.write_zeros(Count);
506 return true;
507}
508
510 const MCFixup &Fixup,
511 const MCValue &Target,
512 const MCSubtargetInfo *STI) {
513 switch ((unsigned)Fixup.getKind()) {
514 default:
515 return Fixup.getKind() >= FirstLiteralRelocationKind;
516 // Fixups which should always be recorded as relocations.
519 // Do not force relocation for PC relative branch like 'rjmp .',
520 // 'rcall . - off' and 'breq . + off'.
521 if (const auto *SymA = Target.getSymA())
522 if (SymA->getSymbol().getName().size() == 0)
523 return false;
524 [[fallthrough]];
525 case AVR::fixup_call:
526 return true;
527 }
528}
529
531 const MCRegisterInfo &MRI,
532 const llvm::MCTargetOptions &TO) {
533 return new AVRAsmBackend(STI.getTargetTriple().getOS());
534}
535
536} // end of namespace llvm
unsigned const MachineRegisterInfo * MRI
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
std::string Name
uint64_t Size
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
Utilities for manipulating generated AVR machine code.
Definition: AVRAsmBackend.h:29
const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const override
Get information on a fixup kind.
std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const override
void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target, uint64_t &Value, MCContext *Ctx=nullptr) const
void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, MutableArrayRef< char > Data, uint64_t Value, bool IsResolved, const MCSubtargetInfo *STI) const override
Apply the Value for given Fixup into the provided data fragment, at the offset specified by the fixup...
std::optional< MCFixupKind > getFixupKind(StringRef Name) const override
Map a relocation name used in .reloc to a fixup kind.
bool writeNopData(raw_ostream &OS, uint64_t Count, const MCSubtargetInfo *STI) const override
Write an (optimal) nop sequence of Count bytes to the given output.
unsigned getNumFixupKinds() const override
Get the number of target specific fixup kinds.
Definition: AVRAsmBackend.h:48
bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, const MCSubtargetInfo *STI) override
Hook to check if a relocation is needed for some target specific reason.
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:42
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
Context object for machine code objects.
Definition: MCContext.h:83
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
const Triple & getTargetTriple() const
This represents an "assembler immediate".
Definition: MCValue.h:36
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:307
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:44
StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:69
R Default(T Value)
Definition: StringSwitch.h:182
Target - Wrapper for Target specific information.
OSType getOS() const
Get the parsed operating system type of this triple.
Definition: Triple.h:382
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:74
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static void hi8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
static void neg(uint64_t &Value)
static void hh8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
static 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.
static void lo8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
static void ms8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
static void unsigned_width(unsigned Width, uint64_t Value, std::string Description, const MCFixup &Fixup, MCContext *Ctx=nullptr)
static void fixup_6(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
6-bit fixup for the immediate operand of the STD/LDD family of instructions.
static void fixup_13_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
12-bit PC-relative fixup.
static void fixup_port6(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
6-bit port number fixup on the IN family of instructions.
static void fixup_lds_sts_16(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
7-bit data space address fixup for the LDS/STS instructions on AVRTiny.
static void signed_width(unsigned Width, uint64_t Value, std::string Description, const MCFixup &Fixup, MCContext *Ctx=nullptr)
static void adjustBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
Adjusts the value of a branch target before fixup application.
static void pm(uint64_t &Value)
Adjusts a program memory address.
static void fixup_call(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
22-bit absolute fixup.
static void fixup_6_adiw(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
6-bit fixup for the immediate operand of the ADIW family of instructions.
static void adjustRelativeBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
Adjusts the value of a relative branch target before fixup application.
static void fixup_7_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
7-bit PC-relative fixup.
static void fixup_port5(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
5-bit port number fixup on the SBIC family of instructions.
void adjustBranchTarget(T &val)
Adjusts the value of a branch target.
@ fixup_16_pm
A 16-bit program memory address.
Definition: AVRFixupKinds.h:46
@ fixup_16
A 16-bit address.
Definition: AVRFixupKinds.h:44
@ fixup_call
A 22-bit fixup for the target of a CALL k or JMP k instruction.
@ fixup_hh8_ldi
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a 24-bit value ...
Definition: AVRFixupKinds.h:59
@ fixup_ms8_ldi_neg
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a negated 32-bi...
Definition: AVRFixupKinds.h:75
@ fixup_lo8_ldi_neg
Replaces the immediate operand of a 16-bit Rd, K instruction with the lower 8 bits of a negated 16-bi...
Definition: AVRFixupKinds.h:66
@ fixup_6_adiw
A symbol+addr fixup for the `LDD <x>+<n>, <r>" family of instructions.
@ fixup_ms8_ldi
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a 32-bit value ...
Definition: AVRFixupKinds.h:62
@ fixup_7_pcrel
A 7-bit PC-relative fixup for the family of conditional branches which take 7-bit targets (BRNE,...
Definition: AVRFixupKinds.h:32
@ NumTargetFixupKinds
@ fixup_ldi
Replaces the 8-bit immediate with another value.
Definition: AVRFixupKinds.h:49
@ fixup_lo8_ldi
Replaces the immediate operand of a 16-bit Rd, K instruction with the lower 8 bits of a 16-bit value ...
Definition: AVRFixupKinds.h:53
@ fixup_hi8_ldi_pm_neg
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a negated 16-bi...
Definition: AVRFixupKinds.h:96
@ fixup_hi8_ldi
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a 16-bit value ...
Definition: AVRFixupKinds.h:56
@ fixup_lo8_ldi_pm
Replaces the immediate operand of a 16-bit Rd, K instruction with the lower 8 bits of a 16-bit progra...
Definition: AVRFixupKinds.h:79
@ fixup_port6
A 6-bit port address.
@ fixup_hh8_ldi_neg
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a negated 24-bi...
Definition: AVRFixupKinds.h:72
@ fixup_hh8_ldi_pm
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a 24-bit progra...
Definition: AVRFixupKinds.h:87
@ fixup_port5
A 5-bit port address.
@ fixup_lo8_ldi_pm_neg
Replaces the immediate operand of a 16-bit Rd, K instruction with the lower 8 bits of a negated 16-bi...
Definition: AVRFixupKinds.h:92
@ fixup_hi8_ldi_pm
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a 16-bit progra...
Definition: AVRFixupKinds.h:83
@ fixup_hh8_ldi_pm_neg
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a negated 24-bi...
@ fixup_13_pcrel
A 12-bit PC-relative fixup for the family of branches which take 12-bit targets (RJMP,...
Definition: AVRFixupKinds.h:41
@ fixup_hi8_ldi_neg
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a negated 16-bi...
Definition: AVRFixupKinds.h:69
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
int64_t maxIntN(int64_t N)
Gets the maximum value for a N-bit signed integer.
Definition: MathExtras.h:244
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
Definition: MathExtras.h:255
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:21
@ FirstTargetFixupKind
Definition: MCFixup.h:45
@ FirstLiteralRelocationKind
The range [FirstLiteralRelocationKind, MaxTargetFixupKind) is used for relocations coming from ....
Definition: MCFixup.h:50
@ FK_Data_8
A eight-byte fixup.
Definition: MCFixup.h:26
@ FK_Data_1
A one-byte fixup.
Definition: MCFixup.h:23
@ FK_Data_4
A four-byte fixup.
Definition: MCFixup.h:25
@ FK_NONE
A no-op fixup.
Definition: MCFixup.h:22
@ FK_GPRel_4
A four-byte gp relative fixup.
Definition: MCFixup.h:34
@ FK_Data_2
A two-byte fixup.
Definition: MCFixup.h:24
std::unique_ptr< MCObjectTargetWriter > createAVRELFObjectWriter(uint8_t OSABI)
Creates an ELF object writer for AVR.
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
Definition: MathExtras.h:260
int64_t minIntN(int64_t N)
Gets the minimum value for a N-bit signed integer.
Definition: MathExtras.h:235
MCAsmBackend * createAVRAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const llvm::MCTargetOptions &TO)
Creates an assembly backend for AVR.
uint64_t maxUIntN(uint64_t N)
Gets the maximum value for a N-bit unsigned integer.
Definition: MathExtras.h:219
Target independent information on a fixup kind.
@ FKF_IsPCRel
Is this fixup kind PCrelative? This is used by the assembler backend to evaluate fixup values in a ta...
unsigned TargetSize
The number of bits written by this fixup.