mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 04:39:34 +02:00
* factored comp/currency-in-register handling out of a_loadfpu_reg_reg()
into llvmconvop() so it's also used by code using that routine git-svn-id: trunk@33938 -
This commit is contained in:
parent
561c7b0862
commit
ea54b6b2c5
@ -494,7 +494,7 @@ implementation
|
|||||||
|
|
||||||
procedure thlcgllvm.a_load_const_reg(list: TAsmList; tosize: tdef; a: tcgint; register: tregister);
|
procedure thlcgllvm.a_load_const_reg(list: TAsmList; tosize: tdef; a: tcgint; register: tregister);
|
||||||
begin
|
begin
|
||||||
list.concat(taillvm.op_reg_size_const_size(llvmconvop(ptrsinttype,tosize),register,ptrsinttype,a,tosize))
|
list.concat(taillvm.op_reg_size_const_size(llvmconvop(ptrsinttype,tosize,false),register,ptrsinttype,a,tosize))
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -604,7 +604,7 @@ implementation
|
|||||||
tmpreg: tregister;
|
tmpreg: tregister;
|
||||||
tmpintdef: tdef;
|
tmpintdef: tdef;
|
||||||
begin
|
begin
|
||||||
op:=llvmconvop(fromsize,tosize);
|
op:=llvmconvop(fromsize,tosize,true);
|
||||||
{ converting from pointer to something else and vice versa is only
|
{ converting from pointer to something else and vice versa is only
|
||||||
possible via an intermediate pass to integer. Same for "something else"
|
possible via an intermediate pass to integer. Same for "something else"
|
||||||
to pointer. }
|
to pointer. }
|
||||||
@ -656,7 +656,7 @@ implementation
|
|||||||
tg.ungettemp(list,tmpref);
|
tg.ungettemp(list,tmpref);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
list.concat(taillvm.op_reg_size_ref_size(llvmconvop(fromsize,tosize),register,fromsize,sref,tosize))
|
list.concat(taillvm.op_reg_size_ref_size(llvmconvop(fromsize,tosize,false),register,fromsize,sref,tosize))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -1124,31 +1124,8 @@ implementation
|
|||||||
procedure thlcgllvm.a_loadfpu_reg_reg(list: TAsmList; fromsize, tosize: tdef; reg1, reg2: tregister);
|
procedure thlcgllvm.a_loadfpu_reg_reg(list: TAsmList; fromsize, tosize: tdef; reg1, reg2: tregister);
|
||||||
var
|
var
|
||||||
op: tllvmop;
|
op: tllvmop;
|
||||||
intfromsize,
|
|
||||||
inttosize: longint;
|
|
||||||
begin
|
begin
|
||||||
{ treat comp and currency as extended in registers (see comment at start
|
op:=llvmconvop(fromsize,tosize,true);
|
||||||
of a_loadfpu_ref_reg) }
|
|
||||||
if tfloatdef(fromsize).floattype in [s64comp,s64currency] then
|
|
||||||
fromsize:=sc80floattype;
|
|
||||||
if tfloatdef(tosize).floattype in [s64comp,s64currency] then
|
|
||||||
tosize:=sc80floattype;
|
|
||||||
{ at the value level, s80real and sc80real are the same }
|
|
||||||
if fromsize<>s80floattype then
|
|
||||||
intfromsize:=fromsize.size
|
|
||||||
else
|
|
||||||
intfromsize:=sc80floattype.size;
|
|
||||||
if tosize<>s80floattype then
|
|
||||||
inttosize:=tosize.size
|
|
||||||
else
|
|
||||||
inttosize:=sc80floattype.size;
|
|
||||||
|
|
||||||
if intfromsize<inttosize then
|
|
||||||
op:=la_fpext
|
|
||||||
else if intfromsize>inttosize then
|
|
||||||
op:=la_fptrunc
|
|
||||||
else
|
|
||||||
op:=la_bitcast;
|
|
||||||
{ reg2 = bitcast fromllsize reg1 to tollsize }
|
{ reg2 = bitcast fromllsize reg1 to tollsize }
|
||||||
list.concat(taillvm.op_reg_size_reg_size(op,reg2,fromsize,reg1,tosize));
|
list.concat(taillvm.op_reg_size_reg_size(op,reg2,fromsize,reg1,tosize));
|
||||||
end;
|
end;
|
||||||
|
@ -100,7 +100,7 @@ interface
|
|||||||
(struct, array) }
|
(struct, array) }
|
||||||
function llvmaggregatetype(def: tdef): boolean;
|
function llvmaggregatetype(def: tdef): boolean;
|
||||||
|
|
||||||
function llvmconvop(fromsize, tosize: tdef): tllvmop;
|
function llvmconvop(var fromsize, tosize: tdef; inregs: boolean): tllvmop;
|
||||||
|
|
||||||
{ mangle a global identifier so that it's recognised by LLVM as a global
|
{ mangle a global identifier so that it's recognised by LLVM as a global
|
||||||
(in the sense of module-global) label and so that it won't mangle the
|
(in the sense of module-global) label and so that it won't mangle the
|
||||||
@ -148,7 +148,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function llvmconvop(fromsize, tosize: tdef): tllvmop;
|
function llvmconvop(var fromsize, tosize: tdef; inregs: boolean): tllvmop;
|
||||||
var
|
var
|
||||||
fromregtyp,
|
fromregtyp,
|
||||||
toregtyp: tregistertype;
|
toregtyp: tregistertype;
|
||||||
@ -182,8 +182,35 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
frombytesize:=fromsize.size;
|
{ treat comp and currency as extended in registers (see comment at start
|
||||||
tobytesize:=tosize.size;
|
of thlgcobj.a_loadfpu_ref_reg) }
|
||||||
|
if inregs and
|
||||||
|
(fromsize.typ=floatdef) then
|
||||||
|
begin
|
||||||
|
if tfloatdef(fromsize).floattype in [s64comp,s64currency] then
|
||||||
|
fromsize:=sc80floattype;
|
||||||
|
{ at the value level, s80real and sc80real are the same }
|
||||||
|
if tfloatdef(fromsize).floattype<>s80real then
|
||||||
|
frombytesize:=fromsize.size
|
||||||
|
else
|
||||||
|
frombytesize:=sc80floattype.size;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
frombytesize:=fromsize.size;
|
||||||
|
|
||||||
|
if inregs and
|
||||||
|
(tosize.typ=floatdef) then
|
||||||
|
begin
|
||||||
|
if tfloatdef(tosize).floattype in [s64comp,s64currency] then
|
||||||
|
tosize:=sc80floattype;
|
||||||
|
if tfloatdef(tosize).floattype<>s80real then
|
||||||
|
tobytesize:=tosize.size
|
||||||
|
else
|
||||||
|
tobytesize:=sc80floattype.size;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
tobytesize:=tosize.size;
|
||||||
|
|
||||||
{ need zero/sign extension, float truncation or plain bitcast? }
|
{ need zero/sign extension, float truncation or plain bitcast? }
|
||||||
if tobytesize<>frombytesize then
|
if tobytesize<>frombytesize then
|
||||||
begin
|
begin
|
||||||
|
@ -671,7 +671,7 @@ implementation
|
|||||||
if (fromdef.typ=procdef) and
|
if (fromdef.typ=procdef) and
|
||||||
(todef.typ<>procdef) then
|
(todef.typ<>procdef) then
|
||||||
fromdef:=cprocvardef.getreusableprocaddr(tprocdef(fromdef));
|
fromdef:=cprocvardef.getreusableprocaddr(tprocdef(fromdef));
|
||||||
op:=llvmconvop(fromdef,todef);
|
op:=llvmconvop(fromdef,todef,false);
|
||||||
case op of
|
case op of
|
||||||
la_ptrtoint_to_x,
|
la_ptrtoint_to_x,
|
||||||
la_x_to_inttoptr:
|
la_x_to_inttoptr:
|
||||||
|
Loading…
Reference in New Issue
Block a user