This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
assertify darwin, and some missed rs6000 bits
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org, mrs at apple dot com
- Date: Sun, 01 May 2005 19:32:54 +0100
- Subject: assertify darwin, and some missed rs6000 bits
Hi,
this patch assertifies some darwin components and some bits of rs6000 target
machine that I missed. The one naked call to abort in the segv handler I
converted to a fancy_abort call. Perhaps this should be a direct internal_error.
I hope to clean that up once the targets are all assertified and we
can poison abort.
booted and tested on powerpc-apple-darwin7.4.0, ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2005-05-01 Nathan Sidwell <nathan@codesourcery.com>
* config/darwin-crt2.c (darwin_unwind_dyld_remove_image_hook): Use
gcc_assert or gcc_unreachable as appropriate.
* config/darwin.c (machopic_define_symbol,
machopic_function_base_name, machopic_indirect_data_reference,
machopic_legitimize_pic_address, darwin_non_lazy_pcrel): Likewise.
* config/host-darwin.c (darwin_gt_pch_use_address): Likewise
* config/rs6000/altivec.md (*mov<mode>_internal,
build_vector_mask_for_load): Likewise.
* config/rs6000/darwin.md (movdf_low_si, movdf_low_di,
*call_nonlocal_darwin64, *call_value_nonlocal_darwin64,
*sibcall_symbolic_64, *sibcall_value_symbolic_64): Likewise.
* config/rs6000/predicates.md (easy_fp_constant,
logical_operand): Likewise.
* config/rs6000/rs6000.c (spe_expand_predicate_builtin,
compute_save_world_info, rs6000_emit_prologue,
rs6000_output_mi_thunk): Reword comments to avoid 'abort'.
* config/rs6000/host-darwin.c (segv_handler): Use fancy_abort
directly.
Index: config/darwin-crt2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin-crt2.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 darwin-crt2.c
*** config/darwin-crt2.c 27 Apr 2004 23:07:52 -0000 1.2
--- config/darwin-crt2.c 1 May 2005 17:47:09 -0000
*************** darwin_unwind_dyld_remove_image_hook (st
*** 120,129 ****
{
destroy = *lip;
*lip = destroy->next; /* unlink DESTROY */
!
! if (destroy->this_size != sizeof (*destroy)) /* sanity check */
! abort ();
!
break;
}
}
--- 120,129 ----
{
destroy = *lip;
*lip = destroy->next; /* unlink DESTROY */
!
! /* sanity check */
! gcc_assert (destroy->this_size == sizeof (*destroy));
!
break;
}
}
Index: config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.117
diff -c -3 -p -r1.117 darwin.c
*** config/darwin.c 26 Apr 2005 00:49:49 -0000 1.117
--- config/darwin.c 1 May 2005 17:47:09 -0000
*************** void
*** 191,198 ****
machopic_define_symbol (rtx mem)
{
rtx sym_ref;
! if (GET_CODE (mem) != MEM)
! abort ();
sym_ref = XEXP (mem, 0);
SYMBOL_REF_FLAGS (sym_ref) |= MACHO_SYMBOL_FLAG_DEFINED;
}
--- 191,198 ----
machopic_define_symbol (rtx mem)
{
rtx sym_ref;
!
! gcc_assert (GET_CODE (mem) == MEM);
sym_ref = XEXP (mem, 0);
SYMBOL_REF_FLAGS (sym_ref) |= MACHO_SYMBOL_FLAG_DEFINED;
}
*************** const char *
*** 203,210 ****
machopic_function_base_name (void)
{
/* if dynamic-no-pic is on, we should not get here */
! if (MACHO_DYNAMIC_NO_PIC_P)
! abort ();
if (function_base == NULL)
function_base =
--- 203,209 ----
machopic_function_base_name (void)
{
/* if dynamic-no-pic is on, we should not get here */
! gcc_assert (!MACHO_DYNAMIC_NO_PIC_P);
if (function_base == NULL)
function_base =
*************** machopic_output_function_base_name (FILE
*** 237,244 ****
const char *current_name;
/* If dynamic-no-pic is on, we should not get here. */
! if (MACHO_DYNAMIC_NO_PIC_P)
! abort ();
current_name =
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl));
if (function_base_func_name != current_name)
--- 236,242 ----
const char *current_name;
/* If dynamic-no-pic is on, we should not get here. */
! gcc_assert (!MACHO_DYNAMIC_NO_PIC_P);
current_name =
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl));
if (function_base_func_name != current_name)
*************** machopic_indirect_data_reference (rtx or
*** 425,431 ****
emit_insn (gen_macho_low (reg, reg, orig));
#else
/* some other cpu -- writeme! */
! abort ();
#endif
return reg;
}
--- 423,429 ----
emit_insn (gen_macho_low (reg, reg, orig));
#else
/* some other cpu -- writeme! */
! gcc_unreachable ();
#endif
return reg;
}
*************** machopic_indirect_data_reference (rtx or
*** 440,447 ****
#if defined (TARGET_TOC) /* i.e., PowerPC */
rtx hi_sum_reg = (no_new_pseudos ? reg : gen_reg_rtx (Pmode));
! if (reg == NULL)
! abort ();
emit_insn (gen_rtx_SET (Pmode, hi_sum_reg,
gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
--- 438,444 ----
#if defined (TARGET_TOC) /* i.e., PowerPC */
rtx hi_sum_reg = (no_new_pseudos ? reg : gen_reg_rtx (Pmode));
! gcc_assert (reg);
emit_insn (gen_rtx_SET (Pmode, hi_sum_reg,
gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
*************** machopic_indirect_data_reference (rtx or
*** 452,458 ****
orig = reg;
#else
#if defined (HAVE_lo_sum)
! if (reg == 0) abort ();
emit_insn (gen_rtx_SET (VOIDmode, reg,
gen_rtx_HIGH (Pmode, offset)));
--- 449,455 ----
orig = reg;
#else
#if defined (HAVE_lo_sum)
! gcc_assert (reg);
emit_insn (gen_rtx_SET (VOIDmode, reg,
gen_rtx_HIGH (Pmode, offset)));
*************** machopic_legitimize_pic_address (rtx ori
*** 602,611 ****
{
if (reg == 0)
{
! if (reload_in_progress)
! abort ();
! else
! reg = gen_reg_rtx (Pmode);
}
#ifdef HAVE_lo_sum
--- 599,606 ----
{
if (reg == 0)
{
! gcc_assert (!reload_in_progress);
! reg = gen_reg_rtx (Pmode);
}
#ifdef HAVE_lo_sum
*************** machopic_legitimize_pic_address (rtx ori
*** 624,630 ****
emit_insn (gen_rtx_SET (VOIDmode, reg, mem));
#else
/* Some other CPU -- WriteMe! but right now there are no other platform that can use dynamic-no-pic */
! abort ();
#endif
pic_ref = reg;
}
--- 619,625 ----
emit_insn (gen_rtx_SET (VOIDmode, reg, mem));
#else
/* Some other CPU -- WriteMe! but right now there are no other platform that can use dynamic-no-pic */
! gcc_unreachable ();
#endif
pic_ref = reg;
}
*************** machopic_legitimize_pic_address (rtx ori
*** 717,726 ****
if (reg == 0)
{
! if (reload_in_progress)
! abort ();
! else
! reg = gen_reg_rtx (Pmode);
}
hi_sum_reg = reg;
--- 712,719 ----
if (reg == 0)
{
! gcc_assert (!reload_in_progress);
! reg = gen_reg_rtx (Pmode);
}
hi_sum_reg = reg;
*************** darwin_non_lazy_pcrel (FILE *file, rtx a
*** 1315,1322 ****
{
const char *nlp_name;
! if (GET_CODE (addr) != SYMBOL_REF)
! abort ();
nlp_name = machopic_indirection_name (addr, /*stub_p=*/false);
fputs ("\t.long\t", file);
--- 1308,1314 ----
{
const char *nlp_name;
! gcc_assert (GET_CODE (addr) == SYMBOL_REF);
nlp_name = machopic_indirection_name (addr, /*stub_p=*/false);
fputs ("\t.long\t", file);
Index: config/host-darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/host-darwin.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 host-darwin.c
*** config/host-darwin.c 6 Apr 2005 08:41:36 -0000 1.1
--- config/host-darwin.c 1 May 2005 17:47:12 -0000
*************** darwin_gt_pch_use_address (void *addr, s
*** 49,57 ****
void *mmap_result;
int ret;
! if ((size_t)pch_address_space % pagesize != 0
! || sizeof (pch_address_space) % pagesize != 0)
! abort ();
ret = (addr == pch_address_space && sz <= sizeof (pch_address_space));
if (! ret)
--- 49,56 ----
void *mmap_result;
int ret;
! gcc_assert ((size_t)pch_address_space % pagesize == 0
! && sizeof (pch_address_space) % pagesize == 0);
ret = (addr == pch_address_space && sz <= sizeof (pch_address_space));
if (! ret)
*************** darwin_gt_pch_use_address (void *addr, s
*** 73,80 ****
ret = mmap_result != (void *) MAP_FAILED;
/* Sanity check for broken MAP_FIXED. */
! if (ret && mmap_result != addr)
! abort ();
}
return ret;
--- 72,78 ----
ret = mmap_result != (void *) MAP_FAILED;
/* Sanity check for broken MAP_FIXED. */
! gcc_assert (!ret || mmap_result == addr);
}
return ret;
Index: config/rs6000/altivec.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/altivec.md,v
retrieving revision 1.34
diff -c -3 -p -r1.34 altivec.md
*** config/rs6000/altivec.md 18 Apr 2005 15:50:51 -0000 1.34
--- config/rs6000/altivec.md 1 May 2005 17:47:20 -0000
***************
*** 102,108 ****
case 4: return "#";
case 5: return "#";
case 6: return output_vec_const_move (operands);
! default: abort();
}
}
[(set_attr "type" "vecstore,vecload,vecsimple,store,load,*,*")])
--- 102,108 ----
case 4: return "#";
case 5: return "#";
case 6: return output_vec_const_move (operands);
! default: gcc_unreachable ();
}
}
[(set_attr "type" "vecstore,vecload,vecsimple,store,load,*,*")])
***************
*** 1649,1656 ****
rtx addr;
rtx temp;
! if (GET_CODE (operands[1]) != MEM)
! abort ();
addr = XEXP (operands[1], 0);
temp = gen_reg_rtx (GET_MODE (addr));
--- 1649,1655 ----
rtx addr;
rtx temp;
! gcc_assert (GET_CODE (operands[1]) == MEM);
addr = XEXP (operands[1], 0);
temp = gen_reg_rtx (GET_MODE (addr));
Index: config/rs6000/darwin.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/darwin.md,v
retrieving revision 1.7
diff -c -3 -p -r1.7 darwin.md
*** config/rs6000/darwin.md 31 Jan 2005 18:11:19 -0000 1.7
--- config/rs6000/darwin.md 1 May 2005 17:47:20 -0000
*************** Boston, MA 02111-1307, USA. */
*** 63,69 ****
}
}
default:
! abort();
}
}"
[(set_attr "type" "load")
--- 63,69 ----
}
}
default:
! gcc_unreachable ();
}
}"
[(set_attr "type" "load")
*************** Boston, MA 02111-1307, USA. */
*** 84,90 ****
case 1:
return \"ld %0,lo16(%2)(%1)\";
default:
! abort();
}
}"
[(set_attr "type" "load")
--- 84,90 ----
case 1:
return \"ld %0,lo16(%2)(%1)\";
default:
! gcc_unreachable ();
}
}"
[(set_attr "type" "load")
*************** Boston, MA 02111-1307, USA. */
*** 342,348 ****
#if TARGET_MACHO
return output_call(insn, operands, 0, 2);
#else
! abort();
#endif
}
[(set_attr "type" "branch,branch")
--- 342,348 ----
#if TARGET_MACHO
return output_call(insn, operands, 0, 2);
#else
! gcc_unreachable ();
#endif
}
[(set_attr "type" "branch,branch")
*************** Boston, MA 02111-1307, USA. */
*** 373,379 ****
#if TARGET_MACHO
return output_call(insn, operands, 1, 3);
#else
! abort();
#endif
}
[(set_attr "type" "branch,branch")
--- 373,379 ----
#if TARGET_MACHO
return output_call(insn, operands, 1, 3);
#else
! gcc_unreachable ();
#endif
}
[(set_attr "type" "branch,branch")
*************** Boston, MA 02111-1307, USA. */
*** 423,429 ****
{
case 0: return \"b %z0\";
case 1: return \"b%T0\";
! default: abort();
}
}"
[(set_attr "type" "branch")
--- 423,429 ----
{
case 0: return \"b %z0\";
case 1: return \"b%T0\";
! default: gcc_unreachable ();
}
}"
[(set_attr "type" "branch")
*************** Boston, MA 02111-1307, USA. */
*** 443,449 ****
{
case 0: return \"b %z1\";
case 1: return \"b%T1\";
! default: abort();
}
}"
[(set_attr "type" "branch")
--- 443,449 ----
{
case 0: return \"b %z1\";
case 1: return \"b%T1\";
! default: gcc_unreachable ();
}
}"
[(set_attr "type" "branch")
Index: config/rs6000/host-darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/host-darwin.c,v
retrieving revision 1.14
diff -c -3 -p -r1.14 host-darwin.c
*** config/rs6000/host-darwin.c 6 Apr 2005 08:41:37 -0000 1.14
--- config/rs6000/host-darwin.c 1 May 2005 17:47:20 -0000
*************** segv_handler (int sig ATTRIBUTE_UNUSED,
*** 107,113 ****
}
if (global_dc->abort_on_error)
! abort ();
exit (FATAL_EXIT_CODE);
}
--- 107,113 ----
}
if (global_dc->abort_on_error)
! fancy_abort (__FILE__, __LINE__, __FUNCTION__);
exit (FATAL_EXIT_CODE);
}
Index: config/rs6000/predicates.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/predicates.md,v
retrieving revision 1.13
diff -c -3 -p -r1.13 predicates.md
*** config/rs6000/predicates.md 9 Apr 2005 16:43:43 -0000 1.13
--- config/rs6000/predicates.md 1 May 2005 17:47:21 -0000
***************
*** 178,183 ****
--- 178,186 ----
(define_predicate "easy_fp_constant"
(match_code "const_double")
{
+ long k[4];
+ REAL_VALUE_TYPE rv;
+
if (GET_MODE (op) != mode
|| (GET_MODE_CLASS (mode) != MODE_FLOAT && mode != DImode))
return 0;
***************
*** 198,208 ****
return 0;
#endif
! if (mode == TFmode)
{
! long k[4];
! REAL_VALUE_TYPE rv;
!
REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, k);
--- 201,209 ----
return 0;
#endif
! switch (mode)
{
! case TFmode:
REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, k);
***************
*** 210,222 ****
&& num_insns_constant_wide ((HOST_WIDE_INT) k[1]) == 1
&& num_insns_constant_wide ((HOST_WIDE_INT) k[2]) == 1
&& num_insns_constant_wide ((HOST_WIDE_INT) k[3]) == 1);
- }
-
- else if (mode == DFmode)
- {
- long k[2];
- REAL_VALUE_TYPE rv;
/* Force constants to memory before reload to utilize
compress_float_constant.
Avoid this when flag_unsafe_math_optimizations is enabled
--- 211,218 ----
&& num_insns_constant_wide ((HOST_WIDE_INT) k[1]) == 1
&& num_insns_constant_wide ((HOST_WIDE_INT) k[2]) == 1
&& num_insns_constant_wide ((HOST_WIDE_INT) k[3]) == 1);
+ case DFmode:
/* Force constants to memory before reload to utilize
compress_float_constant.
Avoid this when flag_unsafe_math_optimizations is enabled
***************
*** 232,244 ****
return (num_insns_constant_wide ((HOST_WIDE_INT) k[0]) == 1
&& num_insns_constant_wide ((HOST_WIDE_INT) k[1]) == 1);
- }
-
- else if (mode == SFmode)
- {
- long l;
- REAL_VALUE_TYPE rv;
/* Force constants to memory before reload to utilize
compress_float_constant.
Avoid this when flag_unsafe_math_optimizations is enabled
--- 228,235 ----
return (num_insns_constant_wide ((HOST_WIDE_INT) k[0]) == 1
&& num_insns_constant_wide ((HOST_WIDE_INT) k[1]) == 1);
+ case SFmode:
/* Force constants to memory before reload to utilize
compress_float_constant.
Avoid this when flag_unsafe_math_optimizations is enabled
***************
*** 249,268 ****
return 0;
REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
! REAL_VALUE_TO_TARGET_SINGLE (rv, l);
! return num_insns_constant_wide (l) == 1;
! }
! else if (mode == DImode)
return ((TARGET_POWERPC64
&& GET_CODE (op) == CONST_DOUBLE && CONST_DOUBLE_LOW (op) == 0)
|| (num_insns_constant (op, DImode) <= 2));
! else if (mode == SImode)
return 1;
! else
! abort ();
})
;; Return 1 if the operand is a CONST_VECTOR and can be loaded into a
--- 240,260 ----
return 0;
REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
! REAL_VALUE_TO_TARGET_SINGLE (rv, k[0]);
! return num_insns_constant_wide (k[0]) == 1;
! case DImode:
return ((TARGET_POWERPC64
&& GET_CODE (op) == CONST_DOUBLE && CONST_DOUBLE_LOW (op) == 0)
|| (num_insns_constant (op, DImode) <= 2));
! case SImode:
return 1;
!
! default:
! gcc_unreachable ();
! }
})
;; Return 1 if the operand is a CONST_VECTOR and can be loaded into a
***************
*** 406,413 ****
}
else if (GET_CODE (op) == CONST_DOUBLE)
{
! if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
! abort ();
opl = CONST_DOUBLE_LOW (op);
oph = CONST_DOUBLE_HIGH (op);
--- 398,404 ----
}
else if (GET_CODE (op) == CONST_DOUBLE)
{
! gcc_assert (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT);
opl = CONST_DOUBLE_LOW (op);
oph = CONST_DOUBLE_HIGH (op);
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.815
diff -c -3 -p -r1.815 rs6000.c
*** config/rs6000/rs6000.c 24 Apr 2005 12:53:22 -0000 1.815
--- config/rs6000/rs6000.c 1 May 2005 17:47:22 -0000
*************** spe_expand_predicate_builtin (enum insn_
*** 6897,6903 ****
case 0:
/* We need to get to the OV bit, which is the ORDERED bit. We
could generate (ordered:SI (reg:CC xx) (const_int 0)), but
! that's ugly and will trigger a validate_condition_mode abort.
So let's just use another pattern. */
emit_insn (gen_move_from_CR_ov_bit (target, scratch));
return target;
--- 6897,6903 ----
case 0:
/* We need to get to the OV bit, which is the ORDERED bit. We
could generate (ordered:SI (reg:CC xx) (const_int 0)), but
! that's ugly and will make validate_condition_mode die.
So let's just use another pattern. */
emit_insn (gen_move_from_CR_ov_bit (target, scratch));
return target;
*************** compute_save_world_info (rs6000_stack_t
*** 11444,11450 ****
/* Because the Darwin register save/restore routines only handle
F14 .. F31 and V20 .. V31 as per the ABI, perform a consistency
! check and abort if there's something worng. */
gcc_assert (info_ptr->first_fp_reg_save >= FIRST_SAVED_FP_REGNO
&& (info_ptr->first_altivec_reg_save
>= FIRST_SAVED_ALTIVEC_REGNO));
--- 11444,11450 ----
/* Because the Darwin register save/restore routines only handle
F14 .. F31 and V20 .. V31 as per the ABI, perform a consistency
! check. */
gcc_assert (info_ptr->first_fp_reg_save >= FIRST_SAVED_FP_REGNO
&& (info_ptr->first_altivec_reg_save
>= FIRST_SAVED_ALTIVEC_REGNO));
*************** rs6000_emit_prologue (void)
*** 12852,12858 ****
/* The SAVE_WORLD and RESTORE_WORLD routines make a number of
assumptions about the offsets of various bits of the stack
! frame. Abort if things aren't what they should be. */
gcc_assert (info->gp_save_offset == -220
&& info->fp_save_offset == -144
&& info->lr_save_offset == 8
--- 12852,12858 ----
/* The SAVE_WORLD and RESTORE_WORLD routines make a number of
assumptions about the offsets of various bits of the stack
! frame. */
gcc_assert (info->gp_save_offset == -220
&& info->fp_save_offset == -144
&& info->lr_save_offset == 8
*************** rs6000_output_mi_thunk (FILE *file, tree
*** 14268,14274 ****
#endif
/* gen_sibcall expects reload to convert scratch pseudo to LR so we must
! generate sibcall RTL explicitly to avoid constraint abort. */
insn = emit_call_insn (
gen_rtx_PARALLEL (VOIDmode,
gen_rtvec (4,
--- 14268,14274 ----
#endif
/* gen_sibcall expects reload to convert scratch pseudo to LR so we must
! generate sibcall RTL explicitly. */
insn = emit_call_insn (
gen_rtx_PARALLEL (VOIDmode,
gen_rtvec (4,