* record in the flowcontrol flags whether we are currently in a block whose

exceptions are caught in the current routine (fc_catching_exceptions),
    so that for LLVM we will be able to use "invoke" instead of "call" in that
    case

git-svn-id: trunk@35158 -
This commit is contained in:
Jonas Maebe 2016-12-18 13:57:33 +00:00
parent 6a1c4f9b75
commit b14c037533
3 changed files with 10 additions and 6 deletions

View File

@ -584,7 +584,6 @@ implementation
begin
current_asmdata.getjumplabel(exceptstate.exceptionlabel);
exceptstate.oldflowcontrol:=flowcontrol;
flowcontrol:=[fc_inflowcontrol];
paraloc1.init;
paraloc2.init;
@ -642,6 +641,8 @@ implementation
longjmp'd back here }
hlcg.a_cmp_const_reg_label(list,setjmpres.def,OC_NE,0,tmpresloc.register,exceptstate.exceptionlabel);
setjmpres.resetiftemp;
flowcontrol:=[fc_inflowcontrol,fc_catching_exceptions];
end;
@ -924,7 +925,7 @@ implementation
{ return all used control flow statements }
flowcontrol:=trystate.oldflowcontrol+(doobjectdestroyandreraisestate.newflowcontrol +
trystate.newflowcontrol - [fc_inflowcontrol]);
trystate.newflowcontrol - [fc_inflowcontrol,fc_catching_exceptions]);
end;
@ -1062,7 +1063,7 @@ implementation
cexceptionstatehandler.unget_exception_temps(current_asmdata.CurrAsmList,excepttemps);
hlcg.a_label(current_asmdata.CurrAsmList,nextonlabel);
flowcontrol:=doobjectdestroyandreraisestate.oldflowcontrol+(doobjectdestroyandreraisestate.newflowcontrol-[fc_inflowcontrol]);
flowcontrol:=doobjectdestroyandreraisestate.oldflowcontrol+(doobjectdestroyandreraisestate.newflowcontrol-[fc_inflowcontrol,fc_catching_exceptions]);
paraloc1.done;
current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
@ -1252,7 +1253,7 @@ implementation
current_procinfo.CurrContinueLabel:=oldContinueLabel;
current_procinfo.CurrBreakLabel:=oldBreakLabel;
end;
flowcontrol:=finallyexceptionstate.oldflowcontrol+(finallyexceptionstate.newflowcontrol-[fc_inflowcontrol]);
flowcontrol:=finallyexceptionstate.oldflowcontrol+(finallyexceptionstate.newflowcontrol-[fc_inflowcontrol,fc_catching_exceptions]);
end;

View File

@ -35,6 +35,9 @@ uses
fc_continue,
fc_inflowcontrol,
fc_gotolabel,
{ in block that has an exception handler associated with it
(try..except, try..finally, exception block of try..except, ... }
fc_catching_exceptions,
{ in try block of try..finally and target uses specific unwinding }
fc_unwind_exit,
fc_unwind_loop,

View File

@ -293,9 +293,9 @@ procedure tx64tryfinallynode.pass_generate_code;
{ fc_unwind_xx tells exit/continue/break statements to emit special
unwind code instead of just JMP }
if not implicitframe then
flowcontrol:=flowcontrol+[fc_unwind_exit,fc_unwind_loop];
flowcontrol:=flowcontrol+[fc_catching_exceptions,fc_unwind_exit,fc_unwind_loop];
secondpass(left);
flowcontrol:=flowcontrol-[fc_unwind_exit,fc_unwind_loop];
flowcontrol:=flowcontrol-[fc_catching_exceptions,fc_unwind_exit,fc_unwind_loop];
if codegenerror then
exit;
end;