|
@@ -395,6 +395,7 @@ implementation
|
|
hregisterhi,
|
|
hregisterhi,
|
|
{$endif not cpu64bitalu and not cpuhighleveltarget}
|
|
{$endif not cpu64bitalu and not cpuhighleveltarget}
|
|
hregister : tregister;
|
|
hregister : tregister;
|
|
|
|
+ hloc: tlocation;
|
|
begin
|
|
begin
|
|
{ set defaults }
|
|
{ set defaults }
|
|
addconstant:=true;
|
|
addconstant:=true;
|
|
@@ -435,14 +436,25 @@ implementation
|
|
addvalue:=addvalue*tpointerconstnode(tcallparanode(tcallparanode(left).right).left).value
|
|
addvalue:=addvalue*tpointerconstnode(tcallparanode(tcallparanode(left).right).left).value
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- hlcg.location_force_reg(current_asmdata.CurrAsmList,tcallparanode(tcallparanode(left).right).left.location,tcallparanode(tcallparanode(left).right).left.resultdef,second_incdec_tempregdef,addvalue<=1);
|
|
|
|
- hregister:=tcallparanode(tcallparanode(left).right).left.location.register;
|
|
|
|
|
|
+ if not(tcallparanode(tcallparanode(left).right).left.location.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_REFERENCE,LOC_CREFERENCE]) or (addvalue>1) or
|
|
|
|
+ (def_cgsize(left.resultdef)<>tcallparanode(tcallparanode(left).right).left.location.size) then
|
|
|
|
+ begin
|
|
|
|
+ hlcg.location_force_reg(current_asmdata.CurrAsmList,tcallparanode(tcallparanode(left).right).left.location,tcallparanode(tcallparanode(left).right).left.resultdef,second_incdec_tempregdef,addvalue<=1);
|
|
|
|
+ hregister:=tcallparanode(tcallparanode(left).right).left.location.register;
|
|
{$if not defined(cpu64bitalu) and not defined(cpuhighleveltarget)}
|
|
{$if not defined(cpu64bitalu) and not defined(cpuhighleveltarget)}
|
|
- hregisterhi:=tcallparanode(tcallparanode(left).right).left.location.register64.reghi;
|
|
|
|
|
|
+ hregisterhi:=tcallparanode(tcallparanode(left).right).left.location.register64.reghi;
|
|
{$endif not defined(cpu64bitalu) and not defined(cpuhighleveltarget)}
|
|
{$endif not defined(cpu64bitalu) and not defined(cpuhighleveltarget)}
|
|
- { insert multiply with addvalue if its >1 }
|
|
|
|
- if addvalue>1 then
|
|
|
|
- hlcg.a_op_const_reg(current_asmdata.CurrAsmList,OP_IMUL,left.resultdef,addvalue.svalue,hregister);
|
|
|
|
|
|
+ { insert multiply with addvalue if its >1 }
|
|
|
|
+ if addvalue>1 then
|
|
|
|
+ hlcg.a_op_const_reg(current_asmdata.CurrAsmList,OP_IMUL,left.resultdef,addvalue.svalue,hregister);
|
|
|
|
+ end
|
|
|
|
+ else if tcallparanode(tcallparanode(left).right).left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
|
|
|
|
+ begin
|
|
|
|
+ hregister:=tcallparanode(tcallparanode(left).right).left.location.register;
|
|
|
|
+{$if not defined(cpu64bitalu) and not defined(cpuhighleveltarget)}
|
|
|
|
+ hregisterhi:=tcallparanode(tcallparanode(left).right).left.location.register64.reghi;
|
|
|
|
+{$endif not defined(cpu64bitalu) and not defined(cpuhighleveltarget)}
|
|
|
|
+ end;
|
|
addconstant:=false;
|
|
addconstant:=false;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -468,12 +480,28 @@ implementation
|
|
begin
|
|
begin
|
|
{$if not defined(cpu64bitalu) and not defined(cpuhighleveltarget)}
|
|
{$if not defined(cpu64bitalu) and not defined(cpuhighleveltarget)}
|
|
if def_cgsize(left.resultdef) in [OS_64,OS_S64] then
|
|
if def_cgsize(left.resultdef) in [OS_64,OS_S64] then
|
|
- cg64.a_op64_reg_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],def_cgsize(left.resultdef),
|
|
|
|
- joinreg64(hregister,hregisterhi),tcallparanode(left).left.location)
|
|
|
|
|
|
+ case tcallparanode(tcallparanode(left).right).left.location.loc of
|
|
|
|
+ LOC_REFERENCE,LOC_CREFERENCE:
|
|
|
|
+ cg64.a_op64_ref_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],def_cgsize(left.resultdef),
|
|
|
|
+ tcallparanode(tcallparanode(left).right).left.location.reference,tcallparanode(left).left.location);
|
|
|
|
+ LOC_REGISTER,LOC_CREGISTER:
|
|
|
|
+ cg64.a_op64_reg_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],def_cgsize(left.resultdef),
|
|
|
|
+ joinreg64(hregister,hregisterhi),tcallparanode(left).left.location);
|
|
|
|
+ else
|
|
|
|
+ Internalerror(2020042801);
|
|
|
|
+ end
|
|
else
|
|
else
|
|
{$endif not cpu64bitalu and not cpuhighleveltarget}
|
|
{$endif not cpu64bitalu and not cpuhighleveltarget}
|
|
- hlcg.a_op_reg_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],left.resultdef,
|
|
|
|
- hregister,tcallparanode(left).left.location);
|
|
|
|
|
|
+ case tcallparanode(tcallparanode(left).right).left.location.loc of
|
|
|
|
+ LOC_REFERENCE,LOC_CREFERENCE:
|
|
|
|
+ hlcg.a_op_ref_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],left.resultdef,
|
|
|
|
+ tcallparanode(tcallparanode(left).right).left.location.reference,tcallparanode(left).left.location);
|
|
|
|
+ LOC_REGISTER,LOC_CREGISTER:
|
|
|
|
+ hlcg.a_op_reg_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],left.resultdef,
|
|
|
|
+ hregister,tcallparanode(left).left.location);
|
|
|
|
+ else
|
|
|
|
+ Internalerror(2020042802);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
{ no overflow checking for pointers (see ninl), and range checking }
|
|
{ no overflow checking for pointers (see ninl), and range checking }
|
|
{ is not applicable for them }
|
|
{ is not applicable for them }
|