diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-01-07 02:31:11 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-01-07 02:31:11 +0000 |
commit | e77ca040263516395fda6e17257ac790253f6c1c (patch) | |
tree | de3f562bd6683bec53d2194ac9235b28cc2176e5 /test | |
parent | 87c41dcd374fe2d132eed6e2a2e6d9af4412dd60 (diff) | |
download | external_llvm-e77ca040263516395fda6e17257ac790253f6c1c.zip external_llvm-e77ca040263516395fda6e17257ac790253f6c1c.tar.gz external_llvm-e77ca040263516395fda6e17257ac790253f6c1c.tar.bz2 |
Setting GlobalDirective in TargetAsmInfo by default rather than
providing a misleading facility. It's used once in the MIPS backend
and hardcoded as "\t.globl\t" everywhere else.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45676 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/Generic/GC/frame_size.ll | 14 | ||||
-rw-r--r-- | test/CodeGen/Generic/GC/simple_ocaml.ll | 42 |
2 files changed, 56 insertions, 0 deletions
diff --git a/test/CodeGen/Generic/GC/frame_size.ll b/test/CodeGen/Generic/GC/frame_size.ll new file mode 100644 index 0000000..75626c1 --- /dev/null +++ b/test/CodeGen/Generic/GC/frame_size.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llc -asm-verbose | grep {frame size} | grep -v 0x0 + +declare void @llvm.gcroot(i8** %value, i8* %tag) +declare void @g() gc "ocaml" + +define void @f(i8* %arg.0, void()* %arg.1) gc "ocaml" { +entry: + %gcroot.0 = alloca i8* + call void @llvm.gcroot(i8** %gcroot.0, i8* null) + store i8* %arg.0, i8** %gcroot.0 + call void @g() + call void %arg.1() + ret void +} diff --git a/test/CodeGen/Generic/GC/simple_ocaml.ll b/test/CodeGen/Generic/GC/simple_ocaml.ll new file mode 100644 index 0000000..a33e035 --- /dev/null +++ b/test/CodeGen/Generic/GC/simple_ocaml.ll @@ -0,0 +1,42 @@ +; RUN: llvm-as < %s | llc | grep caml.*__frametable +; RUN: llvm-as < %s | llc -march=x86 | grep {movl .0} + +%struct.obj = type { i8*, %struct.obj* } + +define %struct.obj* @fun(%struct.obj* %head) gc "ocaml" { +entry: + %gcroot.0 = alloca i8* + %gcroot.1 = alloca i8* + + call void @llvm.gcroot(i8** %gcroot.0, i8* null) + call void @llvm.gcroot(i8** %gcroot.1, i8* null) + + %local.0 = bitcast i8** %gcroot.0 to %struct.obj** + %local.1 = bitcast i8** %gcroot.1 to %struct.obj** + + store %struct.obj* %head, %struct.obj** %local.0 + br label %bb.loop +bb.loop: + %t0 = load %struct.obj** %local.0 + %t1 = getelementptr %struct.obj* %t0, i32 0, i32 1 + %t2 = bitcast %struct.obj* %t0 to i8* + %t3 = bitcast %struct.obj** %t1 to i8** + %t4 = call i8* @llvm.gcread(i8* %t2, i8** %t3) + %t5 = bitcast i8* %t4 to %struct.obj* + %t6 = icmp eq %struct.obj* %t5, null + br i1 %t6, label %bb.loop, label %bb.end +bb.end: + %t7 = malloc %struct.obj + store %struct.obj* %t7, %struct.obj** %local.1 + %t8 = bitcast %struct.obj* %t7 to i8* + %t9 = load %struct.obj** %local.0 + %t10 = getelementptr %struct.obj* %t9, i32 0, i32 1 + %t11 = bitcast %struct.obj* %t9 to i8* + %t12 = bitcast %struct.obj** %t10 to i8** + call void @llvm.gcwrite(i8* %t8, i8* %t11, i8** %t12) + ret %struct.obj* %t7 +} + +declare void @llvm.gcroot(i8** %value, i8* %tag) +declare void @llvm.gcwrite(i8* %value, i8* %obj, i8** %field) +declare i8* @llvm.gcread(i8* %obj, i8** %field) |