Lines Matching full:value

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