diff --git a/compiler/cg386cal.pas b/compiler/cg386cal.pas index 2d292cbe2b..bc0fe2b04b 100644 --- a/compiler/cg386cal.pas +++ b/compiler/cg386cal.pas @@ -29,7 +29,7 @@ interface symtable,tree; 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 secondprocinline(var p : ptree); @@ -56,7 +56,7 @@ implementation *****************************************************************************} 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; begin @@ -68,7 +68,8 @@ implementation if assigned(p^.hightree) then begin 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 else internalerror(432645); @@ -77,13 +78,15 @@ implementation var otlabel,oflabel : plabel; + align : longint; { temporary variables: } tempdeftype : tdeftype; r : preference; begin { push from left to right if specified } 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; oflabel:=falselabel; getlabel(truelabel); @@ -172,7 +175,12 @@ implementation del_reference(p^.left^.location.reference); end 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; freelabel(truelabel); freelabel(falselabel); @@ -180,7 +188,8 @@ implementation falselabel:=oflabel; { push from right to left } 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; @@ -357,10 +366,12 @@ implementation para_offset:=0; if assigned(p^.right) then 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 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; params:=p^.left; p^.left:=nil; @@ -1084,7 +1095,8 @@ implementation begin if assigned(pp^.left) then 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); { process also all nodes of an array of const } if pp^.left^.treetype=arrayconstructn then @@ -1094,7 +1106,8 @@ implementation hp:=pp^.left; while assigned(hp) do 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); hp:=hp^.right; end; @@ -1202,7 +1215,11 @@ implementation end. { $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) Revision 1.73 1999/04/16 10:26:56 pierre diff --git a/compiler/cg386cnv.pas b/compiler/cg386cnv.pas index 778a08377e..bbfe59180f 100644 --- a/compiler/cg386cnv.pas +++ b/compiler/cg386cnv.pas @@ -62,7 +62,7 @@ implementation hightree:=genloadnode(pvarsym(srsym),p^.symtable); firstpass(hightree); secondpass(hightree); - push_value_para(hightree,false,0); + push_value_para(hightree,false,0,4); disposetree(hightree); end else @@ -319,7 +319,7 @@ implementation begin clear_location(pto^.location); 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))); exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,0,newreference(pto^.location.reference)))); pushusedregisters(pushed,$ff); @@ -498,7 +498,7 @@ implementation end; st_ansistring : begin - gettempofsizereference(4,pto^.location.reference); + gettempansistringreference(pto^.location.reference); 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)))); release_loc(pfrom^.location); @@ -545,7 +545,7 @@ implementation end; st_ansistring : begin - gettempofsizereference(4,pto^.location.reference); + gettempansistringreference(pto^.location.reference); 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)))); release_loc(pfrom^.location); @@ -1062,7 +1062,7 @@ implementation end; st_ansistring: begin - gettempofsizereference(pto^.resulttype^.size,pto^.location.reference); + gettempansistringreference(pto^.location.reference); 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)))); case pfrom^.location.loc of @@ -1288,7 +1288,11 @@ implementation end. { $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) Revision 1.63 1999/04/15 08:56:25 peter diff --git a/compiler/cg386inl.pas b/compiler/cg386inl.pas index 985ed5d52a..8b2d3b3445 100644 --- a/compiler/cg386inl.pas +++ b/compiler/cg386inl.pas @@ -295,7 +295,7 @@ implementation { support openstring calling for readln(shortstring) } if doread and (is_shortstring(hp^.resulttype)) then dummycoll.data:=openshortstringdef; - secondcallparan(hp,@dummycoll,false,false,0); + secondcallparan(hp,@dummycoll,false,false,false,0); if ft=ft_typed then never_copy_const_param:=false; end; @@ -337,7 +337,7 @@ implementation hp:=node; node:=node^.right; hp^.right:=nil; - secondcallparan(hp,@dummycoll,false,false,0); + secondcallparan(hp,@dummycoll,false,false,false,0); hp^.right:=node; if codegenerror then exit; @@ -354,7 +354,7 @@ implementation hp:=node; node:=node^.right; hp^.right:=nil; - secondcallparan(hp,@dummycoll,false,false,0); + secondcallparan(hp,@dummycoll,false,false,false,0); hp^.right:=node; if pararesult^.deftype<>floatdef then CGMessage(parser_e_illegal_colon_qualifier); @@ -556,7 +556,7 @@ implementation else dummycoll.data:=hp^.resulttype; procedureprefix:='FPC_'+pstringdef(hp^.resulttype)^.stringtypname+'_'; - secondcallparan(hp,@dummycoll,false,false,0); + secondcallparan(hp,@dummycoll,false,false,false,0); if codegenerror then exit; @@ -573,7 +573,7 @@ implementation begin dummycoll.data:=hp^.resulttype; secondcallparan(hp,@dummycoll,false - ,false,0 + ,false,false,0 ); if codegenerror then exit; @@ -592,7 +592,7 @@ implementation begin dummycoll.data:=hp^.resulttype; secondcallparan(hp,@dummycoll,false - ,false,0 + ,false,false,0 ); if codegenerror then exit; @@ -609,7 +609,7 @@ implementation { last arg longint or real } secondcallparan(hp,@dummycoll,false - ,false,0 + ,false,false,0 ); disposetree(hp); @@ -721,7 +721,7 @@ implementation Begin dummycoll.paratyp:=vs_var; dummycoll.data:=code_para^.resulttype; - secondcallparan(code_para,@dummycoll,false,false,0); + secondcallparan(code_para,@dummycoll,false,false,false,0); if codegenerror then exit; Disposetree(code_para); @@ -736,7 +736,7 @@ implementation {node = first parameter = string} dummycoll.paratyp:=vs_const; dummycoll.data:=node^.resulttype; - secondcallparan(node,@dummycoll,false,false,0); + secondcallparan(node,@dummycoll,false,false,false,0); if codegenerror then exit; @@ -1287,7 +1287,11 @@ implementation end. { $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 Revision 1.41 1999/04/08 23:59:49 pierre