- Cleaned up all of the test/Feature tests to not use uint's with
getelementptr instructions and not to add pointers. llvm-svn: 4049
This commit is contained in:
parent
fa3f55cfaa
commit
8ec8b2547f
|
@ -25,17 +25,17 @@ global float 0.0
|
||||||
;;---------------------------------------------------
|
;;---------------------------------------------------
|
||||||
|
|
||||||
%array = constant [2 x int] [ int 12, int 52 ]
|
%array = constant [2 x int] [ int 12, int 52 ]
|
||||||
%arrayPtr = global int* getelementptr ([2 x int]* %array, uint 0, uint 0) ;; int* &%array[0][0]
|
%arrayPtr = global int* getelementptr ([2 x int]* %array, long 0, long 0) ;; int* &%array[0][0]
|
||||||
%arrayPtr5 = global int* getelementptr (int** %arrayPtr, uint 0, uint 5) ;; int* &%arrayPtr[5]
|
%arrayPtr5 = global int* getelementptr (int** %arrayPtr, long 0, long 5) ;; int* &%arrayPtr[5]
|
||||||
|
|
||||||
%somestr = constant [11x sbyte] c"hello world"
|
%somestr = constant [11x sbyte] c"hello world"
|
||||||
%char5 = global sbyte* getelementptr([11x sbyte]* %somestr, uint 0, uint 5)
|
%char5 = global sbyte* getelementptr([11x sbyte]* %somestr, long 0, long 5)
|
||||||
|
|
||||||
;; cast of getelementptr
|
;; cast of getelementptr
|
||||||
%char8a = global int* cast (sbyte* getelementptr([11x sbyte]* %somestr, uint 0, uint 8) to int*)
|
%char8a = global int* cast (sbyte* getelementptr([11x sbyte]* %somestr, long 0, long 8) to int*)
|
||||||
|
|
||||||
;; getelementptr containing casts
|
;; getelementptr containing casts
|
||||||
%char8b = global sbyte* getelementptr([11x sbyte]* %somestr, uint cast (ubyte 0 to uint), uint cast (sbyte 8 to uint))
|
%char8b = global sbyte* getelementptr([11x sbyte]* %somestr, long cast (ubyte 0 to long), long cast (sbyte 8 to long))
|
||||||
|
|
||||||
;;-------------------------------------------------------
|
;;-------------------------------------------------------
|
||||||
;; TODO: Test constant getelementpr expressions for structures
|
;; TODO: Test constant getelementpr expressions for structures
|
||||||
|
@ -54,17 +54,17 @@ global float 0.0
|
||||||
%S3 = global %SAType* %S3c ;; Ref. to constant S3
|
%S3 = global %SAType* %S3c ;; Ref. to constant S3
|
||||||
|
|
||||||
;; Pointer to float (**%S1).1.0
|
;; Pointer to float (**%S1).1.0
|
||||||
%S1fld1a = global float* getelementptr (%SType** %S1, uint 0, uint 0, ubyte 1, ubyte 0)
|
%S1fld1a = global float* getelementptr (%SType** %S1, long 0, long 0, ubyte 1, ubyte 0)
|
||||||
;; Another ptr to the same!
|
;; Another ptr to the same!
|
||||||
%S1fld1b = global float* getelementptr (%SType*** %S1ptr, uint 0, uint 0, uint 0, ubyte 1, ubyte 0)
|
%S1fld1b = global float* getelementptr (%SType*** %S1ptr, long 0, long 0, long 0, ubyte 1, ubyte 0)
|
||||||
|
|
||||||
%S1fld1bptr = global float** %S1fld1b ;; Ref. to previous pointer
|
%S1fld1bptr = global float** %S1fld1b ;; Ref. to previous pointer
|
||||||
|
|
||||||
;; Pointer to ubyte (**%S2).1.1.0
|
;; Pointer to ubyte (**%S2).1.1.0
|
||||||
%S2fld3 = global ubyte* getelementptr (%SType** %S2, uint 0, uint 0, ubyte 1, ubyte 1, ubyte 0)
|
%S2fld3 = global ubyte* getelementptr (%SType** %S2, long 0, long 0, ubyte 1, ubyte 1, ubyte 0)
|
||||||
|
|
||||||
;; Pointer to float (**%S2).1.0[0]
|
;; Pointer to float (**%S2).1.0[0]
|
||||||
%S3fld3 = global float* getelementptr (%SAType** %S3, uint 0, uint 0, ubyte 1, ubyte 0, uint 0)
|
%S3fld3 = global float* getelementptr (%SAType** %S3, long 0, long 0, ubyte 1, ubyte 0, long 0)
|
||||||
|
|
||||||
;;---------------------------------------------------------
|
;;---------------------------------------------------------
|
||||||
;; TODO: Test constant expressions for unary and binary operators
|
;; TODO: Test constant expressions for unary and binary operators
|
||||||
|
@ -77,9 +77,9 @@ global float 0.0
|
||||||
|
|
||||||
%t4 = global int** cast (uint** %t3 to int**)
|
%t4 = global int** cast (uint** %t3 to int**)
|
||||||
|
|
||||||
%char8a = global int* cast (sbyte* getelementptr([11x sbyte]* %somestr, uint 0, uint 8) to int*)
|
%char8a = global int* cast (sbyte* getelementptr([11x sbyte]* %somestr, long 0, long 8) to int*)
|
||||||
|
|
||||||
%S3fld3 = global float* getelementptr (%SAType** %S3, uint 0, uint 0, ubyte 1, ubyte 0, uint 0)
|
%S3fld3 = global float* getelementptr (%SAType** %S3, long 0, long 0, ubyte 1, ubyte 0, long 0)
|
||||||
|
|
||||||
|
|
||||||
;;---------------------------------------------------
|
;;---------------------------------------------------
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
;;---------------------------------------------------
|
;;---------------------------------------------------
|
||||||
|
|
||||||
;; return value must be a pointer to the element
|
;; return value must be a pointer to the element
|
||||||
;%geperr1 = global sbyte getelementptr([11x sbyte]* %somestr, uint 0, uint 8)
|
;%geperr1 = global sbyte getelementptr([11x sbyte]* %somestr, long 0, long 8)
|
||||||
|
|
||||||
;; index types must be valid for pointer type
|
;; index types must be valid for pointer type
|
||||||
;%geperr2 = global sbyte* getelementptr([11x sbyte]* %somestr, ubyte 0)
|
;%geperr2 = global sbyte* getelementptr([11x sbyte]* %somestr, ubyte 0)
|
||||||
;%geperr3 = global sbyte* getelementptr([11x sbyte]* %somestr, uint 0, uint 0, uint 3)
|
;%geperr3 = global sbyte* getelementptr([11x sbyte]* %somestr, long 0, long 0, long 3)
|
||||||
|
|
||||||
;; element accessed by index list must match return type
|
;; element accessed by index list must match return type
|
||||||
;%geperr4 = global sbyte* getelementptr([11x sbyte]* %somestr)
|
;%geperr4 = global sbyte* getelementptr([11x sbyte]* %somestr)
|
||||||
;%geperr5 = global sbyte* getelementptr([11x sbyte]* %somestr, uint 0)
|
;%geperr5 = global sbyte* getelementptr([11x sbyte]* %somestr, long 0)
|
||||||
;%geperr6 = global int* getelementptr([11x sbyte]* %somestr, uint 0, uint 0)
|
;%geperr6 = global int* getelementptr([11x sbyte]* %somestr, long 0, long 0)
|
||||||
|
|
||||||
;; Cannot use cast expression in pointer field of getelementptr
|
;; Cannot use cast expression in pointer field of getelementptr
|
||||||
;; (unlike the index fields, where it is legal)
|
;; (unlike the index fields, where it is legal)
|
||||||
;%geperr7 = constant int* getelementptr (int* cast long 0, uint 27)
|
;%geperr7 = constant int* getelementptr (int* cast long 0, long 27)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,22 +7,23 @@
|
||||||
%thisfuncty = type int (int) *
|
%thisfuncty = type int (int) *
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
declare void %F(%thisfuncty, %thisfuncty, %thisfuncty)
|
||||||
|
|
||||||
; This function always returns zero
|
; This function always returns zero
|
||||||
int "zarro"(int %Func)
|
int %zarro(int %Func)
|
||||||
begin
|
begin
|
||||||
Startup:
|
Startup:
|
||||||
add int 0, 10
|
add int 0, 10
|
||||||
ret int 0
|
ret int 0
|
||||||
end
|
end
|
||||||
|
|
||||||
int "test"(int)
|
int %test(int)
|
||||||
begin
|
begin
|
||||||
add %thisfuncty %zarro, %test
|
call void %F(%thisfuncty %zarro, %thisfuncty %test, %thisfuncty %foozball)
|
||||||
add %thisfuncty %test, %foozball
|
|
||||||
ret int 0
|
ret int 0
|
||||||
end
|
end
|
||||||
|
|
||||||
int "foozball"(int)
|
int %foozball(int)
|
||||||
begin
|
begin
|
||||||
ret int 0
|
ret int 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -63,8 +63,9 @@ bb3:
|
||||||
%cast1006 = cast %list** %reg119 to sbyte** ;;<sbyte**>
|
%cast1006 = cast %list** %reg119 to sbyte** ;;<sbyte**>
|
||||||
%reg111 = call sbyte* %malloc(uint 16) ;;<sbyte*>
|
%reg111 = call sbyte* %malloc(uint 16) ;;<sbyte*>
|
||||||
store sbyte* %reg111, sbyte** %cast1006 ;;<void>
|
store sbyte* %reg111, sbyte** %cast1006 ;;<void>
|
||||||
%cast1007 = cast ulong 8 to sbyte* ;;<sbyte*>
|
%reg111 = cast sbyte* %reg111 to ulong
|
||||||
%reg1002 = add sbyte* %reg111, %cast1007 ;;<sbyte*>
|
%reg1002 = add ulong %reg111, 8
|
||||||
|
%reg1002 = cast ulong %reg1002 to sbyte* ;;<sbyte*>
|
||||||
%cast1008 = cast sbyte* %reg1002 to int* ;;<int*>
|
%cast1008 = cast sbyte* %reg1002 to int* ;;<int*>
|
||||||
store int %Data, int* %cast1008 ;;<void>
|
store int %Data, int* %cast1008 ;;<void>
|
||||||
%cast1003 = cast ulong 0 to ulong* ;;<ulong*>
|
%cast1003 = cast ulong 0 to ulong* ;;<ulong*>
|
||||||
|
@ -88,7 +89,7 @@ bb3:
|
||||||
ret %list* null
|
ret %list* null
|
||||||
|
|
||||||
bb4:
|
bb4:
|
||||||
%idx = getelementptr %list* %reg115, uint 0, ubyte 1 ;;<int>
|
%idx = getelementptr %list* %reg115, long 0, ubyte 1 ;;<int>
|
||||||
%reg111 = load int* %idx
|
%reg111 = load int* %idx
|
||||||
%cond1013 = setne int %reg111, %Data ;;<bool>
|
%cond1013 = setne int %reg111, %Data ;;<bool>
|
||||||
br bool %cond1013, label %bb6, label %bb5
|
br bool %cond1013, label %bb6, label %bb5
|
||||||
|
@ -97,7 +98,7 @@ bb5:
|
||||||
ret %list* %reg115
|
ret %list* %reg115
|
||||||
|
|
||||||
bb6:
|
bb6:
|
||||||
%idx2 = getelementptr %list* %reg115, uint 0, ubyte 0 ;;<%list*>
|
%idx2 = getelementptr %list* %reg115, long 0, ubyte 0 ;;<%list*>
|
||||||
%reg116 = load %list** %idx2
|
%reg116 = load %list** %idx2
|
||||||
br label %bb2
|
br label %bb2
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,12 +11,12 @@ begin
|
||||||
%val = load int* %ptr ; yields {int}:val = int %3
|
%val = load int* %ptr ; yields {int}:val = int %3
|
||||||
|
|
||||||
%sptr = alloca %struct ; yields {%struct*}:sptr
|
%sptr = alloca %struct ; yields {%struct*}:sptr
|
||||||
%nsptr = getelementptr %struct * %sptr, uint 0, ubyte 1 ; yields {inners*}:nsptr
|
%nsptr = getelementptr %struct * %sptr, long 0, ubyte 1 ; yields {inners*}:nsptr
|
||||||
%ubsptr = getelementptr %inners * %nsptr, uint 0, ubyte 1 ; yields {{ubyte}*}:ubsptr
|
%ubsptr = getelementptr %inners * %nsptr, long 0, ubyte 1 ; yields {{ubyte}*}:ubsptr
|
||||||
%idx = getelementptr {ubyte} * %ubsptr, uint 0, ubyte 0
|
%idx = getelementptr {ubyte} * %ubsptr, long 0, ubyte 0
|
||||||
store ubyte 4, ubyte* %idx
|
store ubyte 4, ubyte* %idx
|
||||||
|
|
||||||
%fptr = getelementptr %struct * %sptr, uint 0, ubyte 1, ubyte 0 ; yields {float*}:fptr
|
%fptr = getelementptr %struct * %sptr, long 0, ubyte 1, ubyte 0 ; yields {float*}:fptr
|
||||||
store float 4.0, float * %fptr
|
store float 4.0, float * %fptr
|
||||||
|
|
||||||
ret int 3
|
ret int 3
|
||||||
|
|
|
@ -11,7 +11,7 @@ end
|
||||||
|
|
||||||
sbyte* %otherfunc(int, double)
|
sbyte* %otherfunc(int, double)
|
||||||
begin
|
begin
|
||||||
%somestr = getelementptr [11x sbyte]* %somestr, uint 0, uint 0
|
%somestr = getelementptr [11x sbyte]* %somestr, long 0, long 0
|
||||||
ret sbyte* %somestr
|
ret sbyte* %somestr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,18 +5,18 @@ implementation
|
||||||
|
|
||||||
int "main"()
|
int "main"()
|
||||||
begin
|
begin
|
||||||
call int %testfunction(uint 0, uint 1)
|
call int %testfunction(long 0, long 1)
|
||||||
ret int 0
|
ret int 0
|
||||||
end
|
end
|
||||||
|
|
||||||
int "testfunction"(uint %i0, uint %j0)
|
int "testfunction"(long %i0, long %j0)
|
||||||
begin
|
begin
|
||||||
%array0 = malloc [4 x ubyte] ; yields {[4 x ubyte]*}:array0
|
%array0 = malloc [4 x ubyte] ; yields {[4 x ubyte]*}:array0
|
||||||
%size = add uint 2, 2 ; yields {uint}:size = uint %4
|
%size = add uint 2, 2 ; yields {uint}:size = uint %4
|
||||||
%array1 = malloc ubyte, uint 4 ; yields {ubyte*}:array1
|
%array1 = malloc ubyte, uint 4 ; yields {ubyte*}:array1
|
||||||
%array2 = malloc ubyte, uint %size ; yields {ubyte*}:array2
|
%array2 = malloc ubyte, uint %size ; yields {ubyte*}:array2
|
||||||
|
|
||||||
%idx = getelementptr [4 x ubyte]* %array0, uint 0, uint 2
|
%idx = getelementptr [4 x ubyte]* %array0, long 0, long 2
|
||||||
store ubyte 123, ubyte* %idx
|
store ubyte 123, ubyte* %idx
|
||||||
free [4x ubyte]* %array0
|
free [4x ubyte]* %array0
|
||||||
free ubyte* %array1
|
free ubyte* %array1
|
||||||
|
@ -24,7 +24,7 @@ begin
|
||||||
|
|
||||||
|
|
||||||
%aa = alloca %complexty, uint 5
|
%aa = alloca %complexty, uint 5
|
||||||
%idx2 = getelementptr %complexty* %aa, uint %i0, ubyte 1, ubyte 0, uint %j0
|
%idx2 = getelementptr %complexty* %aa, long %i0, ubyte 1, ubyte 0, long %j0
|
||||||
store sbyte *null, sbyte** %idx2
|
store sbyte *null, sbyte** %idx2
|
||||||
|
|
||||||
%ptr = alloca int ; yields {int*}:ptr
|
%ptr = alloca int ; yields {int*}:ptr
|
||||||
|
@ -32,8 +32,8 @@ begin
|
||||||
%val = load int* %ptr ; yields {int}:val = int %3
|
%val = load int* %ptr ; yields {int}:val = int %3
|
||||||
|
|
||||||
%sptr = alloca %struct ; yields {%struct*}:sptr
|
%sptr = alloca %struct ; yields {%struct*}:sptr
|
||||||
%ubsptr = getelementptr %struct * %sptr, uint 0, ubyte 1, ubyte 1 ; yields {{ubyte}*}:ubsptr
|
%ubsptr = getelementptr %struct * %sptr, long 0, ubyte 1, ubyte 1 ; yields {{ubyte}*}:ubsptr
|
||||||
%idx3 = getelementptr {ubyte} * %ubsptr, uint 0, ubyte 0
|
%idx3 = getelementptr {ubyte} * %ubsptr, long 0, ubyte 0
|
||||||
store ubyte 4, ubyte* %idx3
|
store ubyte 4, ubyte* %idx3
|
||||||
|
|
||||||
ret int 3
|
ret int 3
|
||||||
|
|
Loading…
Reference in New Issue