r262838 - Implement __builtin_eh_return_data_regno for SPARC and SPARC64.

Joerg Sonnenberger via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 7 09:19:16 PST 2016


Author: joerg
Date: Mon Mar  7 11:19:15 2016
New Revision: 262838

URL: http://llvm.org/viewvc/llvm-project?rev=262838&view=rev
Log:
Implement __builtin_eh_return_data_regno for SPARC and SPARC64.

Added:
    cfe/trunk/test/CodeGen/builtins-sparc.c
Modified:
    cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=262838&r1=262837&r2=262838&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Mar  7 11:19:15 2016
@@ -5952,6 +5952,12 @@ public:
   SparcTargetInfo(const llvm::Triple &Triple)
       : TargetInfo(Triple), SoftFloat(false) {}
 
+  int getEHDataRegisterNumber(unsigned RegNo) const override {
+    if (RegNo == 0) return 24;
+    if (RegNo == 1) return 25;
+    return -1;
+  }
+
   bool handleTargetFeatures(std::vector<std::string> &Features,
                             DiagnosticsEngine &Diags) override {
     // The backend doesn't actually handle soft float yet, but in case someone

Added: cfe/trunk/test/CodeGen/builtins-sparc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-sparc.c?rev=262838&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-sparc.c (added)
+++ cfe/trunk/test/CodeGen/builtins-sparc.c Mon Mar  7 11:19:15 2016
@@ -0,0 +1,10 @@
+// REQUIRES: sparc-registered-target
+// RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple sparc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+void test_eh_return_data_regno(void)
+{
+  volatile int res;
+  res = __builtin_eh_return_data_regno(0);  // CHECK: store volatile i32 24
+  res = __builtin_eh_return_data_regno(1);  // CHECK: store volatile i32 25
+}




More information about the cfe-commits mailing list