[PATCH] D98929: Add missing cases in RISCVMCExpr::getVariantKindName
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 19 11:22:47 PDT 2021
sepavloff updated this revision to Diff 331954.
sepavloff added a comment.
Removed unneeded assert
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98929/new/
https://reviews.llvm.org/D98929
Files:
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
===================================================================
--- llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
+++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
@@ -37,7 +37,7 @@
VK_RISCV_CALL,
VK_RISCV_CALL_PLT,
VK_RISCV_32_PCREL,
- VK_RISCV_Invalid
+ VK_RISCV_Invalid // Must be the last item
};
private:
Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
===================================================================
--- llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
+++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
@@ -133,12 +133,18 @@
.Case("tprel_add", VK_RISCV_TPREL_ADD)
.Case("tls_ie_pcrel_hi", VK_RISCV_TLS_GOT_HI)
.Case("tls_gd_pcrel_hi", VK_RISCV_TLS_GD_HI)
+ .Case("call", VK_RISCV_CALL)
+ .Case("call_plt", VK_RISCV_CALL_PLT)
+ .Case("32_pcrel", VK_RISCV_32_PCREL)
.Default(VK_RISCV_Invalid);
}
StringRef RISCVMCExpr::getVariantKindName(VariantKind Kind) {
+ // When adding new item to VariantKind, getVariantKindForName must also be
+ // updated.
switch (Kind) {
- default:
+ case VK_RISCV_Invalid:
+ case VK_RISCV_None:
llvm_unreachable("Invalid ELF symbol kind");
case VK_RISCV_LO:
return "lo";
@@ -160,7 +166,14 @@
return "tls_ie_pcrel_hi";
case VK_RISCV_TLS_GD_HI:
return "tls_gd_pcrel_hi";
+ case VK_RISCV_CALL:
+ return "call";
+ case VK_RISCV_CALL_PLT:
+ return "call_plt";
+ case VK_RISCV_32_PCREL:
+ return "32_pcrel";
}
+ llvm_unreachable("Invalid ELF symbol kind");
}
static void fixELFSymbolsInTLSFixupsImpl(const MCExpr *Expr, MCAssembler &Asm) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98929.331954.patch
Type: text/x-patch
Size: 1697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210319/3e04f59c/attachment.bin>
More information about the llvm-commits
mailing list