[llvm] ddb0bcb - Add missing cases in RISCVMCExpr::getVariantKindName
Serge Pavlov via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 24 22:58:09 PDT 2021
Author: Serge Pavlov
Date: 2021-03-25T12:57:05+07:00
New Revision: ddb0bcbdff03bfb8949e992e4765aaca177a9d8c
URL: https://github.com/llvm/llvm-project/commit/ddb0bcbdff03bfb8949e992e4765aaca177a9d8c
DIFF: https://github.com/llvm/llvm-project/commit/ddb0bcbdff03bfb8949e992e4765aaca177a9d8c.diff
LOG: Add missing cases in RISCVMCExpr::getVariantKindName
Differential Revision: https://reviews.llvm.org/D98929
Added:
Modified:
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
index 8ce2184c7a41..120c6d95bfc0 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
@@ -138,7 +138,8 @@ RISCVMCExpr::VariantKind RISCVMCExpr::getVariantKindForName(StringRef name) {
StringRef RISCVMCExpr::getVariantKindName(VariantKind Kind) {
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 +161,14 @@ StringRef RISCVMCExpr::getVariantKindName(VariantKind Kind) {
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) {
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
index 77038cee4e9d..2e752c138ecf 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
@@ -37,7 +37,7 @@ class RISCVMCExpr : public MCTargetExpr {
VK_RISCV_CALL,
VK_RISCV_CALL_PLT,
VK_RISCV_32_PCREL,
- VK_RISCV_Invalid
+ VK_RISCV_Invalid // Must be the last item
};
private:
More information about the llvm-commits
mailing list