blob: b2cf0518cc3491e246c2c51299004ab694d1b116 [file] [log] [blame]
Chris Lattner91e15962001-07-08 23:23:30 +00001%struct = type { int , {float, {ubyte } } , ulong }
Chris Lattnerf493a562001-12-14 16:46:53 +00002%complexty = type {int, {[4 x sbyte *], float}, double}
Chris Lattner00950542001-06-06 20:29:01 +00003
4implementation
5
Chris Lattner4d631b82001-11-26 17:02:56 +00006int "main"()
7begin
8 call int %testfunction(uint 0, uint 1)
9 ret int 0
10end
11
12int "testfunction"(uint %i0, uint %j0)
Chris Lattner00950542001-06-06 20:29:01 +000013begin
14 %array0 = malloc [4 x ubyte] ; yields {[4 x ubyte]*}:array0
15 %size = add uint 2, 2 ; yields {uint}:size = uint %4
Chris Lattnerf493a562001-12-14 16:46:53 +000016 %array1 = malloc ubyte, uint 4 ; yields {ubyte*}:array1
17 %array2 = malloc ubyte, uint %size ; yields {ubyte*}:array2
Chris Lattner4d631b82001-11-26 17:02:56 +000018
Chris Lattnerf493a562001-12-14 16:46:53 +000019 store ubyte 123, [4 x ubyte]* %array0, uint 0, uint 2
Chris Lattner00950542001-06-06 20:29:01 +000020 free [4x ubyte]* %array0
Chris Lattnerf493a562001-12-14 16:46:53 +000021 free ubyte* %array1
22 free ubyte* %array2
Chris Lattner00950542001-06-06 20:29:01 +000023
24
Chris Lattner4d631b82001-11-26 17:02:56 +000025 %aa = alloca %complexty, uint 5
26 store sbyte *null, %complexty* %aa, uint %i0, ubyte 1, ubyte 0, uint %j0
27
Chris Lattner00950542001-06-06 20:29:01 +000028 %ptr = alloca int ; yields {int*}:ptr
Chris Lattner91e15962001-07-08 23:23:30 +000029 store int 3, int* %ptr ; yields {void}
30 %val = load int* %ptr ; yields {int}:val = int %3
31
32 %sptr = alloca %struct ; yields {%struct*}:sptr
Chris Lattnerf493a562001-12-14 16:46:53 +000033 %ubsptr = getelementptr %struct * %sptr, uint 0, ubyte 1, ubyte 1 ; yields {{ubyte}*}:ubsptr
34 store ubyte 4, {ubyte} * %ubsptr, uint 0, ubyte 0
Chris Lattner00950542001-06-06 20:29:01 +000035
36 ret int 3
37end
38