Closed zu2 closed 2 weeks ago
The idea is to avoid unnecessary ldb, but there seems to be a better way.
@@ -1300,16 +1413,35 @@
return 1;
return do_xeqop(n, "xminuseq");
case T_PLUSPLUS:
if (s == 1 && nr && memop_const(n, "inc"))
return 1;
if (s == 2 && add_to_node(n, 1, nr))
return 1;
+ if (s == 1 && cpu == 6800){
+ if (r->op == T_CONSTANT && l->op == T_LOCAL){
+ v = load_x_with(l,0);
+ if (!nr)
+ uniop_on_ptr("ldb",v,s);
+ uniop_on_ptr("inc", v, s);
+ return 1;
+ }
+ }
return do_xeqop(n, "xplusplus");
case T_MINUSMINUS:
if (s == 1 && nr && memop_const(n, "dec"))
return 1;
if (s == 2 && add_to_node(n, -1, nr))
return 1;
+ if (s == 1 && cpu == 6800){
+ if (r->op == T_CONSTANT && l->op == T_LOCAL){
+ v = load_x_with(l,0);
+ if (!nr)
+ uniop_on_ptr("ldb",v,s);
+ uniop_on_ptr("dec", v, s);
+ return 1;
+ }
+ }
return do_xeqop(n, "xmminus");
case T_STAREQ:
return do_xeqop(n, "xmuleq");
Fixed it all in memop_const
bcb41f7a466b015348b1794556f119e2709a074c
Currently, ++/-- on char variables calls a helper, but this will be avoided.
This will use 2 extra bytes of memory if you use the modified value, but it will be faster. If you don't need the modified value, the memory size is the same. (If you can output inc instead of addb #1, you can save 1 byte.)
old: 6bytes
new: 8bytes (It's faster to do subb #1 than pshb/pulb)
I would like to produce code like this, but this is also possible with rules.6800.