1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[X86AsmBackend] Move static function before sole use [NFC]

This commit is contained in:
Philip Reames 2020-01-10 15:22:17 -08:00
parent c8d30c065e
commit d59f41ce54

View File

@ -94,40 +94,6 @@ cl::opt<X86AlignBranchKind, true, cl::parser<std::string>> X86AlignBranch(
"indirect indicates indirect jumps."),
cl::location(X86AlignBranchKindLoc));
static unsigned getFixupKindSize(unsigned Kind) {
switch (Kind) {
default:
llvm_unreachable("invalid fixup kind!");
case FK_NONE:
return 0;
case FK_PCRel_1:
case FK_SecRel_1:
case FK_Data_1:
return 1;
case FK_PCRel_2:
case FK_SecRel_2:
case FK_Data_2:
return 2;
case FK_PCRel_4:
case X86::reloc_riprel_4byte:
case X86::reloc_riprel_4byte_relax:
case X86::reloc_riprel_4byte_relax_rex:
case X86::reloc_riprel_4byte_movq_load:
case X86::reloc_signed_4byte:
case X86::reloc_signed_4byte_relax:
case X86::reloc_global_offset_table:
case X86::reloc_branch_4byte_pcrel:
case FK_SecRel_4:
case FK_Data_4:
return 4;
case FK_PCRel_8:
case FK_SecRel_8:
case FK_Data_8:
case X86::reloc_global_offset_table8:
return 8;
}
}
class X86ELFObjectWriter : public MCELFObjectTargetWriter {
public:
X86ELFObjectWriter(bool is64Bit, uint8_t OSABI, uint16_t EMachine,
@ -530,6 +496,40 @@ bool X86AsmBackend::shouldForceRelocation(const MCAssembler &,
return Fixup.getKind() == FK_NONE;
}
static unsigned getFixupKindSize(unsigned Kind) {
switch (Kind) {
default:
llvm_unreachable("invalid fixup kind!");
case FK_NONE:
return 0;
case FK_PCRel_1:
case FK_SecRel_1:
case FK_Data_1:
return 1;
case FK_PCRel_2:
case FK_SecRel_2:
case FK_Data_2:
return 2;
case FK_PCRel_4:
case X86::reloc_riprel_4byte:
case X86::reloc_riprel_4byte_relax:
case X86::reloc_riprel_4byte_relax_rex:
case X86::reloc_riprel_4byte_movq_load:
case X86::reloc_signed_4byte:
case X86::reloc_signed_4byte_relax:
case X86::reloc_global_offset_table:
case X86::reloc_branch_4byte_pcrel:
case FK_SecRel_4:
case FK_Data_4:
return 4;
case FK_PCRel_8:
case FK_SecRel_8:
case FK_Data_8:
case X86::reloc_global_offset_table8:
return 8;
}
}
void X86AsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
const MCValue &Target,
MutableArrayRef<char> Data,