Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | |||||
static void fixup_13_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value, | static void fixup_13_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value, | ||||
MCContext *Ctx = nullptr) { | MCContext *Ctx = nullptr) { | ||||
adjustRelativeBranch(Size, Fixup, Value, Ctx); | adjustRelativeBranch(Size, Fixup, Value, Ctx); | ||||
// Because the value may be negative, we must mask out the sign bits | // Because the value may be negative, we must mask out the sign bits | ||||
Value &= 0xfff; | Value &= 0xfff; | ||||
} | } | ||||
/// 6-bit fixup for the immediate operand of the STD/LDD family of | |||||
/// instructions. | |||||
/// | |||||
/// Resolves to: | |||||
/// 10q0 qq10 0000 1qqq | |||||
static void fixup_6(const MCFixup &Fixup, uint64_t &Value, | |||||
MCContext *Ctx = nullptr) { | |||||
unsigned_width(6, Value, std::string("immediate"), Fixup, Ctx); | |||||
Value = ((Value & 0x20) << 8) | ((Value & 0x18) << 7) | (Value & 0x07); | |||||
} | |||||
/// 6-bit fixup for the immediate operand of the ADIW family of | /// 6-bit fixup for the immediate operand of the ADIW family of | ||||
/// instructions. | /// instructions. | ||||
/// | /// | ||||
/// Resolves to: | /// Resolves to: | ||||
/// 0000 0000 kk00 kkkk | /// 0000 0000 kk00 kkkk | ||||
static void fixup_6_adiw(const MCFixup &Fixup, uint64_t &Value, | static void fixup_6_adiw(const MCFixup &Fixup, uint64_t &Value, | ||||
MCContext *Ctx = nullptr) { | MCContext *Ctx = nullptr) { | ||||
unsigned_width(6, Value, std::string("immediate"), Fixup, Ctx); | unsigned_width(6, Value, std::string("immediate"), Fixup, Ctx); | ||||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | case AVR::fixup_16: | ||||
break; | break; | ||||
case AVR::fixup_16_pm: | case AVR::fixup_16_pm: | ||||
Value >>= 1; // Flash addresses are always shifted. | Value >>= 1; // Flash addresses are always shifted. | ||||
adjust::unsigned_width(16, Value, std::string("port number"), Fixup, Ctx); | adjust::unsigned_width(16, Value, std::string("port number"), Fixup, Ctx); | ||||
Value &= 0xffff; | Value &= 0xffff; | ||||
break; | break; | ||||
case AVR::fixup_6: | |||||
adjust::fixup_6(Fixup, Value, Ctx); | |||||
break; | |||||
case AVR::fixup_6_adiw: | case AVR::fixup_6_adiw: | ||||
adjust::fixup_6_adiw(Fixup, Value, Ctx); | adjust::fixup_6_adiw(Fixup, Value, Ctx); | ||||
break; | break; | ||||
case AVR::fixup_port5: | case AVR::fixup_port5: | ||||
adjust::fixup_port5(Fixup, Value, Ctx); | adjust::fixup_port5(Fixup, Value, Ctx); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 150 Lines • Show Last 20 Lines |