From fea6dd2fd4560a4d925448d1ddb5d1cf0a0a3ded Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 11 Jul 2002 07:33:25 +0000 Subject: [PATCH] * big-endian fixes for location_force_reg*() --- compiler/ncgutil.pas | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index 1dcbc56505..755b61b863 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -341,6 +341,13 @@ implementation begin if (l.loc in [LOC_REGISTER,LOC_CREGISTER]) then l.register:=rg.makeregsize(l.register,dst_size); + { for big endian systems, the reference's offset must } + { be increased in this case, since they have the } + { MSB first in memory and e.g. byte(word_var) should } + { return the second byte in this case (JM) } + if (target_info.endian = ENDIAN_BIG) and + (l.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then + inc(l.reference.offset,TCGSize2Size[l.size]-TCGSize2Size[dst_size]); l.size:=dst_size; end; cg.a_load_loc_reg(list,l,hregister); @@ -426,6 +433,13 @@ implementation begin if (l.loc in [LOC_REGISTER,LOC_CREGISTER]) then l.register:=rg.makeregsize(l.register,dst_size); + { for big endian systems, the reference's offset must } + { be increased in this case, since they have the } + { MSB first in memory and e.g. byte(word_var) should } + { return the second byte in this case (JM) } + if (target_info.endian = ENDIAN_BIG) and + (l.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then + inc(l.reference.offset,TCGSize2Size[l.size]-TCGSize2Size[dst_size]); l.size:=dst_size; end; cg.a_load_loc_reg(list,l,hregister); @@ -1615,7 +1629,10 @@ implementation end. { $Log$ - Revision 1.20 2002-07-07 09:52:32 florian + Revision 1.21 2002-07-11 07:33:25 jonas + * big-endian fixes for location_force_reg*() + + Revision 1.20 2002/07/07 09:52:32 florian * powerpc target fixed, very simple units can be compiled * some basic stuff for better callparanode handling, far from being finished