diff options
author | Olivier Hainque <hainque@adacore.com> | 2015-11-23 11:20:34 +0000 |
---|---|---|
committer | Olivier Hainque <hainque@gcc.gnu.org> | 2015-11-23 11:20:34 +0000 |
commit | 0ab0bf955aa7940b6ed5e4790183c298b864201a (patch) | |
tree | 267b1724f61677cc6d135ffc9cc85a5cab60ec2a /gcc/ada/gcc-interface/trans.c | |
parent | f119bebb36fc3680e94123630f57357d1ae571f6 (diff) | |
download | gcc-0ab0bf955aa7940b6ed5e4790183c298b864201a.zip gcc-0ab0bf955aa7940b6ed5e4790183c298b864201a.tar.gz gcc-0ab0bf955aa7940b6ed5e4790183c298b864201a.tar.bz2 |
opt.ads (Exception_Mechanism): Now three values: Front_End_SJLJ, Back_End_SJLJ and Back_End_ZCX.
2015-11-23 Olivier Hainque <hainque@adacore.com>
Eric Botcazou <botcazou@adacore.com>
* opt.ads (Exception_Mechanism): Now three values: Front_End_SJLJ,
Back_End_SJLJ and Back_End_ZCX.
(Back_End_Exceptions, Front_End_Exceptions, ZCX_Exceptions,
SJLJ_Exceptions): New functions, reflecting properties of the current
Exception_Mechanism.
* opt.adb: Implement the new functions.
* fe.h: Bind the new Exception_Mechanism and helper functions for gigi.
* exp_ch11.adb (Expand_At_End_Handler): Replace test on mechanism by
use of property helper and update comments.
(Expand_Exception_Handlers): Replace tests on mechanism by use of
helper. Restrict Abort_Defer to ZCX specifically.
* exp_ch9.adb (Expand_N_Asynchronous_Select): Replace tests on
mechanism by calls to helper functions. Abort_Undefer for ZCX only,
paired with Expand_Exception_Handlers.
* exp_sel.adb (Build_Abort_Block_Handler): Replace tests on mechanism
by calls to helper functions. Abort_Undefer for ZCX only, paired with
Expand_Exception_Handlers.
* lib-writ.ads (P line documentation): Add entry for "FX",
representative of unit compiled with Frontend_Exceptions True.
* lib-writ.adb (Output_Main_Program_Line): Add "FX" on P line if
compiled with Frontend_Exceptions True.
* ali.ads (ALIs_Record): Ada a Frontend_Exceptions component, to reflect
whether the ALI file contained an "FX" indication on the P line.
(Frontend_Exceptions_Specified): New boolean, to keep track of whether
at least an FX ALI file is in the closure.
* ali.adb (Scan_ALI): Handle "FX" on the P line.
(Initialize_ALI): Initialize Frontend_Exceptions_Specified to False.
* targparm.ads: Update desription of exception schemes.
(Frontend_Exceptions_On_Target): New flag, reflect Frontend_Exceptions
set to True in system.ads, or not set at all.
* targparm.adb (Targparm_Tags): Add FEX to convey Frontend_Exceptions.
Rename ZCD to ZCX for consistency.
(FEX_Str, Targparm_Str, Get_Target_Parameters): Adjust accordingly.
* gnat1drv.adb (Adjust_Global_Switches): Adjust Exception_Mechanism
setting, now from combination of Frontend_Exceptions and ZCX_By_Default.
* bcheck.adb (Check_Consistent_Zero_Cost_Exception_Handling): Rename
as ...
(Check_Consistent_Exception_Handling): Check consistency of both
ZCX_By_Default and Frontend_Exceptions.
(Check_Configuration_Consistency): Check_Consistent_Exception_Handling
if either flag was set at least once.
* make.adb (Check): Remove processing of a possible -fsjlj coming from
lang-specs.h.
* gnatlink.adb (Gnatlin): Likewise.
* gcc-interface/Makefile.in (gnatlib-sjlj/zcx): Now set
both ZCX_By_Default and Frontend_Exceptions.
* gcc-interface/decl.c (gnat_to_gnu_entity, case E_Variable):
Use eh property helper to test for back-end exceptions. Adjust
mechanism name when testing for front-end sjlj.
(case E_Procedure): Likewise.
* gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu):
Likewise, and rename local variables.
(Exception_Handler_to_gnu_sjlj): Rename as
Exception_Handler_to_gnu_fe_sjlj.
(Exception_Handler_to_gnu_zcx): Rename as
Exception_Handler_to_gnu_gcc and adjust tests on eh mechanisms
to use property helpers or correct mechanism name.
Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>
From-SVN: r230752
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 5ee82ec..8cfa1a2 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -646,7 +646,7 @@ gigi (Node_Id gnat_root, (TREE_STRING_POINTER (gnat_to_gnu (Ident_String (Main_Unit)))); /* If we are using the GCC exception mechanism, let GCC know. */ - if (Exception_Mechanism == Back_End_Exceptions) + if (Back_End_Exceptions ()) gnat_init_gcc_eh (); /* Initialize the GCC support for FP operations. */ @@ -4923,14 +4923,14 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) tree gnu_jmpsave_decl = NULL_TREE; tree gnu_jmpbuf_decl = NULL_TREE; /* If just annotating, ignore all EH and cleanups. */ - bool gcc_zcx = (!type_annotate_only - && Present (Exception_Handlers (gnat_node)) - && Exception_Mechanism == Back_End_Exceptions); - bool setjmp_longjmp + bool gcc_eh = (!type_annotate_only + && Present (Exception_Handlers (gnat_node)) + && Back_End_Exceptions ()); + bool fe_sjlj = (!type_annotate_only && Present (Exception_Handlers (gnat_node)) - && Exception_Mechanism == Setjmp_Longjmp); + && Exception_Mechanism == Front_End_SJLJ); bool at_end = !type_annotate_only && Present (At_End_Proc (gnat_node)); - bool binding_for_block = (at_end || gcc_zcx || setjmp_longjmp); + bool binding_for_block = (at_end || gcc_eh || fe_sjlj); tree gnu_inner_block; /* The statement(s) for the block itself. */ tree gnu_result; tree gnu_expr; @@ -4953,17 +4953,17 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) condition to make it not ZCX specific. If there are any exceptions or cleanup processing involved, we need an - outer statement group (for Setjmp_Longjmp) and binding level. */ + outer statement group (for Fe_Sjlj) and binding level. */ if (binding_for_block) { start_stmt_group (); gnat_pushlevel (); } - /* If using setjmp_longjmp, make the variables for the setjmp buffer and save + /* If using fe_sjlj, make the variables for the setjmp buffer and save area for address of previous buffer. Do this first since we need to have the setjmp buf known for any decls in this block. */ - if (setjmp_longjmp) + if (fe_sjlj) { gnu_jmpsave_decl = create_var_decl (get_identifier ("JMPBUF_SAVE"), NULL_TREE, @@ -4973,7 +4973,7 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) NULL, gnat_node); /* The __builtin_setjmp receivers will immediately reinstall it. Now - because of the unstructured form of EH used by setjmp_longjmp, there + because of the unstructured form of EH used by fe_sjlj, there might be forward edges going to __builtin_setjmp receivers on which it is uninitialized, although they will never be actually taken. */ TREE_NO_WARNING (gnu_jmpsave_decl) = 1; @@ -5008,7 +5008,7 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) If this is SJLJ, set our jmp_buf as the current buffer. */ start_stmt_group (); - if (setjmp_longjmp) + if (fe_sjlj) { gnu_expr = build_call_n_expr (set_jmpbuf_decl, 1, build_unary_op (ADDR_EXPR, NULL_TREE, @@ -5031,7 +5031,7 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) /* Now generate code for the two exception models, if either is relevant for this block. */ - if (setjmp_longjmp) + if (fe_sjlj) { tree *gnu_else_ptr = 0; tree gnu_handler; @@ -5103,7 +5103,7 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) gnu_jmpbuf_decl))), gnu_handler, gnu_inner_block); } - else if (gcc_zcx) + else if (gcc_eh) { tree gnu_handlers; location_t locus; @@ -5147,11 +5147,11 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) } /* Subroutine of gnat_to_gnu to translate gnat_node, an N_Exception_Handler, - to a GCC tree, which is returned. This is the variant for Setjmp_Longjmp + to a GCC tree, which is returned. This is the variant for front-end sjlj exception handling. */ static tree -Exception_Handler_to_gnu_sjlj (Node_Id gnat_node) +Exception_Handler_to_gnu_fe_sjlj (Node_Id gnat_node) { /* Unless this is "Others" or the special "Non-Ada" exception for Ada, make an "if" statement to select the proper exceptions. For "Others", exclude @@ -5216,10 +5216,11 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node) } /* Subroutine of gnat_to_gnu to translate gnat_node, an N_Exception_Handler, - to a GCC tree, which is returned. This is the variant for ZCX. */ + to a GCC tree, which is returned. This is the variant for GCC exception + schemes. */ static tree -Exception_Handler_to_gnu_zcx (Node_Id gnat_node) +Exception_Handler_to_gnu_gcc (Node_Id gnat_node) { tree gnu_etypes_list = NULL_TREE; tree gnu_current_exc_ptr, prev_gnu_incoming_exc_ptr; @@ -7294,10 +7295,10 @@ gnat_to_gnu (Node_Id gnat_node) case N_Handled_Sequence_Of_Statements: /* If there is an At_End procedure attached to this node, and the EH - mechanism is SJLJ, we must have at least a corresponding At_End + mechanism is front-end, we must have at least a corresponding At_End handler, unless the No_Exception_Handlers restriction is set. */ gcc_assert (type_annotate_only - || Exception_Mechanism != Setjmp_Longjmp + || !Front_End_Exceptions () || No (At_End_Proc (gnat_node)) || Present (Exception_Handlers (gnat_node)) || No_Exception_Handlers_Set ()); @@ -7306,10 +7307,10 @@ gnat_to_gnu (Node_Id gnat_node) break; case N_Exception_Handler: - if (Exception_Mechanism == Setjmp_Longjmp) - gnu_result = Exception_Handler_to_gnu_sjlj (gnat_node); - else if (Exception_Mechanism == Back_End_Exceptions) - gnu_result = Exception_Handler_to_gnu_zcx (gnat_node); + if (Exception_Mechanism == Front_End_SJLJ) + gnu_result = Exception_Handler_to_gnu_fe_sjlj (gnat_node); + else if (Back_End_Exceptions ()) + gnu_result = Exception_Handler_to_gnu_gcc (gnat_node); else gcc_unreachable (); break; @@ -7317,7 +7318,7 @@ gnat_to_gnu (Node_Id gnat_node) case N_Raise_Statement: /* Only for reraise in back-end exceptions mode. */ gcc_assert (No (Name (gnat_node)) - && Exception_Mechanism == Back_End_Exceptions); + && Back_End_Exceptions ()); start_stmt_group (); gnat_pushlevel (); |