From 7209bfff92e9d216b6a785f9e41845ee35ebad28 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 6 Oct 2002 22:43:49 +0000 Subject: [PATCH] - Cleaned up all of the test/Feature tests to not use uint's with getelementptr instructions and not to add pointers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4049 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Feature/constexpr.ll | 22 +++++++++++----------- test/Feature/constexprbad.ll | 10 +++++----- test/Feature/forwardreftest.ll | 11 ++++++----- test/Feature/recursivetype.ll | 9 +++++---- test/Feature/testalloca.ll | 8 ++++---- test/Feature/testconstants.ll | 2 +- test/Feature/testmemory.ll | 12 ++++++------ 7 files changed, 38 insertions(+), 36 deletions(-) diff --git a/test/Feature/constexpr.ll b/test/Feature/constexpr.ll index a107241e296..9e67b1f4738 100644 --- a/test/Feature/constexpr.ll +++ b/test/Feature/constexpr.ll @@ -25,17 +25,17 @@ global float 0.0 ;;--------------------------------------------------- %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] -%arrayPtr5 = global int* getelementptr (int** %arrayPtr, uint 0, uint 5) ;; int* &%arrayPtr[5] +%arrayPtr = global int* getelementptr ([2 x int]* %array, long 0, long 0) ;; int* &%array[0][0] +%arrayPtr5 = global int* getelementptr (int** %arrayPtr, long 0, long 5) ;; int* &%arrayPtr[5] %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 -%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 -%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 @@ -54,17 +54,17 @@ global float 0.0 %S3 = global %SAType* %S3c ;; Ref. to constant S3 ;; 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! -%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 ;; 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] -%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 @@ -77,9 +77,9 @@ global float 0.0 %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) ;;--------------------------------------------------- diff --git a/test/Feature/constexprbad.ll b/test/Feature/constexprbad.ll index 592e1ca349a..cbec98a417e 100644 --- a/test/Feature/constexprbad.ll +++ b/test/Feature/constexprbad.ll @@ -23,19 +23,19 @@ ;;--------------------------------------------------- ;; 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 ;%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 ;%geperr4 = global sbyte* getelementptr([11x sbyte]* %somestr) -;%geperr5 = global sbyte* getelementptr([11x sbyte]* %somestr, uint 0) -;%geperr6 = global int* getelementptr([11x sbyte]* %somestr, uint 0, uint 0) +;%geperr5 = global sbyte* getelementptr([11x sbyte]* %somestr, long 0) +;%geperr6 = global int* getelementptr([11x sbyte]* %somestr, long 0, long 0) ;; Cannot use cast expression in pointer field of getelementptr ;; (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) diff --git a/test/Feature/forwardreftest.ll b/test/Feature/forwardreftest.ll index 5b62989c637..641aff5ad75 100644 --- a/test/Feature/forwardreftest.ll +++ b/test/Feature/forwardreftest.ll @@ -7,22 +7,23 @@ %thisfuncty = type int (int) * implementation +declare void %F(%thisfuncty, %thisfuncty, %thisfuncty) + ; This function always returns zero -int "zarro"(int %Func) +int %zarro(int %Func) begin Startup: add int 0, 10 ret int 0 end -int "test"(int) +int %test(int) begin - add %thisfuncty %zarro, %test - add %thisfuncty %test, %foozball + call void %F(%thisfuncty %zarro, %thisfuncty %test, %thisfuncty %foozball) ret int 0 end -int "foozball"(int) +int %foozball(int) begin ret int 0 end diff --git a/test/Feature/recursivetype.ll b/test/Feature/recursivetype.ll index 9e16e2c360e..13a2094d3f3 100644 --- a/test/Feature/recursivetype.ll +++ b/test/Feature/recursivetype.ll @@ -63,8 +63,9 @@ bb3: %cast1006 = cast %list** %reg119 to sbyte** ;; %reg111 = call sbyte* %malloc(uint 16) ;; store sbyte* %reg111, sbyte** %cast1006 ;; - %cast1007 = cast ulong 8 to sbyte* ;; - %reg1002 = add sbyte* %reg111, %cast1007 ;; + %reg111 = cast sbyte* %reg111 to ulong + %reg1002 = add ulong %reg111, 8 + %reg1002 = cast ulong %reg1002 to sbyte* ;; %cast1008 = cast sbyte* %reg1002 to int* ;; store int %Data, int* %cast1008 ;; %cast1003 = cast ulong 0 to ulong* ;; @@ -88,7 +89,7 @@ bb3: ret %list* null bb4: - %idx = getelementptr %list* %reg115, uint 0, ubyte 1 ;; + %idx = getelementptr %list* %reg115, long 0, ubyte 1 ;; %reg111 = load int* %idx %cond1013 = setne int %reg111, %Data ;; br bool %cond1013, label %bb6, label %bb5 @@ -97,7 +98,7 @@ bb5: ret %list* %reg115 bb6: - %idx2 = getelementptr %list* %reg115, uint 0, ubyte 0 ;;<%list*> + %idx2 = getelementptr %list* %reg115, long 0, ubyte 0 ;;<%list*> %reg116 = load %list** %idx2 br label %bb2 end diff --git a/test/Feature/testalloca.ll b/test/Feature/testalloca.ll index cf54743dc70..d6af922db5a 100644 --- a/test/Feature/testalloca.ll +++ b/test/Feature/testalloca.ll @@ -11,12 +11,12 @@ begin %val = load int* %ptr ; yields {int}:val = int %3 %sptr = alloca %struct ; yields {%struct*}:sptr - %nsptr = getelementptr %struct * %sptr, uint 0, ubyte 1 ; yields {inners*}:nsptr - %ubsptr = getelementptr %inners * %nsptr, uint 0, ubyte 1 ; yields {{ubyte}*}:ubsptr - %idx = getelementptr {ubyte} * %ubsptr, uint 0, ubyte 0 + %nsptr = getelementptr %struct * %sptr, long 0, ubyte 1 ; yields {inners*}:nsptr + %ubsptr = getelementptr %inners * %nsptr, long 0, ubyte 1 ; yields {{ubyte}*}:ubsptr + %idx = getelementptr {ubyte} * %ubsptr, long 0, ubyte 0 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 ret int 3 diff --git a/test/Feature/testconstants.ll b/test/Feature/testconstants.ll index 0ef48e50bb6..df525f51f36 100644 --- a/test/Feature/testconstants.ll +++ b/test/Feature/testconstants.ll @@ -11,7 +11,7 @@ end sbyte* %otherfunc(int, double) begin - %somestr = getelementptr [11x sbyte]* %somestr, uint 0, uint 0 + %somestr = getelementptr [11x sbyte]* %somestr, long 0, long 0 ret sbyte* %somestr end diff --git a/test/Feature/testmemory.ll b/test/Feature/testmemory.ll index f46dca1bb22..fca4532fae1 100644 --- a/test/Feature/testmemory.ll +++ b/test/Feature/testmemory.ll @@ -5,18 +5,18 @@ implementation int "main"() begin - call int %testfunction(uint 0, uint 1) + call int %testfunction(long 0, long 1) ret int 0 end -int "testfunction"(uint %i0, uint %j0) +int "testfunction"(long %i0, long %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 - %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 free [4x ubyte]* %array0 free ubyte* %array1 @@ -24,7 +24,7 @@ begin %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 %ptr = alloca int ; yields {int*}:ptr @@ -32,8 +32,8 @@ begin %val = load int* %ptr ; yields {int}:val = int %3 %sptr = alloca %struct ; yields {%struct*}:sptr - %ubsptr = getelementptr %struct * %sptr, uint 0, ubyte 1, ubyte 1 ; yields {{ubyte}*}:ubsptr - %idx3 = getelementptr {ubyte} * %ubsptr, uint 0, ubyte 0 + %ubsptr = getelementptr %struct * %sptr, long 0, ubyte 1, ubyte 1 ; yields {{ubyte}*}:ubsptr + %idx3 = getelementptr {ubyte} * %ubsptr, long 0, ubyte 0 store ubyte 4, ubyte* %idx3 ret int 3