diff options
author | Andrew MacLeod <amacleod@cygnus.com> | 1998-06-08 12:43:28 +0000 |
---|---|---|
committer | Andrew Macleod <amacleod@gcc.gnu.org> | 1998-06-08 12:43:28 +0000 |
commit | a1622f838f1188fca74ba0186300882f33006ae7 (patch) | |
tree | 8c6db0a08fe59e66faaa88318e5d8e194578463d /gcc/except.c | |
parent | aeb302bbec86aff44fadaad0c9c9bf5e59cbe3f5 (diff) | |
download | gcc-a1622f838f1188fca74ba0186300882f33006ae7.zip gcc-a1622f838f1188fca74ba0186300882f33006ae7.tar.gz gcc-a1622f838f1188fca74ba0186300882f33006ae7.tar.bz2 |
[multiple changes]
Thu Jun 8 14:16:15 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
* eh-common.h: Remove NEW_EH_MODEL compile time flag, and replace with
flag_new_exceptions runtime flag.
(struct old_exception_table): New struct which represents what
the exception table looks like without the new model.
(NEW_EH_RUNTIME): New value used as a tag in the exception table to
flag that this is a new style table.
* except.h: Remove compile time flag NEW_EH_MODEL.
(expand_builtin_eh_stub_old): New prototype.
* tree.h (enum built_in_function): Add BUILT_IN_EH_STUB_OLD.
* expr.c (expand_builtin): New builtin func BUILT_IN_EH_STUB_OLD.
* c-decl.c (init_decl_processing): Add new builtin function
__builtin_eh_stub_old.
* final.c (final_scan_insn): Replace compile time flag NEW_EH_MODEL.
* flags.h (flag_new_exceptions): New runtime flag.
* toplev.c (flag_new_exceptions): Initialize default to 0,
-fnew-exceptions sets to 1.
* except.c (output_exception_table_entry): Output New style exception
identifier into table, and replace compile time flag NEW_EH_MODEL
with runtime flag flag_new_exceptions.
(output_exception_table): Replace compile time flag NEW_EH_MODEL.
(expand_builtin_eh_stub_old): Duplicates original functionality of
expand_builtin_eh_stub.
(expand_builtin_eh_stub): Replace compile time flag NEW_EH_MODEL.
* libgcc2.c (find_exception_handler): Remove NEW_EH_MODEL #ifdefs.
(old_find_exception_handler): New func, same as find_exception_handler
except it works on the old style exception table.
(__throw): Replace NEW_EH_MODEL. Detect new model based on presence
of identifier in the exception table, and call appropriate routines.
1998-06-08 Andrew MacLeod <amacleod@cygnus.com>
* except.c (init_exception_processing): Remove NEW_EH_MODEL compile
time flag. Call __cp_eh_info instead of __cp_exception_info.
* exception.cc (struct cp_eh_info): Remove NEW_EH_MODEL flag.
(__cp_exception_info): Return offset into cp_eh_info structure to
match what use to be the start of this structure.
(__cp_eh_info): New function to return a pointer to cp_eh_info struct.
(__cplus_type_matcher, __cp_push_exception): Remove NEW_EH_MODEL
compile time flag.
(__uncatch_exception, __check_eh_spec, std::uncaught_exception): Call
__cp_eh_info instead of __cp_exception_info.
From-SVN: r20336
Diffstat (limited to 'gcc/except.c')
-rw-r--r-- | gcc/except.c | 90 |
1 files changed, 50 insertions, 40 deletions
diff --git a/gcc/except.c b/gcc/except.c index 5881e22..b3cb9cd 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -1842,23 +1842,20 @@ output_exception_table_entry (file, n) assemble_integer (handler->handler_label, POINTER_SIZE / BITS_PER_UNIT, 1); -#ifdef NEW_EH_MODEL - /* for now make sure the sizes match */ - if (handler->type_info == NULL) - assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, 1); - else - output_constant ((tree)(handler->type_info), + if (flag_new_exceptions) + { + if (handler->type_info == NULL) + assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, 1); + else + output_constant ((tree)(handler->type_info), POINTER_SIZE / BITS_PER_UNIT); -#endif - + } putc ('\n', file); /* blank line */ } } /* Output the exception table if we have and need one. */ -#ifdef NEW_EH_MODEL - static short language_code = 0; static short version_code = 0; @@ -1876,7 +1873,6 @@ void set_exception_version_code (code) version_code = code; } -#endif void output_exception_table () @@ -1893,17 +1889,20 @@ output_exception_table () assemble_align (GET_MODE_ALIGNMENT (ptr_mode)); assemble_label ("__EXCEPTION_TABLE__"); -#ifdef NEW_EH_MODEL - assemble_integer (GEN_INT (language_code), 2 , 1); - assemble_integer (GEN_INT (version_code), 2 , 1); - - /* Add enough padding to make sure table aligns on a pointer boundry. */ - i = GET_MODE_ALIGNMENT (ptr_mode) / BITS_PER_UNIT - 4; - for ( ; i < 0; i = i + GET_MODE_ALIGNMENT (ptr_mode) / BITS_PER_UNIT) - ; - if (i != 0) - assemble_integer (const0_rtx, i , 1); -#endif + if (flag_new_exceptions) + { + assemble_integer (GEN_INT (NEW_EH_RUNTIME), + POINTER_SIZE / BITS_PER_UNIT, 1); + assemble_integer (GEN_INT (language_code), 2 , 1); + assemble_integer (GEN_INT (version_code), 2 , 1); + + /* Add enough padding to make sure table aligns on a pointer boundry. */ + i = GET_MODE_ALIGNMENT (ptr_mode) / BITS_PER_UNIT - 4; + for ( ; i < 0; i = i + GET_MODE_ALIGNMENT (ptr_mode) / BITS_PER_UNIT) + ; + if (i != 0) + assemble_integer (const0_rtx, i , 1); + } for (i = 0; i < eh_table_size; ++i) output_exception_table_entry (asm_out_file, eh_table[i]); @@ -1913,11 +1912,12 @@ output_exception_table () /* Ending marker for table. */ assemble_integer (constm1_rtx, POINTER_SIZE / BITS_PER_UNIT, 1); -#ifndef NEW_EH_MODEL + /* for binary compatability, the old __throw checked the second position for a -1, so we should output at least 2 -1's */ - assemble_integer (constm1_rtx, POINTER_SIZE / BITS_PER_UNIT, 1); -#endif + if (! flag_new_exceptions) + assemble_integer (constm1_rtx, POINTER_SIZE / BITS_PER_UNIT, 1); + putc ('\n', asm_out_file); /* blank line */ } @@ -2424,11 +2424,30 @@ get_reg_for_handler () and then return to the stub. */ rtx +expand_builtin_eh_stub_old () +{ + rtx stub_start = gen_label_rtx (); + rtx after_stub = gen_label_rtx (); + rtx handler, offset; + + emit_jump (after_stub); + emit_label (stub_start); + + eh_regs (&handler, &offset, 0); + + adjust_stack (offset); + emit_indirect_jump (handler); + emit_label (after_stub); + return gen_rtx_LABEL_REF (Pmode, stub_start); +} + +rtx expand_builtin_eh_stub () { rtx stub_start = gen_label_rtx (); rtx after_stub = gen_label_rtx (); rtx handler, offset; + rtx jump_to, temp; emit_jump (after_stub); emit_label (stub_start); @@ -2436,28 +2455,19 @@ expand_builtin_eh_stub () eh_regs (&handler, &offset, 0); adjust_stack (offset); -#ifdef NEW_EH_MODEL /* Handler is in fact a pointer to the _eh_context structure, we need to pick out the handler field (first element), and jump to there, leaving the pointer to _eh_conext in the same hardware register. */ - { - rtx jump_to, temp; - temp = gen_rtx_MEM (Pmode, handler); - MEM_IN_STRUCT_P (temp) = 1; - RTX_UNCHANGING_P (temp) = 1; - emit_insn (gen_rtx_SET (Pmode, offset, temp)); - emit_insn (gen_rtx_USE (Pmode, handler)); + temp = gen_rtx_MEM (Pmode, handler); + MEM_IN_STRUCT_P (temp) = 1; + RTX_UNCHANGING_P (temp) = 1; + emit_insn (gen_rtx_SET (Pmode, offset, temp)); + emit_insn (gen_rtx_USE (Pmode, handler)); - emit_indirect_jump (offset); + emit_indirect_jump (offset); - } - -#else - emit_indirect_jump (handler); - -#endif emit_label (after_stub); return gen_rtx_LABEL_REF (Pmode, stub_start); } |