* the boolean operators =;<>;xor with LOC_JUMP and LOC_FLAGS

operands fixed, small things for new ansistring management
This commit is contained in:
florian 1999-04-16 20:44:34 +00:00
parent a253af1002
commit 0596b2b719
3 changed files with 114 additions and 9 deletions

View File

@ -65,7 +65,6 @@ implementation
end;
end;
function getresflags(p : ptree;unsigned : boolean) : tresflags;
begin
@ -589,7 +588,7 @@ implementation
pushed,mboverflow,cmpop : boolean;
op,op2 : tasmop;
flags : tresflags;
otl,ofl : plabel;
otl,ofl,hl : plabel;
power : longint;
opsize : topsize;
hl4: plabel;
@ -688,15 +687,78 @@ implementation
equaln,xorn : begin
if p^.left^.treetype=ordconstn then
swaptree(p);
if p^.left^.location.loc=LOC_JUMP then
begin
otl:=truelabel;
getlabel(truelabel);
ofl:=falselabel;
getlabel(falselabel);
end;
secondpass(p^.left);
{ if in flags then copy first to register, because the
flags can be destroyed }
if (p^.left^.location.loc=LOC_FLAGS) then
locflags2reg(p^.left^.location,opsize);
case p^.left^.location.loc of
LOC_FLAGS:
locflags2reg(p^.left^.location,opsize);
LOC_JUMP:
begin
case opsize of
S_L : hregister:=getregister32;
S_W : hregister:=reg32toreg16(getregister32);
S_B : hregister:=reg32toreg8(getregister32);
end;
p^.left^.location.loc:=LOC_REGISTER;
p^.left^.location.register:=hregister;
emitlab(truelabel);
truelabel:=otl;
exprasmlist^.concat(new(pai386,op_const_reg(A_MOV,opsize,1,
hregister)));
getlabel(hl);
emitjmp(C_None,hl);
emitlab(falselabel);
falselabel:=ofl;
exprasmlist^.concat(new(pai386,op_reg_reg(A_XOR,S_L,makereg32(hregister),
makereg32(hregister))));
emitlab(hl);
end;
end;
set_location(p^.location,p^.left^.location);
pushed:=maybe_push(p^.right^.registers32,p);
if p^.right^.location.loc=LOC_JUMP then
begin
otl:=truelabel;
getlabel(truelabel);
ofl:=falselabel;
getlabel(falselabel);
end;
secondpass(p^.right);
if pushed then restore(p);
case p^.right^.location.loc of
LOC_FLAGS:
locflags2reg(p^.right^.location,opsize);
LOC_JUMP:
begin
case opsize of
S_L : hregister:=getregister32;
S_W : hregister:=reg32toreg16(getregister32);
S_B : hregister:=reg32toreg8(getregister32);
end;
p^.right^.location.loc:=LOC_REGISTER;
p^.right^.location.register:=hregister;
emitlab(truelabel);
truelabel:=otl;
exprasmlist^.concat(new(pai386,op_const_reg(A_MOV,opsize,1,
hregister)));
getlabel(hl);
emitjmp(C_None,hl);
emitlab(falselabel);
falselabel:=ofl;
exprasmlist^.concat(new(pai386,op_reg_reg(A_XOR,S_L,makereg32(hregister),
makereg32(hregister))));
emitlab(hl);
end;
end;
goto do_normal;
end
else
@ -1970,7 +2032,11 @@ implementation
end.
{
$Log$
Revision 1.50 1999-04-16 13:42:35 jonas
Revision 1.51 1999-04-16 20:44:34 florian
* the boolean operators =;<>;xor with LOC_JUMP and LOC_FLAGS
operands fixed, small things for new ansistring management
Revision 1.50 1999/04/16 13:42:35 jonas
* more regalloc fixes (still not complete)
Revision 1.49 1999/04/16 11:44:24 peter

View File

@ -347,7 +347,11 @@ implementation
xorn:
begin
make_bool_equal_size(p);
calcregisters(p,1,0,0);
if (p^.left^.location.loc in [LOC_JUMP,LOC_FLAGS]) and
(p^.left^.location.loc in [LOC_JUMP,LOC_FLAGS]) then
calcregisters(p,2,0,0)
else
calcregisters(p,1,0,0);
end;
unequaln,
equaln:
@ -388,11 +392,36 @@ implementation
end;
exit;
end;
calcregisters(p,1,0,0);
if (p^.left^.location.loc in [LOC_JUMP,LOC_FLAGS]) and
(p^.left^.location.loc in [LOC_JUMP,LOC_FLAGS]) then
calcregisters(p,2,0,0)
else
calcregisters(p,1,0,0);
end;
else
CGMessage(type_e_mismatch);
end;
{ these one can't be in flags! }
if p^.treetype in [xorn,unequaln,equaln] then
begin
if p^.left^.location.loc=LOC_FLAGS then
begin
p^.left:=gentypeconvnode(p^.left,porddef(p^.left^.resulttype));
p^.left^.convtyp:=tc_bool_2_int;
p^.left^.explizit:=true;
firstpass(p^.left);
end;
if p^.right^.location.loc=LOC_FLAGS then
begin
p^.right:=gentypeconvnode(p^.right,porddef(p^.right^.resulttype));
p^.right^.convtyp:=tc_bool_2_int;
p^.right^.explizit:=true;
firstpass(p^.right);
end;
{ readjust registers }
calcregisters(p,1,0,0);
end;
convdone:=true;
end
else
@ -1017,7 +1046,11 @@ implementation
end.
{
$Log$
Revision 1.25 1999-04-15 09:01:34 peter
Revision 1.26 1999-04-16 20:44:37 florian
* the boolean operators =;<>;xor with LOC_JUMP and LOC_FLAGS
operands fixed, small things for new ansistring management
Revision 1.25 1999/04/15 09:01:34 peter
* fixed set loading
* object inheritance support for browser

View File

@ -635,10 +635,16 @@ begin
tmpfreelist:=nil;
templist:=nil;
reftempslots:=nil;
{ just to be sure }
tempansilist:=nil;
end.
{
$Log$
Revision 1.18 1999-04-16 14:03:39 pierre
Revision 1.19 1999-04-16 20:44:38 florian
* the boolean operators =;<>;xor with LOC_JUMP and LOC_FLAGS
operands fixed, small things for new ansistring management
Revision 1.18 1999/04/16 14:03:39 pierre
* added paitempalloc for tempansi
Revision 1.17 1999/04/16 11:49:45 peter