Commit 8a33f100 by Jan Hubicka Committed by Jan Hubicka

optabs.c (debug_optab_libfunc): Update; make available to gdb.

	* optabs.c (debug_optab_libfunc): Update; make available to gdb.
	(libfunc_entry): New structure.
	(libfunc_hash): New hashtable.
	(hash_libfunc): New function.
	(eq_libfunc): New function.
	(convert_optab_libfunc): New function.
	(optab_libfunc): New function.
	(expand_binop, sign_expand_binop, expand_twoval_binop_libfunc,
	expand_unop, prepare_cmp_insn, prepare_float_insn, gen_add2_insn,
	expand_float, expand_fix, new_optab, new_convert_optab):
	 Update for new libfunc API.
	(init_libfunc, init_integral_libfuncs,
	init_floating_libfuncs, init_interclass_conv_libfuncs
	init_intraclass_conv_libfuncs): Remove; reorganize all logic to:
	(gen_libfunc, gen_int_libfunc, gen_fp_libfunc, gen_int_fp_libfunc,
	gen_intv_fp_libfunc, gen_interclass_conv_libfunc,
	gen_int_to_fp_conv_libfunc, gen_ufloat_conv_libfunc,
	gen_int_to_fp_nondecimal_conv_libfunc, gen_fp_to_int_conv_libfunc,
	gen_intraclass_conv_libfunc, gen_trunc_conv_libfunc,
	gen_extend_conv_libfunc): New.
	(init_one_libfunc): Revamp for hashtables.
	(set_conv_libfunc): Likewise.
	(init_optabs): Initialize hashtable; use lazy initialization where possible.
	* optabs.h (optab_handlers): Move out of GGC.
	(optab, convert_optab): Move out of GGC; add lazy gen info.
	(code_to_optab, convert_optab_table, optab_table): Move out of GGC.
	(optab_libfunc, convert_optab_libfunc): New.
	* builtins.c (expand_builtin_powi): Update for new API.
	* expr.c (convert_move): Likewise.
	* expmed.c (expand_divmod): Likewise.

From-SVN: r128083
parent 69773742
2007-09-04 Jan Hubicka <jh@suse.cz>
* optabs.c (debug_optab_libfunc): Update; make available to gdb.
(libfunc_entry): New structure.
(libfunc_hash): New hashtable.
(hash_libfunc): New function.
(eq_libfunc): New function.
(convert_optab_libfunc): New function.
(optab_libfunc): New function.
(expand_binop, sign_expand_binop, expand_twoval_binop_libfunc,
expand_unop, prepare_cmp_insn, prepare_float_insn, gen_add2_insn,
expand_float, expand_fix, new_optab, new_convert_optab):
Update for new libfunc API.
(init_libfunc, init_integral_libfuncs,
init_floating_libfuncs, init_interclass_conv_libfuncs
init_intraclass_conv_libfuncs): Remove; reorganize all logic to:
(gen_libfunc, gen_int_libfunc, gen_fp_libfunc, gen_int_fp_libfunc,
gen_intv_fp_libfunc, gen_interclass_conv_libfunc,
gen_int_to_fp_conv_libfunc, gen_ufloat_conv_libfunc,
gen_int_to_fp_nondecimal_conv_libfunc, gen_fp_to_int_conv_libfunc,
gen_intraclass_conv_libfunc, gen_trunc_conv_libfunc,
gen_extend_conv_libfunc): New.
(init_one_libfunc): Revamp for hashtables.
(set_conv_libfunc): Likewise.
(init_optabs): Initialize hashtable; use lazy initialization where possible.
* optabs.h (optab_handlers): Move out of GGC.
(optab, convert_optab): Move out of GGC; add lazy gen info.
(code_to_optab, convert_optab_table, optab_table): Move out of GGC.
(optab_libfunc, convert_optab_libfunc): New.
* builtins.c (expand_builtin_powi): Update for new API.
* expr.c (convert_move): Likewise.
* expmed.c (expand_divmod): Likewise.
2007-09-04 Daniel Jacobowitz <dan@codesourcery.com> 2007-09-04 Daniel Jacobowitz <dan@codesourcery.com>
* config/rs6000/rs6000.c (rs6000_stack_info): Allocate space for the * config/rs6000/rs6000.c (rs6000_stack_info): Allocate space for the
......
...@@ -3060,7 +3060,7 @@ expand_builtin_powi (tree exp, rtx target, rtx subtarget) ...@@ -3060,7 +3060,7 @@ expand_builtin_powi (tree exp, rtx target, rtx subtarget)
if (GET_MODE (op1) != mode2) if (GET_MODE (op1) != mode2)
op1 = convert_to_mode (mode2, op1, 0); op1 = convert_to_mode (mode2, op1, 0);
target = emit_library_call_value (optab_handler (powi_optab, mode)->libfunc, target = emit_library_call_value (optab_libfunc (powi_optab, mode),
target, LCT_CONST_MAKE_BLOCK, mode, 2, target, LCT_CONST_MAKE_BLOCK, mode, 2,
op0, mode, op1, mode2); op0, mode, op1, mode2);
......
...@@ -3886,8 +3886,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, ...@@ -3886,8 +3886,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
if (compute_mode == VOIDmode) if (compute_mode == VOIDmode)
for (compute_mode = mode; compute_mode != VOIDmode; for (compute_mode = mode; compute_mode != VOIDmode;
compute_mode = GET_MODE_WIDER_MODE (compute_mode)) compute_mode = GET_MODE_WIDER_MODE (compute_mode))
if (optab_handler (optab1, compute_mode)->libfunc if (optab_libfunc (optab1, compute_mode)
|| optab_handler (optab2, compute_mode)->libfunc) || optab_libfunc (optab2, compute_mode))
break; break;
/* If we still couldn't find a mode, use MODE, but expand_binop will /* If we still couldn't find a mode, use MODE, but expand_binop will
......
...@@ -443,7 +443,7 @@ convert_move (rtx to, rtx from, int unsignedp) ...@@ -443,7 +443,7 @@ convert_move (rtx to, rtx from, int unsignedp)
} }
/* Otherwise use a libcall. */ /* Otherwise use a libcall. */
libcall = convert_optab_handler (tab, to_mode, from_mode)->libfunc; libcall = convert_optab_libfunc (tab, to_mode, from_mode);
/* Is this conversion implemented yet? */ /* Is this conversion implemented yet? */
gcc_assert (libcall); gcc_assert (libcall);
......
...@@ -39,15 +39,17 @@ along with GCC; see the file COPYING3. If not see ...@@ -39,15 +39,17 @@ along with GCC; see the file COPYING3. If not see
A few optabs, such as move_optab and cmp_optab, are used A few optabs, such as move_optab and cmp_optab, are used
by special code. */ by special code. */
struct optab_handlers GTY(()) struct optab_handlers
{ {
enum insn_code insn_code; enum insn_code insn_code;
rtx libfunc;
}; };
struct optab GTY(()) struct optab
{ {
enum rtx_code code; enum rtx_code code;
const char *libcall_basename;
char libcall_suffix;
void (*libcall_gen)(struct optab *, const char *name, char suffix, enum machine_mode);
struct optab_handlers handlers[NUM_MACHINE_MODES]; struct optab_handlers handlers[NUM_MACHINE_MODES];
}; };
typedef struct optab * optab; typedef struct optab * optab;
...@@ -55,9 +57,13 @@ typedef struct optab * optab; ...@@ -55,9 +57,13 @@ typedef struct optab * optab;
/* A convert_optab is for some sort of conversion operation between /* A convert_optab is for some sort of conversion operation between
modes. The first array index is the destination mode, the second modes. The first array index is the destination mode, the second
is the source mode. */ is the source mode. */
struct convert_optab GTY(()) struct convert_optab
{ {
enum rtx_code code; enum rtx_code code;
const char *libcall_basename;
void (*libcall_gen)(struct convert_optab *, const char *name,
enum machine_mode,
enum machine_mode);
struct optab_handlers handlers[NUM_MACHINE_MODES][NUM_MACHINE_MODES]; struct optab_handlers handlers[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
}; };
typedef struct convert_optab *convert_optab; typedef struct convert_optab *convert_optab;
...@@ -324,7 +330,7 @@ enum optab_index ...@@ -324,7 +330,7 @@ enum optab_index
OTI_MAX OTI_MAX
}; };
extern GTY(()) optab optab_table[OTI_MAX]; extern optab optab_table[OTI_MAX];
#define add_optab (optab_table[OTI_add]) #define add_optab (optab_table[OTI_add])
#define sub_optab (optab_table[OTI_sub]) #define sub_optab (optab_table[OTI_sub])
...@@ -498,7 +504,7 @@ enum convert_optab_index ...@@ -498,7 +504,7 @@ enum convert_optab_index
COI_MAX COI_MAX
}; };
extern GTY(()) convert_optab convert_optab_table[COI_MAX]; extern convert_optab convert_optab_table[COI_MAX];
#define sext_optab (convert_optab_table[COI_sext]) #define sext_optab (convert_optab_table[COI_sext])
#define zext_optab (convert_optab_table[COI_zext]) #define zext_optab (convert_optab_table[COI_zext])
...@@ -521,7 +527,7 @@ extern enum insn_code reload_in_optab[NUM_MACHINE_MODES]; ...@@ -521,7 +527,7 @@ extern enum insn_code reload_in_optab[NUM_MACHINE_MODES];
extern enum insn_code reload_out_optab[NUM_MACHINE_MODES]; extern enum insn_code reload_out_optab[NUM_MACHINE_MODES];
/* Contains the optab used for each rtx code. */ /* Contains the optab used for each rtx code. */
extern GTY(()) optab code_to_optab[NUM_RTX_CODE + 1]; extern optab code_to_optab[NUM_RTX_CODE + 1];
typedef rtx (*rtxfun) (rtx); typedef rtx (*rtxfun) (rtx);
...@@ -709,4 +715,8 @@ extern rtx expand_vec_shift_expr (tree, rtx); ...@@ -709,4 +715,8 @@ extern rtx expand_vec_shift_expr (tree, rtx);
#define convert_optab_handler(optab,mode,mode2) \ #define convert_optab_handler(optab,mode,mode2) \
(&(optab)->handlers[(int) (mode)][(int) (mode2)]) (&(optab)->handlers[(int) (mode)][(int) (mode2)])
extern rtx optab_libfunc (optab optab, enum machine_mode mode);
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);
#endif /* GCC_OPTABS_H */ #endif /* GCC_OPTABS_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment