From a888206111aca93d2fc566c8aca492a4039fb0ee Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 11 Oct 2021 22:10:38 -0500 Subject: [PATCH] Simplify address calculation for auto initializers. This simplifies the code in the compiler, and also generates better code when not using optimization. --- Parser.pas | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/Parser.pas b/Parser.pas index 5159b99..dc40054 100644 --- a/Parser.pas +++ b/Parser.pas @@ -4276,20 +4276,10 @@ var { Load the address of the operand } begin {LoadAddress} - with id^ do {load the base address} - case storage of - stackFrame: Gen2(pc_lda, lln, 0); - parameter: if itype^.kind = arrayType then - Gen2t(pc_lod, pln, 0, cgULong) - else - Gen2(pc_lda, pln, 0); - external, - global, - private: Gen1Name(pc_lao, 0, name); - otherwise: ; - end; {case} - if disp <> 0 then - Gen1t(pc_inc, long(disp).lsw, cgULong) + if id^.storage = stackFrame then + Gen2(pc_lda, id^.lln, ord(disp)) + else + Error(57); end; {LoadAddress}