[PATCH] D84341: Implement __builtin_eh_return_data_regno for SystemZ

Slavomír Kučera via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 22 09:55:44 PDT 2020


slavek-kucera created this revision.
slavek-kucera added a reviewer: uweigand.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Implement __builtin_eh_return_data_regno for SystemZ. Match behavior of GCC.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84341

Files:
  clang/lib/Basic/Targets/SystemZ.h
  clang/test/CodeGen/builtins-systemz.c


Index: clang/test/CodeGen/builtins-systemz.c
===================================================================
--- clang/test/CodeGen/builtins-systemz.c
+++ clang/test/CodeGen/builtins-systemz.c
@@ -142,3 +142,11 @@
   result = __TM_failure_code (tdb);
 }
 
+void test_eh_return_data_regno()
+{
+  volatile int res;
+  res = __builtin_eh_return_data_regno(0);  // CHECK: store volatile i32 6
+  res = __builtin_eh_return_data_regno(1);  // CHECK: store volatile i32 7
+  res = __builtin_eh_return_data_regno(2);  // CHECK: store volatile i32 8
+  res = __builtin_eh_return_data_regno(3);  // CHECK: store volatile i32 9
+}
Index: clang/lib/Basic/Targets/SystemZ.h
===================================================================
--- clang/lib/Basic/Targets/SystemZ.h
+++ clang/lib/Basic/Targets/SystemZ.h
@@ -157,6 +157,10 @@
   const char *getLongDoubleMangling() const override { return "g"; }
 
   bool hasExtIntType() const override { return true; }
+
+  int getEHDataRegisterNumber(unsigned RegNo) const override {
+    return RegNo < 4 ? 6 + RegNo : -1;
+  }
 };
 } // namespace targets
 } // namespace clang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84341.279859.patch
Type: text/x-patch
Size: 1120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200722/06dea353/attachment.bin>


More information about the cfe-commits mailing list