dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/codegen cg_ainit.tc,1.5,1.6


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/codegen cg_ainit.tc,1.5,1.6
Date: Sun, 13 Apr 2003 21:31:37 -0400

Update of /cvsroot/dotgnu-pnet/pnet/codegen
In directory subversions:/tmp/cvs-serv16186/codegen

Modified Files:
        cg_ainit.tc 
Log Message:


Don't call "InitializeArray" if the array is zero-sized.


Index: cg_ainit.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_ainit.tc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** cg_ainit.tc 20 Jul 2002 04:07:05 -0000      1.5
--- cg_ainit.tc 14 Apr 2003 01:31:34 -0000      1.6
***************
*** 531,534 ****
--- 531,536 ----
        int rank, dimension;
        ILUInt32 *posn;
+       ILUInt32 length;
+       int sawZero;
  
        /* Bail out if semantic analysis was not performed correctly */
***************
*** 543,550 ****
        elemType = ILTypeGetElemType(type);
        rank = ILTypeGetRank(type);
        if(rank == 1)
        {
                /* Create a single-dimensional array */
!               ILGenUInt32(info, ILGetArrayInitLength(node->expr, 0));
                ILGenAdjust(info, 1);
                ILGenArrayNew(info, elemType);
--- 545,558 ----
        elemType = ILTypeGetElemType(type);
        rank = ILTypeGetRank(type);
+       sawZero = 0;
        if(rank == 1)
        {
                /* Create a single-dimensional array */
!               length = ILGetArrayInitLength(node->expr, 0);
!               if(length == 0)
!               {
!                       sawZero = 1;
!               }
!               ILGenUInt32(info, length);
                ILGenAdjust(info, 1);
                ILGenArrayNew(info, elemType);
***************
*** 555,559 ****
                for(dimension = 0; dimension < rank; ++dimension)
                {
!                       ILGenUInt32(info, ILGetArrayInitLength(node->expr, 
dimension));
                        ILGenAdjust(info, 1);
                }
--- 563,572 ----
                for(dimension = 0; dimension < rank; ++dimension)
                {
!                       length = ILGetArrayInitLength(node->expr, dimension);
!                       if(length == 0)
!                       {
!                               sawZero = 1;
!                       }
!                       ILGenUInt32(info, length);
                        ILGenAdjust(info, 1);
                }
***************
*** 563,567 ****
  
        /* Determine if we can use "InitializeArray" to populate simple arrays 
*/
!       if(IsSimpleElemType(elemType) && ArrayInitIsConst(info, (ILNode *)node))
        {
                /* Output a ".data" directive to hold the raw array data,
--- 576,581 ----
  
        /* Determine if we can use "InitializeArray" to populate simple arrays 
*/
!       if(IsSimpleElemType(elemType) &&
!          ArrayInitIsConst(info, (ILNode *)node) && !sawZero)
        {
                /* Output a ".data" directive to hold the raw array data,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]