* inline and compilerproc are now procoptions instead of proccall types

(so both can be combined with each other, as well as with other calling
     conventions)
  * defined COMPPROCINLINEFIXED so SYSTEMINLINE is again activated

git-svn-id: trunk@658 -
This commit is contained in:
Jonas Maebe 2005-07-18 15:27:14 +00:00
parent 9941ca2a1f
commit 8bc4e0a32f
21 changed files with 101 additions and 116 deletions

View File

@ -58,8 +58,6 @@ Const
{ calling conventions supported by the code generator } { calling conventions supported by the code generator }
supported_calling_conventions : tproccalloptions = [ supported_calling_conventions : tproccalloptions = [
pocall_internproc, pocall_internproc,
pocall_compilerproc,
pocall_inline,
pocall_stdcall, pocall_stdcall,
{ same as stdcall only different name mangling } { same as stdcall only different name mangling }
pocall_cdecl, pocall_cdecl,

View File

@ -1900,10 +1900,8 @@ end;
DefProcCallName : array[tproccalloption] of string[12] = ('', DefProcCallName : array[tproccalloption] of string[12] = ('',
'CDECL', 'CDECL',
'CPPDECL', 'CPPDECL',
'', { compilerproc }
'FAR16', 'FAR16',
'OLDFPCCALL', 'OLDFPCCALL',
'INLINE',
'', { internproc } '', { internproc }
'', { syscall } '', { syscall }
'PASCAL', 'PASCAL',

View File

@ -195,14 +195,10 @@ than 255 characters. That's why using Ansi Strings}
pocall_cdecl, pocall_cdecl,
{ C++ calling conventions } { C++ calling conventions }
pocall_cppdecl, pocall_cppdecl,
{ Procedure is used for internal compiler calls }
pocall_compilerproc,
{ Far16 for OS/2 } { Far16 for OS/2 }
pocall_far16, pocall_far16,
{ Old style FPC default calling } { Old style FPC default calling }
pocall_oldfpccall, pocall_oldfpccall,
{ Procedure is an assembler macro }
pocall_inline,
{ Procedure has compiler magic} { Procedure has compiler magic}
pocall_internproc, pocall_internproc,
{ procedure is a system call, applies e.g. to MorphOS and PalmOS } { procedure is a system call, applies e.g. to MorphOS and PalmOS }
@ -259,10 +255,8 @@ than 255 characters. That's why using Ansi Strings}
proccalloptionStr : array[tproccalloption] of string[14]=('', proccalloptionStr : array[tproccalloption] of string[14]=('',
'CDecl', 'CDecl',
'CPPDecl', 'CPPDecl',
'CompilerProc',
'Far16', 'Far16',
'OldFPCCall', 'OldFPCCall',
'Inline',
'InternProc', 'InternProc',
'SysCall', 'SysCall',
'Pascal', 'Pascal',

View File

@ -61,8 +61,6 @@ Const
{ calling conventions supported by the code generator } { calling conventions supported by the code generator }
supported_calling_conventions : tproccalloptions = [ supported_calling_conventions : tproccalloptions = [
pocall_internproc, pocall_internproc,
pocall_compilerproc,
pocall_inline,
pocall_register, pocall_register,
pocall_safecall, pocall_safecall,
pocall_stdcall, pocall_stdcall,

View File

@ -208,14 +208,6 @@ unit cpupara;
case calloption of case calloption of
pocall_internproc : pocall_internproc :
result:=[]; result:=[];
pocall_compilerproc :
begin
if pocall_default=pocall_oldfpccall then
result:=[RS_EAX,RS_EDX,RS_ECX,RS_ESI,RS_EDI,RS_EBX]
else
result:=[RS_EAX,RS_EDX,RS_ECX];
end;
pocall_inline,
pocall_register, pocall_register,
pocall_safecall, pocall_safecall,
pocall_stdcall, pocall_stdcall,
@ -567,8 +559,6 @@ unit cpupara;
case p.proccalloption of case p.proccalloption of
pocall_register : pocall_register :
create_register_paraloc_info(p,side,p.paras,parareg,parasize); create_register_paraloc_info(p,side,p.paras,parareg,parasize);
pocall_inline,
pocall_compilerproc,
pocall_internproc : pocall_internproc :
begin begin
{ Use default calling } { Use default calling }

View File

@ -48,8 +48,6 @@ Const
{ calling conventions supported by the code generator } { calling conventions supported by the code generator }
supported_calling_conventions : tproccalloptions = [ supported_calling_conventions : tproccalloptions = [
pocall_internproc, pocall_internproc,
pocall_compilerproc,
pocall_inline,
pocall_stdcall, pocall_stdcall,
{ the difference to stdcall is only the name mangling } { the difference to stdcall is only the name mangling }
pocall_cdecl, pocall_cdecl,

View File

@ -51,8 +51,6 @@ Const
{ calling conventions supported by the code generator } { calling conventions supported by the code generator }
supported_calling_conventions : tproccalloptions = [ supported_calling_conventions : tproccalloptions = [
pocall_internproc, pocall_internproc,
pocall_compilerproc,
pocall_inline,
pocall_stdcall, pocall_stdcall,
{ same as stdcall only different name mangling } { same as stdcall only different name mangling }
pocall_cdecl, pocall_cdecl,

View File

@ -813,7 +813,7 @@ type
include(callnodeflags,cnf_restypeset); include(callnodeflags,cnf_restypeset);
{ both the normal and specified resulttype either have to be returned via a } { both the normal and specified resulttype either have to be returned via a }
{ parameter or not, but no mixing (JM) } { parameter or not, but no mixing (JM) }
if paramanager.ret_in_param(restype.def,pocall_compilerproc) xor if paramanager.ret_in_param(restype.def,symtableprocentry.first_procdef.proccalloption) xor
paramanager.ret_in_param(symtableprocentry.first_procdef.rettype.def,symtableprocentry.first_procdef.proccalloption) then paramanager.ret_in_param(symtableprocentry.first_procdef.rettype.def,symtableprocentry.first_procdef.proccalloption) then
internalerror(200108291); internalerror(200108291);
end; end;
@ -857,7 +857,7 @@ type
para := tcallparanode(para.right); para := tcallparanode(para.right);
end; end;
{ no hidden resultpara found, error! } { no hidden resultpara found, error! }
if not(procdefinition.proccalloption = pocall_inline) then if not(po_inline in procdefinition.procoptions) then
internalerror(200306087); internalerror(200306087);
end; end;
end; end;
@ -2246,7 +2246,7 @@ type
dosimplify(createblock); dosimplify(createblock);
firstpass(createblock); firstpass(createblock);
procdefinition.proccalloption:=pocall_inline; include(procdefinition.procoptions,po_inline);
{ return inlined block } { return inlined block }
result := createblock; result := createblock;
end; end;
@ -2259,8 +2259,7 @@ type
result:=nil; result:=nil;
{ Can we inline the procedure? } { Can we inline the procedure? }
if (procdefinition.proccalloption=pocall_inline) and if ([po_inline,po_has_inlininginfo] <= procdefinition.procoptions) then
(po_has_inlininginfo in procdefinition.procoptions) then
begin begin
{ Check if we can inline the procedure when it references proc/var that { Check if we can inline the procedure when it references proc/var that
are not in the globally available } are not in the globally available }
@ -2330,7 +2329,7 @@ type
{$ifdef PASS2INLINE} {$ifdef PASS2INLINE}
{ calc the correture value for the register } { calc the correture value for the register }
{ handle predefined procedures } { handle predefined procedures }
if (procdefinition.proccalloption=pocall_inline) then if (po_inline in procdefinition.procoptions) then
begin begin
{ inherit flags } { inherit flags }
current_procinfo.flags := current_procinfo.flags + (tprocdef(procdefinition).inlininginfo^.flags*inherited_inlining_flags); current_procinfo.flags := current_procinfo.flags + (tprocdef(procdefinition).inlininginfo^.flags*inherited_inlining_flags);
@ -2497,7 +2496,7 @@ type
end; end;
{$ifdef PASS2INLINE} {$ifdef PASS2INLINE}
if assigned(inlinecode) then if assigned(inlinecode) then
procdefinition.proccalloption:=pocall_inline; include(procdefinition.procoptions,po_inline);
{$endif PASS2INLINE} {$endif PASS2INLINE}
end; end;

View File

@ -225,7 +225,7 @@ interface
{ Allocate registers used in the assembler block } { Allocate registers used in the assembler block }
cg.alloccpuregisters(exprasmlist,R_INTREGISTER,used_regs_int); cg.alloccpuregisters(exprasmlist,R_INTREGISTER,used_regs_int);
if (current_procinfo.procdef.proccalloption=pocall_inline) then if (po_inline in current_procinfo.procdef.procoptions) then
begin begin
objectlibrary.CreateUsedAsmSymbolList; objectlibrary.CreateUsedAsmSymbolList;
hp:=tai(p_asm.first); hp:=tai(p_asm.first);

View File

@ -1953,7 +1953,7 @@ implementation
if (sym.owner.symtabletype=globalsymtable) or if (sym.owner.symtabletype=globalsymtable) or
maybe_smartlink_symbol or maybe_smartlink_symbol or
(assigned(current_procinfo) and (assigned(current_procinfo) and
(current_procinfo.procdef.proccalloption=pocall_inline)) or (po_inline in current_procinfo.procdef.procoptions)) or
DLLSource then DLLSource then
curconstSegment.concat(Tai_symbol.Createname_global(sym.mangledname,AT_DATA,l)) curconstSegment.concat(Tai_symbol.Createname_global(sym.mangledname,AT_DATA,l))
else else
@ -1983,7 +1983,7 @@ implementation
maybe_smartlink_symbol or maybe_smartlink_symbol or
DLLSource or DLLSource or
(assigned(current_procinfo) and (assigned(current_procinfo) and
(current_procinfo.procdef.proccalloption=pocall_inline)) or (po_inline in current_procinfo.procdef.procoptions)) or
(vo_is_exported in sym.varoptions) or (vo_is_exported in sym.varoptions) or
(vo_is_C_var in sym.varoptions) then (vo_is_C_var in sym.varoptions) then
bssSegment.concat(Tai_datablock.Create_global(sym.mangledname,l)) bssSegment.concat(Tai_datablock.Create_global(sym.mangledname,l))
@ -2193,7 +2193,7 @@ implementation
begin begin
{ for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures } { for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
localloc.loc:=LOC_REFERENCE; localloc.loc:=LOC_REFERENCE;
localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pocall_inline)); localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pd.proccalloption));
tg.GetLocal(list,tcgsize2size[localloc.size],vartype.def,localloc.reference); tg.GetLocal(list,tcgsize2size[localloc.size],vartype.def,localloc.reference);
calleeparaloc:=paraloc[calleeside].location; calleeparaloc:=paraloc[calleeside].location;
callerparaloc:=paraloc[callerside].location; callerparaloc:=paraloc[callerside].location;
@ -2256,7 +2256,7 @@ implementation
with tabstractnormalvarsym(pd.funcretsym) do with tabstractnormalvarsym(pd.funcretsym) do
begin begin
localloc.loc:=LOC_REFERENCE; localloc.loc:=LOC_REFERENCE;
localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pocall_inline)); localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pd.proccalloption));
tg.GetLocal(list,tcgsize2size[localloc.size],vartype.def,localloc.reference); tg.GetLocal(list,tcgsize2size[localloc.size],vartype.def,localloc.reference);
callerparaloc:=pd.funcretloc[callerside]; callerparaloc:=pd.funcretloc[callerside];
case pd.funcretloc[calleeside].loc of case pd.funcretloc[calleeside].loc of

View File

@ -1791,6 +1791,8 @@ begin
{ Temporary defines, until things settle down } { Temporary defines, until things settle down }
{ "main" symbol is generated in the main program, and left out of the system unit } { "main" symbol is generated in the main program, and left out of the system unit }
def_system_macro('FPC_DARWIN_PASCALMAIN'); def_system_macro('FPC_DARWIN_PASCALMAIN');
def_system_macro('COMPPROCINLINEFIXED');
if pocall_default = pocall_register then if pocall_default = pocall_register then
def_system_macro('REGCALL'); def_system_macro('REGCALL');

View File

@ -340,7 +340,7 @@ implementation
var var
pd : tabstractprocdef absolute arg; pd : tabstractprocdef absolute arg;
begin begin
if (pd.proccalloption<>pocall_inline) or if not(po_inline in pd.procoptions) or
(tsym(p).typ<>paravarsym) then (tsym(p).typ<>paravarsym) then
exit; exit;
with tparavarsym(p) do with tparavarsym(p) do
@ -1407,27 +1407,27 @@ const
handler : @pd_abstract; handler : @pd_abstract;
pocall : pocall_none; pocall : pocall_none;
pooption : [po_abstractmethod]; pooption : [po_abstractmethod];
mutexclpocall : [pocall_internproc,pocall_inline]; mutexclpocall : [pocall_internproc];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [po_exports,po_interrupt,po_external] mutexclpo : [po_exports,po_interrupt,po_external,po_inline]
),( ),(
idtok:_ALIAS; idtok:_ALIAS;
pd_flags : [pd_implemen,pd_body,pd_notobjintf]; pd_flags : [pd_implemen,pd_body,pd_notobjintf];
handler : @pd_alias; handler : @pd_alias;
pocall : pocall_none; pocall : pocall_none;
pooption : []; pooption : [];
mutexclpocall : [pocall_inline]; mutexclpocall : [];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [po_external] mutexclpo : [po_external,po_inline]
),( ),(
idtok:_ASMNAME; idtok:_ASMNAME;
pd_flags : [pd_interface,pd_implemen,pd_notobjintf]; pd_flags : [pd_interface,pd_implemen,pd_notobjintf];
handler : @pd_asmname; handler : @pd_asmname;
pocall : pocall_cdecl; pocall : pocall_cdecl;
pooption : [po_external]; pooption : [po_external];
mutexclpocall : [pocall_internproc,pocall_inline]; mutexclpocall : [pocall_internproc];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [po_external] mutexclpo : [po_external,po_inline]
),( ),(
idtok:_ASSEMBLER; idtok:_ASSEMBLER;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_notobjintf]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_notobjintf];
@ -1461,36 +1461,36 @@ const
handler : @pd_virtual; handler : @pd_virtual;
pocall : pocall_none; pocall : pocall_none;
pooption : [po_virtualmethod]; pooption : [po_virtualmethod];
mutexclpocall : [pocall_internproc,pocall_inline]; mutexclpocall : [pocall_internproc];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [po_exports,po_interrupt,po_external,po_overridingmethod] mutexclpo : [po_exports,po_interrupt,po_external,po_overridingmethod,po_inline]
),( ),(
idtok:_EXPORT; idtok:_EXPORT;
pd_flags : [pd_body,pd_interface,pd_implemen,pd_notobjintf]; pd_flags : [pd_body,pd_interface,pd_implemen,pd_notobjintf];
handler : @pd_export; handler : @pd_export;
pocall : pocall_none; pocall : pocall_none;
pooption : [po_exports,po_global]; pooption : [po_exports,po_global];
mutexclpocall : [pocall_internproc,pocall_inline]; mutexclpocall : [pocall_internproc];
mutexclpotype : [potype_constructor,potype_destructor]; mutexclpotype : [potype_constructor,potype_destructor];
mutexclpo : [po_external,po_interrupt] mutexclpo : [po_external,po_interrupt,po_inline]
),( ),(
idtok:_EXTERNAL; idtok:_EXTERNAL;
pd_flags : [pd_implemen,pd_interface,pd_notobject,pd_notobjintf]; pd_flags : [pd_implemen,pd_interface,pd_notobject,pd_notobjintf];
handler : @pd_external; handler : @pd_external;
pocall : pocall_none; pocall : pocall_none;
pooption : [po_external]; pooption : [po_external];
mutexclpocall : [pocall_internproc,pocall_inline,pocall_syscall]; mutexclpocall : [pocall_internproc,pocall_syscall];
mutexclpotype : [potype_constructor,potype_destructor]; mutexclpotype : [potype_constructor,potype_destructor];
mutexclpo : [po_public,po_exports,po_interrupt,po_assembler] mutexclpo : [po_public,po_exports,po_interrupt,po_assembler,po_inline]
),( ),(
idtok:_FAR; idtok:_FAR;
pd_flags : [pd_implemen,pd_body,pd_interface,pd_procvar,pd_notobject,pd_notobjintf]; pd_flags : [pd_implemen,pd_body,pd_interface,pd_procvar,pd_notobject,pd_notobjintf];
handler : @pd_far; handler : @pd_far;
pocall : pocall_none; pocall : pocall_none;
pooption : []; pooption : [];
mutexclpocall : [pocall_internproc,pocall_inline]; mutexclpocall : [pocall_internproc];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [] mutexclpo : [po_inline]
),( ),(
idtok:_FAR16; idtok:_FAR16;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar,pd_notobject]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar,pd_notobject];
@ -1506,9 +1506,9 @@ const
handler : @pd_forward; handler : @pd_forward;
pocall : pocall_none; pocall : pocall_none;
pooption : []; pooption : [];
mutexclpocall : [pocall_internproc,pocall_inline]; mutexclpocall : [pocall_internproc];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [po_external] mutexclpo : [po_external,po_inline]
),( ),(
idtok:_OLDFPCCALL; idtok:_OLDFPCCALL;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar];
@ -1522,8 +1522,8 @@ const
idtok:_INLINE; idtok:_INLINE;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_notobjintf]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_notobjintf];
handler : @pd_inline; handler : @pd_inline;
pocall : pocall_inline; pocall : pocall_none;
pooption : []; pooption : [po_inline];
mutexclpocall : []; mutexclpocall : [];
mutexclpotype : [potype_constructor,potype_destructor]; mutexclpotype : [potype_constructor,potype_destructor];
mutexclpo : [po_exports,po_external,po_interrupt,po_virtualmethod] mutexclpo : [po_exports,po_external,po_interrupt,po_virtualmethod]
@ -1552,9 +1552,9 @@ const
pocall : pocall_none; pocall : pocall_none;
pooption : [po_interrupt]; pooption : [po_interrupt];
mutexclpocall : [pocall_internproc,pocall_cdecl,pocall_cppdecl,pocall_stdcall, mutexclpocall : [pocall_internproc,pocall_cdecl,pocall_cppdecl,pocall_stdcall,
pocall_inline,pocall_pascal,pocall_far16,pocall_oldfpccall]; pocall_pascal,pocall_far16,pocall_oldfpccall];
mutexclpotype : [potype_constructor,potype_destructor,potype_operator]; mutexclpotype : [potype_constructor,potype_destructor,potype_operator];
mutexclpo : [po_external] mutexclpo : [po_external,po_inline]
),( ),(
idtok:_IOCHECK; idtok:_IOCHECK;
pd_flags : [pd_implemen,pd_body,pd_notobjintf]; pd_flags : [pd_implemen,pd_body,pd_notobjintf];
@ -1570,9 +1570,9 @@ const
handler : @pd_message; handler : @pd_message;
pocall : pocall_none; pocall : pocall_none;
pooption : []; { can be po_msgstr or po_msgint } pooption : []; { can be po_msgstr or po_msgint }
mutexclpocall : [pocall_inline,pocall_internproc]; mutexclpocall : [pocall_internproc];
mutexclpotype : [potype_constructor,potype_destructor,potype_operator]; mutexclpotype : [potype_constructor,potype_destructor,potype_operator];
mutexclpo : [po_interrupt,po_external] mutexclpo : [po_interrupt,po_external,po_inline]
),( ),(
idtok:_MWPASCAL; idtok:_MWPASCAL;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar];
@ -1615,9 +1615,9 @@ const
handler : @pd_override; handler : @pd_override;
pocall : pocall_none; pocall : pocall_none;
pooption : [po_overridingmethod,po_virtualmethod]; pooption : [po_overridingmethod,po_virtualmethod];
mutexclpocall : [pocall_inline,pocall_internproc]; mutexclpocall : [pocall_internproc];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [po_exports,po_external,po_interrupt,po_virtualmethod] mutexclpo : [po_exports,po_external,po_interrupt,po_virtualmethod,po_inline]
),( ),(
idtok:_PASCAL; idtok:_PASCAL;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar];
@ -1633,9 +1633,9 @@ const
handler : @pd_public; handler : @pd_public;
pocall : pocall_none; pocall : pocall_none;
pooption : [po_public,po_global]; pooption : [po_public,po_global];
mutexclpocall : [pocall_internproc,pocall_inline]; mutexclpocall : [pocall_internproc];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [po_external] mutexclpo : [po_external,po_inline]
),( ),(
idtok:_REGISTER; idtok:_REGISTER;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar];
@ -1651,9 +1651,9 @@ const
handler : @pd_reintroduce; handler : @pd_reintroduce;
pocall : pocall_none; pocall : pocall_none;
pooption : [po_reintroduce]; pooption : [po_reintroduce];
mutexclpocall : [pocall_inline,pocall_internproc]; mutexclpocall : [pocall_internproc];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [po_external,po_interrupt,po_exports,po_overridingmethod] mutexclpo : [po_external,po_interrupt,po_exports,po_overridingmethod,po_inline]
),( ),(
idtok:_SAFECALL; idtok:_SAFECALL;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar];
@ -1680,9 +1680,9 @@ const
handler : @pd_static; handler : @pd_static;
pocall : pocall_none; pocall : pocall_none;
pooption : [po_staticmethod]; pooption : [po_staticmethod];
mutexclpocall : [pocall_inline,pocall_internproc]; mutexclpocall : [pocall_internproc];
mutexclpotype : [potype_constructor,potype_destructor]; mutexclpotype : [potype_constructor,potype_destructor];
mutexclpo : [po_external,po_interrupt,po_exports] mutexclpo : [po_external,po_interrupt,po_exports,po_inline]
),( ),(
idtok:_STDCALL; idtok:_STDCALL;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar];
@ -1707,9 +1707,9 @@ const
handler : @pd_virtual; handler : @pd_virtual;
pocall : pocall_none; pocall : pocall_none;
pooption : [po_virtualmethod]; pooption : [po_virtualmethod];
mutexclpocall : [pocall_inline,pocall_internproc]; mutexclpocall : [pocall_internproc];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [po_external,po_interrupt,po_exports,po_overridingmethod] mutexclpo : [po_external,po_interrupt,po_exports,po_overridingmethod,po_inline]
),( ),(
idtok:_CPPDECL; idtok:_CPPDECL;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar];
@ -1726,15 +1726,15 @@ const
pocall : pocall_none; pocall : pocall_none;
pooption : [po_varargs]; pooption : [po_varargs];
mutexclpocall : [pocall_internproc,pocall_stdcall,pocall_register, mutexclpocall : [pocall_internproc,pocall_stdcall,pocall_register,
pocall_inline,pocall_far16,pocall_oldfpccall,pocall_mwpascal]; pocall_far16,pocall_oldfpccall,pocall_mwpascal];
mutexclpotype : []; mutexclpotype : [];
mutexclpo : [po_assembler,po_interrupt] mutexclpo : [po_assembler,po_interrupt,po_inline]
),( ),(
idtok:_COMPILERPROC; idtok:_COMPILERPROC;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_notobjintf]; pd_flags : [pd_interface,pd_implemen,pd_body,pd_notobjintf];
handler : nil; handler : nil;
pocall : pocall_compilerproc; pocall : pocall_none;
pooption : []; pooption : [po_compilerproc];
mutexclpocall : []; mutexclpocall : [];
mutexclpotype : [potype_constructor,potype_destructor]; mutexclpotype : [potype_constructor,potype_destructor];
mutexclpo : [po_interrupt] mutexclpo : [po_interrupt]
@ -1977,14 +1977,12 @@ const
else else
{ Normal procedures } { Normal procedures }
begin begin
case pd.proccalloption of if (po_compilerproc in pd.procoptions) then
pocall_compilerproc :
begin begin
pd.setmangledname(lower(pd.procsym.name)); pd.setmangledname(lower(pd.procsym.name));
end; end;
end; end;
end; end;
end;
{ Public/exported alias names } { Public/exported alias names }
if (po_public in pd.procoptions) and if (po_public in pd.procoptions) and
@ -2033,13 +2031,14 @@ const
{ Temporary stub, must be rewritten to support OS/2 far16 } { Temporary stub, must be rewritten to support OS/2 far16 }
Message1(parser_w_proc_directive_ignored,'FAR16'); Message1(parser_w_proc_directive_ignored,'FAR16');
end; end;
pocall_inline : end;
if (po_inline in pd.procoptions) then
begin begin
if not(cs_support_inline in aktmoduleswitches) then if not(cs_support_inline in aktmoduleswitches) then
begin begin
Message(parser_e_proc_inline_not_supported); Message(parser_e_proc_inline_not_supported);
pd.proccalloption:=pocall_default; exclude(pd.procoptions,po_inline);
end;
end; end;
end; end;
@ -2388,7 +2387,7 @@ const
hd.import_nr:=pd.import_nr; hd.import_nr:=pd.import_nr;
{ for compilerproc defines we need to rename and update the { for compilerproc defines we need to rename and update the
symbolname to lowercase } symbolname to lowercase }
if (pd.proccalloption=pocall_compilerproc) then if (po_compilerproc in pd.procoptions) then
begin begin
{ rename to lowercase so users can't access it } { rename to lowercase so users can't access it }
aprocsym.owner.rename(aprocsym.name,lower(aprocsym.name)); aprocsym.owner.rename(aprocsym.name,lower(aprocsym.name));

View File

@ -768,7 +768,7 @@ implementation
pd:=tprocdef(def); pd:=tprocdef(def);
if assigned(pd.localst) and if assigned(pd.localst) and
(pd.localst.symtabletype<>staticsymtable) and (pd.localst.symtabletype<>staticsymtable) and
not((pd.proccalloption=pocall_inline) or not((po_inline in pd.procoptions) or
((current_module.flags and uf_local_browser)<>0)) then ((current_module.flags and uf_local_browser)<>0)) then
begin begin
free_localsymtables(pd.localst); free_localsymtables(pd.localst);

View File

@ -47,8 +47,6 @@ Const
{ calling conventions supported by the code generator } { calling conventions supported by the code generator }
supported_calling_conventions : tproccalloptions = [ supported_calling_conventions : tproccalloptions = [
pocall_internproc, pocall_internproc,
pocall_compilerproc,
pocall_inline,
pocall_stdcall, pocall_stdcall,
{ the difference to stdcall is only the name mangling } { the difference to stdcall is only the name mangling }
pocall_cdecl, pocall_cdecl,

View File

@ -1050,7 +1050,7 @@ implementation
end; end;
end; end;
if (procdef.proccalloption=pocall_inline) then if (po_inline in procdef.procoptions) then
begin begin
{ Can we inline this procedure? } { Can we inline this procedure? }
if checknodeinlining(procdef) then if checknodeinlining(procdef) then
@ -1260,7 +1260,7 @@ implementation
{ We can't support inlining for procedures that have nested { We can't support inlining for procedures that have nested
procedures because the nested procedures use a fixed offset procedures because the nested procedures use a fixed offset
for accessing locals in the parent procedure (PFV) } for accessing locals in the parent procedure (PFV) }
if (current_procinfo.procdef.proccalloption=pocall_inline) and if (po_inline in current_procinfo.procdef.procoptions) and
(tcgprocinfo(current_procinfo).nestedprocs.count>0) then (tcgprocinfo(current_procinfo).nestedprocs.count>0) then
begin begin
Message1(parser_w_not_supported_for_inline,'nested procedures'); Message1(parser_w_not_supported_for_inline,'nested procedures');

View File

@ -829,7 +829,7 @@ Begin
indexreg:=NR_NO; indexreg:=NR_NO;
opr.typ:=OPR_LOCAL; opr.typ:=OPR_LOCAL;
if assigned(current_procinfo.parent) and if assigned(current_procinfo.parent) and
(current_procinfo.procdef.proccalloption<>pocall_inline) and not(po_inline in current_procinfo.procdef.procoptions) and
(sym.owner<>current_procinfo.procdef.localst) and (sym.owner<>current_procinfo.procdef.localst) and
(sym.owner<>current_procinfo.procdef.parast) and (sym.owner<>current_procinfo.procdef.parast) and
(current_procinfo.procdef.localst.symtablelevel>normal_function_level) and (current_procinfo.procdef.localst.symtablelevel>normal_function_level) and

View File

@ -47,8 +47,6 @@ const
{ calling conventions supported by the code generator } { calling conventions supported by the code generator }
supported_calling_conventions : tproccalloptions = [ supported_calling_conventions : tproccalloptions = [
pocall_internproc, pocall_internproc,
pocall_compilerproc,
pocall_inline,
pocall_stdcall, pocall_stdcall,
pocall_cdecl, pocall_cdecl,
pocall_cppdecl pocall_cppdecl

View File

@ -171,12 +171,12 @@ implementation
begin begin
p.funcretloc[side].loc:=LOC_REGISTER; p.funcretloc[side].loc:=LOC_REGISTER;
{ high } { high }
if (side=callerside) or (p.proccalloption=pocall_inline)then if (side=callerside) (po_inline in p.procoptions) then
p.funcretloc[side].register64.reghi:=NR_FUNCTION_RESULT64_HIGH_REG p.funcretloc[side].register64.reghi:=NR_FUNCTION_RESULT64_HIGH_REG
else else
p.funcretloc[side].register64.reghi:=NR_FUNCTION_RETURN64_HIGH_REG; p.funcretloc[side].register64.reghi:=NR_FUNCTION_RETURN64_HIGH_REG;
{ low } { low }
if (side=callerside) or (p.proccalloption=pocall_inline) then if (side=callerside) or (po_inline in p.procoptions) then
p.funcretloc[side].register64.reglo:=NR_FUNCTION_RESULT64_LOW_REG p.funcretloc[side].register64.reglo:=NR_FUNCTION_RESULT64_LOW_REG
else else
p.funcretloc[side].register64.reglo:=NR_FUNCTION_RETURN64_LOW_REG; p.funcretloc[side].register64.reglo:=NR_FUNCTION_RETURN64_LOW_REG;
@ -186,7 +186,7 @@ implementation
begin begin
p.funcretloc[side].loc:=LOC_REGISTER; p.funcretloc[side].loc:=LOC_REGISTER;
p.funcretloc[side].size:=retcgsize; p.funcretloc[side].size:=retcgsize;
if (side=callerside) or (p.proccalloption=pocall_inline)then if (side=callerside) or (po_inline in p.procoptions)then
p.funcretloc[side].register:=newreg(R_INTREGISTER,RS_FUNCTION_RESULT_REG,cgsize2subreg(retcgsize)) p.funcretloc[side].register:=newreg(R_INTREGISTER,RS_FUNCTION_RESULT_REG,cgsize2subreg(retcgsize))
else else
p.funcretloc[side].register:=newreg(R_INTREGISTER,RS_FUNCTION_RETURN_REG,cgsize2subreg(retcgsize)); p.funcretloc[side].register:=newreg(R_INTREGISTER,RS_FUNCTION_RETURN_REG,cgsize2subreg(retcgsize));

View File

@ -267,7 +267,11 @@ type
po_syscall_basesysv, po_syscall_basesysv,
po_syscall_sysvbase, po_syscall_sysvbase,
po_syscall_r12base, po_syscall_r12base,
po_local po_local,
{ Procedure can be inlined }
po_inline,
{ Procedure is used for internal compiler calls }
po_compilerproc
); );
tprocoptions=set of tprocoption; tprocoptions=set of tprocoption;
@ -445,8 +449,4 @@ const
implementation implementation
initialization
if pocall_default in [pocall_register,pocall_internproc] then
include(pushleftright_pocalls,pocall_compilerproc);
end. end.

View File

@ -3694,7 +3694,7 @@ implementation
{$endif i386} {$endif i386}
proctypeoption:=tproctypeoption(ppufile.getbyte); proctypeoption:=tproctypeoption(ppufile.getbyte);
proccalloption:=tproccalloption(ppufile.getbyte); proccalloption:=tproccalloption(ppufile.getbyte);
ppufile.getsmallset(procoptions); ppufile.getnormalset(procoptions);
location_reset(funcretloc[callerside],LOC_INVALID,OS_NO); location_reset(funcretloc[callerside],LOC_INVALID,OS_NO);
location_reset(funcretloc[calleeside],LOC_INVALID,OS_NO); location_reset(funcretloc[calleeside],LOC_INVALID,OS_NO);
@ -3731,7 +3731,7 @@ implementation
{$endif} {$endif}
ppufile.putbyte(ord(proctypeoption)); ppufile.putbyte(ord(proctypeoption));
ppufile.putbyte(ord(proccalloption)); ppufile.putbyte(ord(proccalloption));
ppufile.putsmallset(procoptions); ppufile.putnormalset(procoptions);
ppufile.do_interface_crc:=oldintfcrc; ppufile.do_interface_crc:=oldintfcrc;
if (po_explicitparaloc in procoptions) then if (po_explicitparaloc in procoptions) then

View File

@ -769,14 +769,10 @@ type
pocall_cdecl, pocall_cdecl,
{ C++ calling conventions } { C++ calling conventions }
pocall_cppdecl, pocall_cppdecl,
{ Procedure is used for internal compiler calls }
pocall_compilerproc,
{ Far16 for OS/2 } { Far16 for OS/2 }
pocall_far16, pocall_far16,
{ Old style FPC default calling } { Old style FPC default calling }
pocall_oldfpccall, pocall_oldfpccall,
{ Procedure is an assembler macro }
pocall_inline,
{ Procedure has compiler magic} { Procedure has compiler magic}
pocall_internproc, pocall_internproc,
{ procedure is a system call, applies e.g. to MorphOS and PalmOS } { procedure is a system call, applies e.g. to MorphOS and PalmOS }
@ -845,7 +841,19 @@ type
po_has_mangledname, po_has_mangledname,
po_has_public_name, po_has_public_name,
po_forward, po_forward,
po_global po_global,
po_has_inlininginfo,
{ The different kind of syscalls on MorphOS }
po_syscall_legacy,
po_syscall_sysv,
po_syscall_basesysv,
po_syscall_sysvbase,
po_syscall_r12base,
po_local,
{ Procedure can be inlined }
po_inline,
{ Procedure is used for internal compiler calls }
po_compilerproc
); );
tprocoptions=set of tprocoption; tprocoptions=set of tprocoption;
procedure read_abstract_proc_def(var proccalloption:tproccalloption;var procoptions:tprocoptions); procedure read_abstract_proc_def(var proccalloption:tproccalloption;var procoptions:tprocoptions);
@ -866,10 +874,8 @@ const
proccalloptionStr : array[tproccalloption] of string[14]=('', proccalloptionStr : array[tproccalloption] of string[14]=('',
'CDecl', 'CDecl',
'CPPDecl', 'CPPDecl',
'CompilerProc',
'Far16', 'Far16',
'OldFPCCall', 'OldFPCCall',
'Inline',
'InternProc', 'InternProc',
'SysCall', 'SysCall',
'Pascal', 'Pascal',
@ -890,7 +896,7 @@ const
(mask:potype_function; str:'Function'), (mask:potype_function; str:'Function'),
(mask:potype_procedure; str:'Procedure') (mask:potype_procedure; str:'Procedure')
); );
procopts=26; procopts=35;
procopt : array[1..procopts] of tprocopt=( procopt : array[1..procopts] of tprocopt=(
(mask:po_classmethod; str:'ClassMethod'), (mask:po_classmethod; str:'ClassMethod'),
(mask:po_virtualmethod; str:'VirtualMethod'), (mask:po_virtualmethod; str:'VirtualMethod'),
@ -917,7 +923,16 @@ const
(mask:po_has_mangledname; str:'HasMangledName'), (mask:po_has_mangledname; str:'HasMangledName'),
(mask:po_has_public_name; str:'HasPublicName'), (mask:po_has_public_name; str:'HasPublicName'),
(mask:po_forward; str:'Forward'), (mask:po_forward; str:'Forward'),
(mask:po_global; str:'Global') (mask:po_global; str:'Global'),
(mask:po_has_inlininginfo;str:'HasInliningInfo'),
(mask:po_syscall_legacy; str:'SyscallLegacy'),
(mask:po_syscall_sysv; str:'SyscallSysV'),
(mask:po_syscall_basesysv;str:'SyscallBaseSysV'),
(mask:po_syscall_sysvbase;str:'SyscallSysVBase'),
(mask:po_syscall_r12base; str:'SyscallR12Base'),
(mask:po_local; str:'Local'),
(mask:po_inline; str:'Inline'),
(mask:po_compilerproc; str:'CompilerProc')
); );
var var
proctypeoption : tproctypeoption; proctypeoption : tproctypeoption;
@ -943,7 +958,7 @@ begin
writeln; writeln;
proccalloption:=tproccalloption(ppufile.getbyte); proccalloption:=tproccalloption(ppufile.getbyte);
writeln(space,' CallOption : ',proccalloptionStr[proccalloption]); writeln(space,' CallOption : ',proccalloptionStr[proccalloption]);
ppufile.getsmallset(procoptions); ppufile.getnormalset(procoptions);
if procoptions<>[] then if procoptions<>[] then
begin begin
write(space,' Options : '); write(space,' Options : ');
@ -1500,7 +1515,7 @@ begin
write (space,' Library symbol : '); write (space,' Library symbol : ');
readderef; readderef;
end; end;
if (calloption=pocall_inline) then if (po_inline in procoptions) then
begin begin
write (space,' FuncretSym : '); write (space,' FuncretSym : ');
readderef; readderef;
@ -1516,12 +1531,12 @@ begin
readdefinitions('parast',false); readdefinitions('parast',false);
readsymbols('parast'); readsymbols('parast');
{ localst } { localst }
if (calloption = pocall_inline) then if (po_inline in procoptions) then
begin begin
readdefinitions('localst',false); readdefinitions('localst',false);
readsymbols('localst'); readsymbols('localst');
end; end;
if (calloption=pocall_inline) then if (po_inline in procoptions) then
readnodetree; readnodetree;
delete(space,1,4); delete(space,1,4);
end; end;