*fixes related to removal of rg

This commit is contained in:
mazen 2003-10-24 11:31:43 +00:00
parent 7251301e50
commit 619b429650
3 changed files with 30 additions and 21 deletions

View File

@ -112,7 +112,7 @@ implementation
begin begin
location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def)); location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
location_force_mem(exprasmlist,left.location); location_force_mem(exprasmlist,left.location);
location.register:=rg.getregisterfpu(exprasmlist,location.size); location.register:=cg.getfpuregister(exprasmlist,location.size);
{ Load memory in fpu register } { Load memory in fpu register }
cg.a_loadfpu_ref_reg(exprasmlist,location.size,left.location.reference,location.register); cg.a_loadfpu_ref_reg(exprasmlist,location.size,left.location.reference,location.register);
{$warning TODO Handle also double} {$warning TODO Handle also double}
@ -152,19 +152,19 @@ procedure TSparctypeconvnode.second_int_to_bool;
then then
begin begin
reference_release(exprasmlist,left.location.reference); reference_release(exprasmlist,left.location.reference);
hreg2:=rg.getregisterint(exprasmlist,opsize); hreg2:=cg.GetIntRegister(exprasmlist,opsize);
cg.a_load_ref_reg(exprasmlist,OpSize,OpSize,left.location.reference,hreg2); cg.a_load_ref_reg(exprasmlist,OpSize,OpSize,left.location.reference,hreg2);
end end
else else
hreg2 := left.location.register; hreg2 := left.location.register;
hreg1 := rg.getregisterint(exprasmlist,opsize); hreg1 := cg.GetIntRegister(exprasmlist,opsize);
exprasmlist.concat(taicpu.op_reg_const_reg(A_SUB,hreg1,1,hreg2)); exprasmlist.concat(taicpu.op_reg_const_reg(A_SUB,hreg1,1,hreg2));
exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUB,hreg1,hreg1,hreg2)); exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUB,hreg1,hreg1,hreg2));
rg.UnGetRegisterInt(exprasmlist,hreg2); cg.UnGetRegister(exprasmlist,hreg2);
end; end;
LOC_FLAGS : LOC_FLAGS :
begin begin
hreg1:=rg.getregisterint(exprasmlist,location.size); hreg1:=cg.GetIntRegister(exprasmlist,location.size);
resflags:=left.location.resflags; resflags:=left.location.resflags;
cg.g_flags2reg(exprasmlist,location.size,resflags,hreg1); cg.g_flags2reg(exprasmlist,location.size,resflags,hreg1);
end; end;
@ -251,7 +251,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.19 2003-10-01 20:34:50 peter Revision 1.20 2003-10-24 11:31:43 mazen
*fixes related to removal of rg
Revision 1.19 2003/10/01 20:34:50 peter
* procinfo unit contains tprocinfo * procinfo unit contains tprocinfo
* cginfo renamed to cgbase * cginfo renamed to cgbase
* moved cgmessage to verbose * moved cgmessage to verbose

View File

@ -65,7 +65,7 @@ implementation
location_copy(location,left.location); location_copy(location,left.location);
if left.location.loc=LOC_CFPUREGISTER then if left.location.loc=LOC_CFPUREGISTER then
begin begin
location.register:=rg.getregisterfpu(exprasmlist,location.size); location.register:=cg.getfpuregister(exprasmlist,location.size);
location.loc := LOC_FPUREGISTER; location.loc := LOC_FPUREGISTER;
end; end;
end; end;
@ -123,7 +123,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.6 2003-10-01 20:34:50 peter Revision 1.7 2003-10-24 11:32:34 mazen
*fixes related to removal of rg
Revision 1.6 2003/10/01 20:34:50 peter
* procinfo unit contains tprocinfo * procinfo unit contains tprocinfo
* cginfo renamed to cgbase * cginfo renamed to cgbase
* moved cgmessage to verbose * moved cgmessage to verbose

View File

@ -88,23 +88,23 @@ implementation
if (location.loc = LOC_CREGISTER) then if (location.loc = LOC_CREGISTER) then
begin begin
location.loc := LOC_REGISTER; location.loc := LOC_REGISTER;
location.register := rg.getregisterint(exprasmlist,OS_INT); location.register := cg.GetIntRegister(exprasmlist,OS_INT);
resultreg := location.register; resultreg := location.register;
end; end;
if (nodetype = modn) then if (nodetype = modn) then
resultreg := rg.getregisterint(exprasmlist,OS_INT); resultreg := cg.GetIntRegister(exprasmlist,OS_INT);
if (nodetype = divn) and if (nodetype = divn) and
(right.nodetype = ordconstn) and (right.nodetype = ordconstn) and
ispowerof2(tordconstnode(right).value,power) then ispowerof2(tordconstnode(right).value,power) then
begin begin
tmpreg:=rg.getregisterint(exprasmlist,OS_INT); tmpreg:=cg.GetIntRegister(exprasmlist,OS_INT);
cg.a_op_const_reg_reg(exprasmlist,OP_SAR,OS_INT,31,numerator,tmpreg); cg.a_op_const_reg_reg(exprasmlist,OP_SAR,OS_INT,31,numerator,tmpreg);
{ if signed, tmpreg=right value-1, otherwise 0 } { if signed, tmpreg=right value-1, otherwise 0 }
cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,tordconstnode(right).value-1,tmpreg); cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,tordconstnode(right).value-1,tmpreg);
{ add to the left value } { add to the left value }
cg.a_op_reg_reg(exprasmlist,OP_ADD,OS_INT,tmpreg,numerator); cg.a_op_reg_reg(exprasmlist,OP_ADD,OS_INT,tmpreg,numerator);
rg.ungetregisterint(exprasmlist,tmpreg); cg.UngetRegister(exprasmlist,tmpreg);
cg.a_op_const_reg_reg(exprasmlist,OP_SAR,OS_INT,aword(power),numerator,resultreg); cg.a_op_const_reg_reg(exprasmlist,OP_SAR,OS_INT,aword(power),numerator,resultreg);
end end
else else
@ -124,17 +124,17 @@ implementation
if (nodetype = modn) then if (nodetype = modn) then
begin begin
exprasmlist.concat(taicpu.op_reg_reg_reg(A_SMUL,resultreg,divider,resultreg)); exprasmlist.concat(taicpu.op_reg_reg_reg(A_SMUL,resultreg,divider,resultreg));
rg.UnGetRegisterInt(exprasmlist,divider); cg.UngetRegister(exprasmlist,divider);
exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUB,location.register,numerator,resultreg)); exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUB,location.register,numerator,resultreg));
rg.ungetregisterint(exprasmlist,resultreg); cg.UngetRegister(exprasmlist,resultreg);
resultreg := location.register; resultreg := location.register;
end end
else else
rg.UnGetRegisterInt(exprasmlist,divider); cg.UngetRegister(exprasmlist,divider);
end; end;
{ free used registers } { free used registers }
if numerator<>resultreg then if numerator<>resultreg then
rg.ungetregisterint(exprasmlist,numerator); cg.UngetRegister(exprasmlist,numerator);
{ set result location } { set result location }
location.loc:=LOC_REGISTER; location.loc:=LOC_REGISTER;
location.register:=resultreg; location.register:=resultreg;
@ -172,8 +172,8 @@ procedure tSparcshlshrnode.pass_2;
if (location.loc = LOC_CREGISTER) then if (location.loc = LOC_CREGISTER) then
begin begin
location.loc := LOC_REGISTER; location.loc := LOC_REGISTER;
location.registerhigh := rg.getregisterint(exprasmlist,OS_INT); location.registerhigh := cg.GetIntRegister(exprasmlist,OS_INT);
location.registerlow := rg.getregisterint(exprasmlist,OS_INT); location.registerlow := cg.GetIntRegister(exprasmlist,OS_INT);
end; end;
if (right.nodetype = ordconstn) then if (right.nodetype = ordconstn) then
begin begin
@ -241,7 +241,7 @@ procedure tSparcshlshrnode.pass_2;
if (location.loc = LOC_CREGISTER) then if (location.loc = LOC_CREGISTER) then
begin begin
location.loc := LOC_REGISTER; location.loc := LOC_REGISTER;
resultreg := rg.getregisterint(exprasmlist,OS_INT); resultreg := cg.GetIntRegister(exprasmlist,OS_INT);
location.register := resultreg; location.register := resultreg;
end; end;
{ determine operator } { determine operator }
@ -258,7 +258,7 @@ procedure tSparcshlshrnode.pass_2;
location_force_reg(exprasmlist,right.location,def_cgsize(right.resulttype.def),true); location_force_reg(exprasmlist,right.location,def_cgsize(right.resulttype.def),true);
hregister2 := right.location.register; hregister2 := right.location.register;
cg.a_op_reg_reg_reg(exprasmlist,op,OS_32,hregister2,hregister1,resultreg); cg.a_op_reg_reg_reg(exprasmlist,op,OS_32,hregister2,hregister1,resultreg);
rg.UnGetRegisterInt(exprasmlist,hregister2); cg.UngetRegister(exprasmlist,hregister2);
end; end;
end; end;
end; end;
@ -318,7 +318,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.15 2003-10-01 20:34:50 peter Revision 1.16 2003-10-24 11:33:30 mazen
*fixes related to removal of rg
Revision 1.15 2003/10/01 20:34:50 peter
* procinfo unit contains tprocinfo * procinfo unit contains tprocinfo
* cginfo renamed to cgbase * cginfo renamed to cgbase
* moved cgmessage to verbose * moved cgmessage to verbose