mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-04 19:19:41 +01:00
* fixed register leak
* changed a couple of case-statements to location_force_reg()
This commit is contained in:
parent
b69219bae4
commit
a82c9531b7
@ -432,38 +432,13 @@ implementation
|
|||||||
{**************************** SMALL SET **********************}
|
{**************************** SMALL SET **********************}
|
||||||
if left.nodetype=ordconstn then
|
if left.nodetype=ordconstn then
|
||||||
begin
|
begin
|
||||||
{ clear the register value, indicating result is FALSE }
|
location_force_reg(exprasmlist,right.location,OS_32,true);
|
||||||
cg.a_load_const_reg(exprasmlist,location.size,0,location.register);
|
|
||||||
case right.location.loc of
|
|
||||||
LOC_REGISTER:
|
|
||||||
hr:=right.location.register;
|
|
||||||
LOC_CREGISTER:
|
|
||||||
begin
|
|
||||||
hr:=rg.getregisterint(exprasmlist,OS_INT);
|
|
||||||
{ load set value into register }
|
|
||||||
cg.a_load_reg_reg(exprasmlist,right.location.size,OS_INT,
|
|
||||||
right.location.register,hr);
|
|
||||||
location_release(exprasmlist,right.location);
|
|
||||||
end;
|
|
||||||
LOC_REFERENCE,
|
|
||||||
LOC_CREFERENCE :
|
|
||||||
begin
|
|
||||||
hr:=rg.getregisterint(exprasmlist,OS_INT);
|
|
||||||
{ load set value into register }
|
|
||||||
cg.a_load_ref_reg(exprasmlist,OS_INT,opsize,
|
|
||||||
right.location.reference,hr);
|
|
||||||
location_release(exprasmlist,right.location);
|
|
||||||
end;
|
|
||||||
else
|
|
||||||
internalerror(200203312);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ then SHR the register }
|
{ then SHR the register }
|
||||||
cg.a_op_const_reg(exprasmlist,OP_SHR,OS_INT,
|
cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_INT,
|
||||||
tordconstnode(left).value and 31,hr);
|
tordconstnode(left).value and 31,right.location.register,location.register);
|
||||||
|
rg.ungetregisterint(exprasmlist,right.location.register);
|
||||||
{ then extract the lowest bit }
|
{ then extract the lowest bit }
|
||||||
cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,1,hr);
|
cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,1,location.register);
|
||||||
location.register:=hr;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -493,39 +468,11 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
case right.location.loc of
|
location_force_reg(exprasmlist,right.location,OS_32,true);
|
||||||
LOC_REGISTER,
|
|
||||||
LOC_CREGISTER :
|
|
||||||
hr2:=right.location.register;
|
|
||||||
LOC_CONSTANT :
|
|
||||||
begin
|
|
||||||
hr2:=rg.getregisterint(exprasmlist,OS_INT);
|
|
||||||
cg.a_load_const_reg(exprasmlist,OS_INT,right.location.value,hr2);
|
|
||||||
end;
|
|
||||||
LOC_CREFERENCE,
|
|
||||||
LOC_REFERENCE :
|
|
||||||
begin
|
|
||||||
location_release(exprasmlist,right.location);
|
|
||||||
hr2:=rg.getregisterint(exprasmlist,OS_INT);
|
|
||||||
cg.a_load_ref_reg(exprasmlist,OS_INT,OS_INT,right.location.reference,hr2);
|
|
||||||
end;
|
|
||||||
else
|
|
||||||
internalerror(2002032210);
|
|
||||||
end;
|
|
||||||
{ emit bit test operation }
|
{ emit bit test operation }
|
||||||
emit_bit_test_reg_reg(exprasmlist,hr,hr2,location.register);
|
emit_bit_test_reg_reg(exprasmlist,hr,right.location.register,location.register);
|
||||||
{ free the resources }
|
{ free the resources }
|
||||||
case right.location.loc of
|
rg.ungetregisterint(exprasmlist,right.location.register);
|
||||||
LOC_REGISTER,
|
|
||||||
LOC_CREGISTER :
|
|
||||||
rg.ungetregisterint(exprasmlist,right.location.register);
|
|
||||||
LOC_CONSTANT ,
|
|
||||||
LOC_CREFERENCE,
|
|
||||||
LOC_REFERENCE :
|
|
||||||
rg.ungetregisterint(exprasmlist,hr2);
|
|
||||||
else
|
|
||||||
internalerror(2002032210);
|
|
||||||
end;
|
|
||||||
{ free bitnumber register }
|
{ free bitnumber register }
|
||||||
{$ifdef newra}
|
{$ifdef newra}
|
||||||
rg.ungetregisterint(exprasmlist,hr);
|
rg.ungetregisterint(exprasmlist,hr);
|
||||||
@ -1139,7 +1086,11 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.43 2003-06-12 22:09:54 jonas
|
Revision 1.44 2003-07-06 14:28:04 jonas
|
||||||
|
* fixed register leak
|
||||||
|
* changed a couple of case-statements to location_force_reg()
|
||||||
|
|
||||||
|
Revision 1.43 2003/06/12 22:09:54 jonas
|
||||||
* tcginnode.pass_2 doesn't call a helper anymore in any case
|
* tcginnode.pass_2 doesn't call a helper anymore in any case
|
||||||
* fixed ungetregisterfpu compilation problems
|
* fixed ungetregisterfpu compilation problems
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user