On Mon, Nov 9, 2026 at 4:45 PM Shiva S <[email protected]> wrote:
>
> When i386.c was split up (commit 2bf6d93547e, "Split i386.c."), the
> scalar_chain, general_scalar_chain and timode_scalar_chain classes moved
> into i386-features.h together with the anonymous namespace that had made
> them local to the file.  i386.cc also includes i386-features.h, for
> xlogue_layout, so it gets its own internal-linkage copies of these
> classes.  Their non-pure virtual member functions are odr-used there but
> never defined in that translation unit, which makes the program
> ill-formed, no diagnostic required.  GCC accepts it silently, but other
> compilers reject it.
>
> Move the classes back into i386-features.cc, their only user.
>
> gcc/ChangeLog:
>
>         * config/i386/i386-features.h (scalar_chain, general_scalar_chain)
>         (timode_scalar_chain): Move from here...
>         * config/i386/i386-features.cc: ...to here.

OK and pushed.

Thanks,
Uros.

>
> Signed-off-by: Shiva <[email protected]>
> ---
>
> Bootstrapped and regression-tested on x86_64-pc-linux-gnu and
> aarch64-unknown-linux-gnu.  I do not have write access; please commit
> if approved.
>
>  gcc/config/i386/i386-features.cc | 84 ++++++++++++++++++++++++++++++++
>  gcc/config/i386/i386-features.h  | 84 --------------------------------
>  2 files changed, 84 insertions(+), 84 deletions(-)
>
> diff --git a/gcc/config/i386/i386-features.cc 
> b/gcc/config/i386/i386-features.cc
> index 8a54589f332..fdea1cbe6d8 100644
> --- a/gcc/config/i386/i386-features.cc
> +++ b/gcc/config/i386/i386-features.cc
> @@ -274,6 +274,90 @@ xlogue_layout::get_stub_rtx (enum xlogue_stub stub)
>    return gen_rtx_SYMBOL_REF (Pmode, get_stub_name (stub, n_extra_regs));
>  }
>
> +namespace {
> +
> +class scalar_chain
> +{
> + public:
> +  scalar_chain (enum machine_mode, enum machine_mode);
> +  virtual ~scalar_chain ();
> +
> +  static unsigned max_id;
> +
> +  /* Scalar mode.  */
> +  enum machine_mode smode;
> +  /* Vector mode.  */
> +  enum machine_mode vmode;
> +
> +  /* ID of a chain.  */
> +  unsigned int chain_id;
> +  /* A queue of instructions to be included into a chain.  */
> +  bitmap queue;
> +  /* Instructions included into a chain.  */
> +  bitmap insns;
> +  /* All registers defined by a chain.  */
> +  bitmap defs;
> +  /* Registers used in both vector and scalar modes.  */
> +  bitmap defs_conv;
> +
> +  /* Limit on chain discovery.  */
> +  unsigned max_visits;
> +
> +  bitmap insns_conv;
> +  hash_map<rtx, rtx> defs_map;
> +  /* Cost of inserted conversion between ineteger and sse.  */
> +  int cost_sse_integer;
> +  sreal weighted_cost_sse_integer;
> +  auto_vec<rtx_insn *> control_flow_insns;
> +
> +  bool build (bitmap candidates, unsigned insn_uid, bitmap disallowed);
> +  virtual bool compute_convert_gain () = 0;
> +  int convert ();
> +
> + protected:
> +  void add_to_queue (unsigned insn_uid);
> +  void emit_conversion_insns (rtx_insn *insns, rtx_insn *pos);
> +  rtx convert_compare (rtx op1, rtx op2, rtx_insn *insn);
> +  void mark_dual_mode_def (df_ref def);
> +  void convert_reg (rtx_insn *insn, rtx dst, rtx src);
> +  void convert_insn_common (rtx_insn *insn);
> +  void make_vector_copies (rtx_insn *, rtx);
> +  void convert_registers ();
> +  void convert_op (rtx *op, rtx_insn *insn);
> +
> + private:
> +  bool add_insn (bitmap candidates, unsigned insn_uid, bitmap disallowed);
> +  bool analyze_register_chain (bitmap candidates, df_ref ref,
> +                              bitmap disallowed);
> +  virtual void convert_insn (rtx_insn *insn) = 0;
> +};
> +
> +class general_scalar_chain : public scalar_chain
> +{
> + public:
> +  general_scalar_chain (enum machine_mode smode_, enum machine_mode vmode_)
> +    : scalar_chain (smode_, vmode_) {}
> +  bool compute_convert_gain () final override;
> +
> + private:
> +  void convert_insn (rtx_insn *insn) final override;
> +  int vector_const_cost (rtx exp, basic_block bb);
> +  rtx convert_rotate (enum rtx_code, rtx op0, rtx op1, rtx_insn *insn);
> +};
> +
> +class timode_scalar_chain : public scalar_chain
> +{
> + public:
> +  timode_scalar_chain () : scalar_chain (TImode, V1TImode) {}
> +  bool compute_convert_gain () final override;
> +
> + private:
> +  void fix_debug_reg_uses (rtx reg);
> +  void convert_insn (rtx_insn *insn) final override;
> +};
> +
> +} // anon namespace
> +
>  unsigned scalar_chain::max_id = 0;
>
>  namespace {
> diff --git a/gcc/config/i386/i386-features.h b/gcc/config/i386/i386-features.h
> index 61b2393b7ea..46c10c1d695 100644
> --- a/gcc/config/i386/i386-features.h
> +++ b/gcc/config/i386/i386-features.h
> @@ -122,90 +122,6 @@ private:
>    static const xlogue_layout s_instances[XLOGUE_SET_COUNT];
>  };
>
> -namespace {
> -
> -class scalar_chain
> -{
> - public:
> -  scalar_chain (enum machine_mode, enum machine_mode);
> -  virtual ~scalar_chain ();
> -
> -  static unsigned max_id;
> -
> -  /* Scalar mode.  */
> -  enum machine_mode smode;
> -  /* Vector mode.  */
> -  enum machine_mode vmode;
> -
> -  /* ID of a chain.  */
> -  unsigned int chain_id;
> -  /* A queue of instructions to be included into a chain.  */
> -  bitmap queue;
> -  /* Instructions included into a chain.  */
> -  bitmap insns;
> -  /* All registers defined by a chain.  */
> -  bitmap defs;
> -  /* Registers used in both vector and scalar modes.  */
> -  bitmap defs_conv;
> -
> -  /* Limit on chain discovery.  */
> -  unsigned max_visits;
> -
> -  bitmap insns_conv;
> -  hash_map<rtx, rtx> defs_map;
> -  /* Cost of inserted conversion between ineteger and sse.  */
> -  int cost_sse_integer;
> -  sreal weighted_cost_sse_integer;
> -  auto_vec<rtx_insn *> control_flow_insns;
> -
> -  bool build (bitmap candidates, unsigned insn_uid, bitmap disallowed);
> -  virtual bool compute_convert_gain () = 0;
> -  int convert ();
> -
> - protected:
> -  void add_to_queue (unsigned insn_uid);
> -  void emit_conversion_insns (rtx_insn *insns, rtx_insn *pos);
> -  rtx convert_compare (rtx op1, rtx op2, rtx_insn *insn);
> -  void mark_dual_mode_def (df_ref def);
> -  void convert_reg (rtx_insn *insn, rtx dst, rtx src);
> -  void convert_insn_common (rtx_insn *insn);
> -  void make_vector_copies (rtx_insn *, rtx);
> -  void convert_registers ();
> -  void convert_op (rtx *op, rtx_insn *insn);
> -
> - private:
> -  bool add_insn (bitmap candidates, unsigned insn_uid, bitmap disallowed);
> -  bool analyze_register_chain (bitmap candidates, df_ref ref,
> -                              bitmap disallowed);
> -  virtual void convert_insn (rtx_insn *insn) = 0;
> -};
> -
> -class general_scalar_chain : public scalar_chain
> -{
> - public:
> -  general_scalar_chain (enum machine_mode smode_, enum machine_mode vmode_)
> -    : scalar_chain (smode_, vmode_) {}
> -  bool compute_convert_gain () final override;
> -
> - private:
> -  void convert_insn (rtx_insn *insn) final override;
> -  int vector_const_cost (rtx exp, basic_block bb);
> -  rtx convert_rotate (enum rtx_code, rtx op0, rtx op1, rtx_insn *insn);
> -};
> -
> -class timode_scalar_chain : public scalar_chain
> -{
> - public:
> -  timode_scalar_chain () : scalar_chain (TImode, V1TImode) {}
> -  bool compute_convert_gain () final override;
> -
> - private:
> -  void fix_debug_reg_uses (rtx reg);
> -  void convert_insn (rtx_insn *insn) final override;
> -};
> -
> -} // anon namespace
> -
>  bool ix86_save_reg (unsigned int regno, bool maybe_eh_return,
>                     bool ignore_outlined);
>  int ix86_compare_version_priority (tree decl1, tree decl2);

Reply via email to