[Top][All Lists]
[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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/codegen cg_arith.tc,1.14,1.15,
Gopal.V <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.1901,1.1902
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Private/NumberFormat CustomFormatter.cs,1.1,1.2 FixedPointFormatter.cs,1.1,1.2 GeneralFormatter.cs,1.1,1.2 NumberFormatter.cs,1.1,1.2 PercentFormatter.cs,1.1,1.2 ScientificFormatter.cs,1.1,1.2
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.1901,1.1902
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Private/NumberFormat CustomFormatter.cs,1.1,1.2 FixedPointFormatter.cs,1.1,1.2 GeneralFormatter.cs,1.1,1.2 NumberFormatter.cs,1.1,1.2 PercentFormatter.cs,1.1,1.2 ScientificFormatter.cs,1.1,1.2
- Index(es):