[PATCH] D63417: [RISCV] Specify registers used for exception handling

Edward Jones via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 02:48:50 PDT 2019


edward-jones updated this revision to Diff 207736.
edward-jones added a comment.

Add riscv64 target run line, renamed test file to builtins-riscv.c, and rebased.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63417/new/

https://reviews.llvm.org/D63417

Files:
  lib/Basic/Targets/RISCV.h
  test/CodeGen/builtins-riscv.c


Index: test/CodeGen/builtins-riscv.c
===================================================================
--- /dev/null
+++ test/CodeGen/builtins-riscv.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -Wall -Werror -triple riscv32 -disable-O0-optnone -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
+// RUN: %clang_cc1 -Wall -Werror -triple riscv64 -disable-O0-optnone -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
+
+void test_eh_return_data_regno()
+{
+  // CHECK: store volatile i32 10
+  // CHECK: store volatile i32 11
+  volatile int res;
+  res = __builtin_eh_return_data_regno(0);
+  res = __builtin_eh_return_data_regno(1);
+}
Index: lib/Basic/Targets/RISCV.h
===================================================================
--- lib/Basic/Targets/RISCV.h
+++ lib/Basic/Targets/RISCV.h
@@ -57,6 +57,15 @@
 
   ArrayRef<const char *> getGCCRegNames() const override;
 
+  int getEHDataRegisterNumber(unsigned RegNo) const override {
+    if (RegNo == 0)
+      return 10;
+    else if (RegNo == 1)
+      return 11;
+    else
+      return -1;
+  }
+
   ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
 
   bool validateAsmConstraint(const char *&Name,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63417.207736.patch
Type: text/x-patch
Size: 1183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190703/be02bd9f/attachment.bin>


More information about the cfe-commits mailing list