Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,17 @@ void AMDGPUAsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,

std::optional<MCFixupKind>
AMDGPUAsmBackend::getFixupKind(StringRef Name) const {
return StringSwitch<std::optional<MCFixupKind>>(Name)
#define ELF_RELOC(Name, Value) \
.Case(#Name, MCFixupKind(FirstLiteralRelocationKind + Value))
auto Type = StringSwitch<unsigned>(Name)
#define ELF_RELOC(Name, Value) .Case(#Name, Value)
#include "llvm/BinaryFormat/ELFRelocs/AMDGPU.def"
#undef ELF_RELOC
.Default(std::nullopt);
.Case("BFD_RELOC_NONE", ELF::R_AMDGPU_NONE)
.Case("BFD_RELOC_32", ELF::R_AMDGPU_ABS32)
.Case("BFD_RELOC_64", ELF::R_AMDGPU_ABS64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are they not added to "llvm/BinaryFormat/ELFRelocs/AMDGPU.def" ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arsenm This is how the other backends do it (4f7562d), would you prefer it this way or added to the .def file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea why it's like this, why wouldn't these all be in the def? I guess it's fine to copy the pattern and clean them all later?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just need to decide which way we want to do it.

.Default(-1u);
if (Type != -1u)
return static_cast<MCFixupKind>(FirstLiteralRelocationKind + Type);
return std::nullopt;
}

const MCFixupKindInfo &AMDGPUAsmBackend::getFixupKindInfo(
Expand Down
Loading