|
@@ -29,6 +29,9 @@ interface
|
|
|
|
|
|
uses
|
|
|
node,
|
|
|
+ {$ifdef state_tracking}
|
|
|
+ nstate,
|
|
|
+ {$endif state_tracking}
|
|
|
symbase,symtype,symsym,symdef,symtable;
|
|
|
|
|
|
type
|
|
@@ -63,6 +66,9 @@ interface
|
|
|
procedure insertintolist(l : tnodelist);override;
|
|
|
function pass_1 : tnode;override;
|
|
|
function det_resulttype:tnode;override;
|
|
|
+ {$ifdef state_tracking}
|
|
|
+ procedure track_state_pass(exec_known:boolean);override;
|
|
|
+ {$endif state_tracking}
|
|
|
function docompare(p: tnode): boolean; override;
|
|
|
procedure set_procvar(procvar:tnode);
|
|
|
end;
|
|
@@ -123,7 +129,7 @@ implementation
|
|
|
uses
|
|
|
cutils,globtype,systems,
|
|
|
verbose,globals,
|
|
|
- symconst,paramgr,types,
|
|
|
+ symconst,types,
|
|
|
htypechk,pass_1,cpuinfo,cpubase,
|
|
|
ncnv,nld,ninl,nadd,ncon,
|
|
|
rgobj,cgbase
|
|
@@ -364,7 +370,7 @@ implementation
|
|
|
if not(assigned(aktcallprocdef) and
|
|
|
(aktcallprocdef.proccalloption in [pocall_cppdecl,pocall_cdecl]) and
|
|
|
(po_external in aktcallprocdef.procoptions)) and
|
|
|
- paramanager.push_high_param(defcoll.paratype.def) then
|
|
|
+ push_high_param(defcoll.paratype.def) then
|
|
|
gen_high_tree(is_open_string(defcoll.paratype.def));
|
|
|
|
|
|
{ test conversions }
|
|
@@ -411,7 +417,7 @@ implementation
|
|
|
left.resulttype.def.typename,defcoll.paratype.def.typename);
|
|
|
end;
|
|
|
{ Process open parameters }
|
|
|
- if paramanager.push_high_param(defcoll.paratype.def) then
|
|
|
+ if push_high_param(defcoll.paratype.def) then
|
|
|
begin
|
|
|
{ insert type conv but hold the ranges of the array }
|
|
|
oldtype:=left.resulttype;
|
|
@@ -676,7 +682,7 @@ implementation
|
|
|
restypeset := true;
|
|
|
{ both the normal and specified resulttype either have to be returned via a }
|
|
|
{ parameter or not, but no mixing (JM) }
|
|
|
- if paramanager.ret_in_param(restype.def) xor paramanager.ret_in_param(symtableprocentry.defs^.def.rettype.def) then
|
|
|
+ if ret_in_param(restype.def) xor ret_in_param(symtableprocentry.defs^.def.rettype.def) then
|
|
|
internalerror(200108291);
|
|
|
end;
|
|
|
|
|
@@ -685,7 +691,7 @@ implementation
|
|
|
begin
|
|
|
self.createintern(name,params);
|
|
|
funcretrefnode:=returnnode;
|
|
|
- if not paramanager.ret_in_param(symtableprocentry.defs^.def.rettype.def) then
|
|
|
+ if not ret_in_param(symtableprocentry.defs^.def.rettype.def) then
|
|
|
internalerror(200204247);
|
|
|
end;
|
|
|
|
|
@@ -1503,7 +1509,7 @@ implementation
|
|
|
{ get a register for the return value }
|
|
|
if (not is_void(resulttype.def)) then
|
|
|
begin
|
|
|
- if paramanager.ret_in_acc(resulttype.def) then
|
|
|
+ if ret_in_acc(resulttype.def) then
|
|
|
begin
|
|
|
{ wide- and ansistrings are returned in EAX }
|
|
|
{ but they are imm. moved to a memory location }
|
|
@@ -1632,13 +1638,13 @@ implementation
|
|
|
|
|
|
{ It doesn't hurt to calculate it already though :) (JM) }
|
|
|
rg.incrementregisterpushed(tprocdef(procdefinition).usedregisters);
|
|
|
-
|
|
|
+
|
|
|
end;
|
|
|
|
|
|
{ get a register for the return value }
|
|
|
if (not is_void(resulttype.def)) then
|
|
|
begin
|
|
|
- if paramanager.ret_in_param(resulttype.def) then
|
|
|
+ if ret_in_param(resulttype.def) then
|
|
|
begin
|
|
|
location.loc:=LOC_CREFERENCE;
|
|
|
end
|
|
@@ -1776,6 +1782,26 @@ implementation
|
|
|
procdefinition.proccalloption:=pocall_inline;
|
|
|
end;
|
|
|
|
|
|
+{$ifdef state_tracking}
|
|
|
+ procedure Tcallnode.track_state_pass(exec_known:boolean);
|
|
|
+
|
|
|
+ var hp:Tcallparanode;
|
|
|
+ value:Tnode;
|
|
|
+
|
|
|
+ begin
|
|
|
+ hp:=Tcallparanode(left);
|
|
|
+ while assigned(hp) do
|
|
|
+ begin
|
|
|
+ value:=aktstate.find_fact(hp.left);
|
|
|
+ if value<>nil then
|
|
|
+ begin
|
|
|
+ hp.left.destroy;
|
|
|
+ hp.left:=value.getcopy;
|
|
|
+ end;
|
|
|
+ hp:=Tcallparanode(hp.right);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+{$endif}
|
|
|
|
|
|
function tcallnode.docompare(p: tnode): boolean;
|
|
|
begin
|
|
@@ -1802,7 +1828,7 @@ implementation
|
|
|
retoffset:=-POINTER_SIZE; { less dangerous as zero (PM) }
|
|
|
para_offset:=0;
|
|
|
para_size:=inlineprocdef.para_size(target_info.alignment.paraalign);
|
|
|
- if paramanager.ret_in_param(inlineprocdef.rettype.def) then
|
|
|
+ if ret_in_param(inlineprocdef.rettype.def) then
|
|
|
inc(para_size,POINTER_SIZE);
|
|
|
{ copy args }
|
|
|
if assigned(code) then
|
|
@@ -1870,8 +1896,9 @@ begin
|
|
|
end.
|
|
|
{
|
|
|
$Log$
|
|
|
- Revision 1.79 2002-07-11 14:41:27 florian
|
|
|
- * start of the new generic parameter handling
|
|
|
+ Revision 1.80 2002-07-14 18:00:43 daniel
|
|
|
+ + Added the beginning of a state tracker. This will track the values of
|
|
|
+ variables through procedures and optimize things away.
|
|
|
|
|
|
Revision 1.78 2002/07/04 20:43:00 florian
|
|
|
* first x86-64 patches
|
|
@@ -1987,4 +2014,4 @@ end.
|
|
|
Revision 1.62 2002/01/19 11:57:05 peter
|
|
|
* fixed path appending for lib
|
|
|
|
|
|
-}
|
|
|
+}
|