LLVM 22.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"
21#include "llvm/MC/MCExpr.h"
24#include "llvm/MC/MCValue.h"
28
29namespace adjust {
30
31using namespace llvm;
32
33static void unsigned_width(unsigned Width, uint64_t Value,
34 std::string Description, const MCFixup &Fixup,
35 MCContext *Ctx) {
36 if (!isUIntN(Width, Value)) {
37 std::string Diagnostic = "out of range " + Description;
38
39 int64_t Max = maxUIntN(Width);
40
41 Diagnostic +=
42 " (expected an integer in the range 0 to " + std::to_string(Max) + ")";
43
44 Ctx->reportError(Fixup.getLoc(), Diagnostic);
45 }
46}
47
48/// Adjusts the value of a branch target before fixup application.
49static void adjustBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
50 MCContext *Ctx) {
51 // We have one extra bit of precision because the value is rightshifted by
52 // one.
53 unsigned_width(Size + 1, Value, std::string("branch target"), Fixup, Ctx);
54
55 // Rightshifts the value by one.
57}
58
59/// Adjusts the value of a relative branch target before fixup application.
60static bool adjustRelativeBranch(unsigned Size, const MCFixup &Fixup,
61 uint64_t &Value, const MCSubtargetInfo *STI) {
62 // Jumps are relative to the current instruction.
63 Value -= 2;
64
65 // We have one extra bit of precision because the value is rightshifted by
66 // one.
67 Size += 1;
68
69 assert(STI && "STI can not be NULL");
70
71 if (!isIntN(Size, Value) && STI->hasFeature(AVR::FeatureWrappingRjmp)) {
72 const int32_t FlashSize = 0x2000;
73 int32_t SignedValue = Value;
74
75 uint64_t WrappedValue = SignedValue > 0 ? (uint64_t)(Value - FlashSize)
76 : (uint64_t)(FlashSize + Value);
77
78 if (isIntN(Size, WrappedValue)) {
79 Value = WrappedValue;
80 }
81 }
82
83 if (!isIntN(Size, Value)) {
84 return false;
85 }
86
87 // Rightshifts the value by one.
89
90 return true;
91}
92
93/// 22-bit absolute fixup.
94///
95/// Resolves to:
96/// 1001 kkkk 010k kkkk kkkk kkkk 111k kkkk
97///
98/// Offset of 0 (so the result is left shifted by 3 bits before application).
99static void fixup_call(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
100 MCContext *Ctx) {
102
103 auto top = Value & (0xf00000 << 6); // the top four bits
104 auto middle = Value & (0x1ffff << 5); // the middle 13 bits
105 auto bottom = Value & 0x1f; // end bottom 5 bits
106
107 Value = (top << 6) | (middle << 3) | (bottom << 0);
108}
109
110/// 7-bit PC-relative fixup.
111///
112/// Resolves to:
113/// 0000 00kk kkkk k000
114/// Offset of 0 (so the result is left shifted by 3 bits before application).
115static void fixup_7_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
116 MCContext *Ctx) {
118 llvm_unreachable("should've been emitted as a relocation");
119 }
120
121 // Because the value may be negative, we must mask out the sign bits
122 Value &= 0x7f;
123}
124
125/// 12-bit PC-relative fixup.
126/// Yes, the fixup is 12 bits even though the name says otherwise.
127///
128/// Resolves to:
129/// 0000 kkkk kkkk kkkk
130/// Offset of 0 (so the result isn't left-shifted before application).
131static void fixup_13_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
132 MCContext *Ctx) {
134 llvm_unreachable("should've been emitted as a relocation");
135 }
136
137 // Because the value may be negative, we must mask out the sign bits
138 Value &= 0xfff;
139}
140
141/// 6-bit fixup for the immediate operand of the STD/LDD family of
142/// instructions.
143///
144/// Resolves to:
145/// 10q0 qq10 0000 1qqq
146static void fixup_6(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx) {
147 unsigned_width(6, Value, std::string("immediate"), Fixup, Ctx);
148
149 Value = ((Value & 0x20) << 8) | ((Value & 0x18) << 7) | (Value & 0x07);
150}
151
152/// 6-bit fixup for the immediate operand of the ADIW family of
153/// instructions.
154///
155/// Resolves to:
156/// 0000 0000 kk00 kkkk
158 MCContext *Ctx) {
159 unsigned_width(6, Value, std::string("immediate"), Fixup, Ctx);
160
161 Value = ((Value & 0x30) << 2) | (Value & 0x0f);
162}
163
164/// 5-bit port number fixup on the SBIC family of instructions.
165///
166/// Resolves to:
167/// 0000 0000 AAAA A000
168static void fixup_port5(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx) {
169 unsigned_width(5, Value, std::string("port number"), Fixup, Ctx);
170
171 Value &= 0x1f;
172
173 Value <<= 3;
174}
175
176/// 6-bit port number fixup on the IN family of instructions.
177///
178/// Resolves to:
179/// 1011 0AAd dddd AAAA
180static void fixup_port6(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx) {
181 unsigned_width(6, Value, std::string("port number"), Fixup, Ctx);
182
183 Value = ((Value & 0x30) << 5) | (Value & 0x0f);
184}
185
186/// 7-bit data space address fixup for the LDS/STS instructions on AVRTiny.
187///
188/// Resolves to:
189/// 1010 ikkk dddd kkkk
191 MCContext *Ctx) {
192 unsigned_width(7, Value, std::string("immediate"), Fixup, Ctx);
193 Value = ((Value & 0x70) << 8) | (Value & 0x0f);
194}
195
196/// Adjusts a program memory address.
197/// This is a simple right-shift.
198static void pm(uint64_t &Value) { Value >>= 1; }
199
200/// Fixups relating to the LDI instruction.
201namespace ldi {
202
203/// Adjusts a value to fix up the immediate of an `LDI Rd, K` instruction.
204///
205/// Resolves to:
206/// 0000 KKKK 0000 KKKK
207/// Offset of 0 (so the result isn't left-shifted before application).
208static void fixup(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
209 MCContext *Ctx) {
210 uint64_t upper = Value & 0xf0;
211 uint64_t lower = Value & 0x0f;
212
213 Value = (upper << 4) | lower;
214}
215
216static void neg(uint64_t &Value) { Value *= -1; }
217
218static void lo8(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
219 MCContext *Ctx) {
220 Value &= 0xff;
221 ldi::fixup(Size, Fixup, Value, Ctx);
222}
223
224static void hi8(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
225 MCContext *Ctx) {
226 Value = (Value & 0xff00) >> 8;
227 ldi::fixup(Size, Fixup, Value, Ctx);
228}
229
230static void hh8(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
231 MCContext *Ctx) {
232 Value = (Value & 0xff0000) >> 16;
233 ldi::fixup(Size, Fixup, Value, Ctx);
234}
235
236static void ms8(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
237 MCContext *Ctx) {
238 Value = (Value & 0xff000000) >> 24;
239 ldi::fixup(Size, Fixup, Value, Ctx);
240}
241
242} // namespace ldi
243} // namespace adjust
244
245namespace llvm {
246
247// Prepare value for the target space for it
249 const MCValue &Target, uint64_t &Value,
250 MCContext *Ctx) const {
251 // The size of the fixup in bits.
253
254 unsigned Kind = Fixup.getKind();
255 switch (Kind) {
256 default:
257 llvm_unreachable("unhandled fixup");
260 break;
263 break;
264 case AVR::fixup_call:
266 break;
267 case AVR::fixup_ldi:
269 break;
272 break;
277 break;
280 break;
285 break;
288 if (Kind == AVR::fixup_hh8_ldi_pm)
290
292 break;
295 break;
296
299 if (Kind == AVR::fixup_lo8_ldi_pm_neg)
301
304 break;
307 if (Kind == AVR::fixup_hi8_ldi_pm_neg)
309
312 break;
315 if (Kind == AVR::fixup_hh8_ldi_pm_neg)
317
320 break;
324 break;
325 case AVR::fixup_16:
326 adjust::unsigned_width(16, Value, std::string("port number"), Fixup, Ctx);
327
328 Value &= 0xffff;
329 break;
330 case AVR::fixup_16_pm:
331 Value >>= 1; // Flash addresses are always shifted.
332 adjust::unsigned_width(16, Value, std::string("port number"), Fixup, Ctx);
333
334 Value &= 0xffff;
335 break;
336
337 case AVR::fixup_6:
339 break;
342 break;
343
344 case AVR::fixup_port5:
346 break;
347
348 case AVR::fixup_port6:
350 break;
351
354 break;
355
356 // Fixups which do not require adjustments.
357 case FK_Data_1:
358 case FK_Data_2:
359 case FK_Data_4:
360 case FK_Data_8:
361 break;
362 }
363}
364
365std::unique_ptr<MCObjectTargetWriter>
368}
369
371 const MCValue &Target, uint8_t *Data,
372 uint64_t Value, bool IsResolved) {
373 // AVR sets the fixup value to bypass the assembly time overflow with a
374 // relocation.
375 if (IsResolved) {
376 auto TargetVal = MCValue::get(Target.getAddSym(), Target.getSubSym(), Value,
377 Target.getSpecifier());
378 if (forceRelocation(F, Fixup, TargetVal))
379 IsResolved = false;
380 }
381 if (!IsResolved)
383
384 if (mc::isRelocation(Fixup.getKind()))
385 return;
387 if (Value == 0)
388 return; // Doesn't change encoding.
389
391
392 // The number of bits in the fixup mask
393 unsigned 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 assert(Fixup.getOffset() + NumBytes <= F.getSize() &&
400 "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[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, 0},
436 {"fixup_13_pcrel", 0, 12, 0},
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 (mc::isRelocation(Kind))
487 return {};
488
489 if (Kind < FirstTargetFixupKind)
491
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 MCValue &Target) {
511 switch ((unsigned)Fixup.getKind()) {
512 default:
513 return false;
514
517 case AVR::fixup_call:
518 return true;
519 }
520}
521
523 const MCRegisterInfo &MRI,
524 const llvm::MCTargetOptions &TO) {
525 return new AVRAsmBackend(STI.getTargetTriple().getOS());
526}
527
528} // end of namespace llvm
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
std::string Name
uint64_t Size
#define F(x, y, z)
Definition: MD5.cpp:55
PowerPC TLS Dynamic Call Fixup
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
MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const override
Get information on a fixup kind.
bool forceRelocation(const MCFragment &F, const MCFixup &Fixup, const MCValue &Target)
std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const override
void applyFixup(const MCFragment &, const MCFixup &, const MCValue &Target, uint8_t *Data, uint64_t Value, bool IsResolved) override
void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target, uint64_t &Value, MCContext *Ctx=nullptr) const
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.
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:55
virtual MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
MCAssembler * Asm
Definition: MCAsmBackend.h:59
MCContext & getContext() const
MCObjectWriter & getWriter() const
Definition: MCAssembler.h:179
Context object for machine code objects.
Definition: MCContext.h:83
LLVM_ABI void reportError(SMLoc L, const Twine &Msg)
Definition: MCContext.cpp:1115
const MCSubtargetInfo * getSubtargetInfo() const
Definition: MCContext.h:418
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:61
virtual void recordRelocation(const MCFragment &F, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue)
Record a relocation entry.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
const Triple & getTargetTriple() const
static MCValue get(const MCSymbol *SymA, const MCSymbol *SymB=nullptr, int64_t Val=0, uint32_t Specifier=0)
Definition: MCValue.h:56
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:43
StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:68
R Default(T Value)
Definition: StringSwitch.h:177
Target - Wrapper for Target specific information.
OSType getOS() const
Get the parsed operating system type of this triple.
Definition: Triple.h:417
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:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static void ms8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
static void hi8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
static void neg(uint64_t &Value)
static void lo8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
static void hh8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
static void fixup(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
Adjusts a value to fix up the immediate of an LDI Rd, K instruction.
static void unsigned_width(unsigned Width, uint64_t Value, std::string Description, const MCFixup &Fixup, MCContext *Ctx)
static void adjustBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
Adjusts the value of a branch target before fixup application.
static void fixup_lds_sts_16(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
7-bit data space address fixup for the LDS/STS instructions on AVRTiny.
static void fixup_6(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
6-bit fixup for the immediate operand of the STD/LDD family of instructions.
static void fixup_6_adiw(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
6-bit fixup for the immediate operand of the ADIW family of instructions.
static void fixup_port5(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
5-bit port number fixup on the SBIC family of instructions.
static void fixup_port6(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
6-bit port number fixup on the IN family of instructions.
static void fixup_7_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
7-bit PC-relative fixup.
static void fixup_13_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
12-bit PC-relative fixup.
static void fixup_call(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx)
22-bit absolute fixup.
static void pm(uint64_t &Value)
Adjusts a program memory address.
static bool adjustRelativeBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value, const MCSubtargetInfo *STI)
Adjusts the value of a relative branch target before fixup application.
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
bool isRelocation(MCFixupKind FixupKind)
Definition: MCFixup.h:130
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ FirstTargetFixupKind
Definition: MCFixup.h:44
@ FirstLiteralRelocationKind
Definition: MCFixup.h:29
@ FK_Data_8
A eight-byte fixup.
Definition: MCFixup.h:37
@ FK_Data_1
A one-byte fixup.
Definition: MCFixup.h:34
@ FK_Data_4
A four-byte fixup.
Definition: MCFixup.h:36
@ FK_Data_2
A two-byte fixup.
Definition: MCFixup.h:35
constexpr uint64_t maxUIntN(uint64_t N)
Gets the maximum value for a N-bit unsigned integer.
Definition: MathExtras.h:216
constexpr bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
Definition: MathExtras.h:252
std::unique_ptr< MCObjectTargetWriter > createAVRELFObjectWriter(uint8_t OSABI)
Creates an ELF object writer for AVR.
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
Definition: MathExtras.h:257
MCAsmBackend * createAVRAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const llvm::MCTargetOptions &TO)
Creates an assembly backend for AVR.
Target independent information on a fixup kind.
Definition: MCAsmBackend.h:38
uint8_t TargetSize
The number of bits written by this fixup.
Definition: MCAsmBackend.h:48