r200231 - XCore target exception handling
Robert Lytton
robert at xmos.com
Mon Jan 27 09:56:26 PST 2014
Author: rlytton
Date: Mon Jan 27 11:56:25 2014
New Revision: 200231
URL: http://llvm.org/viewvc/llvm-project?rev=200231&view=rev
Log:
XCore target exception handling
Implement __builtin_eh_return_data_regno()
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/xcore-abi.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=200231&r1=200230&r2=200231&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Jan 27 11:56:25 2014
@@ -5514,6 +5514,10 @@ public:
TargetInfo::ConstraintInfo &Info) const {
return false;
}
+ virtual int getEHDataRegisterNumber(unsigned RegNo) const {
+ // R0=ExceptionPointerRegister R1=ExceptionSelectorRegister
+ return (RegNo < 2)? RegNo : -1;
+ }
};
const Builtin::Info XCoreTargetInfo::BuiltinInfo[] = {
Modified: cfe/trunk/test/CodeGen/xcore-abi.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/xcore-abi.c?rev=200231&r1=200230&r2=200231&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/xcore-abi.c (original)
+++ cfe/trunk/test/CodeGen/xcore-abi.c Mon Jan 27 11:56:25 2014
@@ -1,3 +1,4 @@
+// REQUIRES: xcore-registered-target
// RUN: %clang_cc1 -triple xcore -verify %s
_Static_assert(sizeof(long long) == 8, "sizeof long long is wrong");
_Static_assert(_Alignof(long long) == 4, "alignof long long is wrong");
@@ -112,10 +113,18 @@ void testbuiltin (void) {
// CHECK: call i32 @llvm.xcore.getps(i32 {{%[a-z0-9]+}})
// CHECK: call i32 @llvm.xcore.bitrev(i32 {{%[a-z0-9]+}})
// CHECK: call void @llvm.xcore.setps(i32 {{%[a-z0-9]+}}, i32 {{%[a-z0-9]+}})
- int i = __builtin_getid();
- unsigned int ui = __builtin_getps(i);
+ volatile int i = __builtin_getid();
+ volatile unsigned int ui = __builtin_getps(i);
ui = __builtin_bitrev(ui);
__builtin_setps(i,ui);
+
+ // CHECK: store volatile i32 0, i32* {{%[a-z0-9]+}}, align 4
+ // CHECK: store volatile i32 1, i32* {{%[a-z0-9]+}}, align 4
+ // CHECK: store volatile i32 -1, i32* {{%[a-z0-9]+}}, align 4
+ volatile int res;
+ res = __builtin_eh_return_data_regno(0);
+ res = __builtin_eh_return_data_regno(1);
+ res = __builtin_eh_return_data_regno(2);
}
// CHECK-LABEL: define zeroext i8 @testchar()
More information about the cfe-commits
mailing list