less use of optabs/insn-codes, 2/n

Richard Henderson rth@redhat.com
Sat Aug 18 17:21:00 GMT 2001


On Sat, Aug 18, 2001 at 05:48:20PM -0400, Zack Weinberg wrote:
> Bootstrapped i686-linux.  That target defines both casesi and tablejump.
> (I'm not sure why it needs casesi - something weird with PIC mode.)

It doesn't, really.  We should change this to

(define_expand "tablejump"
  [(parallel [(set (pc) (match_operand:P 0 "nonimmediate_operand" "rm"))
	      (use (label_ref (match_operand 1 "" "")))])]
  ""
{
  /* In PIC mode, the table entries are stored GOT-relative.  Convert
     the relative address to an absolute address.  */
  if (flag_pic)
    {
      operands[0] = expand_simple_binop (Pmode, MINUS, pic_offset_table_rtx,
					 operands[0], NULL_RTX,
					 1, OPTAB_DIRECT);
      current_function_uses_pic_offset_table = 1;
    }
})

Err.. I can't figure out how x86-64 does switch statements.  Both
the tablejump and casesi patterns appear to be 32-bit specific.

> 	* stmt.c (check_for_full_enumeration_handling, emit_case_nodes):
> 	Zap #if 0 blocks.
> 	(is_call_to_builtin_classify_type): New function.
> 	(expand_end_case): All low-level code to generate a casesi
> 	or a tablejump split out to routines in expr.c.
> 	* expr.c (do_tablejump): Make static and defined always.
> 	(case_values_threshold, try_casesi, try_tablejump): New functions,
> 	code formerly in stmt.c (expand_end_case).
> 	* expr.h: Prototype try_casesi, try_tablejump, case_values_threshold;
> 	not do_tablejump.

Ok if you build cross compilers to one target that doesn't have casesi
(e.g. alpha) and one that doesn't have tablejump (e.g. s390 or vax).

> +static inline int
> +is_call_to_builtin_classify_type (expr)
> +     tree expr;

Ideally this would be handled in fold_builtin, so that this builtin
wouldn't get this far.

> +#ifndef HAVE_casesi
> +#define HAVE_casesi 0
> +#endif

Don't you need a gen_casesi stub here?



r~



More information about the Gcc-patches mailing list