]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/optabs.h
PR fortran/95090 - ICE: identifier overflow
[thirdparty/gcc.git] / gcc / optabs.h
index 91e36d61b3bc10ed8a5ba4cf5b368e7e341a3d49..5bd19503a0ac0a3dbca322530cfb841a9e83cd2f 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for code generation pass of GNU compiler.
-   Copyright (C) 2001-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -20,87 +20,13 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_OPTABS_H
 #define GCC_OPTABS_H
 
-#include "insn-opinit.h"
+#include "optabs-query.h"
+#include "optabs-libfuncs.h"
+#include "vec-perm-indices.h"
 
 /* Generate code for a widening multiply.  */
 extern rtx expand_widening_mult (machine_mode, rtx, rtx, rtx, int, optab);
 
-/* 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
-optab_handler (optab op, machine_mode mode)
-{
-  unsigned scode = (op << 16) | mode;
-  gcc_assert (op > LAST_CONV_OPTAB);
-  return raw_optab_handler (scode);
-}
-
-/* Return the insn used to perform conversion OP from mode FROM_MODE
-   to mode TO_MODE; return CODE_FOR_nothing if the target does not have
-   such an insn.  */
-
-static inline enum insn_code
-convert_optab_handler (convert_optab op, machine_mode to_mode,
-                      machine_mode from_mode)
-{
-  unsigned scode = (op << 16) | (from_mode << 8) | to_mode;
-  gcc_assert (op > unknown_optab && op <= LAST_CONV_OPTAB);
-  return raw_optab_handler (scode);
-}
-
-/* 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, machine_mode mode)
-{
-  return optab_handler (op, mode);
-}
-
-/* Return true if UNOPTAB is for a trapping-on-overflow operation.  */
-
-static inline bool
-trapv_unoptab_p (optab unoptab)
-{
-  return (unoptab == negv_optab
-         || unoptab == absv_optab); 
-}
-
-/* Return true if BINOPTAB is for a trapping-on-overflow operation.  */
-
-static inline bool
-trapv_binoptab_p (optab binoptab)
-{
-  return (binoptab == addv_optab
-         || binoptab == subv_optab
-         || binoptab == smulv_optab);
-}
-
-
-
-/* Describes an instruction that inserts or extracts a bitfield.  */
-struct extraction_insn
-{
-  /* The code of the instruction.  */
-  enum insn_code icode;
-
-  /* The mode that the structure operand should have.  This is byte_mode
-     when using the legacy insv, extv and extzv patterns to access memory.  */
-  machine_mode struct_mode;
-
-  /* The mode of the field to be inserted or extracted, and by extension
-     the mode of the insertion or extraction itself.  */
-  machine_mode field_mode;
-
-  /* The mode of the field's bit position.  This is only important
-     when the position is variable rather than constant.  */
-  machine_mode pos_mode;
-};
-
-
-
-
 /* Describes the type of an expand_operand.  Each value is associated
    with a create_*_operand function; see the comments above those
    functions for details.  */
@@ -115,7 +41,8 @@ enum expand_operand_type {
 };
 
 /* Information about an operand for instruction expansion.  */
-struct expand_operand {
+class expand_operand {
+public:
   /* The type of operand.  */
   ENUM_BITFIELD (expand_operand_type) type : 8;
 
@@ -123,8 +50,11 @@ struct expand_operand {
      rather than signed.  Only meaningful for certain types.  */
   unsigned int unsigned_p : 1;
 
+  /* Is the target operand.  */
+  unsigned int target : 1;
+
   /* Unused; available for future use.  */
-  unsigned int unused : 7;
+  unsigned int unused : 6;
 
   /* The mode passed to the convert_*_operand function.  It has a
      type-dependent meaning.  */
@@ -132,28 +62,33 @@ struct expand_operand {
 
   /* The value of the operand.  */
   rtx value;
+
+  /* The value of an EXPAND_INTEGER operand.  */
+  poly_int64 int_value;
 };
 
 /* Initialize OP with the given fields.  Initialise the other fields
    to their default values.  */
 
 static inline void
-create_expand_operand (struct expand_operand *op,
+create_expand_operand (class expand_operand *op,
                       enum expand_operand_type type,
                       rtx value, machine_mode mode,
-                      bool unsigned_p)
+                      bool unsigned_p, poly_int64 int_value = 0)
 {
   op->type = type;
   op->unsigned_p = unsigned_p;
+  op->target = 0;
   op->unused = 0;
   op->mode = mode;
   op->value = value;
+  op->int_value = int_value;
 }
 
 /* Make OP describe an operand that must use rtx X, even if X is volatile.  */
 
 static inline void
-create_fixed_operand (struct expand_operand *op, rtx x)
+create_fixed_operand (class expand_operand *op, rtx x)
 {
   create_expand_operand (op, EXPAND_FIXED, x, VOIDmode, false);
 }
@@ -164,7 +99,7 @@ create_fixed_operand (struct expand_operand *op, rtx x)
    be ignored in that case.  */
 
 static inline void
-create_output_operand (struct expand_operand *op, rtx x,
+create_output_operand (class expand_operand *op, rtx x,
                       machine_mode mode)
 {
   create_expand_operand (op, EXPAND_OUTPUT, x, mode, false);
@@ -176,7 +111,7 @@ create_output_operand (struct expand_operand *op, rtx x,
    as an operand.  */
 
 static inline void
-create_input_operand (struct expand_operand *op, rtx value,
+create_input_operand (class expand_operand *op, rtx value,
                      machine_mode mode)
 {
   create_expand_operand (op, EXPAND_INPUT, value, mode, false);
@@ -186,7 +121,7 @@ create_input_operand (struct expand_operand *op, rtx value,
    to mode MODE.  UNSIGNED_P says whether VALUE is unsigned.  */
 
 static inline void
-create_convert_operand_to (struct expand_operand *op, rtx value,
+create_convert_operand_to (class expand_operand *op, rtx value,
                           machine_mode mode, bool unsigned_p)
 {
   create_expand_operand (op, EXPAND_CONVERT_TO, value, mode, unsigned_p);
@@ -195,10 +130,14 @@ create_convert_operand_to (struct expand_operand *op, rtx value,
 /* Make OP describe an input operand that should have the same value
    as VALUE, after any mode conversion that the backend might request.
    If VALUE is a CONST_INT, it should be treated as having mode MODE.
-   UNSIGNED_P says whether VALUE is unsigned.  */
+   UNSIGNED_P says whether VALUE is unsigned.
+
+   The conversion of VALUE can include a combination of numerical
+   conversion (as for convert_modes) and duplicating a scalar to fill
+   a vector (if VALUE is a scalar but the operand is a vector).  */
 
 static inline void
-create_convert_operand_from (struct expand_operand *op, rtx value,
+create_convert_operand_from (class expand_operand *op, rtx value,
                             machine_mode mode, bool unsigned_p)
 {
   create_expand_operand (op, EXPAND_CONVERT_FROM, value, mode, unsigned_p);
@@ -209,47 +148,12 @@ create_convert_operand_from (struct expand_operand *op, rtx value,
    of the address, but it may need to be converted to Pmode first.  */
 
 static inline void
-create_address_operand (struct expand_operand *op, rtx value)
+create_address_operand (class expand_operand *op, rtx value)
 {
   create_expand_operand (op, EXPAND_ADDRESS, value, Pmode, false);
 }
 
-/* Make OP describe an input operand that has value INTVAL and that has
-   no inherent mode.  This function should only be used for operands that
-   are always expand-time constants.  The backend may request that INTVAL
-   be copied into a different kind of rtx, but it must specify the mode
-   of that rtx if so.  */
-
-static inline void
-create_integer_operand (struct expand_operand *op, HOST_WIDE_INT intval)
-{
-  create_expand_operand (op, EXPAND_INTEGER, GEN_INT (intval), VOIDmode, false);
-}
-
-
-extern rtx convert_optab_libfunc (convert_optab optab, machine_mode mode1,
-                                 machine_mode mode2);
-extern rtx optab_libfunc (optab optab, machine_mode mode);
-extern enum insn_code widening_optab_handler (optab, machine_mode,
-                                             machine_mode);
-/* Find a widening optab even if it doesn't widen as much as we want.  */
-#define find_widening_optab_handler(A,B,C,D) \
-  find_widening_optab_handler_and_mode (A, B, C, D, NULL)
-extern enum insn_code find_widening_optab_handler_and_mode (optab,
-                                                           machine_mode,
-                                                           machine_mode,
-                                                           int,
-                                                           machine_mode *);
-
-/* An extra flag to control optab_for_tree_code's behavior.  This is needed to
-   distinguish between machines with a vector shift that takes a scalar for the
-   shift amount vs. machines that take a vector for the shift amount.  */
-enum optab_subtype
-{
-  optab_default,
-  optab_scalar,
-  optab_vector
-};
+extern void create_integer_operand (class expand_operand *, poly_int64);
 
 /* Passed to expand_simple_binop and expand_binop to say which options
    to try to use if the requested operation can't be open-coded on the
@@ -267,16 +171,6 @@ enum optab_methods
   OPTAB_MUST_WIDEN
 };
 
-/* Return the optab used for computing the given operation on the type given by
-   the second argument.  The third argument distinguishes between the types of
-   vector shifts and rotates */
-extern optab optab_for_tree_code (enum tree_code, const_tree, enum optab_subtype);
-
-/* Given an optab that reduces a vector to a scalar, find instead the old
-   optab that produces a vector with the reduction result in one element,
-   for a tree with the specified type.  */
-extern optab scalar_reduc_to_vector (optab, const_tree type);
-
 extern rtx expand_widen_pattern_expr (struct separate_ops *, rtx , rtx , rtx,
                                       rtx, int);
 extern rtx expand_ternary_op (machine_mode mode, optab ternary_optab,
@@ -287,8 +181,7 @@ extern rtx simplify_expand_binop (machine_mode mode, optab binoptab,
                                  enum optab_methods methods);
 extern bool force_expand_binop (machine_mode, optab, rtx, rtx, rtx, int,
                                enum optab_methods);
-/* Generate code for VEC_RSHIFT_EXPR.  */
-extern rtx expand_vec_shift_expr (struct separate_ops *, rtx);
+extern rtx expand_vector_broadcast (machine_mode, rtx);
 
 /* Generate code for a simple binary or unary operation.  "Simple" in
    this case means "can be unambiguously described by a (mode, code)
@@ -335,7 +228,7 @@ extern bool maybe_emit_unop_insn (enum insn_code, rtx, rtx, enum rtx_code);
 extern void emit_unop_insn (enum insn_code, rtx, rtx, enum rtx_code);
 
 /* Emit code to make a call to a constant function or a library call.  */
-extern void emit_libcall_block (rtx, rtx, rtx, rtx);
+extern void emit_libcall_block (rtx_insn *, rtx, rtx, rtx);
 
 /* The various uses that a comparison can have; used by can_compare_p:
    jumps, conditional moves, store flag operations.  */
@@ -350,12 +243,20 @@ enum can_compare_purpose
    (without splitting it into pieces).  */
 extern int can_compare_p (enum rtx_code, machine_mode,
                          enum can_compare_purpose);
+
+/* Return whether the backend can emit a vector comparison for code CODE,
+   comparing operands of mode CMP_OP_MODE and producing a result with
+   VALUE_MODE.  */
+extern bool can_vcond_compare_p (enum rtx_code, machine_mode, machine_mode);
+
 extern rtx prepare_operand (enum insn_code, rtx, int, machine_mode,
                            machine_mode, int);
 /* Emit a pair of rtl insns to compare two rtx's and to jump
    to a label if the comparison is true.  */
 extern void emit_cmp_and_jump_insns (rtx, rtx, enum rtx_code, rtx,
-                                    machine_mode, int, rtx, int prob=-1);
+                                    machine_mode, int, rtx,
+                                    profile_probability prob
+                                       = profile_probability::uninitialized ());
 
 /* Generate code to indirectly jump to a location given in the rtx LOC.  */
 extern void emit_indirect_jump (rtx);
@@ -366,46 +267,32 @@ extern void emit_indirect_jump (rtx);
 #error "insn-config.h must be included before optabs.h"
 #endif
 
-#ifdef HAVE_conditional_move
 /* Emit a conditional move operation.  */
 rtx emit_conditional_move (rtx, enum rtx_code, rtx, rtx, machine_mode,
                           rtx, rtx, machine_mode, int);
 
-/* Return nonzero if the conditional move is supported.  */
-int can_conditionally_move_p (machine_mode mode);
+/* Emit a conditional negate or bitwise complement operation.  */
+rtx emit_conditional_neg_or_complement (rtx, rtx_code, machine_mode, rtx,
+                                        rtx, rtx);
 
-#endif
 rtx emit_conditional_add (rtx, enum rtx_code, rtx, rtx, machine_mode,
                          rtx, rtx, machine_mode, int);
 
 /* Create but don't emit one rtl instruction to perform certain operations.
    Modes must match; operands must meet the operation's predicates.
    Likewise for subtraction and for just copying.  */
-extern rtx gen_add2_insn (rtx, rtx);
-extern rtx gen_add3_insn (rtx, rtx, rtx);
+extern rtx_insn *gen_add2_insn (rtx, rtx);
+extern rtx_insn *gen_add3_insn (rtx, rtx, rtx);
 extern int have_add2_insn (rtx, rtx);
-extern rtx gen_addptr3_insn (rtx, rtx, rtx);
+extern rtx_insn *gen_addptr3_insn (rtx, rtx, rtx);
 extern int have_addptr3_insn (rtx, rtx, rtx);
-extern rtx gen_sub2_insn (rtx, rtx);
-extern rtx gen_sub3_insn (rtx, rtx, rtx);
+extern rtx_insn *gen_sub2_insn (rtx, rtx);
+extern rtx_insn *gen_sub3_insn (rtx, rtx, rtx);
 extern int have_sub2_insn (rtx, rtx);
 
-/* Return the INSN_CODE to use for an extend operation.  */
-extern enum insn_code can_extend_p (machine_mode, machine_mode, int);
-
 /* Generate the body of an insn to extend Y (with mode MFROM)
    into X (with mode MTO).  Do zero-extension if UNSIGNEDP is nonzero.  */
-extern rtx gen_extend_insn (rtx, rtx, machine_mode,
-                           machine_mode, int);
-
-/* Return the insn_code for a FLOAT_EXPR.  */
-enum insn_code can_float_p (machine_mode, machine_mode, int);
-
-/* Check whether an operation represented by the code CODE is a
-   convert operation that is supported by the target platform in
-   vector form */
-bool supportable_convert_operation (enum tree_code, tree, tree, tree *, 
-                                    enum tree_code *);
+extern rtx_insn *gen_extend_insn (rtx, rtx, machine_mode, machine_mode, int);
 
 /* Generate code for a FLOAT_EXPR.  */
 extern void expand_float (rtx, rtx, int);
@@ -423,104 +310,26 @@ extern bool expand_sfix_optab (rtx, rtx, convert_optab);
    perform the operation described by CODE and MODE.  */
 extern int have_insn_for (enum rtx_code, machine_mode);
 
-extern void gen_int_libfunc (optab, const char *, char, machine_mode);
-extern void gen_fp_libfunc (optab, const char *, char, machine_mode);
-extern void gen_fixed_libfunc (optab, const char *, char, machine_mode);
-extern void gen_signed_fixed_libfunc (optab, const char *, char,
-                                     machine_mode);
-extern void gen_unsigned_fixed_libfunc (optab, const char *, char,
-                                       machine_mode);
-extern void gen_int_fp_libfunc (optab, const char *, char, machine_mode);
-extern void gen_intv_fp_libfunc (optab, const char *, char, machine_mode);
-extern void gen_int_fp_fixed_libfunc (optab, const char *, char,
-                                     machine_mode);
-extern void gen_int_fp_signed_fixed_libfunc (optab, const char *, char,
-                                            machine_mode);
-extern void gen_int_fixed_libfunc (optab, const char *, char,
-                                  machine_mode);
-extern void gen_int_signed_fixed_libfunc (optab, const char *, char,
-                                         machine_mode);
-extern void gen_int_unsigned_fixed_libfunc (optab, const char *, char,
-                                           machine_mode);
-
-extern void gen_interclass_conv_libfunc (convert_optab, const char *,
-                                        machine_mode, machine_mode);
-extern void gen_int_to_fp_conv_libfunc (convert_optab, const char *,
-                                       machine_mode, machine_mode);
-extern void gen_ufloat_conv_libfunc (convert_optab, const char *,
-                                    machine_mode, machine_mode);
-extern void gen_int_to_fp_nondecimal_conv_libfunc  (convert_optab,
-                                                   const char *,
-                                                   machine_mode,
-                                                   machine_mode);
-extern void gen_fp_to_int_conv_libfunc (convert_optab, const char *,
-                                       machine_mode, machine_mode);
-extern void gen_intraclass_conv_libfunc (convert_optab, const char *,
-                                        machine_mode, machine_mode);
-extern void gen_trunc_conv_libfunc (convert_optab, const char *,
-                                   machine_mode, machine_mode);
-extern void gen_extend_conv_libfunc (convert_optab, const char *,
-                                    machine_mode, machine_mode);
-extern void gen_fract_conv_libfunc (convert_optab, const char *,
-                                   machine_mode, machine_mode);
-extern void gen_fractuns_conv_libfunc (convert_optab, const char *,
-                                      machine_mode, machine_mode);
-extern void gen_satfract_conv_libfunc (convert_optab, const char *,
-                                      machine_mode, machine_mode);
-extern void gen_satfractuns_conv_libfunc (convert_optab, const char *,
-                                         machine_mode,
-                                         machine_mode);
-
-/* Build a decl for a libfunc named NAME. */
-extern tree build_libfunc_function (const char *);
-
-/* Call this to initialize an optab function entry.  */
-extern rtx init_one_libfunc (const char *);
-extern rtx set_user_assembler_libfunc (const char *, const char *);
-
-/* Call this to reset the function entry for one optab.  */
-extern void set_optab_libfunc (optab, machine_mode, const char *);
-extern void set_conv_libfunc (convert_optab, machine_mode,
-                             machine_mode, const char *);
-
-/* Call this once to initialize the contents of the optabs
-   appropriately for the current target machine.  */
-extern void init_optabs (void);
-extern void init_tree_optimization_optabs (tree);
-
-/* Call this to install all of the __sync libcalls up to size MAX.  */
-extern void init_sync_libfuncs (int max);
-
 /* Generate a conditional trap instruction.  */
-extern rtx gen_cond_trap (enum rtx_code, rtx, rtx, rtx);
-
-/* Return true if target supports vector operations for VEC_PERM_EXPR.  */
-extern bool can_vec_perm_p (machine_mode, bool, const unsigned char *);
+extern rtx_insn *gen_cond_trap (enum rtx_code, rtx, rtx, rtx);
 
 /* Generate code for VEC_PERM_EXPR.  */
-extern rtx expand_vec_perm (machine_mode, rtx, rtx, rtx, rtx);
+extern rtx expand_vec_perm_var (machine_mode, rtx, rtx, rtx, rtx);
+extern rtx expand_vec_perm_const (machine_mode, rtx, rtx,
+                                 const vec_perm_builder &, machine_mode, rtx);
 
-/* Return tree if target supports vector operations for COND_EXPR.  */
-bool expand_vec_cond_expr_p (tree, tree);
+/* Generate code for vector comparison.  */
+extern rtx expand_vec_cmp_expr (tree, tree, rtx);
 
 /* Generate code for VEC_COND_EXPR.  */
 extern rtx expand_vec_cond_expr (tree, tree, tree, tree, rtx);
 
-/* Return non-zero if target supports a given highpart multiplication.  */
-extern int can_mult_highpart_p (machine_mode, bool);
+/* Generate code for VEC_SERIES_EXPR.  */
+extern rtx expand_vec_series_expr (machine_mode, rtx, rtx, rtx);
 
 /* Generate code for MULT_HIGHPART_EXPR.  */
 extern rtx expand_mult_highpart (machine_mode, rtx, rtx, rtx, bool);
 
-/* Return true if target supports vector masked load/store for mode.  */
-extern bool can_vec_mask_load_store_p (machine_mode, bool);
-
-/* Return true if there is an inline compare and swap pattern.  */
-extern bool can_compare_and_swap_p (machine_mode, bool);
-
-/* Return true if there is an inline atomic exchange pattern.  */
-extern bool can_atomic_exchange_p (machine_mode, bool);
-
 extern rtx expand_sync_lock_test_and_set (rtx, rtx, rtx);
 extern rtx expand_atomic_test_and_set (rtx, rtx, enum memmodel);
 extern rtx expand_atomic_exchange (rtx, rtx, rtx, enum memmodel);
@@ -538,34 +347,22 @@ rtx expand_atomic_fetch_op (rtx, rtx, rtx, enum rtx_code, enum memmodel,
 extern bool insn_operand_matches (enum insn_code icode, unsigned int opno,
                                  rtx operand);
 extern bool valid_multiword_target_p (rtx);
-extern void create_convert_operand_from_type (struct expand_operand *op,
+extern void create_convert_operand_from_type (class expand_operand *op,
                                              rtx value, tree type);
 extern bool maybe_legitimize_operands (enum insn_code icode,
                                       unsigned int opno, unsigned int nops,
-                                      struct expand_operand *ops);
-extern rtx maybe_gen_insn (enum insn_code icode, unsigned int nops,
-                          struct expand_operand *ops);
+                                      class expand_operand *ops);
+extern rtx_insn *maybe_gen_insn (enum insn_code icode, unsigned int nops,
+                                class expand_operand *ops);
 extern bool maybe_expand_insn (enum insn_code icode, unsigned int nops,
-                              struct expand_operand *ops);
+                              class expand_operand *ops);
 extern bool maybe_expand_jump_insn (enum insn_code icode, unsigned int nops,
-                                   struct expand_operand *ops);
+                                   class expand_operand *ops);
 extern void expand_insn (enum insn_code icode, unsigned int nops,
-                        struct expand_operand *ops);
+                        class expand_operand *ops);
 extern void expand_jump_insn (enum insn_code icode, unsigned int nops,
-                             struct expand_operand *ops);
-
-/* Enumerates the possible extraction_insn operations.  */
-enum extraction_pattern { EP_insv, EP_extv, EP_extzv };
-
-extern bool get_best_reg_extraction_insn (extraction_insn *,
-                                         enum extraction_pattern,
-                                         unsigned HOST_WIDE_INT,
-                                         machine_mode);
-extern bool get_best_mem_extraction_insn (extraction_insn *,
-                                         enum extraction_pattern,
-                                         HOST_WIDE_INT, HOST_WIDE_INT,
-                                         machine_mode);
+                             class expand_operand *ops);
 
-extern bool lshift_cheap_p (bool);
+extern enum rtx_code get_rtx_code (enum tree_code tcode, bool unsignedp);
 
 #endif /* GCC_OPTABS_H */