summaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
authorAlex Bradbury <asb@lowrisc.org>2019-07-17 13:54:38 +0000
committerAlex Bradbury <asb@lowrisc.org>2019-07-17 13:54:38 +0000
commitb94c233d06731b09d842ed86c5a72c44b40c65bb (patch)
tree1e1c183d84a65bfbd8186706605d8d84e4a00e38 /llvm
parent[RISCV][NFC] Add tests that capture current encodings for DWARF EH (diff)
downloadllvm-project-b94c233d06731b09d842ed86c5a72c44b40c65bb.tar.gz
llvm-project-b94c233d06731b09d842ed86c5a72c44b40c65bb.tar.bz2
llvm-project-b94c233d06731b09d842ed86c5a72c44b40c65bb.zip
[RISCV] Set correct encodings for DWARF exception handling
This patch sets correct encodings for DWARF exception handling for RISC-V (other than call site encoding, which must be udata4 rather than uleb128 and is handled by D63415). This has the same intend as D63409, except this version matches GCC/binutils behaviour which uses the same encodings regardless of PIC/non-PIC and medlow/medany code model. llvm-svn: 366327
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp8
-rw-r--r--llvm/test/CodeGen/RISCV/dwarf-eh.ll30
2 files changed, 22 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 4c18152ea8d8..d8e6b3ef93a3 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -219,6 +219,14 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
TTypeEncoding = dwarf::DW_EH_PE_absptr;
}
break;
+ case Triple::riscv32:
+ case Triple::riscv64:
+ 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;
+ TTypeEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
+ dwarf::DW_EH_PE_sdata4;
+ break;
case Triple::sparcv9:
LSDAEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
if (isPositionIndependent()) {
diff --git a/llvm/test/CodeGen/RISCV/dwarf-eh.ll b/llvm/test/CodeGen/RISCV/dwarf-eh.ll
index 6abea5c2a655..67236d7da668 100644
--- a/llvm/test/CodeGen/RISCV/dwarf-eh.ll
+++ b/llvm/test/CodeGen/RISCV/dwarf-eh.ll
@@ -1,19 +1,19 @@
; RUN: llc -march=riscv32 --code-model=small < %s \
-; RUN: | FileCheck --check-prefixes=CHECK,SMALL %s
+; RUN: | FileCheck %s
; RUN: llc -march=riscv32 --code-model=medium < %s \
-; RUN: | FileCheck --check-prefixes=CHECK,MED %s
+; RUN: | FileCheck %s
; RUN: llc -march=riscv32 --code-model=small -relocation-model=pic < %s \
-; RUN: | FileCheck --check-prefixes=CHECK,PIC %s
+; RUN: | FileCheck %s
; RUN: llc -march=riscv32 --code-model=medium -relocation-model=pic < %s \
-; RUN: | FileCheck --check-prefixes=CHECK,PIC %s
+; RUN: | FileCheck %s
; RUN: llc -march=riscv64 --code-model=small < %s \
-; RUN: | FileCheck --check-prefixes=CHECK,SMALL %s
+; RUN: | FileCheck %s
; RUN: llc -march=riscv64 --code-model=medium < %s \
-; RUN: | FileCheck --check-prefixes=CHECK,MED %s
+; RUN: | FileCheck %s
; RUN: llc -march=riscv64 --code-model=small -relocation-model=pic < %s \
-; RUN: | FileCheck --check-prefixes=CHECK,PIC %s
+; RUN: | FileCheck %s
; RUN: llc -march=riscv64 --code-model=medium -relocation-model=pic < %s \
-; RUN: | FileCheck --check-prefixes=CHECK,PIC %s
+; RUN: | FileCheck %s
declare void @throw_exception()
@@ -25,11 +25,10 @@ declare void @__cxa_end_catch()
; CHECK-LABEL: test1:
; CHECK: .cfi_startproc
-; TODO: Personality encoding should be DW_EH_PE_indirect | DW_EH_PE_pcrel |
-; DW_EH_PE_sdata4
-; CHECK-NEXT: .cfi_personality 0, __gxx_personality_v0
-; TODO: LSDA encoding should be DW_EH_PE_pcrel | DW_EH_PE_sdata4
-; CHECK-NEXT: .cfi_lsda 0, .Lexception0
+; PersonalityEncoding = DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4
+; CHECK-NEXT: .cfi_personality 155, DW.ref.__gxx_personality_v0
+; LSDAEncoding = DW_EH_PE_pcrel | DW_EH_PE_sdata4
+; CHECK-NEXT: .cfi_lsda 27, .Lexception0
define void @test1() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
entry:
@@ -50,9 +49,8 @@ try.cont:
; CHECK-LABEL: GCC_except_table0:
; CHECK-NEXT: .Lexception0:
; CHECK-NEXT: .byte 255 # @LPStart Encoding = omit
-; TODO: TTypeEncoding encoding should be DW_EH_PE_indirect | DW_EH_PE_pcrel |
-; DW_EH_PE_sdata4
-; CHECK-NEXT: .byte 0 # @TType Encoding = absptr
+; TTypeEncoding = DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4
+; CHECK-NEXT: .byte 155 # @TType Encoding = indirect pcrel sdata4
; TODO: call site encoding should be DW_EH_PE_udata4
; CHECK: .Lttbaseref0:
; CHECK-NEXT: .byte 1 # Call site Encoding = uleb128