mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 00:29:33 +02:00
+ default implementation for for the *_checkoverflow() methods in case
setflags is false * don't call the *_checkoverflow() methods from ncgadd with setflags = true in case cs_check_overflow is disabled git-svn-id: branches/jvmbackend@18314 -
This commit is contained in:
parent
4ff56b2471
commit
e4d322bcdb
@ -293,8 +293,8 @@ unit hlcgobj;
|
||||
{ are any processors that support it (JM) }
|
||||
procedure a_op_const_reg_reg(list: TAsmList; op: TOpCg; size: tdef; a: aint; src, dst: tregister); virtual;
|
||||
procedure a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tdef; src1, src2, dst: tregister); virtual;
|
||||
procedure a_op_const_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tdef; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation); virtual; abstract;
|
||||
procedure a_op_reg_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tdef; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation); virtual; abstract;
|
||||
procedure a_op_const_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tdef; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation); virtual;
|
||||
procedure a_op_reg_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tdef; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation); virtual;
|
||||
|
||||
{ comparison operations }
|
||||
procedure a_cmp_const_reg_label(list : TAsmList;size : tdef;cmp_op : topcmp;a : aint;reg : tregister;
|
||||
@ -1367,6 +1367,22 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure thlcgobj.a_op_const_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tdef; a: aint; src, dst: tregister; setflags: boolean; var ovloc: tlocation);
|
||||
begin
|
||||
if not setflags then
|
||||
a_op_const_reg_reg(list,op,size,a,src,dst)
|
||||
else
|
||||
internalerror(2010122910);
|
||||
end;
|
||||
|
||||
procedure thlcgobj.a_op_reg_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tdef; src1, src2, dst: tregister; setflags: boolean; var ovloc: tlocation);
|
||||
begin
|
||||
if not setflags then
|
||||
a_op_reg_reg_reg(list,op,size,src1,src2,dst)
|
||||
else
|
||||
internalerror(2010122911);
|
||||
end;
|
||||
|
||||
procedure thlcgobj.a_cmp_const_reg_label(list: TAsmList; size: tdef; cmp_op: topcmp; a: aint; reg: tregister; l: tasmlabel);
|
||||
var
|
||||
tmpreg: tregister;
|
||||
|
@ -548,7 +548,8 @@ interface
|
||||
checkoverflow:=
|
||||
checkoverflow and
|
||||
(left.resultdef.typ<>pointerdef) and
|
||||
(right.resultdef.typ<>pointerdef);
|
||||
(right.resultdef.typ<>pointerdef) and
|
||||
(cs_check_overflow in current_settings.localswitches);
|
||||
|
||||
{$ifdef cpu64bitalu}
|
||||
case nodetype of
|
||||
@ -572,12 +573,12 @@ interface
|
||||
// reg64 - reg64
|
||||
hlcg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,resultdef,
|
||||
right.location.register,left.location.register,location.register,
|
||||
checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc)
|
||||
checkoverflow,ovloc)
|
||||
else
|
||||
// reg64 - const64
|
||||
hlcg.a_op_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,resultdef,
|
||||
right.location.value,left.location.register,location.register,
|
||||
checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc);
|
||||
checkoverflow,ovloc);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -585,7 +586,7 @@ interface
|
||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
|
||||
hlcg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,resultdef,
|
||||
right.location.register,left.location.register,location.register,
|
||||
checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc);
|
||||
checkoverflow,ovloc);
|
||||
end;
|
||||
end;
|
||||
else
|
||||
@ -598,11 +599,11 @@ interface
|
||||
if (right.location.loc = LOC_CONSTANT) then
|
||||
cg64.a_op64_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,op,location.size,right.location.value64,
|
||||
left.location.register64,location.register64,
|
||||
checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc)
|
||||
checkoverflow,ovloc)
|
||||
else
|
||||
cg64.a_op64_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,op,location.size,right.location.register64,
|
||||
left.location.register64,location.register64,
|
||||
checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc);
|
||||
checkoverflow,ovloc);
|
||||
end;
|
||||
subn:
|
||||
begin
|
||||
@ -616,13 +617,13 @@ interface
|
||||
cg64.a_op64_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size,
|
||||
right.location.register64,left.location.register64,
|
||||
location.register64,
|
||||
checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc)
|
||||
checkoverflow,ovloc)
|
||||
else
|
||||
// reg64 - const64
|
||||
cg64.a_op64_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size,
|
||||
right.location.value64,left.location.register64,
|
||||
location.register64,
|
||||
checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc)
|
||||
checkoverflow,ovloc)
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -631,7 +632,7 @@ interface
|
||||
cg64.a_op64_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size,
|
||||
right.location.register64,left.location.register64,
|
||||
location.register64,
|
||||
checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc);
|
||||
checkoverflow,ovloc);
|
||||
end;
|
||||
end;
|
||||
else
|
||||
@ -739,18 +740,19 @@ interface
|
||||
checkoverflow:=
|
||||
checkoverflow and
|
||||
(left.resultdef.typ<>pointerdef) and
|
||||
(right.resultdef.typ<>pointerdef);
|
||||
(right.resultdef.typ<>pointerdef) and
|
||||
(cs_check_overflow in current_settings.localswitches);
|
||||
|
||||
if nodetype<>subn then
|
||||
begin
|
||||
if (right.location.loc<>LOC_CONSTANT) then
|
||||
hlcg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,cgop,resultdef,
|
||||
left.location.register,right.location.register,
|
||||
location.register,checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc)
|
||||
location.register,checkoverflow,ovloc)
|
||||
else
|
||||
hlcg.a_op_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,cgop,resultdef,
|
||||
right.location.value,left.location.register,
|
||||
location.register,checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc);
|
||||
location.register,checkoverflow,ovloc);
|
||||
end
|
||||
else { subtract is a special case since its not commutative }
|
||||
begin
|
||||
@ -761,11 +763,11 @@ interface
|
||||
if right.location.loc<>LOC_CONSTANT then
|
||||
hlcg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,resultdef,
|
||||
right.location.register,left.location.register,
|
||||
location.register,checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc)
|
||||
location.register,checkoverflow,ovloc)
|
||||
else
|
||||
hlcg.a_op_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,resultdef,
|
||||
right.location.value,left.location.register,
|
||||
location.register,checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc);
|
||||
location.register,checkoverflow,ovloc);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -773,7 +775,7 @@ interface
|
||||
hlcg.a_load_const_reg(current_asmdata.CurrAsmList,resultdef,
|
||||
left.location.value,tmpreg);
|
||||
hlcg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,resultdef,
|
||||
right.location.register,tmpreg,location.register,checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc);
|
||||
right.location.register,tmpreg,location.register,checkoverflow,ovloc);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user