Implement __builtin_eh_return_data_regno for SPARC and SPARC64.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262838 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Joerg Sonnenberger 2016-03-07 17:19:15 +00:00
parent 4d0b0706bc
commit 998d54500c
2 changed files with 16 additions and 0 deletions

View File

@ -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

View File

@ -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
}