summaryrefslogtreecommitdiff
path: root/test/CodeGen/XCore
diff options
context:
space:
mode:
authorRichard Osborne <richard@xmos.com>2011-02-02 14:57:41 +0000
committerRichard Osborne <richard@xmos.com>2011-02-02 14:57:41 +0000
commitff0c5014b2127b16815121d9e723dc85bd164a79 (patch)
tree215725f994e9c9e3f820dd6e1f5464ba8f9670c3 /test/CodeGen/XCore
parentae200c60c31666da81a8550172de03a9f417ba1b (diff)
downloadllvm-ff0c5014b2127b16815121d9e723dc85bd164a79.tar.gz
llvm-ff0c5014b2127b16815121d9e723dc85bd164a79.tar.bz2
llvm-ff0c5014b2127b16815121d9e723dc85bd164a79.tar.xz
Add support for trampolines on the XCore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/XCore')
-rw-r--r--test/CodeGen/XCore/trampoline.ll37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/CodeGen/XCore/trampoline.ll b/test/CodeGen/XCore/trampoline.ll
new file mode 100644
index 0000000000..18cc45edbf
--- /dev/null
+++ b/test/CodeGen/XCore/trampoline.ll
@@ -0,0 +1,37 @@
+; RUN: llc < %s -march=xcore | FileCheck %s
+
+%struct.FRAME.f = type { i32, i32 ()* }
+
+define void @f() nounwind {
+entry:
+; CHECK: f:
+; CHECK ldap r11, g.1101
+; CHECK stw r11, sp[7]
+ %TRAMP.23 = alloca [20 x i8], align 2
+ %FRAME.0 = alloca %struct.FRAME.f, align 4
+ %TRAMP.23.sub = getelementptr inbounds [20 x i8]* %TRAMP.23, i32 0, i32 0
+ %FRAME.02 = bitcast %struct.FRAME.f* %FRAME.0 to i8*
+ %tramp = call i8* @llvm.init.trampoline(i8* %TRAMP.23.sub, i8* bitcast (i32 (%struct.FRAME.f*)* @g.1101 to i8*), i8* %FRAME.02)
+ %0 = getelementptr inbounds %struct.FRAME.f* %FRAME.0, i32 0, i32 1
+ %1 = bitcast i8* %tramp to i32 ()*
+ store i32 ()* %1, i32 ()** %0, align 4
+ %2 = getelementptr inbounds %struct.FRAME.f* %FRAME.0, i32 0, i32 0
+ store i32 1, i32* %2, align 4
+ call void @h(i32 ()* %1) nounwind
+ ret void
+}
+
+define internal i32 @g.1101(%struct.FRAME.f* nocapture nest %CHAIN.1) nounwind readonly {
+entry:
+; CHECK: g.1101:
+; CHECK: ldw r11, sp[0]
+; CHECK-NEXT: ldw r0, r11[0]
+; CHECK-NEXT: retsp 0
+ %0 = getelementptr inbounds %struct.FRAME.f* %CHAIN.1, i32 0, i32 0
+ %1 = load i32* %0, align 4
+ ret i32 %1
+}
+
+declare i8* @llvm.init.trampoline(i8*, i8*, i8*) nounwind
+
+declare void @h(i32 ()*)