mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-08 09:23:48 +02:00
* allow targets to keep certain type conversions for equal types in
inserttypeconv() o keep typeconversions between structurally equivalent but semantically different procvardefs for LLVM and JVM, because they're different types there git-svn-id: trunk@32904 -
This commit is contained in:
parent
5aadb149ed
commit
49a83b2872
@ -30,6 +30,8 @@ interface
|
|||||||
|
|
||||||
type
|
type
|
||||||
tjvmtypeconvnode = class(tcgtypeconvnode)
|
tjvmtypeconvnode = class(tcgtypeconvnode)
|
||||||
|
class function target_specific_need_equal_typeconv(fromdef, todef: tdef): boolean; override;
|
||||||
|
|
||||||
function typecheck_dynarray_to_openarray: tnode; override;
|
function typecheck_dynarray_to_openarray: tnode; override;
|
||||||
function typecheck_string_to_chararray: tnode; override;
|
function typecheck_string_to_chararray: tnode; override;
|
||||||
function typecheck_string_to_string: tnode;override;
|
function typecheck_string_to_string: tnode;override;
|
||||||
@ -148,6 +150,19 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
class function tjvmtypeconvnode.target_specific_need_equal_typeconv(fromdef, todef: tdef): boolean;
|
||||||
|
begin
|
||||||
|
result:=
|
||||||
|
(fromdef<>todef) and
|
||||||
|
{ two procdefs that are structurally the same but semantically different
|
||||||
|
still need a convertion }
|
||||||
|
(
|
||||||
|
((fromdef.typ=procvardef) and
|
||||||
|
(todef.typ=procvardef))
|
||||||
|
);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tjvmtypeconvnode.typecheck_dynarray_to_openarray: tnode;
|
function tjvmtypeconvnode.typecheck_dynarray_to_openarray: tnode;
|
||||||
begin
|
begin
|
||||||
{ all arrays are equal in Java }
|
{ all arrays are equal in Java }
|
||||||
|
@ -26,10 +26,13 @@ unit nllvmcnv;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
symtype,
|
||||||
node,ncnv,ncgcnv,defcmp;
|
node,ncnv,ncgcnv,defcmp;
|
||||||
|
|
||||||
type
|
type
|
||||||
tllvmtypeconvnode = class(tcgtypeconvnode)
|
tllvmtypeconvnode = class(tcgtypeconvnode)
|
||||||
|
public
|
||||||
|
class function target_specific_need_equal_typeconv(fromdef, todef: tdef): boolean; override;
|
||||||
protected
|
protected
|
||||||
function first_int_to_real: tnode; override;
|
function first_int_to_real: tnode; override;
|
||||||
function first_int_to_bool: tnode; override;
|
function first_int_to_bool: tnode; override;
|
||||||
@ -64,11 +67,25 @@ uses
|
|||||||
aasmbase,aasmdata,
|
aasmbase,aasmdata,
|
||||||
llvmbase,aasmllvm,
|
llvmbase,aasmllvm,
|
||||||
procinfo,
|
procinfo,
|
||||||
symconst,symtype,symdef,defutil,
|
symconst,symdef,defutil,
|
||||||
cgbase,cgutils,tgobj,hlcgobj,pass_2;
|
cgbase,cgutils,tgobj,hlcgobj,pass_2;
|
||||||
|
|
||||||
{ tllvmtypeconvnode }
|
{ tllvmtypeconvnode }
|
||||||
|
|
||||||
|
|
||||||
|
class function tllvmtypeconvnode.target_specific_need_equal_typeconv(fromdef, todef: tdef): boolean;
|
||||||
|
begin
|
||||||
|
result:=
|
||||||
|
(fromdef<>todef) and
|
||||||
|
{ two procdefs that are structurally the same but semantically different
|
||||||
|
still need a convertion }
|
||||||
|
(
|
||||||
|
((fromdef.typ=procvardef) and
|
||||||
|
(todef.typ=procvardef))
|
||||||
|
);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tllvmtypeconvnode.first_int_to_real: tnode;
|
function tllvmtypeconvnode.first_int_to_real: tnode;
|
||||||
begin
|
begin
|
||||||
expectloc:=LOC_FPUREGISTER;
|
expectloc:=LOC_FPUREGISTER;
|
||||||
|
@ -65,6 +65,10 @@ interface
|
|||||||
replace this explicit type conversion with a different node, or to
|
replace this explicit type conversion with a different node, or to
|
||||||
reject it after all }
|
reject it after all }
|
||||||
function target_specific_explicit_typeconv: boolean;virtual;
|
function target_specific_explicit_typeconv: boolean;virtual;
|
||||||
|
|
||||||
|
{ called when inserttypeconv is used to convert to a def that is equal
|
||||||
|
according to compare_defs() }
|
||||||
|
class function target_specific_need_equal_typeconv(fromdef, todef: tdef): boolean; virtual;
|
||||||
protected
|
protected
|
||||||
function typecheck_int_to_int : tnode; virtual;
|
function typecheck_int_to_int : tnode; virtual;
|
||||||
function typecheck_cord_to_pointer : tnode; virtual;
|
function typecheck_cord_to_pointer : tnode; virtual;
|
||||||
@ -326,7 +330,8 @@ implementation
|
|||||||
still expects the resultdef of the node to be a stringdef) }
|
still expects the resultdef of the node to be a stringdef) }
|
||||||
if equal_defs(p.resultdef,def) and
|
if equal_defs(p.resultdef,def) and
|
||||||
(p.resultdef.typ=def.typ) and
|
(p.resultdef.typ=def.typ) and
|
||||||
not is_bitpacked_access(p) then
|
not is_bitpacked_access(p) and
|
||||||
|
not ctypeconvnode.target_specific_need_equal_typeconv(p.resultdef,def) then
|
||||||
begin
|
begin
|
||||||
{ don't replace encoded string constants to rawbytestring encoding.
|
{ don't replace encoded string constants to rawbytestring encoding.
|
||||||
preserve the codepage }
|
preserve the codepage }
|
||||||
@ -1988,6 +1993,12 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
class function ttypeconvnode.target_specific_need_equal_typeconv(fromdef, todef: tdef): boolean;
|
||||||
|
begin
|
||||||
|
result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function ttypeconvnode.typecheck_proc_to_procvar : tnode;
|
function ttypeconvnode.typecheck_proc_to_procvar : tnode;
|
||||||
var
|
var
|
||||||
pd : tabstractprocdef;
|
pd : tabstractprocdef;
|
||||||
|
Loading…
Reference in New Issue
Block a user