diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2007-07-20 16:49:35 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2007-07-20 16:49:35 +0000 |
commit | c5f6f902a774546ef465f1ee21a15bd277b98560 (patch) | |
tree | 90bb4108a633ca82ba16834f3859ad96ae8a69b8 /compiler/nbas.pas | |
parent | 3eaed0468cba68a3b003e986280be2e18029b653 (diff) | |
download | fpc-c5f6f902a774546ef465f1ee21a15bd277b98560.tar.gz |
* fixed calling inline functions (with exit statements) from inside
finally blocks
* fixed the handling of function results of inlined functions with
exit statements
+ test for the above two issues and for bug fixed in r8091
* copy may_be_in_reg field inside ttempcreatenode.dogetcopy (allows
some more temps which were needlessly forced into memory to be in
registers)
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@8108 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/nbas.pas')
-rw-r--r-- | compiler/nbas.pas | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/nbas.pas b/compiler/nbas.pas index 7edca18799..5137200f42 100644 --- a/compiler/nbas.pas +++ b/compiler/nbas.pas @@ -111,6 +111,7 @@ interface may_be_in_reg : boolean; valid : boolean; nextref_set_hookoncopy_nil : boolean; + is_inlined_result : boolean; end; { a node which will create a (non)persistent temp of a given type with a given } @@ -127,6 +128,7 @@ interface { to it and *not* generate a ttempdeletenode } constructor create(_typedef: tdef; _size: aint; _temptype: ttemptype;allowreg:boolean); virtual; constructor create_withnode(_typedef: tdef; _size: aint; _temptype: ttemptype; allowreg:boolean; withnode: tnode); virtual; + constructor create_inlined_result(_typedef: tdef; _size: aint; _temptype: ttemptype; allowreg:boolean); virtual; constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override; procedure buildderefimpl;override; @@ -736,6 +738,13 @@ implementation end; + constructor ttempcreatenode.create_inlined_result(_typedef: tdef; _size: aint; _temptype: ttemptype; allowreg:boolean); + begin + self.create(_typedef,_size,_temptype,allowreg); + tempinfo^.is_inlined_result:=true; + end; + + function ttempcreatenode.dogetcopy: tnode; var n: ttempcreatenode; @@ -748,6 +757,8 @@ implementation n.tempinfo^.owner:=n; n.tempinfo^.typedef := tempinfo^.typedef; n.tempinfo^.temptype := tempinfo^.temptype; + n.tempinfo^.may_be_in_reg := tempinfo^.may_be_in_reg; + n.tempinfo^.is_inlined_result := tempinfo^.is_inlined_result; if assigned(tempinfo^.withnode) then n.tempinfo^.withnode := tempinfo^.withnode.getcopy else @@ -776,6 +787,7 @@ implementation new(tempinfo); fillchar(tempinfo^,sizeof(tempinfo^),0); tempinfo^.may_be_in_reg:=boolean(ppufile.getbyte); + tempinfo^.is_inlined_result:=boolean(ppufile.getbyte); ppufile.getderef(tempinfo^.typedefderef); tempinfo^.temptype := ttemptype(ppufile.getbyte); tempinfo^.owner:=self; @@ -788,6 +800,7 @@ implementation inherited ppuwrite(ppufile); ppufile.putlongint(size); ppufile.putbyte(byte(tempinfo^.may_be_in_reg)); + ppufile.putbyte(byte(tempinfo^.is_inlined_result)); ppufile.putderef(tempinfo^.typedefderef); ppufile.putbyte(byte(tempinfo^.temptype)); ppuwritenode(ppufile,tempinfo^.withnode); @@ -847,6 +860,7 @@ implementation inherited docompare(p) and (ttempcreatenode(p).size = size) and (ttempcreatenode(p).tempinfo^.may_be_in_reg = tempinfo^.may_be_in_reg) and + (ttempcreatenode(p).tempinfo^.is_inlined_result = tempinfo^.is_inlined_result) and (ttempcreatenode(p).tempinfo^.withnode.isequal(tempinfo^.withnode)) and equal_defs(ttempcreatenode(p).tempinfo^.typedef,tempinfo^.typedef); end; |