mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Update LLVM tests to use new pointer indexing, and remove unsized array test support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -8,8 +8,8 @@ void "_Z17UseAllocaFunctionj"(uint %n)
|
||||
begin
|
||||
bb1: ;;<label>
|
||||
%reg110 = shl uint %n, ubyte 2 ;;<uint>
|
||||
%reg108 = alloca [ubyte], uint %reg110 ;;<ubyte*>
|
||||
%cast1000 = cast [ubyte]* %reg108 to uint* ;;<uint*>
|
||||
%reg108 = alloca ubyte, uint %reg110 ;;<ubyte*>
|
||||
%cast1000 = cast ubyte* %reg108 to uint* ;;<uint*>
|
||||
call void %_Z12combinationsjPj(uint %n, uint* %cast1000) ;;<void>
|
||||
%cast113 = cast uint %reg110 to ulong* ;;<ulong*>
|
||||
cast uint 7 to ulong *
|
||||
@@ -17,8 +17,8 @@ bb1: ;;<label>
|
||||
%reg115 = shr ulong* %reg114, ubyte 3 ;;<ulong*>:(uns ops)
|
||||
%reg117 = shl ulong* %reg115, ubyte 3 ;;<ulong*>
|
||||
%cast1001 = cast ulong* %reg117 to uint ;;<uint>
|
||||
%reg118 = alloca [ubyte], uint %cast1001 ;;<ubyte*>
|
||||
%cast1002 = cast [ubyte]* %reg118 to uint* ;;<uint*>
|
||||
%reg118 = alloca ubyte, uint %cast1001 ;;<ubyte*>
|
||||
%cast1002 = cast ubyte* %reg118 to uint* ;;<uint*>
|
||||
call void %_Z12combinationsjPj(uint %n, uint* %cast1002) ;;<void>
|
||||
ret void ;;<void>
|
||||
end
|
||||
|
@@ -12,7 +12,7 @@ implementation
|
||||
int "foo"(int %blah)
|
||||
begin
|
||||
store int 5, int *%MyVar
|
||||
store int 12, { \2 *, int } * %MyIntList, ubyte 1
|
||||
store int 12, { \2 *, int } * %MyIntList, uint 0, ubyte 1
|
||||
ret int %blah
|
||||
end
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
%CCC = type { \2* }
|
||||
%BBB = type { \2*, \2 * }
|
||||
%AAA = type { \2*, {\2*}, [{\2*}], {[1x{\2*}]} }
|
||||
%AAA = type { \2*, {\2*}, [12x{\2*}], {[1x{\2*}]} }
|
||||
|
||||
; Test numbered types
|
||||
type %CCC
|
||||
@@ -35,7 +35,7 @@ type %BBB
|
||||
|
||||
; A complex recursive type...
|
||||
%Y = type { {%Y*}, %Y* }
|
||||
%Z = type { { %Z * }, [%Z] *, {{{ %Z * }}} }
|
||||
%Z = type { { %Z * }, [12x%Z] *, {{{ %Z * }}} }
|
||||
|
||||
; More ridiculous test cases...
|
||||
%A = type [ 123x %A*]
|
||||
@@ -49,7 +49,7 @@ type %BBB
|
||||
; Test the parser for unnamed recursive types...
|
||||
%P1 = type \1 *
|
||||
%Y1 = type { { \3 * }, \2 * }
|
||||
%Z1 = type { { \3 * }, [\3] *, { { { \5 * } } } }
|
||||
%Z1 = type { { \3 * }, [12x\3] *, { { { \5 * } } } }
|
||||
|
||||
implementation
|
||||
|
||||
|
@@ -85,11 +85,10 @@ bb2:
|
||||
br bool %cond1011, label %bb4, label %bb3
|
||||
|
||||
bb3:
|
||||
%cast1015 = cast ulong 0 to %list* ;;<%list*>
|
||||
ret %list* %cast1015
|
||||
ret %list* null
|
||||
|
||||
bb4:
|
||||
%reg111 = load %list* %reg115, ubyte 1 ;;<int>
|
||||
%reg111 = load %list* %reg115, uint 0, ubyte 1 ;;<int>
|
||||
%cond1013 = setne int %reg111, %Data ;;<bool>
|
||||
br bool %cond1013, label %bb6, label %bb5
|
||||
|
||||
@@ -97,6 +96,6 @@ bb5:
|
||||
ret %list* %reg115
|
||||
|
||||
bb6:
|
||||
%reg116 = load %list* %reg115, ubyte 0 ;;<%list*>
|
||||
%reg116 = load %list* %reg115, uint 0, ubyte 0 ;;<%list*>
|
||||
br label %bb2
|
||||
end
|
||||
|
@@ -5,17 +5,17 @@ implementation
|
||||
|
||||
int "test function"(int %i0, int %j0)
|
||||
begin
|
||||
alloca [ubyte], uint 5
|
||||
alloca ubyte, uint 5
|
||||
%ptr = alloca int ; yields {int*}:ptr
|
||||
store int 3, int* %ptr ; yields {void}
|
||||
%val = load int* %ptr ; yields {int}:val = int %3
|
||||
|
||||
%sptr = alloca %struct ; yields {%struct*}:sptr
|
||||
%nsptr = getelementptr %struct * %sptr, ubyte 1 ; yields {inners*}:nsptr
|
||||
%ubsptr = getelementptr %inners * %nsptr, ubyte 1 ; yields {{ubyte}*}:ubsptr
|
||||
store ubyte 4, {ubyte} * %ubsptr, ubyte 0
|
||||
%nsptr = getelementptr %struct * %sptr, uint 0, ubyte 1 ; yields {inners*}:nsptr
|
||||
%ubsptr = getelementptr %inners * %nsptr, uint 0, ubyte 1 ; yields {{ubyte}*}:ubsptr
|
||||
store ubyte 4, {ubyte} * %ubsptr, uint 0, ubyte 0
|
||||
|
||||
%fptr = getelementptr %struct * %sptr, ubyte 1, ubyte 0 ; yields {float*}:fptr
|
||||
%fptr = getelementptr %struct * %sptr, uint 0, ubyte 1, ubyte 0 ; yields {float*}:fptr
|
||||
store float 4.0, float * %fptr
|
||||
|
||||
ret int 3
|
||||
|
@@ -1,29 +1,22 @@
|
||||
%somestr = constant [sbyte] c"hello world"
|
||||
%somestr = constant [11x sbyte] c"hello world"
|
||||
%array = constant [[2 x int]] [ [2 x int] [ int 12, int 52 ] ]
|
||||
%array = constant [2 x int] [ int 12, int 52 ]
|
||||
constant { int, int } { int 4, int 3 }
|
||||
|
||||
implementation
|
||||
|
||||
[[2 x int]]* "test function"(int %i0, int %j0)
|
||||
[2 x int]* "test function"(int %i0, int %j0)
|
||||
begin
|
||||
ret [[2x int]]* %array
|
||||
ret [2x int]* %array
|
||||
end
|
||||
|
||||
[sbyte]* "other func"(int, double)
|
||||
sbyte* "other func"(int, double)
|
||||
begin
|
||||
ret [sbyte]* %somestr
|
||||
%somestr = getelementptr [11x sbyte]* %somestr, uint 0, uint 0
|
||||
ret sbyte* %somestr
|
||||
end
|
||||
|
||||
[sbyte]* "yet another func"(int, double)
|
||||
sbyte* "yet another func"(int, double)
|
||||
begin
|
||||
ret [sbyte]* null ; Test null
|
||||
end
|
||||
|
||||
|
||||
[sbyte]* "again"(float)
|
||||
begin
|
||||
%cast = cast [11x sbyte]* %somestr to [sbyte]*
|
||||
ret [sbyte]* %cast
|
||||
ret sbyte* null ; Test null
|
||||
end
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
%struct = type { int , {float, {ubyte } } , ulong }
|
||||
%complexty = type [{int, {[4 x sbyte *], float}, double}]
|
||||
%complexty = type {int, {[4 x sbyte *], float}, double}
|
||||
|
||||
implementation
|
||||
|
||||
@@ -13,13 +13,13 @@ int "testfunction"(uint %i0, uint %j0)
|
||||
begin
|
||||
%array0 = malloc [4 x ubyte] ; yields {[4 x ubyte]*}:array0
|
||||
%size = add uint 2, 2 ; yields {uint}:size = uint %4
|
||||
%array1 = malloc [ubyte], uint 4 ; yields {[ubyte]*}:array1
|
||||
%array2 = malloc [ubyte], uint %size ; yields {[ubyte]*}:array2
|
||||
%array1 = malloc ubyte, uint 4 ; yields {ubyte*}:array1
|
||||
%array2 = malloc ubyte, uint %size ; yields {ubyte*}:array2
|
||||
|
||||
store ubyte 123, [4 x ubyte]* %array0, uint 2
|
||||
store ubyte 123, [4 x ubyte]* %array0, uint 0, uint 2
|
||||
free [4x ubyte]* %array0
|
||||
free [ubyte]* %array1
|
||||
free [ubyte]* %array2
|
||||
free ubyte* %array1
|
||||
free ubyte* %array2
|
||||
|
||||
|
||||
%aa = alloca %complexty, uint 5
|
||||
@@ -30,8 +30,8 @@ begin
|
||||
%val = load int* %ptr ; yields {int}:val = int %3
|
||||
|
||||
%sptr = alloca %struct ; yields {%struct*}:sptr
|
||||
%ubsptr = getelementptr %struct * %sptr, ubyte 1, ubyte 1 ; yields {{ubyte}*}:ubsptr
|
||||
store ubyte 4, {ubyte} * %ubsptr, ubyte 0
|
||||
%ubsptr = getelementptr %struct * %sptr, uint 0, ubyte 1, ubyte 1 ; yields {{ubyte}*}:ubsptr
|
||||
store ubyte 4, {ubyte} * %ubsptr, uint 0, ubyte 0
|
||||
|
||||
ret int 3
|
||||
end
|
||||
|
Reference in New Issue
Block a user