Skip to content

Commit c05593b

Browse files
committed
M68: Replace FK_PCRel_ with FK_Data_+PCRel
1 parent 5760c06 commit c05593b

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

llvm/lib/Target/M68k/MCTargetDesc/M68kFixupKinds.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,15 @@
1919
namespace llvm {
2020
static inline unsigned getFixupKindLog2Size(unsigned Kind) {
2121
switch (Kind) {
22-
case FK_PCRel_1:
23-
case FK_SecRel_1:
2422
case FK_Data_1:
2523
return 0;
26-
case FK_PCRel_2:
27-
case FK_SecRel_2:
2824
case FK_Data_2:
2925
return 1;
30-
case FK_PCRel_4:
31-
case FK_SecRel_4:
3226
case FK_Data_4:
3327
return 2;
3428
}
3529
llvm_unreachable("invalid fixup kind!");
3630
}
37-
38-
static inline MCFixupKind getFixupForSize(unsigned Size, bool isPCRel) {
39-
switch (Size) {
40-
case 8:
41-
return isPCRel ? FK_PCRel_1 : FK_Data_1;
42-
case 16:
43-
return isPCRel ? FK_PCRel_2 : FK_Data_2;
44-
case 32:
45-
return isPCRel ? FK_PCRel_4 : FK_Data_4;
46-
case 64:
47-
return isPCRel ? FK_PCRel_8 : FK_Data_8;
48-
}
49-
llvm_unreachable("Invalid generic fixup size!");
50-
}
51-
5231
} // namespace llvm
5332

5433
#endif // LLVM_LIB_TARGET_M68k_MCTARGETDESC_M68kFIXUPKINDS_H

llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ void M68kMCCodeEmitter::encodeRelocImm(const MCInst &MI, unsigned OpIdx,
144144

145145
// Relocatable address
146146
unsigned InsertByte = getBytePosition<Size>(InsertPos);
147-
addFixup(Fixups, InsertByte, Expr,
148-
getFixupForSize(Size, /*IsPCRel=*/false));
147+
addFixup(Fixups, InsertByte, Expr, MCFixup::getDataKindForSize(Size / 8));
149148
}
150149
}
151150

@@ -179,7 +178,8 @@ void M68kMCCodeEmitter::encodePCRelImm(const MCInst &MI, unsigned OpIdx,
179178
Expr, MCConstantExpr::create(LabelOffset, Ctx), Ctx);
180179
}
181180

182-
addFixup(Fixups, InsertByte, Expr, getFixupForSize(Size, true), true);
181+
addFixup(Fixups, InsertByte, Expr, MCFixup::getDataKindForSize(Size / 8),
182+
true);
183183
}
184184
}
185185

0 commit comments

Comments
 (0)