mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-22 07:30:54 +00:00
Don't allocate stack space for varargs stack repair unless it's needed.
If there are no varargs calls (and nothing else that saves stack positions), then space doesn't need to be allocated for the saved stack position. This can also lead to more efficient prolog/epilog code for small functions.
This commit is contained in:
parent
f24f37aa9f
commit
4a7644e0b5
1
CGI.pas
1
CGI.pas
@ -329,6 +329,7 @@ var
|
||||
symLength: integer; {length of debug symbol table}
|
||||
toolParms: boolean; {generate tool format paramaters?}
|
||||
volatile: boolean; {has a volatile qualifier been used?}
|
||||
hasVarargsCall: boolean; {does current function call any varargs fns?}
|
||||
|
||||
{desk accessory variables}
|
||||
{------------------------}
|
||||
|
@ -2781,6 +2781,8 @@ var
|
||||
Gen1tName(pc_cup, ord(fType^.varargs and strictVararg),
|
||||
UsualUnaryConversions, fname);
|
||||
end; {else}
|
||||
if fType^.varargs then
|
||||
hasVarargsCall := true;
|
||||
end {if}
|
||||
else
|
||||
GenTool(pc_tl1, ftype^.toolNum, long(ftype^.ftype^.size).lsw,
|
||||
|
2
Gen.pas
2
Gen.pas
@ -5679,7 +5679,7 @@ while bk <> nil do begin
|
||||
end; {while}
|
||||
bk := bk^.next;
|
||||
end; {while}
|
||||
if saveStack or checkStack or strictVararg then begin
|
||||
if saveStack or checkStack or (strictVararg and hasVarargsCall) then begin
|
||||
stackLoc := minSize;
|
||||
minSize := minSize + 2;
|
||||
localSize := localSize + 2;
|
||||
|
@ -3474,6 +3474,7 @@ if isFunction then begin
|
||||
else
|
||||
Gen2Name (dc_str, segType, 0, variable^.name);
|
||||
doingMain := variable^.name^ = 'main';
|
||||
hasVarargsCall := false;
|
||||
firstCompoundStatement := true;
|
||||
Gen0 (dc_pin);
|
||||
if not isAsm then
|
||||
|
Loading…
Reference in New Issue
Block a user