From 1ab3d815419f07c5f3cfebafea7a40e70f6f6805 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 20 Aug 2006 19:28:10 +0000 Subject: [PATCH] * also use LOC_CSUBSETREF * set expectloc properly for packed arrays git-svn-id: trunk@4480 - --- compiler/ncgmem.pas | 10 ++++++++-- compiler/nmem.pas | 13 ++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/compiler/ncgmem.pas b/compiler/ncgmem.pas index a204fbaa19..0818d12f0d 100644 --- a/compiler/ncgmem.pas +++ b/compiler/ncgmem.pas @@ -465,7 +465,10 @@ implementation sref.bitindexreg := reg; sref.startbit := 0; sref.bitlen := resulttype.def.packedbitsize; - location.loc := LOC_SUBSETREF; + if (left.location.loc = LOC_REFERENCE) then + location.loc := LOC_SUBSETREF + else + location.loc := LOC_CSUBSETREF; location.sref := sref; end; @@ -731,7 +734,10 @@ implementation subsetref.bitindexreg := NR_NO; subsetref.startbit := (mulsize * (tordconstnode(right).value-tarraydef(left.resulttype.def).lowrange)) and ((1 shl (3+alignpow))-1); subsetref.bitlen := resulttype.def.packedbitsize; - location.loc := LOC_SUBSETREF; + if (left.location.loc = LOC_REFERENCE) then + location.loc := LOC_SUBSETREF + else + location.loc := LOC_CSUBSETREF; location.sref := subsetref; end; end diff --git a/compiler/nmem.pas b/compiler/nmem.pas index a6d2228fb4..ac1bd11c52 100644 --- a/compiler/nmem.pas +++ b/compiler/nmem.pas @@ -851,10 +851,17 @@ implementation {$ifdef SUPPORT_MMX} registersmmx:=max(left.registersmmx,right.registersmmx); {$endif SUPPORT_MMX} - if left.expectloc=LOC_CREFERENCE then - expectloc:=LOC_CREFERENCE + if (not is_packed_array(left.resulttype.def)) or + ((tarraydef(left.resulttype.def).elepackedbitsize mod 8) = 0) then + if left.expectloc=LOC_CREFERENCE then + expectloc:=LOC_CREFERENCE + else + expectloc:=LOC_REFERENCE else - expectloc:=LOC_REFERENCE; + if left.expectloc=LOC_CREFERENCE then + expectloc:=LOC_CSUBSETREF + else + expectloc:=LOC_SUBSETREF; end;