* avoid problems when using a_load*loc* calls with 3-byte-sized parameters

(fix internalerror when compiling webtbs/tw16163 on non-Darwin/ARM)

git-svn-id: trunk@21330 -
This commit is contained in:
Jonas Maebe 2012-05-19 10:19:53 +00:00
parent 958600e74b
commit 9e51b0837c

View File

@ -533,16 +533,26 @@ implementation
end; end;
procedure thlcg2ll.a_load_reg_loc(list: TAsmList; fromsize, tosize: tdef; reg: tregister; const loc: tlocation); procedure thlcg2ll.a_load_reg_loc(list: TAsmList; fromsize, tosize: tdef; reg: tregister; const loc: tlocation);
var
fromcgsize: tcgsize;
begin begin
case loc.loc of case loc.loc of
LOC_SUBSETREG,LOC_CSUBSETREG, LOC_SUBSETREG,LOC_CSUBSETREG,
LOC_SUBSETREF,LOC_CSUBSETREF: LOC_SUBSETREF,LOC_CSUBSETREF:
inherited; inherited;
else else
{ fromsize can be a floatdef (in case the destination is an begin
MMREGISTER) -> use int_cgsize rather than def_cgsize to get the { avoid problems with 3-byte records and the like }
corresponding integer cgsize of the def } if (fromsize.typ<>floatdef) and
cg.a_load_reg_loc(list,int_cgsize(fromsize.size),reg,loc); (fromsize=tosize) then
fromcgsize:=loc.size
else
{ fromsize can be a floatdef (in case the destination is an
MMREGISTER) -> use int_cgsize rather than def_cgsize to get the
corresponding integer cgsize of the def }
fromcgsize:=int_cgsize(fromsize.size);
cg.a_load_reg_loc(list,fromcgsize,reg,loc);
end;
end; end;
end; end;
@ -562,24 +572,42 @@ implementation
end; end;
procedure thlcg2ll.a_load_loc_reg(list: TAsmList; fromsize, tosize: tdef; const loc: tlocation; reg: tregister); procedure thlcg2ll.a_load_loc_reg(list: TAsmList; fromsize, tosize: tdef; const loc: tlocation; reg: tregister);
var
tocgsize: tcgsize;
begin begin
case loc.loc of case loc.loc of
LOC_SUBSETREG,LOC_CSUBSETREG, LOC_SUBSETREG,LOC_CSUBSETREG,
LOC_SUBSETREF,LOC_CSUBSETREF: LOC_SUBSETREF,LOC_CSUBSETREF:
inherited inherited
else else
cg.a_load_loc_reg(list,def_cgsize(tosize),loc,reg); begin
{ avoid problems with 3-byte records and the like }
if fromsize=tosize then
tocgsize:=loc.size
else
tocgsize:=def_cgsize(tosize);
cg.a_load_loc_reg(list,tocgsize,loc,reg);
end;
end; end;
end; end;
procedure thlcg2ll.a_load_loc_ref(list: TAsmList; fromsize, tosize: tdef; const loc: tlocation; const ref: treference); procedure thlcg2ll.a_load_loc_ref(list: TAsmList; fromsize, tosize: tdef; const loc: tlocation; const ref: treference);
var
tocgsize: tcgsize;
begin begin
case loc.loc of case loc.loc of
LOC_SUBSETREG,LOC_CSUBSETREG, LOC_SUBSETREG,LOC_CSUBSETREG,
LOC_SUBSETREF,LOC_CSUBSETREF: LOC_SUBSETREF,LOC_CSUBSETREF:
inherited inherited
else else
cg.a_load_loc_ref(list,def_cgsize(tosize),loc,ref); begin
{ avoid problems with 3-byte records and the like }
if fromsize=tosize then
tocgsize:=loc.size
else
tocgsize:=def_cgsize(tosize);
cg.a_load_loc_ref(list,tocgsize,loc,ref);
end;
end; end;
end; end;