Go to the documentation of this file.
38 std::string Description,
const MCFixup &Fixup,
41 std::string Diagnostic =
"out of range " + Description;
46 Diagnostic +=
" (expected an integer in the range " +
std::to_string(Min) +
50 Ctx->reportError(
Fixup.getLoc(), Diagnostic);
58 std::string Description,
const MCFixup &Fixup,
61 std::string Diagnostic =
"out of range " + Description;
66 " (expected an integer in the range 0 to " +
std::to_string(Max) +
")";
69 Ctx->reportError(
Fixup.getLoc(), Diagnostic);
108 auto top =
Value & (0xf00000 << 6);
109 auto middle =
Value & (0x1ffff << 5);
110 auto bottom =
Value & 0x1f;
112 Value = (top << 6) | (middle << 3) | (bottom << 0);
207 Value = (upper << 4) | lower;
359 std::unique_ptr<MCObjectTargetWriter>
376 auto NumBits =
Info.TargetSize +
Info.TargetOffset;
377 auto NumBytes = (NumBits / 8) + ((NumBits % 8) == 0 ? 0 : 1);
382 unsigned Offset =
Fixup.getOffset();
383 assert(Offset + NumBytes <=
Data.size() &&
"Invalid fixup offset!");
387 for (
unsigned i = 0;
i < NumBytes; ++
i) {
388 uint8_t mask = (((
Value >> (
i * 8)) & 0xff));
389 Data[Offset +
i] |= mask;
401 {
"fixup_32", 0, 32, 0},
406 {
"fixup_16", 0, 16, 0},
407 {
"fixup_16_pm", 0, 16, 0},
409 {
"fixup_ldi", 0, 8, 0},
411 {
"fixup_lo8_ldi", 0, 8, 0},
412 {
"fixup_hi8_ldi", 0, 8, 0},
413 {
"fixup_hh8_ldi", 0, 8, 0},
414 {
"fixup_ms8_ldi", 0, 8, 0},
416 {
"fixup_lo8_ldi_neg", 0, 8, 0},
417 {
"fixup_hi8_ldi_neg", 0, 8, 0},
418 {
"fixup_hh8_ldi_neg", 0, 8, 0},
419 {
"fixup_ms8_ldi_neg", 0, 8, 0},
421 {
"fixup_lo8_ldi_pm", 0, 8, 0},
422 {
"fixup_hi8_ldi_pm", 0, 8, 0},
423 {
"fixup_hh8_ldi_pm", 0, 8, 0},
425 {
"fixup_lo8_ldi_pm_neg", 0, 8, 0},
426 {
"fixup_hi8_ldi_pm_neg", 0, 8, 0},
427 {
"fixup_hh8_ldi_pm_neg", 0, 8, 0},
429 {
"fixup_call", 0, 22, 0},
431 {
"fixup_6", 0, 16, 0},
432 {
"fixup_6_adiw", 0, 6, 0},
434 {
"fixup_lo8_ldi_gs", 0, 8, 0},
435 {
"fixup_hi8_ldi_gs", 0, 8, 0},
437 {
"fixup_8", 0, 8, 0},
438 {
"fixup_8_lo8", 0, 8, 0},
439 {
"fixup_8_hi8", 0, 8, 0},
440 {
"fixup_8_hlo8", 0, 8, 0},
442 {
"fixup_diff8", 0, 8, 0},
443 {
"fixup_diff16", 0, 16, 0},
444 {
"fixup_diff32", 0, 32, 0},
446 {
"fixup_lds_sts_16", 0, 16, 0},
448 {
"fixup_port6", 0, 16, 0},
449 {
"fixup_port5", 3, 5, 0},
466 assert((Count % 2) == 0 &&
"NOP instructions must be 2 bytes");
475 switch ((
unsigned)
Fixup.getKind()) {
This is an optimization pass for GlobalISel generic memory operations.
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
raw_ostream & write_zeros(unsigned NumZeros)
write_zeros - Insert 'NumZeros' nulls.
Context object for machine code objects.
Target - Wrapper for Target specific information.
static void fixup_call(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
22-bit absolute fixup.
void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target, uint64_t &Value, MCContext *Ctx=nullptr) const
@ fixup_hh8_ldi_neg
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a negated negat...
void adjustBranchTarget(T &val)
Adjusts the value of a branch target.
int64_t maxIntN(int64_t N)
Gets the maximum value for a N-bit signed integer.
@ 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...
@ fixup_port5
A 5-bit port address.
@ 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...
@ fixup_hh8_ldi
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a 24-bit value ...
bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target) override
Hook to check if a relocation is needed for some target specific reason.
@ fixup_lo8_ldi
Replaces the immediate operand of a 16-bit Rd, K instruction with the lower 8 bits of a 16-bit value ...
@ 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...
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.
std::unique_ptr< MCObjectTargetWriter > createAVRELFObjectWriter(uint8_t OSABI)
Creates an ELF object writer for AVR.
@ FK_Data_4
A four-byte fixup.
Generic interface to target specific assembler backends.
@ FK_GPRel_4
A four-byte gp relative fixup.
@ fixup_13_pcrel
A 12-bit PC-relative fixup for the family of branches which take 12-bit targets (RJMP,...
const Triple & getTargetTriple() const
static void signed_width(unsigned Width, uint64_t Value, std::string Description, const MCFixup &Fixup, MCContext *Ctx=nullptr)
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
@ fixup_port6
A 6-bit port address.
This class implements an extremely fast bulk output stream that can only output to a stream.
Analysis containing CSE Info
@ 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...
@ 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...
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
@ fixup_ms8_ldi_neg
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a negated negat...
@ 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...
Utilities for manipulating generated AVR machine code.
int64_t minIntN(int64_t N)
Gets the minimum value for a N-bit signed integer.
static void fixup_port6(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
6-bit port number fixup on the IN family of instructions.
OSType getOS() const
Get the parsed operating system type of this triple.
static void fixup_port5(const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
5-bit port number fixup on the SBIC family of instructions.
@ 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.
static void hh8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
@ fixup_call
A 22-bit fixup for the target of a CALL k or JMP k instruction.
const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const override
Get information on a fixup kind.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const override
Target independent information on a fixup kind.
MCAsmBackend * createAVRAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const llvm::MCTargetOptions &TO)
Creates an assembly backend for AVR.
@ FK_Data_1
A one-byte fixup.
PowerPC TLS Dynamic Call Fixup
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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 adjustRelativeBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
Adjusts the value of a relative branch target before fixup application.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
unsigned const MachineRegisterInfo * MRI
@ fixup_ldi
Replaces the 8-bit immediate with another value.
static void hi8(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.
@ fixup_7_pcrel
A 7-bit PC-relative fixup for the family of conditional branches which take 7-bit targets (BRNE,...
static void unsigned_width(unsigned Width, uint64_t Value, std::string Description, const MCFixup &Fixup, MCContext *Ctx=nullptr)
@ fixup_16
A 16-bit address.
unsigned getNumFixupKinds() const override
Get the number of target specific fixup kinds.
static void fixup_7_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
7-bit PC-relative fixup.
@ fixup_6_adiw
A symbol+addr fixup for the `LDD <x>+<n>, <r>" family of instructions.
static void neg(uint64_t &Value)
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.
static void fixup_13_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
12-bit PC-relative fixup.
static void ms8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
@ fixup_ms8_ldi
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a 32-bit value ...
MCFixupKind
Extensible enumeration to represent the type of a fixup.
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...
@ FK_Data_8
A eight-byte fixup.
std::string to_string(const T &Value)
We currently generate a but we really shouldn eax ecx xorl edx divl ecx eax divl ecx movl eax ret A similar code sequence works for division We currently compile i32 v2 eax eax jo LBB1_2 neg
@ fixup_hi8_ldi
Replaces the immediate operand of a 16-bit Rd, K instruction with the upper 8 bits of a 16-bit value ...
static void lo8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
@ 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...
This represents an "assembler immediate".
uint64_t maxUIntN(uint64_t N)
Gets the maximum value for a N-bit unsigned integer.
@ FK_Data_2
A two-byte fixup.
@ fixup_16_pm
A 16-bit program memory address.
Generic base class for all target subtargets.
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.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
LLVM Value Representation.
@ 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...