patch: an optimization and a triviality
Per Bothner
per@bothner.com
Mon Dec 3 17:48:00 GMT 2001
More trivial patches. The first one I've posted earlier
- it does some constant folding even when we can't call fold.
The second one is so trivial it's embarassing - but it's the
principle of not using resources you don't need.
2001-12-03 Per Bothner <per@bothner.com>
* parse.y (patch_binop): Minor constant folding.
* parse.y (build_current_thisn): Shorter 'buffer'.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.328
diff -u -p -r1.328 parse.y
--- parse.y 2001/12/03 19:13:40 1.328
+++ parse.y 2001/12/04 01:22:14
@@ -8619,7 +8619,7 @@ build_current_thisn (type)
static int saved_type_i = 0;
static int initialized_p;
tree decl;
- char buffer [80];
+ char buffer [24];
int i = 0;
/* Register SAVED_THISN and SAVED_TYPE with the garbage collector. */
@@ -13769,6 +13769,14 @@ patch_binop (node, wfl_op1, wfl_op2)
TREE_TYPE (node) = boolean_type_node;
error_found = 1;
break;
+
}
+ else if (integer_zerop (op1))
+
{
+
return code == TRUTH_ANDIF_EXPR ? op1 : op2;
+
}
+ else if (integer_onep (op1))
+
{
+
return code == TRUTH_ANDIF_EXPR ? op2 : op1;
}
/* The type of the conditional operators is BOOLEAN */
prom_type = boolean_type_node;
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: binop.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20011203/1db02f8c/attachment.ksh>
More information about the Gcc-patches
mailing list