]> granicus.if.org Git - clang/commitdiff
Implement __builtin_eh_return_data_regno() for ARM and MIPS.
authorLogan Chien <tzuhsiang.chien@gmail.com>
Sat, 23 Feb 2013 04:24:36 +0000 (04:24 +0000)
committerLogan Chien <tzuhsiang.chien@gmail.com>
Sat, 23 Feb 2013 04:24:36 +0000 (04:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175954 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/CodeGen/builtins-arm.c
test/CodeGen/builtins-mips.c

index eaf2e7d05e6eddf1fdf103cabe5389fdac03aa65..ec57ca3609f15739b2697b636a064637c4617893 100644 (file)
@@ -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[] = {
index 3611650c38ce3c346a71a91210b540e8654c2a8a..e6c7cede1fdccee911b8f004cc6d05b336a4d40b 100644 (file)
@@ -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
+}
index ef4662cd59463b2e98cae21478c2438f40e14d1b..c6be896e81928dfb6563d47bbf55888ac1b9c60c 100644 (file)
@@ -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
+}