commit 873b26e64752c8c008c69abbb7c4d94c34880935
parent a72bc11f3f3b1aa72ee9acabadf419f7f2544b2d
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Fri, 31 Mar 2023 19:06:58 -0400
halcc: consolidate
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/comp/c/expr.fs b/fs/comp/c/expr.fs
@@ -72,7 +72,7 @@ struct[ Result
CONST of = arg i) endof
CDECL of =
dup cdecl dup CDecl :halop ( self cdecl halop )
- swap CDecl nbelem if A>) lea, A*) then ( self halop )
+ swap CDecl :reference? if A>) lea, A*) then ( self halop )
swap :nb) endof
PS of = arg PSP+) endof
REF of = target :hal# A>) lea, A*) endof
diff --git a/fs/comp/c/type.fs b/fs/comp/c/type.fs
@@ -79,12 +79,14 @@ struct[ CDecl
: :isvar? ( self -- f ) storage STORAGE_RS = ;
: :isglobal? ( self -- f ) storage STORAGE_MEM = ;
- : :lvl bi lvl | nbelem bool + ;
+ \ Arrays, function signatures and struct ident "naturally" yield references.
+ : :reference? bi nbelem | flags 3 and or? ;
+ : :lvl bi lvl | :reference? + ;
: :halop ( self -- operand ) dup bi offset | storage case ( self offset )
STORAGE_RS of = RSP) swap +) endof
STORAGE_PS of = PSP+) endof
- STORAGE_MEM of = over :funcsig? if i) else m) then endof
+ STORAGE_MEM of = m) endof
_err endcase ( self operand ) nip ;
\ Combined size of all fields in the LL.