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_arith.tc,1.14,1.15


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/codegen cg_arith.tc,1.14,1.15
Date: Wed, 27 Nov 2002 13:45:09 -0500

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

Modified Files:
        cg_arith.tc 
Log Message:
constant folding for string concat


Index: cg_arith.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_arith.tc,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** cg_arith.tc 21 Nov 2002 09:52:26 -0000      1.14
--- cg_arith.tc 27 Nov 2002 18:45:04 -0000      1.15
***************
*** 847,850 ****
--- 847,881 ----
  }
  
+ ILNode_EvalConst(ILNode_Concat)
+ {
+       ILMachineType type1;
+       ILMachineType type2;
+       ILEvalValue value2;
+       ILIntString new_string;
+ 
+       type1 = ILNode_GetType(node->expr1, info);
+       type2 = ILNode_GetType(node->expr2, info);
+       if(type1 != ILMachineType_String || type2 != ILMachineType_String)
+       {
+               return 0;
+       }
+       if(!ILNode_EvalConst(node->expr1,info,value)) 
+       {
+               return 0;
+       }
+       if(!ILNode_EvalConst(node->expr2,info,&value2)) 
+       {
+               return 0;
+       }
+       new_string = ILInternAppendedString
+                               (ILInternString(value->un.strValue.str, 
+                                       value->un.strValue.len),
+                                ILInternString(value2.un.strValue.str,
+                                       value2.un.strValue.len));
+       value->un.strValue.str=new_string.string; 
+       value->un.strValue.len=new_string.len;
+       return 1;
+ }
+ 
  /*
   * Apply the addition operator to various types.





reply via email to

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