@@ -35,26 +35,6 @@ namespace adjust {
35
35
36
36
using namespace llvm ;
37
37
38
- static void signed_width (unsigned Width, uint64_t Value,
39
- std::string Description, const MCFixup &Fixup,
40
- MCContext *Ctx = nullptr ) {
41
- if (!isIntN (Width, Value)) {
42
- std::string Diagnostic = " out of range " + Description;
43
-
44
- int64_t Min = minIntN (Width);
45
- int64_t Max = maxIntN (Width);
46
-
47
- Diagnostic += " (expected an integer in the range " + std::to_string (Min) +
48
- " to " + std::to_string (Max) + " )" ;
49
-
50
- if (Ctx) {
51
- Ctx->reportError (Fixup.getLoc (), Diagnostic);
52
- } else {
53
- llvm_unreachable (Diagnostic.c_str ());
54
- }
55
- }
56
- }
57
-
58
38
static void unsigned_width (unsigned Width, uint64_t Value,
59
39
std::string Description, const MCFixup &Fixup,
60
40
MCContext *Ctx = nullptr ) {
@@ -85,20 +65,6 @@ static void adjustBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
85
65
AVR::fixups::adjustBranchTarget (Value);
86
66
}
87
67
88
- // / Adjusts the value of a relative branch target before fixup application.
89
- static void adjustRelativeBranch (unsigned Size, const MCFixup &Fixup,
90
- uint64_t &Value, MCContext *Ctx = nullptr ) {
91
- // Jumps are relative to the current instruction.
92
- Value -= 2 ;
93
-
94
- // We have one extra bit of precision because the value is rightshifted by
95
- // one.
96
- signed_width (Size + 1 , Value, std::string (" branch target" ), Fixup, Ctx);
97
-
98
- // Rightshifts the value by one.
99
- AVR::fixups::adjustBranchTarget (Value);
100
- }
101
-
102
68
// / 22-bit absolute fixup.
103
69
// /
104
70
// / Resolves to:
@@ -116,33 +82,6 @@ static void fixup_call(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
116
82
Value = (top << 6 ) | (middle << 3 ) | (bottom << 0 );
117
83
}
118
84
119
- // / 7-bit PC-relative fixup.
120
- // /
121
- // / Resolves to:
122
- // / 0000 00kk kkkk k000
123
- // / Offset of 0 (so the result is left shifted by 3 bits before application).
124
- static void fixup_7_pcrel (unsigned Size, const MCFixup &Fixup, uint64_t &Value,
125
- MCContext *Ctx = nullptr ) {
126
- adjustRelativeBranch (Size, Fixup, Value, Ctx);
127
-
128
- // Because the value may be negative, we must mask out the sign bits
129
- Value &= 0x7f ;
130
- }
131
-
132
- // / 12-bit PC-relative fixup.
133
- // / Yes, the fixup is 12 bits even though the name says otherwise.
134
- // /
135
- // / Resolves to:
136
- // / 0000 kkkk kkkk kkkk
137
- // / Offset of 0 (so the result isn't left-shifted before application).
138
- static void fixup_13_pcrel (unsigned Size, const MCFixup &Fixup, uint64_t &Value,
139
- MCContext *Ctx = nullptr ) {
140
- adjustRelativeBranch (Size, Fixup, Value, Ctx);
141
-
142
- // Because the value may be negative, we must mask out the sign bits
143
- Value &= 0xfff ;
144
- }
145
-
146
85
// / 6-bit fixup for the immediate operand of the STD/LDD family of
147
86
// / instructions.
148
87
// /
@@ -264,10 +203,8 @@ void AVRAsmBackend::adjustFixupValue(const MCFixup &Fixup,
264
203
default :
265
204
llvm_unreachable (" unhandled fixup" );
266
205
case AVR::fixup_7_pcrel:
267
- adjust::fixup_7_pcrel (Size, Fixup, Value, Ctx);
268
- break ;
269
206
case AVR::fixup_13_pcrel:
270
- adjust::fixup_13_pcrel (Size, Fixup, Value, Ctx);
207
+ // Emitted as relocations, no fixup required.
271
208
break ;
272
209
case AVR::fixup_call:
273
210
adjust::fixup_call (Size, Fixup, Value, Ctx);
@@ -518,8 +455,6 @@ bool AVRAsmBackend::shouldForceRelocation(const MCAssembler &Asm,
518
455
return Fixup.getKind () >= FirstLiteralRelocationKind;
519
456
case AVR::fixup_7_pcrel:
520
457
case AVR::fixup_13_pcrel:
521
- // Always resolve relocations for PC-relative branches
522
- return false ;
523
458
case AVR::fixup_call:
524
459
return true ;
525
460
}
0 commit comments