mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 01:59:18 +02:00
* improve register handling for not and unary minus operator by using a new register for the destination
git-svn-id: trunk@24678 -
This commit is contained in:
parent
4056194e7c
commit
44a7ef600f
@ -236,8 +236,7 @@ implementation
|
|||||||
opsize: tdef;
|
opsize: tdef;
|
||||||
begin
|
begin
|
||||||
secondpass(left);
|
secondpass(left);
|
||||||
{ load left operator in a register }
|
|
||||||
location_copy(location,left.location);
|
|
||||||
{$ifdef cpunodefaultint}
|
{$ifdef cpunodefaultint}
|
||||||
opsize:=left.resultdef;
|
opsize:=left.resultdef;
|
||||||
{$else cpunodefaultint}
|
{$else cpunodefaultint}
|
||||||
@ -247,8 +246,11 @@ implementation
|
|||||||
else
|
else
|
||||||
opsize:={$ifdef cpu16bitalu}s32inttype{$else}s64inttype{$endif};
|
opsize:={$ifdef cpu16bitalu}s32inttype{$else}s64inttype{$endif};
|
||||||
{$endif cpunodefaultint}
|
{$endif cpunodefaultint}
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,location,left.resultdef,opsize,false);
|
if not(left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
|
||||||
hlcg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,opsize,location.register,location.register);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,opsize,false);
|
||||||
|
location_reset(location,LOC_REGISTER,def_cgsize(opsize));
|
||||||
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
|
||||||
|
hlcg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,opsize,left.location.register,location.register);
|
||||||
|
|
||||||
if (cs_check_overflow in current_settings.localswitches) then
|
if (cs_check_overflow in current_settings.localswitches) then
|
||||||
begin
|
begin
|
||||||
@ -524,8 +526,11 @@ implementation
|
|||||||
procedure tcgnotnode.second_64bit;
|
procedure tcgnotnode.second_64bit;
|
||||||
begin
|
begin
|
||||||
secondpass(left);
|
secondpass(left);
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
|
if not(left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
|
||||||
location_copy(location,left.location);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
|
||||||
|
location_reset(location,LOC_REGISTER,left.location.size);
|
||||||
|
location.register64.reglo:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
||||||
|
location.register64.reghi:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
||||||
{ perform the NOT operation }
|
{ perform the NOT operation }
|
||||||
cg64.a_op64_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,left.location.register64,location.register64);
|
cg64.a_op64_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,left.location.register64,location.register64);
|
||||||
end;
|
end;
|
||||||
@ -535,10 +540,12 @@ implementation
|
|||||||
procedure tcgnotnode.second_integer;
|
procedure tcgnotnode.second_integer;
|
||||||
begin
|
begin
|
||||||
secondpass(left);
|
secondpass(left);
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
|
if not(left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
|
||||||
location_copy(location,left.location);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
|
||||||
|
location_reset(location,LOC_REGISTER,left.location.size);
|
||||||
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
|
||||||
{ perform the NOT operation }
|
{ perform the NOT operation }
|
||||||
hlcg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,left.resultdef,location.register,location.register);
|
hlcg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,left.resultdef,left.location.register,location.register);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user