[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/cscc/c c_oper.tc,1.25,1.26
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/cscc/c c_oper.tc,1.25,1.26 |
Date: |
Tue, 15 Apr 2003 22:12:45 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/cscc/c
In directory subversions:/tmp/cvs-serv19029/cscc/c
Modified Files:
c_oper.tc
Log Message:
Constant evaluation for the "sizeof" operator (Bug #2776).
Index: c_oper.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_oper.tc,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** c_oper.tc 23 Dec 2002 22:43:26 -0000 1.25
--- c_oper.tc 16 Apr 2003 02:12:42 -0000 1.26
***************
*** 2396,2399 ****
--- 2396,2424 ----
/*
+ * Evaluate the constant value of the "sizeof expression" operator.
+ */
+ ILNode_EvalConst(ILNode_SizeOfExpr)
+ {
+ ILUInt32 size;
+ if(!(node->type))
+ {
+ return 0;
+ }
+ size = CTypeSizeAndAlign(node->type, (ILUInt32 *)0);
+ if(size != CTYPE_DYNAMIC)
+ {
+ /* The type's size can be evaluated to a compile-time constant
*/
+ value->valueType = ILMachineType_UInt32;
+ value->un.i4Value = (ILInt32)size;
+ return 1;
+ }
+ else
+ {
+ /* We must compute this constant value dynamically at runtime */
+ return 0;
+ }
+ }
+
+ /*
* Perform semantic analysis for the "sizeof type" operator.
*/
***************
*** 2418,2421 ****
--- 2443,2467 ----
}
return value;
+ }
+
+ /*
+ * Evaluate the constant value of a "sizeof type" operator.
+ */
+ ILNode_EvalConst(ILNode_SizeOfType)
+ {
+ ILUInt32 size;
+ size = CTypeSizeAndAlign(node->type, (ILUInt32 *)0);
+ if(size != CTYPE_DYNAMIC)
+ {
+ /* The type's size can be evaluated to a compile-time constant
*/
+ value->valueType = ILMachineType_UInt32;
+ value->un.i4Value = (ILInt32)size;
+ return 1;
+ }
+ else
+ {
+ /* We must compute this constant value dynamically at runtime */
+ return 0;
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/cscc/c c_oper.tc,1.25,1.26,
Rhys Weatherley <address@hidden> <=