mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 18:06:12 +02:00
* reversed expected operand order of tjvmhlcg.a_cmp_*(), because
that's how these operations also work on other architectures * fixed tjvmaddnode.second_generic_compare() for this new order git-svn-id: branches/jvmbackend@18338 -
This commit is contained in:
parent
87925db8fb
commit
71b348757b
@ -761,7 +761,25 @@ implementation
|
||||
|
||||
procedure thlcgjvm.a_cmp_const_ref_label(list: TAsmList; size: tdef; cmp_op: topcmp; a: aint; const ref: treference; l: tasmlabel);
|
||||
begin
|
||||
if ref.base<>NR_EVAL_STACK_BASE then
|
||||
a_load_ref_stack(list,size,ref,prepare_stack_for_ref(list,ref,false));
|
||||
maybe_adjust_cmp_stackval(list,size,cmp_op);
|
||||
a_load_const_stack(list,size,maybe_adjust_cmp_constval(size,cmp_op,a),R_INTREGISTER);
|
||||
a_cmp_stack_label(list,size,cmp_op,l);
|
||||
end;
|
||||
|
||||
procedure thlcgjvm.a_cmp_const_reg_label(list: TAsmList; size: tdef; cmp_op: topcmp; a: aint; reg: tregister; l: tasmlabel);
|
||||
begin
|
||||
a_load_reg_stack(list,size,reg);
|
||||
maybe_adjust_cmp_stackval(list,size,cmp_op);
|
||||
a_load_const_stack(list,size,maybe_adjust_cmp_constval(size,cmp_op,a),R_INTREGISTER);
|
||||
a_cmp_stack_label(list,size,cmp_op,l);
|
||||
end;
|
||||
|
||||
procedure thlcgjvm.a_cmp_ref_reg_label(list: TAsmList; size: tdef; cmp_op: topcmp; const ref: treference; reg: tregister; l: tasmlabel);
|
||||
begin
|
||||
a_load_reg_stack(list,size,reg);
|
||||
maybe_adjust_cmp_stackval(list,size,cmp_op);
|
||||
if ref.base<>NR_EVAL_STACK_BASE then
|
||||
a_load_ref_stack(list,size,ref,prepare_stack_for_ref(list,ref,false))
|
||||
else
|
||||
@ -770,15 +788,7 @@ implementation
|
||||
a_cmp_stack_label(list,size,cmp_op,l);
|
||||
end;
|
||||
|
||||
procedure thlcgjvm.a_cmp_const_reg_label(list: TAsmList; size: tdef; cmp_op: topcmp; a: aint; reg: tregister; l: tasmlabel);
|
||||
begin
|
||||
a_load_const_stack(list,size,maybe_adjust_cmp_constval(size,cmp_op,a),R_INTREGISTER);
|
||||
a_load_reg_stack(list,size,reg);
|
||||
maybe_adjust_cmp_stackval(list,size,cmp_op);
|
||||
a_cmp_stack_label(list,size,cmp_op,l);
|
||||
end;
|
||||
|
||||
procedure thlcgjvm.a_cmp_ref_reg_label(list: TAsmList; size: tdef; cmp_op: topcmp; const ref: treference; reg: tregister; l: tasmlabel);
|
||||
procedure thlcgjvm.a_cmp_reg_ref_label(list: TAsmList; size: tdef; cmp_op: topcmp; reg: tregister; const ref: treference; l: tasmlabel);
|
||||
begin
|
||||
if ref.base<>NR_EVAL_STACK_BASE then
|
||||
a_load_ref_stack(list,size,ref,prepare_stack_for_ref(list,ref,false));
|
||||
@ -788,24 +798,12 @@ implementation
|
||||
a_cmp_stack_label(list,size,cmp_op,l);
|
||||
end;
|
||||
|
||||
procedure thlcgjvm.a_cmp_reg_ref_label(list: TAsmList; size: tdef; cmp_op: topcmp; reg: tregister; const ref: treference; l: tasmlabel);
|
||||
begin
|
||||
a_load_reg_stack(list,size,reg);
|
||||
maybe_adjust_cmp_stackval(list,size,cmp_op);
|
||||
if ref.base<>NR_EVAL_STACK_BASE then
|
||||
a_load_ref_stack(list,size,ref,prepare_stack_for_ref(list,ref,false))
|
||||
else
|
||||
list.concat(taicpu.op_none(a_swap));
|
||||
maybe_adjust_cmp_stackval(list,size,cmp_op);
|
||||
a_cmp_stack_label(list,size,cmp_op,l);
|
||||
end;
|
||||
|
||||
procedure thlcgjvm.a_cmp_reg_reg_label(list: TAsmList; size: tdef; cmp_op: topcmp; reg1, reg2: tregister; l: tasmlabel);
|
||||
begin
|
||||
a_load_reg_stack(list,size,reg1);
|
||||
maybe_adjust_cmp_stackval(list,size,cmp_op);
|
||||
a_load_reg_stack(list,size,reg2);
|
||||
maybe_adjust_cmp_stackval(list,size,cmp_op);
|
||||
a_load_reg_stack(list,size,reg1);
|
||||
maybe_adjust_cmp_stackval(list,size,cmp_op);
|
||||
a_cmp_stack_label(list,size,cmp_op,l);
|
||||
end;
|
||||
|
||||
|
@ -95,15 +95,15 @@ interface
|
||||
swapleftright;
|
||||
location_reset(location,LOC_JUMP,OS_NO);
|
||||
|
||||
if right.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
|
||||
hlcg.a_cmp_loc_reg_label(current_asmdata.CurrAsmList,left.resultdef,cmpnode2signedtopcmp,left.location,right.location.register,current_procinfo.CurrTrueLabel)
|
||||
else case left.location.loc of
|
||||
if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
|
||||
hlcg.a_cmp_loc_reg_label(current_asmdata.CurrAsmList,left.resultdef,cmpnode2signedtopcmp,right.location,left.location.register,current_procinfo.CurrTrueLabel)
|
||||
else case right.location.loc of
|
||||
LOC_REGISTER,LOC_CREGISTER:
|
||||
hlcg.a_cmp_reg_loc_label(current_asmdata.CurrAsmList,left.resultdef,cmpnode2signedtopcmp,left.location.register,right.location,current_procinfo.CurrTrueLabel);
|
||||
hlcg.a_cmp_reg_loc_label(current_asmdata.CurrAsmList,left.resultdef,cmpnode2signedtopcmp,right.location.register,left.location,current_procinfo.CurrTrueLabel);
|
||||
LOC_REFERENCE,LOC_CREFERENCE:
|
||||
hlcg.a_cmp_ref_loc_label(current_asmdata.CurrAsmList,left.resultdef,cmpnode2signedtopcmp,left.location.reference,right.location,current_procinfo.CurrTrueLabel);
|
||||
hlcg.a_cmp_ref_loc_label(current_asmdata.CurrAsmList,left.resultdef,cmpnode2signedtopcmp,right.location.reference,left.location,current_procinfo.CurrTrueLabel);
|
||||
LOC_CONSTANT:
|
||||
hlcg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,left.resultdef,cmpnode2signedtopcmp,left.location.value,right.location,current_procinfo.CurrTrueLabel);
|
||||
hlcg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,left.resultdef,cmpnode2signedtopcmp,right.location.value,left.location,current_procinfo.CurrTrueLabel);
|
||||
else
|
||||
internalerror(2011010413);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user