From 440ca29ea266a816c4a00216aff356ece0d14cc9 Mon Sep 17 00:00:00 2001 From: Stefan Pintilie Date: Wed, 19 Feb 2020 09:47:14 -0600 Subject: [PATCH] [Hexagon][NFC] Rename VK_Hexagon_PCREL to VK_PCREL On PowerPC we will soon need to use pcrel to indicate PC Relative addressing. Renamed the Hexagon specific variant kind to a non target specific VK so that it can be used on both Hexagon and PowerPC. Differential Revision: https://reviews.llvm.org/D74788 --- llvm/include/llvm/MC/MCExpr.h | 2 +- llvm/lib/MC/MCExpr.cpp | 4 ++-- llvm/lib/Target/Hexagon/HexagonMCInstLower.cpp | 2 +- .../Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp | 2 +- .../Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h index a0b3e0ac097c..c0060c8610e7 100644 --- a/llvm/include/llvm/MC/MCExpr.h +++ b/llvm/include/llvm/MC/MCExpr.h @@ -182,6 +182,7 @@ public: VK_GOT, VK_GOTOFF, VK_GOTREL, + VK_PCREL, VK_GOTPCREL, VK_GOTTPOFF, VK_INDNTPOFF, @@ -286,7 +287,6 @@ public: VK_COFF_IMGREL32, // symbol@imgrel (image-relative) - VK_Hexagon_PCREL, VK_Hexagon_LO16, VK_Hexagon_HI16, VK_Hexagon_GPREL, diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index 77c12c7d096c..2ddbf944f8ed 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -221,6 +221,7 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) { case VK_GOT: return "GOT"; case VK_GOTOFF: return "GOTOFF"; case VK_GOTREL: return "GOTREL"; + case VK_PCREL: return "PCREL"; case VK_GOTPCREL: return "GOTPCREL"; case VK_GOTTPOFF: return "GOTTPOFF"; case VK_INDNTPOFF: return "INDNTPOFF"; @@ -319,7 +320,6 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) { case VK_PPC_TLSLD: return "tlsld"; case VK_PPC_LOCAL: return "local"; case VK_COFF_IMGREL32: return "IMGREL"; - case VK_Hexagon_PCREL: return "PCREL"; case VK_Hexagon_LO16: return "LO16"; case VK_Hexagon_HI16: return "HI16"; case VK_Hexagon_GPREL: return "GPREL"; @@ -351,6 +351,7 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) { .Case("got", VK_GOT) .Case("gotoff", VK_GOTOFF) .Case("gotrel", VK_GOTREL) + .Case("pcrel", VK_PCREL) .Case("gotpcrel", VK_GOTPCREL) .Case("gottpoff", VK_GOTTPOFF) .Case("indntpoff", VK_INDNTPOFF) @@ -437,7 +438,6 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) { .Case("ie", VK_Hexagon_IE) .Case("ldgot", VK_Hexagon_LD_GOT) .Case("ldplt", VK_Hexagon_LD_PLT) - .Case("pcrel", VK_Hexagon_PCREL) .Case("none", VK_ARM_NONE) .Case("got_prel", VK_ARM_GOT_PREL) .Case("target1", VK_ARM_TARGET1) diff --git a/llvm/lib/Target/Hexagon/HexagonMCInstLower.cpp b/llvm/lib/Target/Hexagon/HexagonMCInstLower.cpp index d1a153920e5e..188d91355a35 100644 --- a/llvm/lib/Target/Hexagon/HexagonMCInstLower.cpp +++ b/llvm/lib/Target/Hexagon/HexagonMCInstLower.cpp @@ -51,7 +51,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol, RelocationType = MCSymbolRefExpr::VK_None; break; case HexagonII::MO_PCREL: - RelocationType = MCSymbolRefExpr::VK_Hexagon_PCREL; + RelocationType = MCSymbolRefExpr::VK_PCREL; break; case HexagonII::MO_GOT: RelocationType = MCSymbolRefExpr::VK_GOT; diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp index cdbeae38b3a1..3dba6b07c460 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp @@ -64,7 +64,7 @@ unsigned HexagonELFObjectWriter::getRelocType(MCContext &Ctx, return ELF::R_HEX_IE_GOT_32; case MCSymbolRefExpr::VariantKind::VK_Hexagon_LD_GOT: return ELF::R_HEX_LD_GOT_32; - case MCSymbolRefExpr::VariantKind::VK_Hexagon_PCREL: + case MCSymbolRefExpr::VariantKind::VK_PCREL: return ELF::R_HEX_32_PCREL; case MCSymbolRefExpr::VariantKind::VK_TPREL: return ELF::R_HEX_TPREL_32; diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp index 36800b427943..24169c83bdb9 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp @@ -147,7 +147,7 @@ static const std::map> ExtFixups = { _, _, _, _, _, _, _, _, _ }}, - { MCSymbolRefExpr::VK_Hexagon_PCREL, + { MCSymbolRefExpr::VK_PCREL, { _, _, _, _, _, _, P(_6_PCREL_X), _, _, P(_9_X), _, _, @@ -311,7 +311,7 @@ static const std::map> StdFixups = { _, _, _, _, _, _, _, _, _ }}, - { MCSymbolRefExpr::VK_Hexagon_PCREL, + { MCSymbolRefExpr::VK_PCREL, { _, _, _, _, _, _, _, _, _, _, _, _, @@ -491,7 +491,7 @@ Hexagon::Fixups HexagonMCCodeEmitter::getFixupNoBits( { MCSymbolRefExpr::VK_Hexagon_LD_GOT, fixup_Hexagon_LD_GOT_32_6_X }, { MCSymbolRefExpr::VK_Hexagon_IE, fixup_Hexagon_IE_32_6_X }, { MCSymbolRefExpr::VK_Hexagon_IE_GOT, fixup_Hexagon_IE_GOT_32_6_X }, - { MCSymbolRefExpr::VK_Hexagon_PCREL, fixup_Hexagon_B32_PCREL_X }, + { MCSymbolRefExpr::VK_PCREL, fixup_Hexagon_B32_PCREL_X }, { MCSymbolRefExpr::VK_Hexagon_GD_PLT, fixup_Hexagon_GD_PLT_B32_PCREL_X }, { MCSymbolRefExpr::VK_Hexagon_LD_PLT, fixup_Hexagon_LD_PLT_B32_PCREL_X }, };