* optabs.h (reload_in_optab, reload_out_optab, code_to_optab)
	(vcond_gen_code, vcondu_gen_code, movmem_optab, setmem_optab)
	(cmpstr_optab, cmpstrn_optab, cmpmem_optab, sync_add_optab)
	(sync_sub_optab, sync_ior_optab, sync_and_optab, sync_xor_optab)
	(sync_nand_optab, sync_old_add_optab, sync_old_sub_optab)
	(sync_old_ior_optab, sync_old_and_optab, sync_old_xor_optab)
	(sync_old_nand_optab, sync_new_add_optab, sync_new_sub_optab)
	(sync_new_ior_optab, sync_new_and_optab, sync_new_xor_optab)
	(sync_new_nand_optab): Redefine as macros.
	(sync_compare_and_swap, sync_lock_test_and_set, sync_lock_release):
	Delete.
	(direct_optab_index): New enum.
	(direct_optab_d): New structure.
	(direct_optab): New typedef.
	(direct_optab_table): Declare.
	(direct_optab_handler, set_direct_optab_handler): New functions.
	(sync_compare_and_swap_optab, sync_lock_test_and_set_optab)
	(sync_lock_release_optab): New macros.
	* optabs.c (direct_optab_table): New variable.
	(movcc_gen_code, vcond_gen_code, vcondu_gen_code): Delete.
	(prepare_cmp_insn): Use direct_optab_handler for cmpmem_optab,
	cmpstr_optab and cmpstrn_optab.
	(emit_conditional_move): Likewise for movcc_optab.
	(can_conditionally_move_p): Likewise for movcc_gen_code.
	(init_insn_codes): Clear direct_optab_table.
	(init_optabs): Don't initialize the new "direct optabs" here.
	(get_vcond_icode): Use direct_optab_handler for vcondu_gen_code and
	vcond_gen_code.
	(expand_val_compare_and_swap): Likewise sync_compare_and_swap_optab.
	(expand_bool_compare_and_swap): Likewise sync_compare_and_swap_optab.
	(expand_compare_and_swap_loop): Likewise sync_compare_and_swap_optab.
	(expand_sync_operation): Likewise other sync_*_optabs.
	(expand_sync_fetch_operation): Likewise.  Rename sync_compare_and_swap
	to sync_compare_and_swap_optab.
	(expand_sync_lock_test_and_set): Use direct_optab_handler for
	sync_lock_test_and_set and sync_compare_and_swap, adding "_optab"
	to the names of both.
	* builtins.c (expand_builtin_strcmp): Use direct_optab_handler for
	cmpstr_optab and cmpstrn_optab.
	(expand_builtin_lock_release): Likewise sync_lock_release.
	* expr.c (movmem_optab, setmem_optab, cmpstr_optab, cmpstrn_optab)
	(cmpmem_optab, sync_add_optab, sync_sub_optab, sync_ior_optab)
	(sync_and_optab, sync_xor_optab, sync_nand_optab, sync_old_add_optab)
	(sync_old_sub_optab, sync_old_ior_optab, sync_old_and_optab)
	(sync_old_xor_optab, sync_old_nand_optab, sync_new_add_optab)
	(sync_new_sub_optab, sync_new_ior_optab, sync_new_and_optab)
	(sync_new_xor_optab, sync_new_nand_optab, sync_compare_and_swap)
	(sync_lock_test_and_set, sync_lock_release): Delete.
	(emit_block_move_via_movmem): Use direct_optab_handler for movmem_optab.
	(emit_block_move_via_setmem): Use direct_optab_handler for setmem_optab.
	* genopinit.c (optabs): Use set_direct_optab_handler for the new
	macro optabs.
	* omp-low.c (expand_omp_atomic_fetch_op): Update the type of
	the "optab" local variable.  Use direct_optab_handler for optab and
	sync_compare_and_swap_optab.
	* reload1.c (reload_in_optab, reload_out_optab): Delete.
	* targhooks.c (default_secondary_reload): Use direct_optab_handler for
	reload_in_optab and reload_out_optab.
	* config/alpha/alpha.c (alpha_secondary_reload): Likewise.
	* config/frv/frv.c (frv_alloc_temp_reg): Likewise.
	* config/pa/pa.c (pa_secondary_reload): Likewise.
	* java/builtins.c (compareAndSwapInt_builtin): Use direct_optab_handler
	for sync_compare_and_swap, renaming it to sync_compare_and_swap_optab.
	(compareAndSwapLong_builtin, compareAndSwapObject_builtin): Likewise.
	(VMSupportsCS8_builtin): Likewise.

From-SVN: r161810
This commit is contained in:
Richard Sandiford 2010-07-04 22:14:56 +00:00 committed by Richard Sandiford
parent 596455ce05
commit f9621cc477
13 changed files with 298 additions and 243 deletions

View File

@ -1,3 +1,71 @@
2010-07-04 Richard Sandiford <rdsandiford@googlemail.com>
* optabs.h (reload_in_optab, reload_out_optab, code_to_optab)
(vcond_gen_code, vcondu_gen_code, movmem_optab, setmem_optab)
(cmpstr_optab, cmpstrn_optab, cmpmem_optab, sync_add_optab)
(sync_sub_optab, sync_ior_optab, sync_and_optab, sync_xor_optab)
(sync_nand_optab, sync_old_add_optab, sync_old_sub_optab)
(sync_old_ior_optab, sync_old_and_optab, sync_old_xor_optab)
(sync_old_nand_optab, sync_new_add_optab, sync_new_sub_optab)
(sync_new_ior_optab, sync_new_and_optab, sync_new_xor_optab)
(sync_new_nand_optab): Redefine as macros.
(sync_compare_and_swap, sync_lock_test_and_set, sync_lock_release):
Delete.
(direct_optab_index): New enum.
(direct_optab_d): New structure.
(direct_optab): New typedef.
(direct_optab_table): Declare.
(direct_optab_handler, set_direct_optab_handler): New functions.
(sync_compare_and_swap_optab, sync_lock_test_and_set_optab)
(sync_lock_release_optab): New macros.
* optabs.c (direct_optab_table): New variable.
(movcc_gen_code, vcond_gen_code, vcondu_gen_code): Delete.
(prepare_cmp_insn): Use direct_optab_handler for cmpmem_optab,
cmpstr_optab and cmpstrn_optab.
(emit_conditional_move): Likewise for movcc_optab.
(can_conditionally_move_p): Likewise for movcc_gen_code.
(init_insn_codes): Clear direct_optab_table.
(init_optabs): Don't initialize the new "direct optabs" here.
(get_vcond_icode): Use direct_optab_handler for vcondu_gen_code and
vcond_gen_code.
(expand_val_compare_and_swap): Likewise sync_compare_and_swap_optab.
(expand_bool_compare_and_swap): Likewise sync_compare_and_swap_optab.
(expand_compare_and_swap_loop): Likewise sync_compare_and_swap_optab.
(expand_sync_operation): Likewise other sync_*_optabs.
(expand_sync_fetch_operation): Likewise. Rename sync_compare_and_swap
to sync_compare_and_swap_optab.
(expand_sync_lock_test_and_set): Use direct_optab_handler for
sync_lock_test_and_set and sync_compare_and_swap, adding "_optab"
to the names of both.
* builtins.c (expand_builtin_strcmp): Use direct_optab_handler for
cmpstr_optab and cmpstrn_optab.
(expand_builtin_lock_release): Likewise sync_lock_release.
* expr.c (movmem_optab, setmem_optab, cmpstr_optab, cmpstrn_optab)
(cmpmem_optab, sync_add_optab, sync_sub_optab, sync_ior_optab)
(sync_and_optab, sync_xor_optab, sync_nand_optab, sync_old_add_optab)
(sync_old_sub_optab, sync_old_ior_optab, sync_old_and_optab)
(sync_old_xor_optab, sync_old_nand_optab, sync_new_add_optab)
(sync_new_sub_optab, sync_new_ior_optab, sync_new_and_optab)
(sync_new_xor_optab, sync_new_nand_optab, sync_compare_and_swap)
(sync_lock_test_and_set, sync_lock_release): Delete.
(emit_block_move_via_movmem): Use direct_optab_handler for movmem_optab.
(emit_block_move_via_setmem): Use direct_optab_handler for setmem_optab.
* genopinit.c (optabs): Use set_direct_optab_handler for the new
macro optabs.
* omp-low.c (expand_omp_atomic_fetch_op): Update the type of
the "optab" local variable. Use direct_optab_handler for optab and
sync_compare_and_swap_optab.
* reload1.c (reload_in_optab, reload_out_optab): Delete.
* targhooks.c (default_secondary_reload): Use direct_optab_handler for
reload_in_optab and reload_out_optab.
* config/alpha/alpha.c (alpha_secondary_reload): Likewise.
* config/frv/frv.c (frv_alloc_temp_reg): Likewise.
* config/pa/pa.c (pa_secondary_reload): Likewise.
* java/builtins.c (compareAndSwapInt_builtin): Use direct_optab_handler
for sync_compare_and_swap, renaming it to sync_compare_and_swap_optab.
(compareAndSwapLong_builtin, compareAndSwapObject_builtin): Likewise.
(VMSupportsCS8_builtin): Likewise.
2010-07-04 Richard Sandiford <rdsandiford@googlemail.com>
* optabs.h (optab_handlers): Change type of insn_code to int.

View File

@ -4109,8 +4109,8 @@ expand_builtin_strcmp (tree exp, ATTRIBUTE_UNUSED rtx target)
return NULL_RTX;
#if defined HAVE_cmpstrsi || defined HAVE_cmpstrnsi
if (cmpstr_optab[SImode] != CODE_FOR_nothing
|| cmpstrn_optab[SImode] != CODE_FOR_nothing)
if (direct_optab_handler (cmpstr_optab, SImode) != CODE_FOR_nothing
|| direct_optab_handler (cmpstrn_optab, SImode) != CODE_FOR_nothing)
{
rtx arg1_rtx, arg2_rtx;
rtx result, insn = NULL_RTX;
@ -5677,7 +5677,7 @@ expand_builtin_lock_release (enum machine_mode mode, tree exp)
mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
/* If there is an explicit operation in the md file, use it. */
icode = sync_lock_release[mode];
icode = direct_optab_handler (sync_lock_release_optab, mode);
if (icode != CODE_FOR_nothing)
{
if (!insn_data[icode].operand[1].predicate (val, mode))

View File

@ -1584,10 +1584,10 @@ alpha_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
if (in_p)
{
if (!aligned_memory_operand (x, mode))
sri->icode = reload_in_optab[mode];
sri->icode = direct_optab_handler (reload_in_optab, mode);
}
else
sri->icode = reload_out_optab[mode];
sri->icode = direct_optab_handler (reload_out_optab, mode);
return NO_REGS;
}
}

View File

@ -6510,8 +6510,9 @@ frv_secondary_reload (bool in_p, rtx x, reg_class_t reload_class_i,
if (rclass != NO_REGS)
{
enum insn_code icode = (in_p ? reload_in_optab[(int) reload_mode]
: reload_out_optab[(int) reload_mode]);
enum insn_code icode
= direct_optab_handler (in_p ? reload_in_optab : reload_out_optab,
reload_mode);
if (icode == 0)
{
/* This happens when then the reload_[in|out]_optabs have

View File

@ -5767,7 +5767,9 @@ pa_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
/* Request a secondary reload with a general scratch register
for everthing else. ??? Could symbolic operands be handled
directly when generating non-pic PA 2.0 code? */
sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
sri->icode = (in_p
? direct_optab_handler (reload_in_optab, mode)
: direct_optab_handler (reload_out_optab, mode));
return NO_REGS;
}
@ -5775,7 +5777,9 @@ pa_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
and anything other than a general register. */
if (rclass == SHIFT_REGS && (regno <= 0 || regno >= 32))
{
sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
sri->icode = (in_p
? direct_optab_handler (reload_in_optab, mode)
: direct_optab_handler (reload_out_optab, mode));
return NO_REGS;
}
@ -5785,7 +5789,9 @@ pa_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
&& (REGNO_REG_CLASS (regno) == SHIFT_REGS
&& FP_REG_CLASS_P (rclass)))
{
sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
sri->icode = (in_p
? direct_optab_handler (reload_in_optab, mode)
: direct_optab_handler (reload_out_optab, mode));
return NO_REGS;
}

View File

@ -201,41 +201,6 @@ static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
< (unsigned int) MOVE_RATIO (optimize_insn_for_speed_p ()))
#endif
/* This array records the insn_code of insns to perform block moves. */
enum insn_code movmem_optab[NUM_MACHINE_MODES];
/* This array records the insn_code of insns to perform block sets. */
enum insn_code setmem_optab[NUM_MACHINE_MODES];
/* These arrays record the insn_code of three different kinds of insns
to perform block compares. */
enum insn_code cmpstr_optab[NUM_MACHINE_MODES];
enum insn_code cmpstrn_optab[NUM_MACHINE_MODES];
enum insn_code cmpmem_optab[NUM_MACHINE_MODES];
/* Synchronization primitives. */
enum insn_code sync_add_optab[NUM_MACHINE_MODES];
enum insn_code sync_sub_optab[NUM_MACHINE_MODES];
enum insn_code sync_ior_optab[NUM_MACHINE_MODES];
enum insn_code sync_and_optab[NUM_MACHINE_MODES];
enum insn_code sync_xor_optab[NUM_MACHINE_MODES];
enum insn_code sync_nand_optab[NUM_MACHINE_MODES];
enum insn_code sync_old_add_optab[NUM_MACHINE_MODES];
enum insn_code sync_old_sub_optab[NUM_MACHINE_MODES];
enum insn_code sync_old_ior_optab[NUM_MACHINE_MODES];
enum insn_code sync_old_and_optab[NUM_MACHINE_MODES];
enum insn_code sync_old_xor_optab[NUM_MACHINE_MODES];
enum insn_code sync_old_nand_optab[NUM_MACHINE_MODES];
enum insn_code sync_new_add_optab[NUM_MACHINE_MODES];
enum insn_code sync_new_sub_optab[NUM_MACHINE_MODES];
enum insn_code sync_new_ior_optab[NUM_MACHINE_MODES];
enum insn_code sync_new_and_optab[NUM_MACHINE_MODES];
enum insn_code sync_new_xor_optab[NUM_MACHINE_MODES];
enum insn_code sync_new_nand_optab[NUM_MACHINE_MODES];
enum insn_code sync_compare_and_swap[NUM_MACHINE_MODES];
enum insn_code sync_lock_test_and_set[NUM_MACHINE_MODES];
enum insn_code sync_lock_release[NUM_MACHINE_MODES];
/* SLOW_UNALIGNED_ACCESS is nonzero if unaligned accesses are very slow. */
#ifndef SLOW_UNALIGNED_ACCESS
@ -1315,7 +1280,7 @@ emit_block_move_via_movmem (rtx x, rtx y, rtx size, unsigned int align,
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
enum insn_code code = movmem_optab[(int) mode];
enum insn_code code = direct_optab_handler (movmem_optab, mode);
insn_operand_predicate_fn pred;
if (code != CODE_FOR_nothing
@ -2791,7 +2756,7 @@ set_storage_via_setmem (rtx object, rtx size, rtx val, unsigned int align,
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
enum insn_code code = setmem_optab[(int) mode];
enum insn_code code = direct_optab_handler (setmem_optab, mode);
insn_operand_predicate_fn pred;
if (code != CODE_FOR_nothing

View File

@ -200,40 +200,40 @@ static const char * const optabs[] =
"set_optab_handler (movmisalign_optab, $A, CODE_FOR_$(movmisalign$a$))",
"set_optab_handler (storent_optab, $A, CODE_FOR_$(storent$a$))",
"set_optab_handler (addcc_optab, $A, CODE_FOR_$(add$acc$))",
"movcc_gen_code[$A] = CODE_FOR_$(mov$acc$)",
"set_direct_optab_handler (movcc_optab, $A, CODE_FOR_$(mov$acc$))",
"set_optab_handler (cbranch_optab, $A, CODE_FOR_$(cbranch$a4$))",
"set_optab_handler (cmov_optab, $A, CODE_FOR_$(cmov$a6$))",
"set_optab_handler (cstore_optab, $A, CODE_FOR_$(cstore$a4$))",
"set_optab_handler (ctrap_optab, $A, CODE_FOR_$(ctrap$a4$))",
"set_optab_handler (push_optab, $A, CODE_FOR_$(push$a1$))",
"reload_in_optab[$A] = CODE_FOR_$(reload_in$a$)",
"reload_out_optab[$A] = CODE_FOR_$(reload_out$a$)",
"movmem_optab[$A] = CODE_FOR_$(movmem$a$)",
"cmpstr_optab[$A] = CODE_FOR_$(cmpstr$a$)",
"cmpstrn_optab[$A] = CODE_FOR_$(cmpstrn$a$)",
"cmpmem_optab[$A] = CODE_FOR_$(cmpmem$a$)",
"setmem_optab[$A] = CODE_FOR_$(setmem$a$)",
"sync_add_optab[$A] = CODE_FOR_$(sync_add$I$a$)",
"sync_sub_optab[$A] = CODE_FOR_$(sync_sub$I$a$)",
"sync_ior_optab[$A] = CODE_FOR_$(sync_ior$I$a$)",
"sync_and_optab[$A] = CODE_FOR_$(sync_and$I$a$)",
"sync_xor_optab[$A] = CODE_FOR_$(sync_xor$I$a$)",
"sync_nand_optab[$A] = CODE_FOR_$(sync_nand$I$a$)",
"sync_old_add_optab[$A] = CODE_FOR_$(sync_old_add$I$a$)",
"sync_old_sub_optab[$A] = CODE_FOR_$(sync_old_sub$I$a$)",
"sync_old_ior_optab[$A] = CODE_FOR_$(sync_old_ior$I$a$)",
"sync_old_and_optab[$A] = CODE_FOR_$(sync_old_and$I$a$)",
"sync_old_xor_optab[$A] = CODE_FOR_$(sync_old_xor$I$a$)",
"sync_old_nand_optab[$A] = CODE_FOR_$(sync_old_nand$I$a$)",
"sync_new_add_optab[$A] = CODE_FOR_$(sync_new_add$I$a$)",
"sync_new_sub_optab[$A] = CODE_FOR_$(sync_new_sub$I$a$)",
"sync_new_ior_optab[$A] = CODE_FOR_$(sync_new_ior$I$a$)",
"sync_new_and_optab[$A] = CODE_FOR_$(sync_new_and$I$a$)",
"sync_new_xor_optab[$A] = CODE_FOR_$(sync_new_xor$I$a$)",
"sync_new_nand_optab[$A] = CODE_FOR_$(sync_new_nand$I$a$)",
"sync_compare_and_swap[$A] = CODE_FOR_$(sync_compare_and_swap$I$a$)",
"sync_lock_test_and_set[$A] = CODE_FOR_$(sync_lock_test_and_set$I$a$)",
"sync_lock_release[$A] = CODE_FOR_$(sync_lock_release$I$a$)",
"set_direct_optab_handler (reload_in_optab, $A, CODE_FOR_$(reload_in$a$))",
"set_direct_optab_handler (reload_out_optab, $A, CODE_FOR_$(reload_out$a$))",
"set_direct_optab_handler (movmem_optab, $A, CODE_FOR_$(movmem$a$))",
"set_direct_optab_handler (cmpstr_optab, $A, CODE_FOR_$(cmpstr$a$))",
"set_direct_optab_handler (cmpstrn_optab, $A, CODE_FOR_$(cmpstrn$a$))",
"set_direct_optab_handler (cmpmem_optab, $A, CODE_FOR_$(cmpmem$a$))",
"set_direct_optab_handler (setmem_optab, $A, CODE_FOR_$(setmem$a$))",
"set_direct_optab_handler (sync_add_optab, $A, CODE_FOR_$(sync_add$I$a$))",
"set_direct_optab_handler (sync_sub_optab, $A, CODE_FOR_$(sync_sub$I$a$))",
"set_direct_optab_handler (sync_ior_optab, $A, CODE_FOR_$(sync_ior$I$a$))",
"set_direct_optab_handler (sync_and_optab, $A, CODE_FOR_$(sync_and$I$a$))",
"set_direct_optab_handler (sync_xor_optab, $A, CODE_FOR_$(sync_xor$I$a$))",
"set_direct_optab_handler (sync_nand_optab, $A, CODE_FOR_$(sync_nand$I$a$))",
"set_direct_optab_handler (sync_old_add_optab, $A, CODE_FOR_$(sync_old_add$I$a$))",
"set_direct_optab_handler (sync_old_sub_optab, $A, CODE_FOR_$(sync_old_sub$I$a$))",
"set_direct_optab_handler (sync_old_ior_optab, $A, CODE_FOR_$(sync_old_ior$I$a$))",
"set_direct_optab_handler (sync_old_and_optab, $A, CODE_FOR_$(sync_old_and$I$a$))",
"set_direct_optab_handler (sync_old_xor_optab, $A, CODE_FOR_$(sync_old_xor$I$a$))",
"set_direct_optab_handler (sync_old_nand_optab, $A, CODE_FOR_$(sync_old_nand$I$a$))",
"set_direct_optab_handler (sync_new_add_optab, $A, CODE_FOR_$(sync_new_add$I$a$))",
"set_direct_optab_handler (sync_new_sub_optab, $A, CODE_FOR_$(sync_new_sub$I$a$))",
"set_direct_optab_handler (sync_new_ior_optab, $A, CODE_FOR_$(sync_new_ior$I$a$))",
"set_direct_optab_handler (sync_new_and_optab, $A, CODE_FOR_$(sync_new_and$I$a$))",
"set_direct_optab_handler (sync_new_xor_optab, $A, CODE_FOR_$(sync_new_xor$I$a$))",
"set_direct_optab_handler (sync_new_nand_optab, $A, CODE_FOR_$(sync_new_nand$I$a$))",
"set_direct_optab_handler (sync_compare_and_swap_optab, $A, CODE_FOR_$(sync_compare_and_swap$I$a$))",
"set_direct_optab_handler (sync_lock_test_and_set_optab, $A, CODE_FOR_$(sync_lock_test_and_set$I$a$))",
"set_direct_optab_handler (sync_lock_release_optab, $A, CODE_FOR_$(sync_lock_release$I$a$))",
"set_optab_handler (vec_set_optab, $A, CODE_FOR_$(vec_set$a$))",
"set_optab_handler (vec_extract_optab, $A, CODE_FOR_$(vec_extract$a$))",
"set_optab_handler (vec_extract_even_optab, $A, CODE_FOR_$(vec_extract_even$a$))",
@ -244,8 +244,8 @@ static const char * const optabs[] =
"set_optab_handler (vec_shl_optab, $A, CODE_FOR_$(vec_shl_$a$))",
"set_optab_handler (vec_shr_optab, $A, CODE_FOR_$(vec_shr_$a$))",
"set_optab_handler (vec_realign_load_optab, $A, CODE_FOR_$(vec_realign_load_$a$))",
"vcond_gen_code[$A] = CODE_FOR_$(vcond$a$)",
"vcondu_gen_code[$A] = CODE_FOR_$(vcondu$a$)",
"set_direct_optab_handler (vcond_optab, $A, CODE_FOR_$(vcond$a$))",
"set_direct_optab_handler (vcondu_optab, $A, CODE_FOR_$(vcondu$a$))",
"set_optab_handler (ssum_widen_optab, $A, CODE_FOR_$(widen_ssum$I$a3$))",
"set_optab_handler (usum_widen_optab, $A, CODE_FOR_$(widen_usum$I$a3$))",
"set_optab_handler (udot_prod_optab, $A, CODE_FOR_$(udot_prod$I$a$))",

View File

@ -323,7 +323,8 @@ compareAndSwapInt_builtin (tree method_return_type ATTRIBUTE_UNUSED,
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (int_type_node);
if (sync_compare_and_swap[mode] != CODE_FOR_nothing
if (direct_optab_handler (sync_compare_and_swap_optab, mode)
!= CODE_FOR_nothing
|| flag_use_atomic_builtins)
{
tree addr, stmt;
@ -344,7 +345,8 @@ compareAndSwapLong_builtin (tree method_return_type ATTRIBUTE_UNUSED,
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (long_type_node);
if (sync_compare_and_swap[mode] != CODE_FOR_nothing
if (direct_optab_handler (sync_compare_and_swap_optab, mode)
!= CODE_FOR_nothing
|| (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (word_mode)
&& flag_use_atomic_builtins))
/* We don't trust flag_use_atomic_builtins for multi-word
@ -368,7 +370,8 @@ compareAndSwapObject_builtin (tree method_return_type ATTRIBUTE_UNUSED,
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (ptr_type_node);
if (sync_compare_and_swap[mode] != CODE_FOR_nothing
if (direct_optab_handler (sync_compare_and_swap_optab, mode)
!= CODE_FOR_nothing
|| flag_use_atomic_builtins)
{
tree addr, stmt;
@ -448,7 +451,8 @@ VMSupportsCS8_builtin (tree method_return_type,
{
enum machine_mode mode = TYPE_MODE (long_type_node);
gcc_assert (method_return_type == boolean_type_node);
if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
if (direct_optab_handler (sync_compare_and_swap_optab, mode)
!= CODE_FOR_nothing)
return boolean_true_node;
else
return boolean_false_node;

View File

@ -4918,7 +4918,7 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
{
enum built_in_function base;
tree decl, itype, call;
enum insn_code *optab;
direct_optab optab;
tree rhs;
basic_block store_bb = single_succ (load_bb);
gimple_stmt_iterator gsi;
@ -4990,7 +4990,7 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
decl = built_in_decls[base + index + 1];
itype = TREE_TYPE (TREE_TYPE (decl));
if (optab[TYPE_MODE (itype)] == CODE_FOR_nothing)
if (direct_optab_handler (optab, TYPE_MODE (itype)) == CODE_FOR_nothing)
return false;
gsi = gsi_last_bb (load_bb);
@ -5042,7 +5042,8 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
itype = TREE_TYPE (TREE_TYPE (cmpxchg));
if (sync_compare_and_swap[TYPE_MODE (itype)] == CODE_FOR_nothing)
if (direct_optab_handler (sync_compare_and_swap_optab, TYPE_MODE (itype))
== CODE_FOR_nothing)
return false;
/* Load the initial value, replacing the GIMPLE_OMP_ATOMIC_LOAD. */

View File

@ -60,24 +60,13 @@ rtx libfunc_table[LTI_MAX];
/* Tables of patterns for converting one mode to another. */
struct convert_optab_d convert_optab_table[COI_MAX];
/* Tables of patterns for direct optabs (i.e. those which cannot be
implemented using a libcall). */
struct direct_optab_d direct_optab_table[(int) DOI_MAX];
/* Contains the optab used for each rtx code. */
optab code_to_optab[NUM_RTX_CODE + 1];
#ifdef HAVE_conditional_move
/* Indexed by the machine mode, gives the insn code to make a conditional
move insn. This is not indexed by the rtx-code like bcc_gen_fctn and
setcc_gen_code to cut down on the number of named patterns. Consider a day
when a lot more rtx codes are conditional (eg: for the ARM). */
enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
#endif
/* Indexed by the machine mode, gives the insn code for vector conditional
operation. */
enum insn_code vcond_gen_code[NUM_MACHINE_MODES];
enum insn_code vcondu_gen_code[NUM_MACHINE_MODES];
static void prepare_float_lib_cmp (rtx, rtx, enum rtx_code, rtx *,
enum machine_mode *);
static rtx expand_unop_direct (enum machine_mode, optab, rtx, rtx, int);
@ -4071,11 +4060,11 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size,
cmp_mode != VOIDmode;
cmp_mode = GET_MODE_WIDER_MODE (cmp_mode))
{
cmp_code = cmpmem_optab[cmp_mode];
cmp_code = direct_optab_handler (cmpmem_optab, cmp_mode);
if (cmp_code == CODE_FOR_nothing)
cmp_code = cmpstr_optab[cmp_mode];
cmp_code = direct_optab_handler (cmpstr_optab, cmp_mode);
if (cmp_code == CODE_FOR_nothing)
cmp_code = cmpstrn_optab[cmp_mode];
cmp_code = direct_optab_handler (cmpstrn_optab, cmp_mode);
if (cmp_code == CODE_FOR_nothing)
continue;
@ -4520,7 +4509,7 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1,
if (mode == VOIDmode)
mode = GET_MODE (op2);
icode = movcc_gen_code[mode];
icode = direct_optab_handler (movcc_optab, mode);
if (icode == CODE_FOR_nothing)
return 0;
@ -4593,7 +4582,7 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1,
int
can_conditionally_move_p (enum machine_mode mode)
{
if (movcc_gen_code[mode] != CODE_FOR_nothing)
if (direct_optab_handler (movcc_optab, mode) != CODE_FOR_nothing)
return 1;
return 0;
@ -5439,6 +5428,7 @@ init_insn_codes (void)
{
memset (optab_table, 0, sizeof (optab_table));
memset (convert_optab_table, 0, sizeof (convert_optab_table));
memset (direct_optab_table, 0, sizeof (direct_optab_table));
}
/* Initialize OP's code to CODE, and write it into the code_to_optab table. */
@ -6146,25 +6136,12 @@ set_conv_libfunc (convert_optab optable, enum machine_mode tmode,
void
init_optabs (void)
{
unsigned int i;
static bool reinit;
libfunc_hash = htab_create_ggc (10, hash_libfunc, eq_libfunc, NULL);
/* Start by initializing all tables to contain CODE_FOR_nothing. */
#ifdef HAVE_conditional_move
for (i = 0; i < NUM_MACHINE_MODES; i++)
movcc_gen_code[i] = CODE_FOR_nothing;
#endif
for (i = 0; i < NUM_MACHINE_MODES; i++)
{
vcond_gen_code[i] = CODE_FOR_nothing;
vcondu_gen_code[i] = CODE_FOR_nothing;
}
/* We statically initialize the insn_codes with the equivalent of
CODE_FOR_nothing. */
CODE_FOR_nothing. Repeat the process if reinitialising. */
if (reinit)
init_insn_codes ();
@ -6357,39 +6334,6 @@ init_optabs (void)
init_convert_optab (satfract_optab, SAT_FRACT);
init_convert_optab (satfractuns_optab, UNSIGNED_SAT_FRACT);
for (i = 0; i < NUM_MACHINE_MODES; i++)
{
movmem_optab[i] = CODE_FOR_nothing;
cmpstr_optab[i] = CODE_FOR_nothing;
cmpstrn_optab[i] = CODE_FOR_nothing;
cmpmem_optab[i] = CODE_FOR_nothing;
setmem_optab[i] = CODE_FOR_nothing;
sync_add_optab[i] = CODE_FOR_nothing;
sync_sub_optab[i] = CODE_FOR_nothing;
sync_ior_optab[i] = CODE_FOR_nothing;
sync_and_optab[i] = CODE_FOR_nothing;
sync_xor_optab[i] = CODE_FOR_nothing;
sync_nand_optab[i] = CODE_FOR_nothing;
sync_old_add_optab[i] = CODE_FOR_nothing;
sync_old_sub_optab[i] = CODE_FOR_nothing;
sync_old_ior_optab[i] = CODE_FOR_nothing;
sync_old_and_optab[i] = CODE_FOR_nothing;
sync_old_xor_optab[i] = CODE_FOR_nothing;
sync_old_nand_optab[i] = CODE_FOR_nothing;
sync_new_add_optab[i] = CODE_FOR_nothing;
sync_new_sub_optab[i] = CODE_FOR_nothing;
sync_new_ior_optab[i] = CODE_FOR_nothing;
sync_new_and_optab[i] = CODE_FOR_nothing;
sync_new_xor_optab[i] = CODE_FOR_nothing;
sync_new_nand_optab[i] = CODE_FOR_nothing;
sync_compare_and_swap[i] = CODE_FOR_nothing;
sync_lock_test_and_set[i] = CODE_FOR_nothing;
sync_lock_release[i] = CODE_FOR_nothing;
reload_in_optab[i] = reload_out_optab[i] = CODE_FOR_nothing;
}
/* Fill in the optabs with the insns we support. */
init_all_optabs ();
@ -6845,9 +6789,9 @@ get_vcond_icode (tree type, enum machine_mode mode)
enum insn_code icode = CODE_FOR_nothing;
if (TYPE_UNSIGNED (type))
icode = vcondu_gen_code[mode];
icode = direct_optab_handler (vcondu_optab, mode);
else
icode = vcond_gen_code[mode];
icode = direct_optab_handler (vcond_optab, mode);
return icode;
}
@ -6945,7 +6889,8 @@ rtx
expand_val_compare_and_swap (rtx mem, rtx old_val, rtx new_val, rtx target)
{
enum machine_mode mode = GET_MODE (mem);
enum insn_code icode = sync_compare_and_swap[mode];
enum insn_code icode
= direct_optab_handler (sync_compare_and_swap_optab, mode);
if (icode == CODE_FOR_nothing)
return NULL_RTX;
@ -6982,7 +6927,7 @@ expand_bool_compare_and_swap (rtx mem, rtx old_val, rtx new_val, rtx target)
/* If the target supports a compare-and-swap pattern that simultaneously
sets some flag for success, then use it. Otherwise use the regular
compare-and-swap and follow that immediately with a compare insn. */
icode = sync_compare_and_swap[mode];
icode = direct_optab_handler (sync_compare_and_swap_optab, mode);
if (icode == CODE_FOR_nothing)
return NULL_RTX;
@ -7060,7 +7005,7 @@ expand_compare_and_swap_loop (rtx mem, rtx old_reg, rtx new_reg, rtx seq)
/* If the target supports a compare-and-swap pattern that simultaneously
sets some flag for success, then use it. Otherwise use the regular
compare-and-swap and follow that immediately with a compare insn. */
icode = sync_compare_and_swap[mode];
icode = direct_optab_handler (sync_compare_and_swap_optab, mode);
if (icode == CODE_FOR_nothing)
return false;
@ -7104,26 +7049,26 @@ expand_sync_operation (rtx mem, rtx val, enum rtx_code code)
switch (code)
{
case PLUS:
icode = sync_add_optab[mode];
icode = direct_optab_handler (sync_add_optab, mode);
break;
case IOR:
icode = sync_ior_optab[mode];
icode = direct_optab_handler (sync_ior_optab, mode);
break;
case XOR:
icode = sync_xor_optab[mode];
icode = direct_optab_handler (sync_xor_optab, mode);
break;
case AND:
icode = sync_and_optab[mode];
icode = direct_optab_handler (sync_and_optab, mode);
break;
case NOT:
icode = sync_nand_optab[mode];
icode = direct_optab_handler (sync_nand_optab, mode);
break;
case MINUS:
icode = sync_sub_optab[mode];
icode = direct_optab_handler (sync_sub_optab, mode);
if (icode == CODE_FOR_nothing || CONST_INT_P (val))
{
icode = sync_add_optab[mode];
icode = direct_optab_handler (sync_add_optab, mode);
if (icode != CODE_FOR_nothing)
{
val = expand_simple_unop (mode, NEG, val, NULL_RTX, 1);
@ -7154,7 +7099,8 @@ expand_sync_operation (rtx mem, rtx val, enum rtx_code code)
/* Failing that, generate a compare-and-swap loop in which we perform the
operation with normal arithmetic instructions. */
if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
if (direct_optab_handler (sync_compare_and_swap_optab, mode)
!= CODE_FOR_nothing)
{
rtx t0 = gen_reg_rtx (mode), t1;
@ -7199,34 +7145,34 @@ expand_sync_fetch_operation (rtx mem, rtx val, enum rtx_code code,
switch (code)
{
case PLUS:
old_code = sync_old_add_optab[mode];
new_code = sync_new_add_optab[mode];
old_code = direct_optab_handler (sync_old_add_optab, mode);
new_code = direct_optab_handler (sync_new_add_optab, mode);
break;
case IOR:
old_code = sync_old_ior_optab[mode];
new_code = sync_new_ior_optab[mode];
old_code = direct_optab_handler (sync_old_ior_optab, mode);
new_code = direct_optab_handler (sync_new_ior_optab, mode);
break;
case XOR:
old_code = sync_old_xor_optab[mode];
new_code = sync_new_xor_optab[mode];
old_code = direct_optab_handler (sync_old_xor_optab, mode);
new_code = direct_optab_handler (sync_new_xor_optab, mode);
break;
case AND:
old_code = sync_old_and_optab[mode];
new_code = sync_new_and_optab[mode];
old_code = direct_optab_handler (sync_old_and_optab, mode);
new_code = direct_optab_handler (sync_new_and_optab, mode);
break;
case NOT:
old_code = sync_old_nand_optab[mode];
new_code = sync_new_nand_optab[mode];
old_code = direct_optab_handler (sync_old_nand_optab, mode);
new_code = direct_optab_handler (sync_new_nand_optab, mode);
break;
case MINUS:
old_code = sync_old_sub_optab[mode];
new_code = sync_new_sub_optab[mode];
old_code = direct_optab_handler (sync_old_sub_optab, mode);
new_code = direct_optab_handler (sync_new_sub_optab, mode);
if ((old_code == CODE_FOR_nothing && new_code == CODE_FOR_nothing)
|| CONST_INT_P (val))
{
old_code = sync_old_add_optab[mode];
new_code = sync_new_add_optab[mode];
old_code = direct_optab_handler (sync_old_add_optab, mode);
new_code = direct_optab_handler (sync_new_add_optab, mode);
if (old_code != CODE_FOR_nothing || new_code != CODE_FOR_nothing)
{
val = expand_simple_unop (mode, NEG, val, NULL_RTX, 1);
@ -7316,7 +7262,8 @@ expand_sync_fetch_operation (rtx mem, rtx val, enum rtx_code code,
/* Failing that, generate a compare-and-swap loop in which we perform the
operation with normal arithmetic instructions. */
if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
if (direct_optab_handler (sync_compare_and_swap_optab, mode)
!= CODE_FOR_nothing)
{
rtx t0 = gen_reg_rtx (mode), t1;
@ -7365,7 +7312,7 @@ expand_sync_lock_test_and_set (rtx mem, rtx val, rtx target)
rtx insn;
/* If the target supports the test-and-set directly, great. */
icode = sync_lock_test_and_set[mode];
icode = direct_optab_handler (sync_lock_test_and_set_optab, mode);
if (icode != CODE_FOR_nothing)
{
if (!target || !insn_data[icode].operand[0].predicate (target, mode))
@ -7385,7 +7332,8 @@ expand_sync_lock_test_and_set (rtx mem, rtx val, rtx target)
}
/* Otherwise, use a compare-and-swap loop for the exchange. */
if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
if (direct_optab_handler (sync_compare_and_swap_optab, mode)
!= CODE_FOR_nothing)
{
if (!target || !register_operand (target, mode))
target = gen_reg_rtx (mode);

View File

@ -594,79 +594,127 @@ extern struct convert_optab_d convert_optab_table[COI_MAX];
#define satfract_optab (&convert_optab_table[COI_satfract])
#define satfractuns_optab (&convert_optab_table[COI_satfractuns])
/* These arrays record the insn_code of insns that may be needed to
perform input and output reloads of special objects. They provide a
place to pass a scratch register. */
extern enum insn_code reload_in_optab[NUM_MACHINE_MODES];
extern enum insn_code reload_out_optab[NUM_MACHINE_MODES];
/* Contains the optab used for each rtx code. */
extern optab code_to_optab[NUM_RTX_CODE + 1];
typedef rtx (*rtxfun) (rtx);
/* Enumerates operations that have a named .md pattern associated
with them, but which are not implemented as library functions. */
enum direct_optab_index
{
#ifdef HAVE_conditional_move
/* Indexed by the machine mode, gives the insn code to make a conditional
move insn. */
extern enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
/* Conditional move operations. */
DOI_movcc,
#endif
/* Indexed by the machine mode, gives the insn code for vector conditional
operation. */
/* Operations that use a scratch register to perform input and output
reloads of special objects. */
DOI_reload_in,
DOI_reload_out,
extern enum insn_code vcond_gen_code[NUM_MACHINE_MODES];
extern enum insn_code vcondu_gen_code[NUM_MACHINE_MODES];
/* Vector conditional operations. */
DOI_vcond,
DOI_vcondu,
/* This array records the insn_code of insns to perform block moves. */
extern enum insn_code movmem_optab[NUM_MACHINE_MODES];
/* Block move operation. */
DOI_movmem,
/* This array records the insn_code of insns to perform block sets. */
extern enum insn_code setmem_optab[NUM_MACHINE_MODES];
/* Block set operation. */
DOI_setmem,
/* These arrays record the insn_code of two different kinds of insns
to perform block compares. */
extern enum insn_code cmpstr_optab[NUM_MACHINE_MODES];
extern enum insn_code cmpstrn_optab[NUM_MACHINE_MODES];
extern enum insn_code cmpmem_optab[NUM_MACHINE_MODES];
/* Various types of block compare operation. */
DOI_cmpstr,
DOI_cmpstrn,
DOI_cmpmem,
/* Synchronization primitives. This first set is atomic operation for
which we don't care about the resulting value. */
extern enum insn_code sync_add_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_sub_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_ior_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_and_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_xor_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_nand_optab[NUM_MACHINE_MODES];
/* Synchronization primitives. This first set is atomic operation for
which we don't care about the resulting value. */
DOI_sync_add,
DOI_sync_sub,
DOI_sync_ior,
DOI_sync_and,
DOI_sync_xor,
DOI_sync_nand,
/* This second set is atomic operations in which we return the value
that existed in memory before the operation. */
extern enum insn_code sync_old_add_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_old_sub_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_old_ior_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_old_and_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_old_xor_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_old_nand_optab[NUM_MACHINE_MODES];
/* This second set is atomic operations in which we return the value
that existed in memory before the operation. */
DOI_sync_old_add,
DOI_sync_old_sub,
DOI_sync_old_ior,
DOI_sync_old_and,
DOI_sync_old_xor,
DOI_sync_old_nand,
/* This third set is atomic operations in which we return the value
that resulted after performing the operation. */
extern enum insn_code sync_new_add_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_new_sub_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_new_ior_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_new_and_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_new_xor_optab[NUM_MACHINE_MODES];
extern enum insn_code sync_new_nand_optab[NUM_MACHINE_MODES];
/* This third set is atomic operations in which we return the value
that resulted after performing the operation. */
DOI_sync_new_add,
DOI_sync_new_sub,
DOI_sync_new_ior,
DOI_sync_new_and,
DOI_sync_new_xor,
DOI_sync_new_nand,
/* Atomic compare and swap. */
extern enum insn_code sync_compare_and_swap[NUM_MACHINE_MODES];
/* Atomic compare and swap. */
DOI_sync_compare_and_swap,
/* Atomic exchange with acquire semantics. */
extern enum insn_code sync_lock_test_and_set[NUM_MACHINE_MODES];
/* Atomic exchange with acquire semantics. */
DOI_sync_lock_test_and_set,
/* Atomic clear with release semantics. */
extern enum insn_code sync_lock_release[NUM_MACHINE_MODES];
/* Atomic clear with release semantics. */
DOI_sync_lock_release,
DOI_MAX
};
/* A structure that says which insn should be used to perform an operation
in a particular mode. */
struct direct_optab_d
{
struct optab_handlers handlers[NUM_MACHINE_MODES];
};
typedef struct direct_optab_d *direct_optab;
extern struct direct_optab_d direct_optab_table[(int) DOI_MAX];
#ifdef HAVE_conditional_move
#define movcc_optab (&direct_optab_table[(int) DOI_movcc])
#endif
#define reload_in_optab (&direct_optab_table[(int) DOI_reload_in])
#define reload_out_optab (&direct_optab_table[(int) DOI_reload_out])
#define vcond_optab (&direct_optab_table[(int) DOI_vcond])
#define vcondu_optab (&direct_optab_table[(int) DOI_vcondu])
#define movmem_optab (&direct_optab_table[(int) DOI_movmem])
#define setmem_optab (&direct_optab_table[(int) DOI_setmem])
#define cmpstr_optab (&direct_optab_table[(int) DOI_cmpstr])
#define cmpstrn_optab (&direct_optab_table[(int) DOI_cmpstrn])
#define cmpmem_optab (&direct_optab_table[(int) DOI_cmpmem])
#define sync_add_optab (&direct_optab_table[(int) DOI_sync_add])
#define sync_sub_optab (&direct_optab_table[(int) DOI_sync_sub])
#define sync_ior_optab (&direct_optab_table[(int) DOI_sync_ior])
#define sync_and_optab (&direct_optab_table[(int) DOI_sync_and])
#define sync_xor_optab (&direct_optab_table[(int) DOI_sync_xor])
#define sync_nand_optab (&direct_optab_table[(int) DOI_sync_nand])
#define sync_old_add_optab (&direct_optab_table[(int) DOI_sync_old_add])
#define sync_old_sub_optab (&direct_optab_table[(int) DOI_sync_old_sub])
#define sync_old_ior_optab (&direct_optab_table[(int) DOI_sync_old_ior])
#define sync_old_and_optab (&direct_optab_table[(int) DOI_sync_old_and])
#define sync_old_xor_optab (&direct_optab_table[(int) DOI_sync_old_xor])
#define sync_old_nand_optab (&direct_optab_table[(int) DOI_sync_old_nand])
#define sync_new_add_optab (&direct_optab_table[(int) DOI_sync_new_add])
#define sync_new_sub_optab (&direct_optab_table[(int) DOI_sync_new_sub])
#define sync_new_ior_optab (&direct_optab_table[(int) DOI_sync_new_ior])
#define sync_new_and_optab (&direct_optab_table[(int) DOI_sync_new_and])
#define sync_new_xor_optab (&direct_optab_table[(int) DOI_sync_new_xor])
#define sync_new_nand_optab (&direct_optab_table[(int) DOI_sync_new_nand])
#define sync_compare_and_swap_optab \
(&direct_optab_table[(int) DOI_sync_compare_and_swap])
#define sync_lock_test_and_set_optab \
(&direct_optab_table[(int) DOI_sync_lock_test_and_set])
#define sync_lock_release_optab \
(&direct_optab_table[(int) DOI_sync_lock_release])
/* Define functions given in optabs.c. */
extern rtx expand_widen_pattern_expr (sepops ops, rtx op0, rtx op1, rtx wide_op,
@ -823,6 +871,25 @@ set_convert_optab_handler (convert_optab op, enum machine_mode to_mode,
= (int) code - (int) CODE_FOR_nothing;
}
/* Return the insn used to implement mode MODE of OP, or CODE_FOR_nothing
if the target does not have such an insn. */
static inline enum insn_code
direct_optab_handler (direct_optab op, enum machine_mode mode)
{
return (enum insn_code) (op->handlers[(int) mode].insn_code
+ (int) CODE_FOR_nothing);
}
/* Record that insn CODE should be used to implement mode MODE of OP. */
static inline void
set_direct_optab_handler (direct_optab op, enum machine_mode mode,
enum insn_code code)
{
op->handlers[(int) mode].insn_code = (int) code - (int) CODE_FOR_nothing;
}
extern rtx optab_libfunc (optab optab, enum machine_mode mode);
extern rtx convert_optab_libfunc (convert_optab optab, enum machine_mode mode1,
enum machine_mode mode2);

View File

@ -275,12 +275,6 @@ int caller_save_needed;
Required by some machines to handle any generated moves differently. */
int reload_in_progress = 0;
/* These arrays record the insn_code of insns that may be needed to
perform input and output reloads of special objects. They provide a
place to pass a scratch register. */
enum insn_code reload_in_optab[NUM_MACHINE_MODES];
enum insn_code reload_out_optab[NUM_MACHINE_MODES];
/* This obstack is used for allocation of rtl during register elimination.
The allocated storage can be freed once find_reloads has processed the
insn. */

View File

@ -849,8 +849,9 @@ default_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
#endif
if (rclass != NO_REGS)
{
enum insn_code icode = (in_p ? reload_in_optab[(int) reload_mode]
: reload_out_optab[(int) reload_mode]);
enum insn_code icode
= direct_optab_handler (in_p ? reload_in_optab : reload_out_optab,
reload_mode);
if (icode != CODE_FOR_nothing
&& insn_data[(int) icode].operand[in_p].predicate