[llvm] 9a99896 - [TargetLoweringObjectFile] Handle riscv BE (#155166)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 08:04:51 PDT 2025


Author: Djordje Todorovic
Date: 2025-08-28T17:04:47+02:00
New Revision: 9a99896387eaa406529ee574762fc7988348d6fe

URL: https://github.com/llvm/llvm-project/commit/9a99896387eaa406529ee574762fc7988348d6fe
DIFF: https://github.com/llvm/llvm-project/commit/9a99896387eaa406529ee574762fc7988348d6fe.diff

LOG: [TargetLoweringObjectFile] Handle riscv BE (#155166)

Add DWARF exception handling support for riscv big-endian targets.
More CodeGen changes related to riscvbe are coming.

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    llvm/test/CodeGen/RISCV/dwarf-eh.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index d19ef923ef740..739dcc7f4c868 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -247,6 +247,8 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
     break;
   case Triple::riscv32:
   case Triple::riscv64:
+  case Triple::riscv32be:
+  case Triple::riscv64be:
     LSDAEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
     PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
                           dwarf::DW_EH_PE_sdata4;

diff  --git a/llvm/test/CodeGen/RISCV/dwarf-eh.ll b/llvm/test/CodeGen/RISCV/dwarf-eh.ll
index 39cc0d52c9fe1..dd9e9e59206ac 100644
--- a/llvm/test/CodeGen/RISCV/dwarf-eh.ll
+++ b/llvm/test/CodeGen/RISCV/dwarf-eh.ll
@@ -14,6 +14,22 @@
 ; RUN:     | FileCheck %s
 ; RUN: llc -mtriple=riscv64 --code-model=medium -relocation-model=pic < %s \
 ; RUN:     | FileCheck %s
+; RUN: llc -mtriple=riscv32be --code-model=small  < %s \
+; RUN:     | FileCheck %s
+; RUN: llc -mtriple=riscv32be --code-model=medium < %s \
+; RUN:     | FileCheck %s
+; RUN: llc -mtriple=riscv32be --code-model=small  -relocation-model=pic < %s \
+; RUN:     | FileCheck %s
+; RUN: llc -mtriple=riscv32be --code-model=medium -relocation-model=pic < %s \
+; RUN:     | FileCheck %s
+; RUN: llc -mtriple=riscv64be --code-model=small  < %s \
+; RUN:     | FileCheck %s
+; RUN: llc -mtriple=riscv64be --code-model=medium < %s \
+; RUN:     | FileCheck %s
+; RUN: llc -mtriple=riscv64be --code-model=small  -relocation-model=pic < %s \
+; RUN:     | FileCheck %s
+; RUN: llc -mtriple=riscv64be --code-model=medium -relocation-model=pic < %s \
+; RUN:     | FileCheck %s
 
 declare void @throw_exception()
 


        


More information about the llvm-commits mailing list