mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 09:39:09 +02:00
+ cdecl or stdcall push all args with longint size
* tempansi stuff cleaned up
This commit is contained in:
parent
66422d18ba
commit
833f624fc4
@ -29,7 +29,7 @@ interface
|
|||||||
symtable,tree;
|
symtable,tree;
|
||||||
|
|
||||||
procedure secondcallparan(var p : ptree;defcoll : pdefcoll;
|
procedure secondcallparan(var p : ptree;defcoll : pdefcoll;
|
||||||
push_from_left_to_right,inlined : boolean;para_offset : longint);
|
push_from_left_to_right,inlined,dword_align : boolean;para_offset : longint);
|
||||||
procedure secondcalln(var p : ptree);
|
procedure secondcalln(var p : ptree);
|
||||||
procedure secondprocinline(var p : ptree);
|
procedure secondprocinline(var p : ptree);
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ implementation
|
|||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
procedure secondcallparan(var p : ptree;defcoll : pdefcoll;
|
procedure secondcallparan(var p : ptree;defcoll : pdefcoll;
|
||||||
push_from_left_to_right,inlined : boolean;para_offset : longint);
|
push_from_left_to_right,inlined,dword_align : boolean;para_offset : longint);
|
||||||
|
|
||||||
procedure maybe_push_high;
|
procedure maybe_push_high;
|
||||||
begin
|
begin
|
||||||
@ -68,7 +68,8 @@ implementation
|
|||||||
if assigned(p^.hightree) then
|
if assigned(p^.hightree) then
|
||||||
begin
|
begin
|
||||||
secondpass(p^.hightree);
|
secondpass(p^.hightree);
|
||||||
push_value_para(p^.hightree,inlined,para_offset);
|
{ this is a longint anyway ! }
|
||||||
|
push_value_para(p^.hightree,inlined,para_offset,4);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
internalerror(432645);
|
internalerror(432645);
|
||||||
@ -77,13 +78,15 @@ implementation
|
|||||||
|
|
||||||
var
|
var
|
||||||
otlabel,oflabel : plabel;
|
otlabel,oflabel : plabel;
|
||||||
|
align : longint;
|
||||||
{ temporary variables: }
|
{ temporary variables: }
|
||||||
tempdeftype : tdeftype;
|
tempdeftype : tdeftype;
|
||||||
r : preference;
|
r : preference;
|
||||||
begin
|
begin
|
||||||
{ push from left to right if specified }
|
{ push from left to right if specified }
|
||||||
if push_from_left_to_right and assigned(p^.right) then
|
if push_from_left_to_right and assigned(p^.right) then
|
||||||
secondcallparan(p^.right,defcoll^.next,push_from_left_to_right,inlined,para_offset);
|
secondcallparan(p^.right,defcoll^.next,push_from_left_to_right,
|
||||||
|
inlined,dword_align,para_offset);
|
||||||
otlabel:=truelabel;
|
otlabel:=truelabel;
|
||||||
oflabel:=falselabel;
|
oflabel:=falselabel;
|
||||||
getlabel(truelabel);
|
getlabel(truelabel);
|
||||||
@ -172,7 +175,12 @@ implementation
|
|||||||
del_reference(p^.left^.location.reference);
|
del_reference(p^.left^.location.reference);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
push_value_para(p^.left,inlined,para_offset);
|
begin
|
||||||
|
align:=target_os.stackalignment;
|
||||||
|
if dword_align then
|
||||||
|
align:=4;
|
||||||
|
push_value_para(p^.left,inlined,para_offset,align);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
freelabel(truelabel);
|
freelabel(truelabel);
|
||||||
freelabel(falselabel);
|
freelabel(falselabel);
|
||||||
@ -180,7 +188,8 @@ implementation
|
|||||||
falselabel:=oflabel;
|
falselabel:=oflabel;
|
||||||
{ push from right to left }
|
{ push from right to left }
|
||||||
if not push_from_left_to_right and assigned(p^.right) then
|
if not push_from_left_to_right and assigned(p^.right) then
|
||||||
secondcallparan(p^.right,defcoll^.next,push_from_left_to_right,inlined,para_offset);
|
secondcallparan(p^.right,defcoll^.next,push_from_left_to_right,
|
||||||
|
inlined,dword_align,para_offset);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -357,10 +366,12 @@ implementation
|
|||||||
para_offset:=0;
|
para_offset:=0;
|
||||||
if assigned(p^.right) then
|
if assigned(p^.right) then
|
||||||
secondcallparan(p^.left,pprocvardef(p^.right^.resulttype)^.para1,
|
secondcallparan(p^.left,pprocvardef(p^.right^.resulttype)^.para1,
|
||||||
(p^.procdefinition^.options and poleftright)<>0,inlined,para_offset)
|
(p^.procdefinition^.options and poleftright)<>0,
|
||||||
|
inlined,(p^.procdefinition^.options and (pocdecl or postdcall))<>0,para_offset)
|
||||||
else
|
else
|
||||||
secondcallparan(p^.left,p^.procdefinition^.para1,
|
secondcallparan(p^.left,p^.procdefinition^.para1,
|
||||||
(p^.procdefinition^.options and poleftright)<>0,inlined,para_offset);
|
(p^.procdefinition^.options and poleftright)<>0,
|
||||||
|
inlined,(p^.procdefinition^.options and (pocdecl or postdcall))<>0,para_offset);
|
||||||
end;
|
end;
|
||||||
params:=p^.left;
|
params:=p^.left;
|
||||||
p^.left:=nil;
|
p^.left:=nil;
|
||||||
@ -1084,7 +1095,8 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if assigned(pp^.left) then
|
if assigned(pp^.left) then
|
||||||
begin
|
begin
|
||||||
if pp^.left^.location.loc in [LOC_REFERENCE,LOC_MEM] then
|
if (pp^.left^.location.loc in [LOC_REFERENCE,LOC_MEM]) and
|
||||||
|
ungettempoftype(pp^.left^.resulttype) then
|
||||||
ungetiftemp(pp^.left^.location.reference);
|
ungetiftemp(pp^.left^.location.reference);
|
||||||
{ process also all nodes of an array of const }
|
{ process also all nodes of an array of const }
|
||||||
if pp^.left^.treetype=arrayconstructn then
|
if pp^.left^.treetype=arrayconstructn then
|
||||||
@ -1094,7 +1106,8 @@ implementation
|
|||||||
hp:=pp^.left;
|
hp:=pp^.left;
|
||||||
while assigned(hp) do
|
while assigned(hp) do
|
||||||
begin
|
begin
|
||||||
if hp^.left^.location.loc in [LOC_REFERENCE,LOC_MEM] then
|
if (hp^.left^.location.loc in [LOC_REFERENCE,LOC_MEM]) and
|
||||||
|
ungettempoftype(hp^.left^.resulttype) then
|
||||||
ungetiftemp(hp^.left^.location.reference);
|
ungetiftemp(hp^.left^.location.reference);
|
||||||
hp:=hp^.right;
|
hp:=hp^.right;
|
||||||
end;
|
end;
|
||||||
@ -1202,7 +1215,11 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.74 1999-04-16 13:42:23 jonas
|
Revision 1.75 1999-04-19 09:45:46 pierre
|
||||||
|
+ cdecl or stdcall push all args with longint size
|
||||||
|
* tempansi stuff cleaned up
|
||||||
|
|
||||||
|
Revision 1.74 1999/04/16 13:42:23 jonas
|
||||||
* more regalloc fixes (still not complete)
|
* more regalloc fixes (still not complete)
|
||||||
|
|
||||||
Revision 1.73 1999/04/16 10:26:56 pierre
|
Revision 1.73 1999/04/16 10:26:56 pierre
|
||||||
|
@ -62,7 +62,7 @@ implementation
|
|||||||
hightree:=genloadnode(pvarsym(srsym),p^.symtable);
|
hightree:=genloadnode(pvarsym(srsym),p^.symtable);
|
||||||
firstpass(hightree);
|
firstpass(hightree);
|
||||||
secondpass(hightree);
|
secondpass(hightree);
|
||||||
push_value_para(hightree,false,0);
|
push_value_para(hightree,false,0,4);
|
||||||
disposetree(hightree);
|
disposetree(hightree);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -319,7 +319,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
clear_location(pto^.location);
|
clear_location(pto^.location);
|
||||||
pto^.location.loc:=LOC_REFERENCE;
|
pto^.location.loc:=LOC_REFERENCE;
|
||||||
gettempofsizereference(pto^.resulttype^.size,pto^.location.reference);
|
gettempansistringreference(pto^.location.reference);
|
||||||
ltemptoremove^.concat(new(ptemptodestroy,init(pto^.location.reference,pto^.resulttype)));
|
ltemptoremove^.concat(new(ptemptodestroy,init(pto^.location.reference,pto^.resulttype)));
|
||||||
exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,0,newreference(pto^.location.reference))));
|
exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,0,newreference(pto^.location.reference))));
|
||||||
pushusedregisters(pushed,$ff);
|
pushusedregisters(pushed,$ff);
|
||||||
@ -498,7 +498,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
st_ansistring :
|
st_ansistring :
|
||||||
begin
|
begin
|
||||||
gettempofsizereference(4,pto^.location.reference);
|
gettempansistringreference(pto^.location.reference);
|
||||||
ltemptoremove^.concat(new(ptemptodestroy,init(pto^.location.reference,pto^.resulttype)));
|
ltemptoremove^.concat(new(ptemptodestroy,init(pto^.location.reference,pto^.resulttype)));
|
||||||
exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,0,newreference(pto^.location.reference))));
|
exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,0,newreference(pto^.location.reference))));
|
||||||
release_loc(pfrom^.location);
|
release_loc(pfrom^.location);
|
||||||
@ -545,7 +545,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
st_ansistring :
|
st_ansistring :
|
||||||
begin
|
begin
|
||||||
gettempofsizereference(4,pto^.location.reference);
|
gettempansistringreference(pto^.location.reference);
|
||||||
ltemptoremove^.concat(new(ptemptodestroy,init(pto^.location.reference,pto^.resulttype)));
|
ltemptoremove^.concat(new(ptemptodestroy,init(pto^.location.reference,pto^.resulttype)));
|
||||||
exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,0,newreference(pto^.location.reference))));
|
exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,0,newreference(pto^.location.reference))));
|
||||||
release_loc(pfrom^.location);
|
release_loc(pfrom^.location);
|
||||||
@ -1062,7 +1062,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
st_ansistring:
|
st_ansistring:
|
||||||
begin
|
begin
|
||||||
gettempofsizereference(pto^.resulttype^.size,pto^.location.reference);
|
gettempansistringreference(pto^.location.reference);
|
||||||
ltemptoremove^.concat(new(ptemptodestroy,init(pto^.location.reference,pto^.resulttype)));
|
ltemptoremove^.concat(new(ptemptodestroy,init(pto^.location.reference,pto^.resulttype)));
|
||||||
exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,0,newreference(pto^.location.reference))));
|
exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,0,newreference(pto^.location.reference))));
|
||||||
case pfrom^.location.loc of
|
case pfrom^.location.loc of
|
||||||
@ -1288,7 +1288,11 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.64 1999-04-16 13:42:25 jonas
|
Revision 1.65 1999-04-19 09:45:47 pierre
|
||||||
|
+ cdecl or stdcall push all args with longint size
|
||||||
|
* tempansi stuff cleaned up
|
||||||
|
|
||||||
|
Revision 1.64 1999/04/16 13:42:25 jonas
|
||||||
* more regalloc fixes (still not complete)
|
* more regalloc fixes (still not complete)
|
||||||
|
|
||||||
Revision 1.63 1999/04/15 08:56:25 peter
|
Revision 1.63 1999/04/15 08:56:25 peter
|
||||||
|
@ -295,7 +295,7 @@ implementation
|
|||||||
{ support openstring calling for readln(shortstring) }
|
{ support openstring calling for readln(shortstring) }
|
||||||
if doread and (is_shortstring(hp^.resulttype)) then
|
if doread and (is_shortstring(hp^.resulttype)) then
|
||||||
dummycoll.data:=openshortstringdef;
|
dummycoll.data:=openshortstringdef;
|
||||||
secondcallparan(hp,@dummycoll,false,false,0);
|
secondcallparan(hp,@dummycoll,false,false,false,0);
|
||||||
if ft=ft_typed then
|
if ft=ft_typed then
|
||||||
never_copy_const_param:=false;
|
never_copy_const_param:=false;
|
||||||
end;
|
end;
|
||||||
@ -337,7 +337,7 @@ implementation
|
|||||||
hp:=node;
|
hp:=node;
|
||||||
node:=node^.right;
|
node:=node^.right;
|
||||||
hp^.right:=nil;
|
hp^.right:=nil;
|
||||||
secondcallparan(hp,@dummycoll,false,false,0);
|
secondcallparan(hp,@dummycoll,false,false,false,0);
|
||||||
hp^.right:=node;
|
hp^.right:=node;
|
||||||
if codegenerror then
|
if codegenerror then
|
||||||
exit;
|
exit;
|
||||||
@ -354,7 +354,7 @@ implementation
|
|||||||
hp:=node;
|
hp:=node;
|
||||||
node:=node^.right;
|
node:=node^.right;
|
||||||
hp^.right:=nil;
|
hp^.right:=nil;
|
||||||
secondcallparan(hp,@dummycoll,false,false,0);
|
secondcallparan(hp,@dummycoll,false,false,false,0);
|
||||||
hp^.right:=node;
|
hp^.right:=node;
|
||||||
if pararesult^.deftype<>floatdef then
|
if pararesult^.deftype<>floatdef then
|
||||||
CGMessage(parser_e_illegal_colon_qualifier);
|
CGMessage(parser_e_illegal_colon_qualifier);
|
||||||
@ -556,7 +556,7 @@ implementation
|
|||||||
else
|
else
|
||||||
dummycoll.data:=hp^.resulttype;
|
dummycoll.data:=hp^.resulttype;
|
||||||
procedureprefix:='FPC_'+pstringdef(hp^.resulttype)^.stringtypname+'_';
|
procedureprefix:='FPC_'+pstringdef(hp^.resulttype)^.stringtypname+'_';
|
||||||
secondcallparan(hp,@dummycoll,false,false,0);
|
secondcallparan(hp,@dummycoll,false,false,false,0);
|
||||||
if codegenerror then
|
if codegenerror then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@ -573,7 +573,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
dummycoll.data:=hp^.resulttype;
|
dummycoll.data:=hp^.resulttype;
|
||||||
secondcallparan(hp,@dummycoll,false
|
secondcallparan(hp,@dummycoll,false
|
||||||
,false,0
|
,false,false,0
|
||||||
);
|
);
|
||||||
if codegenerror then
|
if codegenerror then
|
||||||
exit;
|
exit;
|
||||||
@ -592,7 +592,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
dummycoll.data:=hp^.resulttype;
|
dummycoll.data:=hp^.resulttype;
|
||||||
secondcallparan(hp,@dummycoll,false
|
secondcallparan(hp,@dummycoll,false
|
||||||
,false,0
|
,false,false,0
|
||||||
);
|
);
|
||||||
if codegenerror then
|
if codegenerror then
|
||||||
exit;
|
exit;
|
||||||
@ -609,7 +609,7 @@ implementation
|
|||||||
|
|
||||||
{ last arg longint or real }
|
{ last arg longint or real }
|
||||||
secondcallparan(hp,@dummycoll,false
|
secondcallparan(hp,@dummycoll,false
|
||||||
,false,0
|
,false,false,0
|
||||||
);
|
);
|
||||||
disposetree(hp);
|
disposetree(hp);
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ implementation
|
|||||||
Begin
|
Begin
|
||||||
dummycoll.paratyp:=vs_var;
|
dummycoll.paratyp:=vs_var;
|
||||||
dummycoll.data:=code_para^.resulttype;
|
dummycoll.data:=code_para^.resulttype;
|
||||||
secondcallparan(code_para,@dummycoll,false,false,0);
|
secondcallparan(code_para,@dummycoll,false,false,false,0);
|
||||||
if codegenerror then
|
if codegenerror then
|
||||||
exit;
|
exit;
|
||||||
Disposetree(code_para);
|
Disposetree(code_para);
|
||||||
@ -736,7 +736,7 @@ implementation
|
|||||||
{node = first parameter = string}
|
{node = first parameter = string}
|
||||||
dummycoll.paratyp:=vs_const;
|
dummycoll.paratyp:=vs_const;
|
||||||
dummycoll.data:=node^.resulttype;
|
dummycoll.data:=node^.resulttype;
|
||||||
secondcallparan(node,@dummycoll,false,false,0);
|
secondcallparan(node,@dummycoll,false,false,false,0);
|
||||||
if codegenerror then
|
if codegenerror then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@ -1287,7 +1287,11 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.42 1999-04-14 09:11:59 peter
|
Revision 1.43 1999-04-19 09:45:48 pierre
|
||||||
|
+ cdecl or stdcall push all args with longint size
|
||||||
|
* tempansi stuff cleaned up
|
||||||
|
|
||||||
|
Revision 1.42 1999/04/14 09:11:59 peter
|
||||||
* fixed include
|
* fixed include
|
||||||
|
|
||||||
Revision 1.41 1999/04/08 23:59:49 pierre
|
Revision 1.41 1999/04/08 23:59:49 pierre
|
||||||
|
Loading…
Reference in New Issue
Block a user