* bug #580 fixed

This commit is contained in:
florian 1999-09-04 20:50:08 +00:00
parent d2c3613518
commit 96dd7c82fa
3 changed files with 100 additions and 57 deletions

View File

@ -57,63 +57,79 @@ implementation
hp1 : pai;
lastlabel : pasmlabel;
realait : tait;
begin
lastlabel:=nil;
realait:=floattype2ait[pfloatdef(p^.resulttype)^.typ];
{ const already used ? }
if not assigned(p^.lab_real) then
if (p^.value_real=1.0) then
begin
{ tries to found an old entry }
hp1:=pai(consts^.first);
while assigned(hp1) do
begin
if hp1^.typ=ait_label then
lastlabel:=pai_label(hp1)^.l
else
begin
if (hp1^.typ=realait) and (lastlabel<>nil) then
begin
if(
((realait=ait_real_32bit) and (pai_real_32bit(hp1)^.value=p^.value_real)) or
((realait=ait_real_64bit) and (pai_real_64bit(hp1)^.value=p^.value_real)) or
((realait=ait_real_80bit) and (pai_real_80bit(hp1)^.value=p^.value_real)) or
((realait=ait_comp_64bit) and (pai_comp_64bit(hp1)^.value=p^.value_real))
) then
begin
{ found! }
p^.lab_real:=lastlabel;
break;
end;
end;
lastlabel:=nil;
end;
hp1:=pai(hp1^.next);
end;
{ :-(, we must generate a new entry }
emit_none(A_FLD1,S_NO);
p^.location.loc:=LOC_FPU;
inc(fpuvaroffset);
end
else if (p^.value_real=0.0) then
begin
emit_none(A_FLDZ,S_NO);
p^.location.loc:=LOC_FPU;
inc(fpuvaroffset);
end
else
begin
lastlabel:=nil;
realait:=floattype2ait[pfloatdef(p^.resulttype)^.typ];
{ const already used ? }
if not assigned(p^.lab_real) then
begin
getdatalabel(lastlabel);
p^.lab_real:=lastlabel;
if (cs_smartlink in aktmoduleswitches) then
consts^.concat(new(pai_cut,init));
consts^.concat(new(pai_label,init(lastlabel)));
case realait of
ait_real_32bit :
consts^.concat(new(pai_real_32bit,init(p^.value_real)));
ait_real_64bit :
consts^.concat(new(pai_real_64bit,init(p^.value_real)));
ait_real_80bit :
consts^.concat(new(pai_real_80bit,init(p^.value_real)));
ait_comp_64bit :
consts^.concat(new(pai_comp_64bit,init(p^.value_real)));
else
internalerror(10120);
end;
{ tries to found an old entry }
hp1:=pai(consts^.first);
while assigned(hp1) do
begin
if hp1^.typ=ait_label then
lastlabel:=pai_label(hp1)^.l
else
begin
if (hp1^.typ=realait) and (lastlabel<>nil) then
begin
if(
((realait=ait_real_32bit) and (pai_real_32bit(hp1)^.value=p^.value_real)) or
((realait=ait_real_64bit) and (pai_real_64bit(hp1)^.value=p^.value_real)) or
((realait=ait_real_80bit) and (pai_real_80bit(hp1)^.value=p^.value_real)) or
((realait=ait_comp_64bit) and (pai_comp_64bit(hp1)^.value=p^.value_real))
) then
begin
{ found! }
p^.lab_real:=lastlabel;
break;
end;
end;
lastlabel:=nil;
end;
hp1:=pai(hp1^.next);
end;
{ :-(, we must generate a new entry }
if not assigned(p^.lab_real) then
begin
getdatalabel(lastlabel);
p^.lab_real:=lastlabel;
if (cs_smartlink in aktmoduleswitches) then
consts^.concat(new(pai_cut,init));
consts^.concat(new(pai_label,init(lastlabel)));
case realait of
ait_real_32bit :
consts^.concat(new(pai_real_32bit,init(p^.value_real)));
ait_real_64bit :
consts^.concat(new(pai_real_64bit,init(p^.value_real)));
ait_real_80bit :
consts^.concat(new(pai_real_80bit,init(p^.value_real)));
ait_comp_64bit :
consts^.concat(new(pai_comp_64bit,init(p^.value_real)));
else
internalerror(10120);
end;
end;
end;
reset_reference(p^.location.reference);
p^.location.reference.symbol:=p^.lab_real;
p^.location.loc:=LOC_MEM;
end;
reset_reference(p^.location.reference);
p^.location.reference.symbol:=p^.lab_real;
p^.location.loc:=LOC_MEM;
end;
@ -401,7 +417,10 @@ implementation
end.
{
$Log$
Revision 1.39 1999-08-04 00:22:45 florian
Revision 1.40 1999-09-04 20:53:06 florian
* bug 580 fixed
Revision 1.39 1999/08/04 00:22:45 florian
* renamed i386asm and i386base to cpuasm and cpubase
Revision 1.38 1999/08/03 22:02:38 peter

View File

@ -696,11 +696,23 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
reset_reference(p^.location.reference);
gettempofsizereference(10,p^.location.reference);
floatstore(pfloatdef(p^.resulttype)^.typ,p^.location.reference);
p^.location.loc:=LOC_REFERENCE;
{ This can't be never a l-value! (FK)
p^.location.loc:=LOC_REFERENCE; }
p^.location.loc:=LOC_MEM;
end;
LOC_MEM,
LOC_REFERENCE : ;
else
LOC_CFPUREGISTER : begin
emit_reg(A_FLD,S_NO,correct_fpuregister(p^.location.register,fpuvaroffset));
inc(fpuvaroffset);
reset_reference(p^.location.reference);
gettempofsizereference(10,p^.location.reference);
floatstore(pfloatdef(p^.resulttype)^.typ,p^.location.reference);
{ This can't be never a l-value! (FK)
p^.location.loc:=LOC_REFERENCE; }
p^.location.loc:=LOC_MEM;
end;
else
internalerror(333);
end;
end;
@ -3294,7 +3306,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end.
{
$Log$
Revision 1.37 1999-09-02 17:07:38 florian
Revision 1.38 1999-09-04 20:50:08 florian
* bug 580 fixed
Revision 1.37 1999/09/02 17:07:38 florian
* problems with -Or fixed: tdef.isfpuregable was wrong!
Revision 1.36 1999/09/01 09:26:23 peter

View File

@ -47,7 +47,13 @@ implementation
procedure firstrealconst(var p : ptree);
begin
p^.location.loc:=LOC_MEM;
if (p^.value_real=1.0) or (p^.value_real=0.0) then
begin
p^.location.loc:=LOC_FPU;
p^.registersfpu:=1;
end
else
p^.location.loc:=LOC_MEM;
end;
@ -119,7 +125,10 @@ implementation
end.
{
$Log$
Revision 1.8 1999-08-04 00:23:38 florian
Revision 1.9 1999-09-04 20:52:07 florian
* bug 580 fixed
Revision 1.8 1999/08/04 00:23:38 florian
* renamed i386asm and i386base to cpuasm and cpubase
Revision 1.7 1999/08/03 22:03:29 peter