mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 01:45:57 +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
|
||||
function jvm_first_addset: tnode;
|
||||
|
||||
function cmpnode2topcmp(unsigned: boolean): TOpCmp;
|
||||
|
||||
procedure second_generic_compare(unsigned: boolean);
|
||||
|
||||
procedure pass_left_right;override;
|
||||
@ -333,33 +331,6 @@ interface
|
||||
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);
|
||||
var
|
||||
cmpop: TOpCmp;
|
||||
|
@ -68,29 +68,20 @@ uses
|
||||
{*****************************************************************************
|
||||
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);
|
||||
var
|
||||
ntype: tnodetype;
|
||||
cond: TOpCmp;
|
||||
begin
|
||||
pass_left_right;
|
||||
force_reg_left_right(True, True);
|
||||
location_reset(location,LOC_FLAGS,OS_NO);
|
||||
|
||||
ntype:=nodetype;
|
||||
cond:=cmpnode2topcmp(unsigned);
|
||||
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.use_const:=(right.location.loc=LOC_CONSTANT);
|
||||
if location.resflags.use_const then
|
||||
|
@ -26,7 +26,7 @@ unit ncgadd;
|
||||
interface
|
||||
|
||||
uses
|
||||
node,nadd,cpubase;
|
||||
node,nadd,cpubase,cgbase;
|
||||
|
||||
type
|
||||
tcgaddnode = class(taddnode)
|
||||
@ -40,6 +40,8 @@ interface
|
||||
{ load left and right nodes into registers }
|
||||
procedure force_reg_left_right(allow_swap,allow_constant:boolean);
|
||||
|
||||
function cmpnode2topcmp(unsigned: boolean): TOpCmp;
|
||||
|
||||
procedure second_opfloat;
|
||||
procedure second_opboolean;
|
||||
procedure second_opsmallset;
|
||||
@ -73,7 +75,7 @@ interface
|
||||
cutils,verbose,globals,
|
||||
symconst,symdef,paramgr,
|
||||
aasmbase,aasmtai,aasmdata,defutil,
|
||||
cgbase,procinfo,pass_2,tgobj,
|
||||
procinfo,pass_2,tgobj,
|
||||
nutils,ncon,nset,ncgutil,cgobj,cgutils,
|
||||
hlcgobj
|
||||
;
|
||||
@ -216,6 +218,32 @@ interface
|
||||
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
|
||||
*****************************************************************************}
|
||||
|
Loading…
Reference in New Issue
Block a user