From a8f7a97a22d1ed92fd3309f071c0121c22e52aa3 Mon Sep 17 00:00:00 2001 From: Logan Chien Date: Sat, 23 Feb 2013 04:24:36 +0000 Subject: [PATCH] Implement __builtin_eh_return_data_regno() for ARM and MIPS. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175954 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/Targets.cpp | 12 ++++++++++++ test/CodeGen/builtins-arm.c | 7 +++++++ test/CodeGen/builtins-mips.c | 7 +++++++ 3 files changed, 26 insertions(+) diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index eaf2e7d05e..ec57ca3609 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -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[] = { diff --git a/test/CodeGen/builtins-arm.c b/test/CodeGen/builtins-arm.c index 3611650c38..e6c7cede1f 100644 --- a/test/CodeGen/builtins-arm.c +++ b/test/CodeGen/builtins-arm.c @@ -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 +} diff --git a/test/CodeGen/builtins-mips.c b/test/CodeGen/builtins-mips.c index ef4662cd59..c6be896e81 100644 --- a/test/CodeGen/builtins-mips.c +++ b/test/CodeGen/builtins-mips.c @@ -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 +} -- 2.40.0