mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 13:49:21 +02:00
* Function tjvmaddnode.cmpnode2topcmp is, in fact, not specific to any target. Moved it to generic tcgaddnode and reused in tmipsaddnode, where the same functionality was implemented in different way.
git-svn-id: trunk@26151 -
This commit is contained in:
parent
5b58162d6b
commit
d72478eb64
@ -38,8 +38,6 @@ interface
|
|||||||
protected
|
protected
|
||||||
function jvm_first_addset: tnode;
|
function jvm_first_addset: tnode;
|
||||||
|
|
||||||
function cmpnode2topcmp(unsigned: boolean): TOpCmp;
|
|
||||||
|
|
||||||
procedure second_generic_compare(unsigned: boolean);
|
procedure second_generic_compare(unsigned: boolean);
|
||||||
|
|
||||||
procedure pass_left_right;override;
|
procedure pass_left_right;override;
|
||||||
@ -333,33 +331,6 @@ interface
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tjvmaddnode.cmpnode2topcmp(unsigned: boolean): TOpCmp;
|
|
||||||
begin
|
|
||||||
if not unsigned then
|
|
||||||
case nodetype of
|
|
||||||
gtn: result:=OC_GT;
|
|
||||||
gten: result:=OC_GTE;
|
|
||||||
ltn: result:=OC_LT;
|
|
||||||
lten: result:=OC_LTE;
|
|
||||||
equaln: result:=OC_EQ;
|
|
||||||
unequaln: result:=OC_NE;
|
|
||||||
else
|
|
||||||
internalerror(2011010412);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
case nodetype of
|
|
||||||
gtn: result:=OC_A;
|
|
||||||
gten: result:=OC_AE;
|
|
||||||
ltn: result:=OC_B;
|
|
||||||
lten: result:=OC_BE;
|
|
||||||
equaln: result:=OC_EQ;
|
|
||||||
unequaln: result:=OC_NE;
|
|
||||||
else
|
|
||||||
internalerror(2011010412);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure tjvmaddnode.second_generic_compare(unsigned: boolean);
|
procedure tjvmaddnode.second_generic_compare(unsigned: boolean);
|
||||||
var
|
var
|
||||||
cmpop: TOpCmp;
|
cmpop: TOpCmp;
|
||||||
|
@ -68,29 +68,20 @@ uses
|
|||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
tmipsaddnode
|
tmipsaddnode
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
const
|
|
||||||
swapped_nodetype: array[ltn..unequaln] of tnodetype =
|
|
||||||
//lt lte gt gte
|
|
||||||
(gtn, gten,ltn,lten, equaln, unequaln);
|
|
||||||
|
|
||||||
nodetype2opcmp: array[boolean,ltn..unequaln] of TOpCmp = (
|
|
||||||
(OC_LT, OC_LTE, OC_GT, OC_GTE, OC_EQ, OC_NE),
|
|
||||||
(OC_B, OC_BE, OC_A, OC_AE, OC_EQ, OC_NE)
|
|
||||||
);
|
|
||||||
|
|
||||||
procedure tmipsaddnode.second_generic_cmp32(unsigned: boolean);
|
procedure tmipsaddnode.second_generic_cmp32(unsigned: boolean);
|
||||||
var
|
var
|
||||||
ntype: tnodetype;
|
cond: TOpCmp;
|
||||||
begin
|
begin
|
||||||
pass_left_right;
|
pass_left_right;
|
||||||
force_reg_left_right(True, True);
|
force_reg_left_right(True, True);
|
||||||
location_reset(location,LOC_FLAGS,OS_NO);
|
location_reset(location,LOC_FLAGS,OS_NO);
|
||||||
|
|
||||||
ntype:=nodetype;
|
cond:=cmpnode2topcmp(unsigned);
|
||||||
if nf_swapped in flags then
|
if nf_swapped in flags then
|
||||||
ntype:=swapped_nodetype[nodetype];
|
cond:=swap_opcmp(cond);
|
||||||
|
|
||||||
location.resflags.cond:=nodetype2opcmp[unsigned,ntype];
|
location.resflags.cond:=cond;
|
||||||
location.resflags.reg1:=left.location.register;
|
location.resflags.reg1:=left.location.register;
|
||||||
location.resflags.use_const:=(right.location.loc=LOC_CONSTANT);
|
location.resflags.use_const:=(right.location.loc=LOC_CONSTANT);
|
||||||
if location.resflags.use_const then
|
if location.resflags.use_const then
|
||||||
|
@ -26,7 +26,7 @@ unit ncgadd;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
node,nadd,cpubase;
|
node,nadd,cpubase,cgbase;
|
||||||
|
|
||||||
type
|
type
|
||||||
tcgaddnode = class(taddnode)
|
tcgaddnode = class(taddnode)
|
||||||
@ -40,6 +40,8 @@ interface
|
|||||||
{ load left and right nodes into registers }
|
{ load left and right nodes into registers }
|
||||||
procedure force_reg_left_right(allow_swap,allow_constant:boolean);
|
procedure force_reg_left_right(allow_swap,allow_constant:boolean);
|
||||||
|
|
||||||
|
function cmpnode2topcmp(unsigned: boolean): TOpCmp;
|
||||||
|
|
||||||
procedure second_opfloat;
|
procedure second_opfloat;
|
||||||
procedure second_opboolean;
|
procedure second_opboolean;
|
||||||
procedure second_opsmallset;
|
procedure second_opsmallset;
|
||||||
@ -73,7 +75,7 @@ interface
|
|||||||
cutils,verbose,globals,
|
cutils,verbose,globals,
|
||||||
symconst,symdef,paramgr,
|
symconst,symdef,paramgr,
|
||||||
aasmbase,aasmtai,aasmdata,defutil,
|
aasmbase,aasmtai,aasmdata,defutil,
|
||||||
cgbase,procinfo,pass_2,tgobj,
|
procinfo,pass_2,tgobj,
|
||||||
nutils,ncon,nset,ncgutil,cgobj,cgutils,
|
nutils,ncon,nset,ncgutil,cgobj,cgutils,
|
||||||
hlcgobj
|
hlcgobj
|
||||||
;
|
;
|
||||||
@ -216,6 +218,32 @@ interface
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tcgaddnode.cmpnode2topcmp(unsigned: boolean): TOpCmp;
|
||||||
|
begin
|
||||||
|
if unsigned then
|
||||||
|
case nodetype of
|
||||||
|
gtn: result:=OC_A;
|
||||||
|
gten: result:=OC_AE;
|
||||||
|
ltn: result:=OC_B;
|
||||||
|
lten: result:=OC_BE;
|
||||||
|
equaln: result:=OC_EQ;
|
||||||
|
unequaln: result:=OC_NE;
|
||||||
|
else
|
||||||
|
internalerror(2011010412);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
case nodetype of
|
||||||
|
gtn: result:=OC_GT;
|
||||||
|
gten: result:=OC_GTE;
|
||||||
|
ltn: result:=OC_LT;
|
||||||
|
lten: result:=OC_LTE;
|
||||||
|
equaln: result:=OC_EQ;
|
||||||
|
unequaln: result:=OC_NE;
|
||||||
|
else
|
||||||
|
internalerror(2011010412);
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
Smallsets
|
Smallsets
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
Loading…
Reference in New Issue
Block a user