Lines Matching full:value
38 static void signed_width(unsigned Width, uint64_t Value, in signed_width() argument
41 if (!isIntN(Width, Value)) { in signed_width()
58 static void unsigned_width(unsigned Width, uint64_t Value, in unsigned_width() argument
61 if (!isUIntN(Width, Value)) { in unsigned_width()
77 /// Adjusts the value of a branch target before fixup application.
78 static void adjustBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value, in adjustBranch() argument
80 // We have one extra bit of precision because the value is rightshifted by in adjustBranch()
82 unsigned_width(Size + 1, Value, std::string("branch target"), Fixup, Ctx); in adjustBranch()
84 // Rightshifts the value by one. in adjustBranch()
85 AVR::fixups::adjustBranchTarget(Value); in adjustBranch()
88 /// Adjusts the value of a relative branch target before fixup application.
90 uint64_t &Value, MCContext *Ctx = nullptr) { in adjustRelativeBranch() argument
92 Value -= 2; in adjustRelativeBranch()
94 // We have one extra bit of precision because the value is rightshifted by in adjustRelativeBranch()
96 signed_width(Size + 1, Value, std::string("branch target"), Fixup, Ctx); in adjustRelativeBranch()
98 // Rightshifts the value by one. in adjustRelativeBranch()
99 AVR::fixups::adjustBranchTarget(Value); in adjustRelativeBranch()
108 static void fixup_call(unsigned Size, const MCFixup &Fixup, uint64_t &Value, in fixup_call() argument
110 adjustBranch(Size, Fixup, Value, Ctx); in fixup_call()
112 auto top = Value & (0xf00000 << 6); // the top four bits in fixup_call()
113 auto middle = Value & (0x1ffff << 5); // the middle 13 bits in fixup_call()
114 auto bottom = Value & 0x1f; // end bottom 5 bits in fixup_call()
116 Value = (top << 6) | (middle << 3) | (bottom << 0); in fixup_call()
124 static void fixup_7_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value, in fixup_7_pcrel() argument
126 adjustRelativeBranch(Size, Fixup, Value, Ctx); in fixup_7_pcrel()
128 // Because the value may be negative, we must mask out the sign bits in fixup_7_pcrel()
129 Value &= 0x7f; in fixup_7_pcrel()
138 static void fixup_13_pcrel(unsigned Size, const MCFixup &Fixup, uint64_t &Value, in fixup_13_pcrel() argument
140 adjustRelativeBranch(Size, Fixup, Value, Ctx); in fixup_13_pcrel()
142 // Because the value may be negative, we must mask out the sign bits in fixup_13_pcrel()
143 Value &= 0xfff; in fixup_13_pcrel()
151 static void fixup_6(const MCFixup &Fixup, uint64_t &Value, in fixup_6() argument
153 unsigned_width(6, Value, std::string("immediate"), Fixup, Ctx); in fixup_6()
155 Value = ((Value & 0x20) << 8) | ((Value & 0x18) << 7) | (Value & 0x07); in fixup_6()
163 static void fixup_6_adiw(const MCFixup &Fixup, uint64_t &Value, in fixup_6_adiw() argument
165 unsigned_width(6, Value, std::string("immediate"), Fixup, Ctx); in fixup_6_adiw()
167 Value = ((Value & 0x30) << 2) | (Value & 0x0f); in fixup_6_adiw()
174 static void fixup_port5(const MCFixup &Fixup, uint64_t &Value, in fixup_port5() argument
176 unsigned_width(5, Value, std::string("port number"), Fixup, Ctx); in fixup_port5()
178 Value &= 0x1f; in fixup_port5()
180 Value <<= 3; in fixup_port5()
187 static void fixup_port6(const MCFixup &Fixup, uint64_t &Value, in fixup_port6() argument
189 unsigned_width(6, Value, std::string("port number"), Fixup, Ctx); in fixup_port6()
191 Value = ((Value & 0x30) << 5) | (Value & 0x0f); in fixup_port6()
198 static void fixup_lds_sts_16(const MCFixup &Fixup, uint64_t &Value, in fixup_lds_sts_16() argument
200 unsigned_width(7, Value, std::string("immediate"), Fixup, Ctx); in fixup_lds_sts_16()
201 Value = ((Value & 0x70) << 8) | (Value & 0x0f); in fixup_lds_sts_16()
206 static void pm(uint64_t &Value) { Value >>= 1; } in pm() argument
211 /// Adjusts a value to fix up the immediate of an `LDI Rd, K` instruction.
216 static void fixup(unsigned Size, const MCFixup &Fixup, uint64_t &Value, in fixup() argument
218 uint64_t upper = Value & 0xf0; in fixup()
219 uint64_t lower = Value & 0x0f; in fixup()
221 Value = (upper << 4) | lower; in fixup()
224 static void neg(uint64_t &Value) { Value *= -1; } in neg() argument
226 static void lo8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, in lo8() argument
228 Value &= 0xff; in lo8()
229 ldi::fixup(Size, Fixup, Value, Ctx); in lo8()
232 static void hi8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, in hi8() argument
234 Value = (Value & 0xff00) >> 8; in hi8()
235 ldi::fixup(Size, Fixup, Value, Ctx); in hi8()
238 static void hh8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, in hh8() argument
240 Value = (Value & 0xff0000) >> 16; in hh8()
241 ldi::fixup(Size, Fixup, Value, Ctx); in hh8()
244 static void ms8(unsigned Size, const MCFixup &Fixup, uint64_t &Value, in ms8() argument
246 Value = (Value & 0xff000000) >> 24; in ms8()
247 ldi::fixup(Size, Fixup, Value, Ctx); in ms8()
255 // Prepare value for the target space for it
257 const MCValue &Target, uint64_t &Value, in adjustFixupValue() argument
267 adjust::fixup_7_pcrel(Size, Fixup, Value, Ctx); in adjustFixupValue()
270 adjust::fixup_13_pcrel(Size, Fixup, Value, Ctx); in adjustFixupValue()
273 adjust::fixup_call(Size, Fixup, Value, Ctx); in adjustFixupValue()
276 adjust::ldi::fixup(Size, Fixup, Value, Ctx); in adjustFixupValue()
279 adjust::ldi::lo8(Size, Fixup, Value, Ctx); in adjustFixupValue()
283 adjust::pm(Value); in adjustFixupValue()
284 adjust::ldi::lo8(Size, Fixup, Value, Ctx); in adjustFixupValue()
287 adjust::ldi::hi8(Size, Fixup, Value, Ctx); in adjustFixupValue()
291 adjust::pm(Value); in adjustFixupValue()
292 adjust::ldi::hi8(Size, Fixup, Value, Ctx); in adjustFixupValue()
297 adjust::pm(Value); in adjustFixupValue()
299 adjust::ldi::hh8(Size, Fixup, Value, Ctx); in adjustFixupValue()
302 adjust::ldi::ms8(Size, Fixup, Value, Ctx); in adjustFixupValue()
308 adjust::pm(Value); in adjustFixupValue()
310 adjust::ldi::neg(Value); in adjustFixupValue()
311 adjust::ldi::lo8(Size, Fixup, Value, Ctx); in adjustFixupValue()
316 adjust::pm(Value); in adjustFixupValue()
318 adjust::ldi::neg(Value); in adjustFixupValue()
319 adjust::ldi::hi8(Size, Fixup, Value, Ctx); in adjustFixupValue()
324 adjust::pm(Value); in adjustFixupValue()
326 adjust::ldi::neg(Value); in adjustFixupValue()
327 adjust::ldi::hh8(Size, Fixup, Value, Ctx); in adjustFixupValue()
330 adjust::ldi::neg(Value); in adjustFixupValue()
331 adjust::ldi::ms8(Size, Fixup, Value, Ctx); in adjustFixupValue()
334 adjust::unsigned_width(16, Value, std::string("port number"), Fixup, Ctx); in adjustFixupValue()
336 Value &= 0xffff; in adjustFixupValue()
339 Value >>= 1; // Flash addresses are always shifted. in adjustFixupValue()
340 adjust::unsigned_width(16, Value, std::string("port number"), Fixup, Ctx); in adjustFixupValue()
342 Value &= 0xffff; in adjustFixupValue()
346 adjust::fixup_6(Fixup, Value, Ctx); in adjustFixupValue()
349 adjust::fixup_6_adiw(Fixup, Value, Ctx); in adjustFixupValue()
353 adjust::fixup_port5(Fixup, Value, Ctx); in adjustFixupValue()
357 adjust::fixup_port6(Fixup, Value, Ctx); in adjustFixupValue()
361 adjust::fixup_lds_sts_16(Fixup, Value, Ctx); in adjustFixupValue()
384 MutableArrayRef<char> Data, uint64_t Value, in applyFixup() argument
389 adjustFixupValue(Fixup, Target, Value, &Asm.getContext()); in applyFixup()
390 if (Value == 0) in applyFixup()
399 // Shift the value into position. in applyFixup()
400 Value <<= Info.TargetOffset; in applyFixup()
406 // bits from the fixup value. in applyFixup()
408 uint8_t mask = (((Value >> (i * 8)) & 0xff)); in applyFixup()