mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 21:49:18 +02:00
* llvm implementation of tmoddivnode
o doesn't reuse the generic code generator methods, as the div-to-mul/shift optimization can be performed by llvm if necessary git-svn-id: branches/hlcgllvm@28205 -
This commit is contained in:
parent
d8394fc89c
commit
1c9932d921
@ -30,6 +30,10 @@ uses
|
|||||||
node, nmat, ncgmat, cgbase;
|
node, nmat, ncgmat, cgbase;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
tllvmmoddivnode = class(tcgmoddivnode)
|
||||||
|
procedure pass_generate_code; override;
|
||||||
|
end;
|
||||||
|
|
||||||
Tllvmunaryminusnode = class(tcgunaryminusnode)
|
Tllvmunaryminusnode = class(tcgunaryminusnode)
|
||||||
procedure emit_float_sign_change(r: tregister; _size : tdef);override;
|
procedure emit_float_sign_change(r: tregister; _size : tdef);override;
|
||||||
end;
|
end;
|
||||||
@ -48,6 +52,36 @@ uses
|
|||||||
llvmbase,
|
llvmbase,
|
||||||
ncgutil, cgutils;
|
ncgutil, cgutils;
|
||||||
|
|
||||||
|
{*****************************************************************************
|
||||||
|
tllvmmoddivnode
|
||||||
|
*****************************************************************************}
|
||||||
|
|
||||||
|
procedure tllvmmoddivnode.pass_generate_code;
|
||||||
|
var
|
||||||
|
op: tllvmop;
|
||||||
|
begin
|
||||||
|
secondpass(left);
|
||||||
|
secondpass(right);
|
||||||
|
if is_signed(left.resultdef) then
|
||||||
|
if nodetype=divn then
|
||||||
|
op:=la_sdiv
|
||||||
|
else
|
||||||
|
op:=la_srem
|
||||||
|
else if nodetype=divn then
|
||||||
|
op:=la_udiv
|
||||||
|
else
|
||||||
|
op:=la_urem;
|
||||||
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,resultdef,true);
|
||||||
|
if right.location.loc<>LOC_CONSTANT then
|
||||||
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,resultdef,true);
|
||||||
|
location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
|
||||||
|
location.register:=hlcg.getintregister(current_asmdata.CurrAsmList,resultdef);
|
||||||
|
if right.location.loc=LOC_CONSTANT then
|
||||||
|
current_asmdata.CurrAsmList.concat(taillvm.op_reg_size_reg_const(op,location.register,resultdef,left.location.register,right.location.value))
|
||||||
|
else
|
||||||
|
current_asmdata.CurrAsmList.concat(taillvm.op_reg_size_reg_reg(op,location.register,resultdef,left.location.register,right.location.register))
|
||||||
|
end;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
Tllvmunaryminusnode
|
Tllvmunaryminusnode
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
@ -77,8 +111,8 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
(*
|
|
||||||
cmoddivnode := tllvmmoddivnode;
|
cmoddivnode := tllvmmoddivnode;
|
||||||
|
(*
|
||||||
cshlshrnode := tllvmshlshrnode;
|
cshlshrnode := tllvmshlshrnode;
|
||||||
cnotnode := tllvmnotnode;
|
cnotnode := tllvmnotnode;
|
||||||
*)
|
*)
|
||||||
|
Loading…
Reference in New Issue
Block a user