+ mw_pascal calling convention support for ARM, ppc64 and x86_64: identical

to cdecl, except that all const record parameters are passed by reference
    (required for Mac OS X interfaces)

git-svn-id: trunk@14114 -
This commit is contained in:
Jonas Maebe 2009-11-08 13:42:11 +00:00
parent 0b57ceef21
commit 62c1781bea
6 changed files with 22 additions and 7 deletions

View File

@ -91,7 +91,10 @@ Const
{ same as stdcall only different name mangling }
pocall_cppdecl,
{ same as stdcall but floating point numbers are handled like equal sized integers }
pocall_softfloat
pocall_softfloat,
{ same as stdcall (requires that all const records are passed by
reference, but that's already done for stdcall) }
pocall_mwpascal
];
cputypestr : array[tcputype] of string[8] = ('',

View File

@ -164,6 +164,8 @@ unit cpupara;
objectdef:
result:=is_object(def) and ((varspez=vs_const) or (def.size=0));
recorddef:
{ note: should this ever be changed, make sure that const records
are always passed by reference for calloption=pocall_mwpascal }
result:=(varspez=vs_const) or (def.size=0);
variantdef,
formaldef:

View File

@ -48,7 +48,10 @@ const
{ the difference to stdcall is only the name mangling }
pocall_cdecl,
{ the difference to stdcall is only the name mangling }
pocall_cppdecl
pocall_cppdecl,
{ the difference with stdcall is that all const record
parameters are passed by reference }
pocall_mwpascal
];
cputypestr: array[tcputype] of string[10] = ('',

View File

@ -173,10 +173,11 @@ begin
recorddef:
result :=
((varspez = vs_const) and
(
(not (calloption in [pocall_cdecl, pocall_cppdecl]) and
(def.size > 8))
)
(
(not (calloption in [pocall_cdecl, pocall_cppdecl]) and
(def.size > 8))
) or
(calloption = pocall_mwpascal)
);
arraydef:
result := (tarraydef(def).highrange >= tarraydef(def).lowrange) or

View File

@ -67,7 +67,8 @@ Const
pocall_safecall,
pocall_stdcall,
pocall_cdecl,
pocall_cppdecl
pocall_cppdecl,
pocall_mwpascal
];
cputypestr : array[tcputype] of string[10] = ('',

View File

@ -284,6 +284,11 @@ unit cpupara;
{ Win ABI depends on size to pass it in a register or not }
if (target_info.system=system_x86_64_win64) then
result:=not structure_in_registers(varspez,def.size)
{ MetroWerks Pascal: const records always passed by reference
(for Mac OS X interfaces) }
else if (calloption=pocall_mwpascal) and
(varspez=vs_const) then
result:=true
else
{ linux ABI always passes it as value parameter }
result:=false;