mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 07:59:27 +02:00
* take care of dyn. arrays in cse
git-svn-id: trunk@26740 -
This commit is contained in:
parent
a8643410c4
commit
3e4198ea45
@ -1157,6 +1157,9 @@ implementation
|
||||
vecn:
|
||||
begin
|
||||
set_varstate(tbinarynode(p).right,vs_read,[vsf_must_be_valid]);
|
||||
{ dyn. arrays and dyn. strings are read }
|
||||
if is_implicit_array_pointer(tunarynode(p).left.resultdef) then
|
||||
newstate:=vs_read;
|
||||
if (newstate in [vs_read,vs_readwritten]) or
|
||||
not(tunarynode(p).left.resultdef.typ in [stringdef,arraydef]) then
|
||||
include(varstateflags,vsf_must_be_valid)
|
||||
|
@ -918,7 +918,8 @@ implementation
|
||||
begin
|
||||
result := nil;
|
||||
expectloc:=LOC_VOID;
|
||||
if (tempinfo^.typedef.needs_inittable) then
|
||||
{ temps which are immutable do not need to be initialized/finalized }
|
||||
if (tempinfo^.typedef.needs_inittable) and not(ti_const in tempinfo^.flags) then
|
||||
include(current_procinfo.flags,pi_needs_implicit_finally);
|
||||
if (cs_create_pic in current_settings.moduleswitches) and
|
||||
(tf_pic_uses_got in target_info.flags) and
|
||||
|
@ -152,9 +152,9 @@ unit optcse;
|
||||
(
|
||||
{ regable expressions }
|
||||
(actualtargetnode(@n)^.flags*[nf_write,nf_modify,nf_address_taken]=[]) and
|
||||
((tstoreddef(n.resultdef).is_intregable or tstoreddef(n.resultdef).is_fpuregable) and
|
||||
((((tstoreddef(n.resultdef).is_intregable or tstoreddef(n.resultdef).is_fpuregable) and
|
||||
{ is_int/fpuregable allows arrays and records to be in registers, cse cannot handle this }
|
||||
(not(n.resultdef.typ in [arraydef,recorddef])) and
|
||||
(not(n.resultdef.typ in [arraydef,recorddef]))) or is_dynamic_array(n.resultdef)) and
|
||||
{ same for voiddef }
|
||||
not(is_void(n.resultdef)) and
|
||||
{ adding tempref and callpara nodes itself is worthless but
|
||||
@ -374,14 +374,21 @@ unit optcse;
|
||||
def:=tstoreddef(tnode(lists.nodelist[i]).resultdef);
|
||||
{ we cannot handle register stored records or array in CSE yet
|
||||
but we can store their reference }
|
||||
addrstored:=(def.typ in [arraydef,recorddef]) or is_object(def);
|
||||
addrstored:=((def.typ in [arraydef,recorddef]) or is_object(def)) and not(is_dynamic_array(def));
|
||||
|
||||
if addrstored then
|
||||
templist[i]:=ctempcreatenode.create_value(getpointerdef(def),voidpointertype.size,tt_persistent,
|
||||
true,caddrnode.create_internal(tnode(lists.nodelist[i])))
|
||||
else
|
||||
templist[i]:=ctempcreatenode.create_value(def,def.size,tt_persistent,
|
||||
def.is_intregable or def.is_fpuregable,tnode(lists.nodelist[i]));
|
||||
def.is_intregable or def.is_fpuregable or is_dynamic_array(def),tnode(lists.nodelist[i]));
|
||||
|
||||
{ the value described by the temp. is immutable and the temp. can be always in register
|
||||
|
||||
ttempcreatenode.create normally takes care of the register location but it does not
|
||||
know about immutability so it cannot take care of managed types }
|
||||
include(ttempcreatenode(templist[i]).tempinfo^.flags,ti_const);
|
||||
include(ttempcreatenode(templist[i]).tempinfo^.flags,ti_may_be_in_reg);
|
||||
|
||||
{ make debugging easier and set temp. location to the original location }
|
||||
tnode(templist[i]).fileinfo:=tnode(lists.nodelist[i]).fileinfo;
|
||||
@ -412,7 +419,7 @@ unit optcse;
|
||||
def:=tstoreddef(tnode(lists.nodelist[i]).resultdef);
|
||||
{ we cannot handle register stored records or array in CSE yet
|
||||
but we can store their reference }
|
||||
addrstored:=(def.typ in [arraydef,recorddef]) or is_object(def);
|
||||
addrstored:=((def.typ in [arraydef,recorddef]) or is_object(def)) and not(is_dynamic_array(def));
|
||||
|
||||
{$if defined(csedebug) or defined(csestats)}
|
||||
writeln;
|
||||
|
@ -1088,6 +1088,8 @@ interface
|
||||
function is_class_or_interface_or_object(def: tdef): boolean;
|
||||
function is_class_or_interface_or_dispinterface(def: tdef): boolean;
|
||||
function is_implicit_pointer_object_type(def: tdef): boolean;
|
||||
{ returns true, if def is a type which is an implicit pointer to an array (dyn. array or dyn. string) }
|
||||
function is_implicit_array_pointer(def: tdef): boolean;
|
||||
function is_class_or_object(def: tdef): boolean;
|
||||
function is_record(def: tdef): boolean;
|
||||
|
||||
@ -7321,6 +7323,11 @@ implementation
|
||||
(def.typ=recorddef)));
|
||||
end;
|
||||
|
||||
function is_implicit_array_pointer(def: tdef): boolean;
|
||||
begin
|
||||
result:=is_dynamic_array(def) or is_dynamicstring(def);
|
||||
end;
|
||||
|
||||
function is_class_or_object(def: tdef): boolean;
|
||||
begin
|
||||
result:=
|
||||
|
Loading…
Reference in New Issue
Block a user