From 290a1c5179de0e3999527336495e6931950114bb Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Thu, 11 Oct 2018 14:17:38 +0300 Subject: compiler: save some bytes When doing IO operation on field, ignore the calculation for field register if index == 0, as the offset is already enough. --- src/compiler/compiler.lm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/compiler.lm b/src/compiler/compiler.lm index d0864b4..1ca7705 100644 --- a/src/compiler/compiler.lm +++ b/src/compiler/compiler.lm @@ -433,8 +433,10 @@ write_declaration(d:fspec::declaration::type, index:int) if (!c) { write_ins(INS_PUSHR, g_fcr) - write_ins(INS_PUSH, index) - write_ins(INS_OP, g_ops->find('#+')) + if (index != 0) { + write_ins(INS_PUSH, index) + write_ins(INS_OP, g_ops->find('#+')) + } write_ins(INS_IO, d.primitive.bits) } else { write_ins(INS_PUSH, g_offs->find(%c)) -- cgit v1.2.3