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_misc.tc,1.45,1.46 cg_nodes.t


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/codegen cg_misc.tc,1.45,1.46 cg_nodes.tc,1.75,1.76
Date: Wed, 26 Feb 2003 21:57:46 -0500

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

Modified Files:
        cg_misc.tc cg_nodes.tc 
Log Message:


Implement array access operations on pointer types.


Index: cg_misc.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_misc.tc,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -r1.45 -r1.46
*** cg_misc.tc  28 Dec 2002 17:17:02 -0000      1.45
--- cg_misc.tc  27 Feb 2003 02:57:43 -0000      1.46
***************
*** 322,327 ****
  ILNode_GetType(ILNode_Deref)
  {
!       /* TODO */
!       return ILMachineType_Void;
  }
  
--- 322,326 ----
  ILNode_GetType(ILNode_Deref)
  {
!       return ILTypeToMachineType(node->elemType);
  }
  
***************
*** 1499,1504 ****
  ILNode_GenValue(ILNode_Deref)
  {
!       /* TODO */
!       return ILMachineType_Void;
  }
  
--- 1498,1511 ----
  ILNode_GenValue(ILNode_Deref)
  {
!       ILMachineType machineType;
! 
!       /* Evaluate the pointer expression */
!       ILGenCast(info, ILNode_GenValue(node->expr, info),
!                         ILMachineType_UnmanagedPtr);
! 
!       /* Load the value onto the stack */
!       machineType = ILTypeToMachineType(node->elemType);
!       ILGenLoadManaged(info, machineType, node->elemType);
!       return machineType;
  }
  
***************
*** 2367,2372 ****
  ILNode_Prepare(ILNode_Deref)
  {
!       /* TODO */
!       return ILMachineType_Void;
  }
  
--- 2374,2383 ----
  ILNode_Prepare(ILNode_Deref)
  {
!       /* Evaluate the pointer expression */
!       ILGenCast(info, ILNode_GenValue(node->expr, info),
!                         ILMachineType_UnmanagedPtr);
! 
!       /* Return the machine type for the underlying value */
!       return ILTypeToMachineType(node->elemType);
  }
  
***************
*** 2463,2468 ****
  ILNode_GetAndPrepare(ILNode_Deref)
  {
!       /* TODO */
!       return ILMachineType_Void;
  }
  
--- 2474,2513 ----
  ILNode_GetAndPrepare(ILNode_Deref)
  {
!       ILMachineType machineType = ILTypeToMachineType(node->elemType);
! 
!       /* Evaluate the pointer expression */
!       ILGenCast(info, ILNode_GenValue(node->expr, info),
!                         ILMachineType_UnmanagedPtr);
! 
!       /* Should we leave the previous value on the stack afterwards? */
!       if(leave)
!       {
!               unsigned tempVar1 = ILGenTempTypedVar(info, ILType_Int);
!               unsigned tempVar2 = ILGenTempTypedVar(info, node->elemType);
!               ILGenSimple(info, IL_OP_DUP);
!               ILGenAdjust(info, 1);
!               ILGenStoreLocal(info, tempVar1);
!               ILGenAdjust(info, -1);
!               ILGenLoadManaged(info, machineType, node->elemType);
!               ILGenSimple(info, IL_OP_DUP);
!               ILGenAdjust(info, 1);
!               ILGenStoreLocal(info, tempVar2);
!               ILGenAdjust(info, -1);
!               ILGenLoadLocal(info, tempVar1);
!               ILGenAdjust(info, 1);
!               ILGenLoadLocal(info, tempVar2);
!               ILGenAdjust(info, 1);
!               ILGenReleaseTempVar(info, tempVar1);
!               ILGenReleaseTempVar(info, tempVar2);
!       }
!       else
!       {
!               ILGenSimple(info, IL_OP_DUP);
!               ILGenAdjust(info, 1);
!               ILGenLoadManaged(info, machineType, node->elemType);
!       }
! 
!       /* Return the machine type for the underlying value */
!       return ILTypeToMachineType(node->elemType);
  }
  
***************
*** 2541,2545 ****
  ILNode_Store(ILNode_Deref)
  {
!       /* TODO */
  }
  
--- 2586,2608 ----
  ILNode_Store(ILNode_Deref)
  {
!       ILMachineType machineType = ILTypeToMachineType(node->elemType);
!       if(leave)
!       {
!               unsigned tempVar = ILGenTempTypedVar(info, node->elemType);
!               ILGenSimple(info, IL_OP_DUP);
!               ILGenAdjust(info, 1);
!               ILGenStoreLocal(info, tempVar);
!               ILGenAdjust(info, -1);
!               ILGenStoreManaged(info, machineType, node->elemType);
!               ILGenAdjust(info, -2);
!               ILGenLoadLocal(info, tempVar);
!               ILGenAdjust(info, 1);
!               ILGenReleaseTempVar(info, tempVar);
!       }
!       else
!       {
!               ILGenStoreManaged(info, machineType, node->elemType);
!               ILGenAdjust(info, -2);
!       }
  }
  

Index: cg_nodes.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_nodes.tc,v
retrieving revision 1.75
retrieving revision 1.76
diff -C2 -r1.75 -r1.76
*** cg_nodes.tc 22 Feb 2003 07:21:59 -0000      1.75
--- cg_nodes.tc 27 Feb 2003 02:57:43 -0000      1.76
***************
*** 405,408 ****
--- 405,409 ----
  {
        ILNode *expr;
+       ILType *elemType;
  }
  %node ILNode_AddressOf ILNode_UnaryExpression





reply via email to

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