public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: philip.herron@embecosm.com
Cc: gcc-patches@gcc.gnu.org, herron.philip@googlemail.com,
	SimplyTheOther <simplytheother@gmail.com>
Subject: Re: [PATCH Rust front-end v1 2/4] Add Rust lang TargetHooks for i386 and x86_64
Date: Thu, 28 Jul 2022 11:57:50 +0200	[thread overview]
Message-ID: <YuJdnslnlJJz7yQL@tucnak> (raw)
In-Reply-To: <20220727134040.843750-3-philip.herron@embecosm.com>

Note, the ChangeLog entry formatting is wrong and in various places
the code formatting as well.  In gcc/rust/ you can choose different
formatting if there are strong reasons for that, but at least it should be
consistent and ideally documented.

None of the gcc/doc, gcc/config, gcc/config/i386 directories have
ChangeLog files, so all this should go into gcc/ChangeLog
and filenames should be relative to the gcc/ directory, so
doc/tm.texi.in, config/default-rust.cc, config/i386/crtdll.h etc.

After : there should be a capital letter and the description what
changed should end with a dot.
Where possible, before : there should be space ( followed by what
has changed followed by ).
When some file is regenerated, just write Regenerated. or so.
When a new file is added, just write New. or New file.

On Wed, Jul 27, 2022 at 02:40:38PM +0100, herron.philip--- via Gcc-patches wrote:
> gcc/doc/ChangeLog:
> 
>         * tm.texi.in: specifiy hooks for rust target info
>         * tm.texi: commit the generated documentation
> 
> gcc/ChangeLog:
> 
>         * Makefile.in: add target to generate rust hooks
>         * config.gcc: add rust target interface to be compiled for i386
> 	* genhooks.cc: generate rust target hooks
> 	* configure: autoconf update
> 	* configure.ac: add tm_rust_file_list and tm_rust_include_list
> 
> gcc/config/ChangeLog:
> 
>         * default-rust.cc: new target hooks initializer for rust
>         * gnu.h: add new macro GNU_USER_TARGET_RUST_OS_INFO
> 	* dragonfly.h: define TARGET_RUST_OS_INFO
> 	* freebsd-spec.h: define FBSD_TARGET_RUST_OS_INFO
> 	* freebsd.h: define guard for TARGET_RUST_OS_INFO
> 	* fuchsia.h: define TARGET_RUST_OS_INFO
> 	* kfreebsd-gnu.h: define GNU_USER_TARGET_RUST_OS_INFO
> 	* kopensolaris-gnu.h: define GNU_USER_TARGET_RUST_OS_INFO
> 	* linux-android.h: define ANDROID_TARGET_RUST_OS_INFO
> 	* linux.h: define GNU_USER_TARGET_RUST_OS_INFO
> 	* netbsd.h: define NETBSD_TARGET_RUST_OS_INFO
> 	* openbsd.h: define OPENBSD_TARGET_RUST_OS_INFO
> 	* phoenix.h: define TARGET_RUST_OS_INFO
> 	* sol2.h: define TARGET_RUST_OS_INFO
> 	* vxworks.h: define VXWORKS_TARGET_RUST_OS_INFO
> 	* vxworksae.h: define VXWORKS_TARGET_RUST_OS_INFO
> 
> gcc/config/i386/ChangeLog:
> 
>         * crtdll.h: define EXTRA_TARGET_RUST_OS_INFO
>         * cygming.h: define TARGET_RUST_OS_INFO
>         * cygwin.h: define EXTRA_TARGET_RUST_OS_INFO
>         * darwin.h: define TARGET_RUST_OS_INFO
>         * djgpp.h: likewise
>         * gnu-user-common.h: define TARGET_RUST_OS_INFO
>         * i386-protos.h: prototype for ix86_rust_target_cpu_info
>         * i386-rust.cc: new file to generate the rust target host info
>         * i386.h: define TARGET_RUST_CPU_INFO hook
>         * linux-common.h: define hooks for target info
>         * lynx.h: likewise
>         * mingw32.h: likewise
>         * netbsd-elf.h: likewise
>         * netbsd64.h: likewise
>         * nto.h: likewise
>         * openbsdelf.h: likewise
>         * rdos.h: likewise
>         * rtemself.h: likewise
>         * t-i386: add makefilke rule for i386-rust.cc
>         * vxworks.h: define TARGET_RUST_OS_INFO
> 
> gcc/rust/ChangeLog:
> 
>         * rust-target-def.h: define the headers to access the hooks
>         * rust-target.def: define the hooks nessecary based on C90
>         * rust-target.h: define extern gcc_targetrustm
> +/* Implement TARGET_RUST_CPU_INFO for x86 targets.  */
> +
> +void
> +ix86_rust_target_cpu_info (void)
> +{
> +    if (TARGET_64BIT) {
> +        rust_add_target_info("target_arch", "x86_64");

The indentation should be just 2 columns rather than 4, and
{ doesn't go at the end of line.  Single statement if/else/etc.
bodies aren't wrapped with {}s.  There is space before (.
So
  if (TARGET_64BIT)
    {
      rust_add_target_info ("target_arch", "x86_64");
      ...
    }
  else
    rust_add_target_info ("target_arch", "x86");

> +  // nopl: hard-coded (as gcc doesn't technically have feature) to return true for cpu arches with it
> +  // maybe refactor into switch if multiple options
> +  bool hasNOPL = ix86_arch == PROCESSOR_PENTIUMPRO || ix86_arch == PROCESSOR_PENTIUM4 
> +    || ix86_arch == PROCESSOR_NOCONA || ix86_arch == PROCESSOR_CORE2 || ix86_arch == PROCESSOR_NEHALEM 

Some lines are too long.

	Jakub


  reply	other threads:[~2022-07-28  9:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27 13:40 Rust frontend patches v1 herron.philip
2022-07-27 13:40 ` [PATCH Rust front-end v1 1/4] Add skeleton Rust front-end folder herron.philip
2022-07-27 13:40 ` [PATCH Rust front-end v1 2/4] Add Rust lang TargetHooks for i386 and x86_64 herron.philip
2022-07-28  9:57   ` Jakub Jelinek [this message]
2022-07-28 10:38   ` Thomas Schwinge
2022-07-28 10:51     ` Philip Herron
2022-07-28 11:08       ` Thomas Schwinge
2022-07-28 11:41         ` Philip Herron
2022-07-27 13:40 ` [PATCH Rust front-end v1 3/4] Add Rust target hooks to ARM herron.philip
2022-07-27 14:13   ` Richard Earnshaw
2022-07-27 16:45 ` Rust frontend patches v1 David Malcolm
2022-07-28  9:39   ` Philip Herron
2022-08-10 18:56     ` Philip Herron
2022-08-10 19:06       ` David Malcolm
2022-08-12 20:45       ` Mike Stump
2022-08-15 14:07       ` Manuel López-Ibáñez
2022-08-15 14:33         ` Martin Liška
2022-08-24 13:48           ` Martin Liška
2022-08-24 13:51             ` Philip Herron
2022-08-24 14:02               ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YuJdnslnlJJz7yQL@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=herron.philip@googlemail.com \
    --cc=philip.herron@embecosm.com \
    --cc=simplytheother@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).