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

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

[Dotgnu-pnet-commits] pnet/cscc/c c_oper.tc,1.33,1.34


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnet/cscc/c c_oper.tc,1.33,1.34
Date: Thu, 02 Oct 2003 09:37:33 +0000

Update of /cvsroot/dotgnu-pnet/pnet/cscc/c
In directory subversions:/tmp/cvs-serv31990/cscc/c

Modified Files:
        c_oper.tc 
Log Message:


Improve the handling of boolean constant values in the C compiler.


Index: c_oper.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_oper.tc,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** c_oper.tc   12 Aug 2003 07:16:28 -0000      1.33
--- c_oper.tc   2 Oct 2003 09:37:30 -0000       1.34
***************
*** 40,43 ****
--- 40,56 ----
  
  /*
+  * Construct a boolean constant semantic value.
+  */
+ static CSemValue CreateBoolValue(ILInt32 value)
+ {
+       ILEvalValue eval;
+       CSemValue result;
+       eval.valueType = ILMachineType_Boolean;
+       eval.un.i4Value = value;
+       CSemSetConstant(result, ILType_Boolean, eval);
+       return result;
+ }
+ 
+ /*
   * Construct a constant node from a compile-time constant.
   * If it isn't possible to construct a node, return "origNode".
***************
*** 49,52 ****
--- 62,71 ----
        switch(evalValue->valueType)
        {
+               case ILMachineType_Boolean:
+               {
+                       node = CreateBoolConstant(cloneFrom, 
evalValue->un.i4Value);
+               }
+               break;
+ 
                case ILMachineType_Int8:
                {
***************
*** 230,233 ****
--- 249,253 ----
                /* Replace this node with either "true" or "false" */
                *parent = CreateBoolConstant(node->expr, evalValue->un.i4Value);
+               return CreateBoolValue(evalValue->un.i4Value);
        }
        return CSemValueBool;
***************
*** 273,280 ****
--- 293,302 ----
                {
                        *parent = CreateBoolConstant((ILNode *)node, 1);
+                       return CreateBoolValue(1);
                }
                else
                {
                        *parent = CreateBoolConstant((ILNode *)node, 0);
+                       return CreateBoolValue(0);
                }
        }
***************
*** 292,295 ****
--- 314,318 ----
                        /* The whole expression evaluates to false */
                        *parent = CreateBoolConstant((ILNode *)node, 0);
+                       return CreateBoolValue(0);
                }
        }
***************
*** 355,362 ****
--- 378,387 ----
                {
                        *parent = CreateBoolConstant((ILNode *)node, 1);
+                       return CreateBoolValue(1);
                }
                else
                {
                        *parent = CreateBoolConstant((ILNode *)node, 0);
+                       return CreateBoolValue(0);
                }
        }
***************
*** 368,371 ****
--- 393,397 ----
                        /* The whole expression evaluates to true */
                        *parent = CreateBoolConstant((ILNode *)node, 1);
+                       return CreateBoolValue(1);
                }
                else
***************
*** 404,414 ****
   */
  #define       IsNumericMachineType(type)      \
!                       ((type) >= ILMachineType_Int8 && \
                         (type) <= ILMachineType_NativeFloat)
  #define       IsIntegerMachineType(type)      \
!                       ((type) >= ILMachineType_Int8 && \
                         (type) <= ILMachineType_NativeUInt)
  #define       IsSmallIntegerMachineType(type) \
!                       ((type) >= ILMachineType_Int8 && \
                         (type) <= ILMachineType_Int32)
  
--- 430,440 ----
   */
  #define       IsNumericMachineType(type)      \
!                       ((type) >= ILMachineType_Boolean && \
                         (type) <= ILMachineType_NativeFloat)
  #define       IsIntegerMachineType(type)      \
!                       ((type) >= ILMachineType_Boolean && \
                         (type) <= ILMachineType_NativeUInt)
  #define       IsSmallIntegerMachineType(type) \
!                       ((type) >= ILMachineType_Boolean && \
                         (type) <= ILMachineType_Int32)
  
***************
*** 566,569 ****
--- 592,596 ----
        switch(common)
        {
+               case ILMachineType_Boolean:
                case ILMachineType_Int8:
                case ILMachineType_UInt8:
***************
*** 1309,1312 ****
--- 1336,1340 ----
        switch(type)
        {
+               case ILMachineType_Boolean:
                case ILMachineType_Int8:
                case ILMachineType_UInt8:
***************
*** 1405,1408 ****
--- 1433,1437 ----
        switch(type)
        {
+               case ILMachineType_Boolean:
                case ILMachineType_Int8:
                case ILMachineType_UInt8:
***************
*** 1529,1532 ****
--- 1558,1562 ----
        switch(type)
        {
+               case ILMachineType_Boolean:
                case ILMachineType_Int8:
                case ILMachineType_UInt8:
***************
*** 2264,2268 ****
        {
                *parent = CreateBoolConstant((ILNode *)node, 
evalValue->un.i4Value);
!               return CSemValueBool;
        }
  
--- 2294,2298 ----
        {
                *parent = CreateBoolConstant((ILNode *)node, 
evalValue->un.i4Value);
!               return CreateBoolValue(evalValue->un.i4Value);
        }
  





reply via email to

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