* remove some unit dependencies

* current_procinfo changes to store more info
This commit is contained in:
peter 2003-05-23 14:27:35 +00:00
parent e6f72d2037
commit 8ff5792776
19 changed files with 156 additions and 81 deletions

View File

@ -87,7 +87,7 @@ interface
is_addr : boolean;
labelnr : longint;
constructor create(nr:longint);
constructor createdata(nr:longint);
constructor createdata(const modulename:string;nr:longint);
constructor createaddr(nr:longint);
function getname:string;override;
end;
@ -178,7 +178,8 @@ interface
nextaltnr : longint;
nextlabelnr : longint;
public
name : string[80];
name,
realname : string[80];
symbolsearch : tdictionary; { contains ALL assembler symbols }
usedasmsymbollist : tsinglelist;
{ ppu }
@ -227,7 +228,7 @@ implementation
{$else}
strings,
{$endif}
fmodule,verbose;
verbose;
const
symbolsgrow = 100;
@ -253,7 +254,6 @@ implementation
procedure tasmsymbol.reset;
begin
{ WriteLn(ClassName,' InstanceSize :',InstanceSize);}
{ reset section info }
section:=sec_none;
address:=0;
@ -317,12 +317,12 @@ implementation
end;
constructor tasmlabel.createdata(nr:longint);
constructor tasmlabel.createdata(const modulename:string;nr:longint);
begin;
labelnr:=nr;
if (cs_create_smart in aktmoduleswitches) or
target_asm.labelprefix_only_inside_procedure then
inherited create('_$'+current_module.modulename^+'$_L'+tostr(labelnr),AB_GLOBAL,AT_DATA)
inherited create('_$'+modulename+'$_L'+tostr(labelnr),AB_GLOBAL,AT_DATA)
else
inherited create(target_asm.labelprefix+tostr(labelnr),AB_LOCAL,AT_DATA);
is_set:=false;
@ -337,6 +337,7 @@ implementation
is_addr := true;
end;
function tasmlabel.getname:string;
begin
getname:=inherited getname;
@ -657,7 +658,8 @@ implementation
constructor TAsmLibraryData.create(const n:string);
begin
inherited create;
name:=n;
realname:=n;
name:=upper(n);
{ symbols }
symbolsearch:=tdictionary.create;
symbolsearch.usehash;
@ -861,7 +863,7 @@ implementation
if is_addr then
hp:=tasmlabel.createaddr(nr)
else if is_data then
hp:=tasmlabel.createdata(nr)
hp:=tasmlabel.createdata(name,nr)
else
hp:=tasmlabel.create(nr);
symbolsearch.insert(hp);
@ -879,7 +881,7 @@ implementation
procedure TAsmLibraryData.getdatalabel(var l : tasmlabel);
begin
l:=tasmlabel.createdata(nextlabelnr);
l:=tasmlabel.createdata(name,nextlabelnr);
inc(nextlabelnr);
symbolsearch.insert(l);
end;
@ -903,7 +905,11 @@ implementation
end.
{
$Log$
Revision 1.14 2003-04-06 21:11:23 olle
Revision 1.15 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.14 2003/04/06 21:11:23 olle
* changed newasmsymbol to newasmsymboldata for data symbols
Revision 1.13 2003/01/30 21:46:20 peter

View File

@ -32,7 +32,7 @@ unit cgbase;
{ common }
cclasses,
{ global }
globals,verbose,
globtype,globals,verbose,
{ symtable }
symconst,symtype,symdef,symsym,
{ aasm }
@ -44,8 +44,6 @@ unit cgbase;
tprocinfoflag=(
{# procedure uses asm }
pi_uses_asm,
{# procedure is exported by an unit }
pi_is_global,
{# procedure does a call }
pi_do_call,
{# procedure has a try statement = no register optimization }
@ -61,11 +59,19 @@ unit cgbase;
{# This object gives information on the current routine being
compiled.
}
tprocinfo = class
tprocinfo = class(tlinkedlistitem)
{ pointer to parent in nested procedures }
parent : tprocinfo;
{# the definition of the routine itself }
procdef : tprocdef;
{ file location of begin of procedure }
entrypos : tfileposinfo;
{ file location of end of procedure }
exitpos : tfileposinfo;
{ local switches at begin of procedure }
entryswitches : tlocalswitches;
{ local switches at end of procedure }
exitswitches : tlocalswitches;
{# offset from frame pointer to get parent frame pointer reference
(used in nested routines only)
On the PowerPC, this is used to store the offset where the
@ -185,9 +191,6 @@ unit cgbase;
{ also an exit label, only used we need to clear only the stack }
aktexit2label : tasmlabel;
{# only used in constructor for fail keyword or if getmem fails }
quickexitlabel : tasmlabel;
{# true, if there was an error while code generation occurs }
codegenerror : boolean;
@ -579,7 +582,11 @@ implementation
end.
{
$Log$
Revision 1.50 2003-05-16 20:54:12 jonas
Revision 1.51 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.50 2003/05/16 20:54:12 jonas
- undid previous commit, it wasn't necessary
Revision 1.49 2003/05/16 20:00:39 jonas

View File

@ -39,7 +39,7 @@ unit cgobj;
uses
cclasses,aasmbase,aasmtai,aasmcpu,symtable,
cpubase,cpuinfo,cpupara,
cpubase,cpuinfo,
cginfo,
symconst,symbase,symtype,symdef,node
{$ifdef delphi}
@ -1697,7 +1697,11 @@ finalization
end.
{
$Log$
Revision 1.98 2003-05-15 18:58:53 peter
Revision 1.99 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.98 2003/05/15 18:58:53 peter
* removed selfpointer_offset, vmtpointer_offset
* tvarsym.adjusted_address
* address in localsymtable is now in the real direction

View File

@ -131,6 +131,7 @@ interface
procedure flagdependent(callermodule:tmodule);
function addusedunit(hp:tmodule;inuses:boolean):tused_unit;
procedure numberunits;
procedure setmodulename(const s:string);
end;
tused_unit = class(tlinkedlistitem)
@ -636,10 +637,25 @@ uses
end;
procedure tmodule.setmodulename(const s:string);
begin
stringdispose(modulename);
stringdispose(realmodulename);
modulename:=stringdup(upper(s));
realmodulename:=stringdup(s);
{ also update asmlibrary names }
librarydata.name:=modulename^;
librarydata.realname:=realmodulename^;
end;
end.
{
$Log$
Revision 1.33 2003-04-27 11:21:32 peter
Revision 1.34 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.33 2003/04/27 11:21:32 peter
* aktprocdef renamed to current_procdef
* procinfo renamed to current_procinfo
* procinfo will now be stored in current_module so it can be

View File

@ -550,13 +550,13 @@ implementation
begin
result:=nil;
resulttype:=voidtype;
include(current_procinfo.flags,pi_uses_asm);
end;
function tasmnode.pass_1 : tnode;
begin
result:=nil;
expectloc:=LOC_VOID;
include(current_procinfo.flags,pi_uses_asm);
end;
@ -800,7 +800,11 @@ begin
end.
{
$Log$
Revision 1.51 2003-05-17 13:30:08 jonas
Revision 1.52 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.51 2003/05/17 13:30:08 jonas
* changed tt_persistant to tt_persistent :)
* tempcreatenode now doesn't accept a boolean anymore for persistent
temps, but a ttemptype, so you can also create ansistring temps etc

View File

@ -1927,6 +1927,7 @@ type
when there is only one proc definition, else the
loadnode will give a strange error }
if not(assigned(left)) and
not(nf_inherited in flags) and
(m_tp_procvar in aktmodeswitches) and
(symtableprocentry.procdef_count=1) then
begin
@ -2725,7 +2726,11 @@ begin
end.
{
$Log$
Revision 1.157 2003-05-17 14:05:58 jonas
Revision 1.158 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.157 2003/05/17 14:05:58 jonas
* fixed callparatemp for ansi/widestring and interfacecoms
Revision 1.156 2003/05/17 13:30:08 jonas

View File

@ -65,8 +65,7 @@ interface
symconst,symdef,paramgr,
aasmbase,aasmtai,aasmcpu,defutil,htypechk,
cgbase,cpuinfo,pass_1,pass_2,regvars,
cpupara,
ncon,nset,ncgutil,tgobj,rgobj,rgcpu,cgobj,
ncon,nset,ncgutil,tgobj,rgobj,cgobj,
{$ifdef cpu64bit}
cg64f64
{$else cpu64bit}
@ -822,7 +821,11 @@ begin
end.
{
$Log$
Revision 1.9 2003-04-30 22:15:59 florian
Revision 1.10 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.9 2003/04/30 22:15:59 florian
* some 64 bit adaptions in ncgadd
* x86-64 now uses ncgadd
* tparamanager.ret_in_acc doesn't return true anymore for a void-def

View File

@ -80,7 +80,7 @@ implementation
gdb,
{$endif GDB}
cginfo,cgbase,pass_2,
cpuinfo,cpupi,aasmbase,aasmtai,aasmcpu,
cpuinfo,aasmbase,aasmtai,aasmcpu,
nbas,nmem,nld,ncnv,
{$ifdef x86}
cga,
@ -90,7 +90,7 @@ implementation
{$else cpu64bit}
cg64f32,
{$endif cpu64bit}
ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cgcpu;
ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu;
var
@ -953,7 +953,7 @@ implementation
oldinlining_procedure,
nostackframe,make_global : boolean;
inlineentrycode,inlineexitcode : TAAsmoutput;
oldexitlabel,oldexit2label,oldquickexitlabel:tasmlabel;
oldexitlabel,oldexit2label:tasmlabel;
oldregstate: pointer;
localsref : treference;
{$ifdef GDB}
@ -991,7 +991,6 @@ implementation
oldinlining_procedure:=inlining_procedure;
oldexitlabel:=aktexitlabel;
oldexit2label:=aktexit2label;
oldquickexitlabel:=quickexitlabel;
oldprocdef:=current_procdef;
oldprocinfo:=current_procinfo;
objectlibrary.getlabel(aktexitlabel);
@ -1063,8 +1062,7 @@ implementation
inlineentrycode:=TAAsmoutput.Create;
inlineexitcode:=TAAsmoutput.Create;
ps:=para_size;
make_global:=false; { to avoid warning }
genentrycode(inlineentrycode,make_global,0,ps,nostackframe,true);
genentrycode(inlineentrycode,0,ps,nostackframe,true);
if po_assembler in current_procdef.procoptions then
inlineentrycode.insert(Tai_marker.Create(asmblockstart));
exprasmList.concatlist(inlineentrycode);
@ -1108,7 +1106,6 @@ implementation
current_procdef:=oldprocdef;
aktexitlabel:=oldexitlabel;
aktexit2label:=oldexit2label;
quickexitlabel:=oldquickexitlabel;
inlining_procedure:=oldinlining_procedure;
{ reallocate the registers used for the current procedure's regvars, }
@ -1128,7 +1125,11 @@ begin
end.
{
$Log$
Revision 1.67 2003-05-17 13:30:08 jonas
Revision 1.68 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.67 2003/05/17 13:30:08 jonas
* changed tt_persistant to tt_persistent :)
* tempcreatenode now doesn't accept a boolean anymore for persistent
temps, but a ttemptype, so you can also create ansistring temps etc

View File

@ -64,10 +64,10 @@ interface
cutils,verbose,globtype,
aasmbase,aasmtai,aasmcpu,symconst,symdef,paramgr,
ncon,ncal,
cpubase,cpuinfo,cpupara,systems,
cpubase,cpuinfo,systems,
pass_2,
cginfo,cgbase,
cgobj,cgcpu,
cgobj,
ncgutil,
tgobj,rgobj
;
@ -511,7 +511,11 @@ end.
{
$Log$
Revision 1.39 2003-04-22 23:50:22 peter
Revision 1.40 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.39 2003/04/22 23:50:22 peter
* firstpass uses expectloc
* checks if there are differences between the expectloc and
location.loc from secondpass in EXTDEBUG

View File

@ -91,7 +91,7 @@ implementation
nld,ncon,
ncgutil,
tgobj,rgobj,paramgr,
regvars,cgobj,cgcpu
regvars,cgobj
{$ifndef cpu64bit}
,cg64f32
{$endif cpu64bit}
@ -1554,7 +1554,11 @@ begin
end.
{
$Log$
Revision 1.62 2003-05-17 13:30:08 jonas
Revision 1.63 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.62 2003/05/17 13:30:08 jonas
* changed tt_persistant to tt_persistent :)
* tempcreatenode now doesn't accept a boolean anymore for persistent
temps, but a ttemptype, so you can also create ansistring temps etc

View File

@ -59,7 +59,7 @@ implementation
cginfo,cgbase,pass_1,pass_2,
cpuinfo,cpubase,paramgr,
nbas,ncon,ncal,ncnv,nld,
tgobj,ncgutil,cgobj,rgobj,rgcpu
tgobj,ncgutil,cgobj,rgobj
{$ifndef cpu64bit}
,cg64f32
{$endif cpu64bit}
@ -682,7 +682,11 @@ end.
{
$Log$
Revision 1.30 2003-05-09 17:47:02 peter
Revision 1.31 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.30 2003/05/09 17:47:02 peter
* self moved to hidden parameter
* removed hdisposen,hnewn,selfn

View File

@ -53,8 +53,8 @@ implementation
ncnv,ncon,nmem,
aasmbase,aasmtai,aasmcpu,regvars,
cginfo,cgbase,pass_2,
cpubase,cpuinfo,cpupara,
tgobj,ncgutil,cgobj,rgobj,rgcpu;
cpubase,cpuinfo,
tgobj,ncgutil,cgobj,rgobj;
{*****************************************************************************
SecondLoad
@ -915,7 +915,11 @@ begin
end.
{
$Log$
Revision 1.59 2003-05-15 18:58:53 peter
Revision 1.60 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.59 2003/05/15 18:58:53 peter
* removed selfpointer_offset, vmtpointer_offset
* tvarsym.adjusted_address
* address in localsymtable is now in the real direction

View File

@ -103,7 +103,7 @@ implementation
pass_1,pass_2,
ncon,
cpuinfo,
tgobj,ncgutil,cgobj,rgobj,rgcpu,paramgr,cg64f32;
tgobj,ncgutil,cgobj,rgobj,paramgr,cg64f32;
{*****************************************************************************
TCGUNARYMINUSNODE
@ -467,7 +467,11 @@ begin
end.
{
$Log$
Revision 1.9 2003-04-23 20:16:04 peter
Revision 1.10 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.9 2003/04/23 20:16:04 peter
+ added currency support based on int64
+ is_64bit for use in cg units instead of is_64bitint
* removed cgmessage from n386add, replace with internalerrors

View File

@ -29,7 +29,7 @@ interface
uses
node,cpuinfo,
globtype,
cpubase,cpupara,
cpubase,
aasmbase,aasmtai,aasmcpu,
cginfo,symbase,symdef,symtype,
{$ifndef cpu64bit}
@ -63,7 +63,6 @@ interface
const locpara : tparalocation);
procedure genentrycode(list : TAAsmoutput;
make_global:boolean;
stackframe:longint;
var parasize:longint;
var nostackframe:boolean;
@ -107,7 +106,7 @@ implementation
gdb,
{$endif GDB}
ncon,
tgobj,cgobj,cgcpu;
tgobj,cgobj;
const
@ -1308,7 +1307,6 @@ implementation
procedure genentrycode(list : TAAsmoutput;
make_global:boolean;
stackframe:longint;
var parasize:longint;
var nostackframe:boolean;
@ -1532,17 +1530,10 @@ implementation
else
stackalloclist.concat(Tai_align.Create(aktalignment.procalign));
if (cs_profile in aktmoduleswitches) or
(current_procdef.owner.symtabletype=globalsymtable) or
(assigned(current_procdef._class) and
(current_procdef._class.owner.symtabletype=globalsymtable)) then
make_global:=true;
{$ifdef GDB}
if (cs_debuginfo in aktmoduleswitches) then
begin
if make_global or
(pi_is_global in current_procinfo.flags) then
if (po_public in current_procdef.procoptions) then
tprocsym(current_procdef.procsym).is_global:=true;
current_procdef.concatstabto(stackalloclist);
tprocsym(current_procdef.procsym).isstabwritten:=true;
@ -1558,7 +1549,8 @@ implementation
target_info.use_function_relative_addresses then
stackalloclist.concat(Tai_stab_function_name.Create(strpnew(hs)));
{$endif GDB}
if make_global then
if (cs_profile in aktmoduleswitches) or
(po_public in current_procdef.procoptions) then
stackalloclist.concat(Tai_symbol.Createname_global(hs,0))
else
stackalloclist.concat(Tai_symbol.Createname(hs,0));
@ -1835,7 +1827,11 @@ implementation
end.
{
$Log$
Revision 1.104 2003-05-15 18:58:53 peter
Revision 1.105 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.104 2003/05/15 18:58:53 peter
* removed selfpointer_offset, vmtpointer_offset
* tvarsym.adjusted_address
* address in localsymtable is now in the real direction

View File

@ -386,6 +386,7 @@ implementation
end;
varsym :
begin
inc(tvarsym(symtableentry).refs);
{ if it's refered by absolute then it's used }
if nf_absolute in flags then
tvarsym(symtableentry).varstate:=vs_used
@ -497,10 +498,8 @@ implementation
else
Tvarsym(symtableentry).trigger_notifications(vn_onread);
{ count variable references }
if rg.t_times<1 then
inc(tvarsym(symtableentry).refs)
else
inc(tvarsym(symtableentry).refs,rg.t_times);
if rg.t_times>1 then
inc(tvarsym(symtableentry).refs,rg.t_times-1);
end;
typedconstsym :
;
@ -1215,7 +1214,11 @@ begin
end.
{
$Log$
Revision 1.93 2003-05-11 21:37:03 peter
Revision 1.94 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.93 2003/05/11 21:37:03 peter
* moved implicit exception frame from ncgutil to psub
* constructor/destructor helpers moved from cobj/ncgutil to psub

View File

@ -674,8 +674,8 @@ implementation
if (procdefcoll^.data.proccalloption<>pd.proccalloption) or
(procdefcoll^.data.proctypeoption<>pd.proctypeoption) or
((procdefcoll^.data.procoptions-
[po_abstractmethod,po_overridingmethod,po_assembler,po_overload])<>
(pd.procoptions-[po_abstractmethod,po_overridingmethod,po_assembler,po_overload])) then
[po_abstractmethod,po_overridingmethod,po_assembler,po_overload,po_public])<>
(pd.procoptions-[po_abstractmethod,po_overridingmethod,po_assembler,po_overload,po_public])) then
MessagePos1(pd.fileinfo,parser_e_header_dont_match_forward,pd.fullprocname(false));
{ error, if the return types aren't equal }
@ -1333,7 +1333,11 @@ initialization
end.
{
$Log$
Revision 1.42 2003-04-25 20:59:33 peter
Revision 1.43 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.42 2003/04/25 20:59:33 peter
* removed funcretn,funcretsym, function result is now in varsym
and aliases for result and function name are added using absolutesym
* vs_hidden parameter for funcret passed in parameter

View File

@ -573,7 +573,6 @@ implementation
pcrd : tclassrefdef;
tt : ttype;
old_object_option : tsymoptions;
old_current_procinfo : tprocinfo;
oldparse_only : boolean;
storetypecanbeforward : boolean;
@ -948,10 +947,6 @@ implementation
testcurobject:=1;
curobjectname:=Upper(n);
{ temp procinfo }
old_current_procinfo:=current_procinfo;
current_procinfo:=cprocinfo.create(nil);
{ short class declaration ? }
if (classtype<>odt_class) or (token<>_SEMICOLON) then
begin
@ -1135,9 +1130,6 @@ implementation
{ restore old state }
symtablestack:=symtablestack.next;
aktobjectdef:=nil;
{Restore procinfo}
current_procinfo.free;
current_procinfo:=old_current_procinfo;
current_object_option:=old_object_option;
object_dec:=aktclass;
@ -1146,7 +1138,11 @@ implementation
end.
{
$Log$
Revision 1.65 2003-05-09 17:47:02 peter
Revision 1.66 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.65 2003/05/09 17:47:02 peter
* self moved to hidden parameter
* removed hdisposen,hnewn,selfn

View File

@ -51,7 +51,7 @@ implementation
globtype,systems,comphook,
cutils,cclasses,verbose,globals,
symconst,symbase,symtype,symdef,paramgr,defutil,
cgbase,cgobj,cgcpu,rgcpu;
cgbase,cgobj,rgcpu;
procedure searchregvars(p : tnamedindexitem;arg:pointer);
@ -561,7 +561,11 @@ end.
{
$Log$
Revision 1.50 2003-05-16 14:33:31 peter
Revision 1.51 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.50 2003/05/16 14:33:31 peter
* regvar fixes
Revision 1.49 2003/05/15 18:58:53 peter

View File

@ -764,7 +764,9 @@ implementation
not(is_funcret_sym(tsym(p))) and
(
(tsym(p).typ<>procsym) or
{$ifdef GDB}
not (tprocsym(p).is_global) or
{$endif GDB}
{ all program functions are declared global
but unused should still be signaled PM }
((tsym(p).owner.symtabletype=staticsymtable) and
@ -2419,7 +2421,11 @@ implementation
end.
{
$Log$
Revision 1.101 2003-05-16 14:32:58 peter
Revision 1.102 2003-05-23 14:27:35 peter
* remove some unit dependencies
* current_procinfo changes to store more info
Revision 1.101 2003/05/16 14:32:58 peter
* fix dup check for hiding the result varsym in localst, the result
sym was already in the localst when adding the locals