r175954 - Implement __builtin_eh_return_data_regno() for ARM and MIPS.

Logan Chien tzuhsiang.chien at gmail.com
Fri Feb 22 20:24:36 PST 2013


Author: logan
Date: Fri Feb 22 22:24:36 2013
New Revision: 175954

URL: http://llvm.org/viewvc/llvm-project?rev=175954&view=rev
Log:
Implement __builtin_eh_return_data_regno() for ARM and MIPS.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/test/CodeGen/builtins-arm.c
    cfe/trunk/test/CodeGen/builtins-mips.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=175954&r1=175953&r2=175954&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Feb 22 22:24:36 2013
@@ -3721,6 +3721,12 @@ public:
   virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const {
     return (CC == CC_AAPCS || CC == CC_AAPCS_VFP) ? CCCR_OK : CCCR_Warning;
   }
+
+  virtual int getEHDataRegisterNumber(unsigned RegNo) const {
+    if (RegNo == 0) return 0;
+    if (RegNo == 1) return 1;
+    return -1;
+  }
 };
 
 const char * const ARMTargetInfo::GCCRegNames[] = {
@@ -4434,6 +4440,12 @@ public:
     if (it != Features.end())
       Features.erase(it);
   }
+
+  virtual int getEHDataRegisterNumber(unsigned RegNo) const {
+    if (RegNo == 0) return 4;
+    if (RegNo == 1) return 5;
+    return -1;
+  }
 };
 
 const Builtin::Info MipsTargetInfoBase::BuiltinInfo[] = {

Modified: cfe/trunk/test/CodeGen/builtins-arm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-arm.c?rev=175954&r1=175953&r2=175954&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-arm.c (original)
+++ cfe/trunk/test/CodeGen/builtins-arm.c Fri Feb 22 22:24:36 2013
@@ -11,3 +11,10 @@ void f1(char *a, char *b) {
 }
 
 // CHECK: call {{.*}} @__clear_cache
+
+void test_eh_return_data_regno()
+{
+  volatile int res;
+  res = __builtin_eh_return_data_regno(0);  // CHECK: store volatile i32 0
+  res = __builtin_eh_return_data_regno(1);  // CHECK: store volatile i32 1
+}

Modified: cfe/trunk/test/CodeGen/builtins-mips.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-mips.c?rev=175954&r1=175953&r2=175954&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-mips.c (original)
+++ cfe/trunk/test/CodeGen/builtins-mips.c Fri Feb 22 22:24:36 2013
@@ -532,3 +532,10 @@ void foo() {
   v4i8_r = __builtin_mips_subuh_r_qb(v4i8_a, v4i8_b);
 // CHECK: call <4 x i8> @llvm.mips.subuh.r.qb
 }
+
+void test_eh_return_data_regno()
+{
+  volatile int res;
+  res = __builtin_eh_return_data_regno(0);  // CHECK: store volatile i32 4
+  res = __builtin_eh_return_data_regno(1);  // CHECK: store volatile i32 5
+}





More information about the cfe-commits mailing list