mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-31 16:46:30 +02:00
* better skipping of secondpass if error
This commit is contained in:
parent
a0794814d3
commit
cf8a1e1462
@ -336,95 +336,84 @@ implementation
|
|||||||
aktlocalswitches:=entryswitches;
|
aktlocalswitches:=entryswitches;
|
||||||
oldaktmaxfpuregisters:=aktmaxfpuregisters;
|
oldaktmaxfpuregisters:=aktmaxfpuregisters;
|
||||||
aktmaxfpuregisters:=localmaxfpuregisters;
|
aktmaxfpuregisters:=localmaxfpuregisters;
|
||||||
{$ifndef NOPASS2}
|
|
||||||
if assigned(code) then
|
if assigned(code) then
|
||||||
begin
|
begin
|
||||||
{ only generate the code if no type errors are found, else
|
{ the procedure is now defined }
|
||||||
finish at least the type checking pass }
|
aktprocsym.definition.forwarddef:=false;
|
||||||
|
|
||||||
|
{ only generate the code if no type errors are found, else
|
||||||
|
finish at least the type checking pass }
|
||||||
|
{$ifndef NOPASS2}
|
||||||
if (status.errorcount=0) then
|
if (status.errorcount=0) then
|
||||||
generatecode(code)
|
begin
|
||||||
else
|
generatecode(code);
|
||||||
do_resulttypepass(code);
|
aktprocsym.definition.code:=code;
|
||||||
end;
|
|
||||||
{ set switches to status at end of procedure }
|
|
||||||
aktlocalswitches:=exitswitches;
|
|
||||||
|
|
||||||
if assigned(code) then
|
|
||||||
begin
|
|
||||||
aktprocsym.definition.code:=code;
|
|
||||||
|
|
||||||
{ the procedure is now defined }
|
|
||||||
aktprocsym.definition.forwarddef:=false;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ifdef newcg}
|
{$ifdef newcg}
|
||||||
stackframe:=tg.gettempsize;
|
stackframe:=tg.gettempsize;
|
||||||
{$else newcg}
|
{$else newcg}
|
||||||
stackframe:=gettempsize;
|
stackframe:=gettempsize;
|
||||||
{$endif newcg}
|
{$endif newcg}
|
||||||
|
|
||||||
{ first generate entry code with the correct position and switches }
|
{ first generate entry code with the correct position and switches }
|
||||||
aktfilepos:=entrypos;
|
aktfilepos:=entrypos;
|
||||||
aktlocalswitches:=entryswitches;
|
aktlocalswitches:=entryswitches;
|
||||||
{$ifdef newcg}
|
{$ifdef newcg}
|
||||||
if assigned(code) then
|
cg^.g_entrycode(procinfo^.aktentrycode,proc_names,make_global,stackframe,parasize,nostackframe,false);
|
||||||
cg^.g_entrycode(procinfo^.aktentrycode,proc_names,make_global,stackframe,parasize,nostackframe,false);
|
|
||||||
{$else newcg}
|
{$else newcg}
|
||||||
if assigned(code) then
|
genentrycode(procinfo^.aktentrycode,make_global,stackframe,parasize,nostackframe,false);
|
||||||
genentrycode(procinfo^.aktentrycode,make_global,stackframe,parasize,nostackframe,false);
|
|
||||||
{$endif newcg}
|
{$endif newcg}
|
||||||
|
|
||||||
{ FPC_POPADDRSTACK destroys all registers (JM) }
|
{ FPC_POPADDRSTACK destroys all registers (JM) }
|
||||||
if (procinfo^.flags and (pi_needs_implicit_finally or pi_uses_exceptions)) <> 0 then
|
if (procinfo^.flags and (pi_needs_implicit_finally or pi_uses_exceptions)) <> 0 then
|
||||||
usedinproc := $ff;
|
usedinproc := $ff;
|
||||||
|
|
||||||
{ now generate exit code with the correct position and switches }
|
{ now generate exit code with the correct position and switches }
|
||||||
aktfilepos:=exitpos;
|
aktfilepos:=exitpos;
|
||||||
aktlocalswitches:=exitswitches;
|
aktlocalswitches:=exitswitches;
|
||||||
if assigned(code) then
|
|
||||||
begin
|
|
||||||
{$ifdef newcg}
|
{$ifdef newcg}
|
||||||
cg^.g_exitcode(procinfo^.aktexitcode,parasize,nostackframe,false);
|
cg^.g_exitcode(procinfo^.aktexitcode,parasize,nostackframe,false);
|
||||||
{$else newcg}
|
{$else newcg}
|
||||||
genexitcode(procinfo^.aktexitcode,parasize,nostackframe,false);
|
genexitcode(procinfo^.aktexitcode,parasize,nostackframe,false);
|
||||||
{$endif newcg}
|
{$endif newcg}
|
||||||
{ now all the registers used are known }
|
|
||||||
|
{ now all the registers used are known }
|
||||||
{$ifdef newcg}
|
{$ifdef newcg}
|
||||||
aktprocsym.definition.usedregisters:=tg.usedinproc;
|
aktprocsym.definition.usedregisters:=tg.usedinproc;
|
||||||
{$else newcg}
|
{$else newcg}
|
||||||
aktprocsym.definition.usedregisters:=usedinproc;
|
aktprocsym.definition.usedregisters:=usedinproc;
|
||||||
{$endif newcg}
|
{$endif newcg}
|
||||||
procinfo^.aktproccode.insertlist(procinfo^.aktentrycode);
|
procinfo^.aktproccode.insertlist(procinfo^.aktentrycode);
|
||||||
procinfo^.aktproccode.concatlist(procinfo^.aktexitcode);
|
procinfo^.aktproccode.concatlist(procinfo^.aktexitcode);
|
||||||
{$ifdef i386}
|
{$ifdef i386}
|
||||||
{$ifndef NoOpt}
|
{$ifndef NoOpt}
|
||||||
if (cs_optimize in aktglobalswitches) and
|
if (cs_optimize in aktglobalswitches) and
|
||||||
{ do not optimize pure assembler procedures }
|
{ do not optimize pure assembler procedures }
|
||||||
((procinfo^.flags and pi_is_assembler)=0) then
|
((procinfo^.flags and pi_is_assembler)=0) then
|
||||||
Optimize(procinfo^.aktproccode);
|
Optimize(procinfo^.aktproccode);
|
||||||
{$endif NoOpt}
|
{$endif NoOpt}
|
||||||
{$endif i386}
|
{$endif i386}
|
||||||
{ save local data (casetable) also in the same file }
|
{ save local data (casetable) also in the same file }
|
||||||
if assigned(procinfo^.aktlocaldata) and
|
if assigned(procinfo^.aktlocaldata) and
|
||||||
(not procinfo^.aktlocaldata.empty) then
|
(not procinfo^.aktlocaldata.empty) then
|
||||||
begin
|
begin
|
||||||
procinfo^.aktproccode.concat(Tai_section.Create(sec_data));
|
procinfo^.aktproccode.concat(Tai_section.Create(sec_data));
|
||||||
procinfo^.aktproccode.concatlist(procinfo^.aktlocaldata);
|
procinfo^.aktproccode.concatlist(procinfo^.aktlocaldata);
|
||||||
procinfo^.aktproccode.concat(Tai_section.Create(sec_code));
|
procinfo^.aktproccode.concat(Tai_section.Create(sec_code));
|
||||||
end;
|
end;
|
||||||
{ now we can insert a cut }
|
|
||||||
if (cs_create_smart in aktmoduleswitches) then
|
|
||||||
codeSegment.concat(Tai_cut.Create);
|
|
||||||
|
|
||||||
{ add the procedure to the codesegment }
|
{ add the procedure to the codesegment }
|
||||||
codeSegment.concatlist(procinfo^.aktproccode);
|
if (cs_create_smart in aktmoduleswitches) then
|
||||||
end;
|
codeSegment.concat(Tai_cut.Create);
|
||||||
|
codeSegment.concatlist(procinfo^.aktproccode);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
do_resulttypepass(code);
|
||||||
|
{$else NOPASS2}
|
||||||
|
do_resulttypepass(code);
|
||||||
{$endif NOPASS2}
|
{$endif NOPASS2}
|
||||||
|
end;
|
||||||
|
|
||||||
{ ... remove symbol tables, for the browser leave the static table }
|
{ ... remove symbol tables }
|
||||||
{ if (cs_browser in aktmoduleswitches) and (symtablestack.symtabletype=staticsymtable) then
|
|
||||||
symtablestack.next:=symtablestack.next^.next
|
|
||||||
else }
|
|
||||||
if lexlevel>=normal_function_level then
|
if lexlevel>=normal_function_level then
|
||||||
symtablestack:=symtablestack.next.next
|
symtablestack:=symtablestack.next.next
|
||||||
else
|
else
|
||||||
@ -814,7 +803,10 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.29 2001-04-13 23:49:24 peter
|
Revision 1.30 2001-04-14 14:05:47 peter
|
||||||
|
* better skipping of secondpass if error
|
||||||
|
|
||||||
|
Revision 1.29 2001/04/13 23:49:24 peter
|
||||||
* when errors are found don't generate code, but still run the
|
* when errors are found don't generate code, but still run the
|
||||||
resulttype pass
|
resulttype pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user