public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>
Cc: cgen@sourceware.org
Subject: Re: [PATCH] desc-cpu.scm: support passing the instruction endianness to cgen_cpu_open
Date: Wed, 20 May 2020 08:28:34 +0100	[thread overview]
Message-ID: <20200520072834.GG2242921@embecosm.com> (raw)
In-Reply-To: <87mu64jdoq.fsf@oracle.com>

* Jose E. Marchesi via Cgen <cgen@sourceware.org> [2020-05-19 14:45:41 +0200]:

> 
> Hi people!
> 
> This patch adds support for specifying the "instruction endianness" (as
> oppossed to data endianness) when calling cgen_cpu_open.
> 
> This is part of a bigger work to properly support arches like BPF, where
> the endianness of the instruction is different to the endianness of the
> contents of the instruction's fields.
> 
> The accompanying patch for opcodes will be sent to
> binutils@sourceware.org today.  This CGEN patch will have to be applied
> first though.
> 
> OK for master?

I'm not a maintainer so can't approve the patch, but for what it's
worth, this looks good to me.

Thanks,
Andrew



>     
> 2020-05-19  Jose E. Marchesi  <jemarch@gnu.org>
> 
> 	* desc-cpu.scm (/gen-cpu-open): Support passing the instruction
> 	endianness to cgen_cpu_open.
> 
> 
> diff --git a/desc-cpu.scm b/desc-cpu.scm
> index b24c9f2..e00d8cd 100644
> --- a/desc-cpu.scm
> +++ b/desc-cpu.scm
> @@ -788,6 +788,7 @@ static void
>     CGEN_CPU_OPEN_MACHS:   bitmap of values in enum mach_attr
>     CGEN_CPU_OPEN_BFDMACH: specify 1 mach using bfd name
>     CGEN_CPU_OPEN_ENDIAN:  specify endian choice
> +   CGEN_CPU_OPEN_INSN_ENDIAN: specify instruction endian choice
>     CGEN_CPU_OPEN_END:     terminates arguments
>  
>     ??? Simultaneous multiple isas might not make sense, but it's not (yet)
> @@ -801,6 +802,7 @@ CGEN_CPU_DESC
>    CGEN_BITSET *isas = 0;  /* 0 = \"unspecified\" */
>    unsigned int machs = 0; /* 0 = \"unspecified\" */
>    enum cgen_endian endian = CGEN_ENDIAN_UNKNOWN;
> +  enum cgen_endian insn_endian = CGEN_ENDIAN_UNKNOWN;
>    va_list ap;
>  
>    if (! init_p)
> @@ -835,6 +837,9 @@ CGEN_CPU_DESC
>  	case CGEN_CPU_OPEN_ENDIAN :
>  	  endian = va_arg (ap, enum cgen_endian);
>  	  break;
> +	case CGEN_CPU_OPEN_INSN_ENDIAN :
> +	  insn_endian = va_arg (ap, enum cgen_endian);
> +	  break;
>  	default :
>  	  opcodes_error_handler
>  	    (/* xgettext:c-format */
> @@ -864,11 +869,8 @@ CGEN_CPU_DESC
>    cd->isas = cgen_bitset_copy (isas);
>    cd->machs = machs;
>    cd->endian = endian;
> -  /* FIXME: for the sparc case we can determine insn-endianness statically.
> -     The worry here is where both data and insn endian can be independently
> -     chosen, in which case this function will need another argument.
> -     Actually, will want to allow for more arguments in the future anyway.  */
> -  cd->insn_endian = endian;
> +  if (insn_endian == CGEN_ENDIAN_UNKNOWN)
> +    cd->insn_endian = endian;
>  
>    /* Table (re)builder.  */
>    cd->rebuild_tables = @arch@_cgen_rebuild_tables;

  reply	other threads:[~2020-05-20  7:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 12:45 Jose E. Marchesi
2020-05-20  7:28 ` Andrew Burgess [this message]
2020-05-21  1:26 ` Frank Ch. Eigler
2020-05-21  8:02   ` Jose E. Marchesi
2020-05-29 14:52     ` Jose E. Marchesi
2020-06-04 13:58       ` Jose E. Marchesi

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=20200520072834.GG2242921@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=cgen@sourceware.org \
    --cc=jose.marchesi@oracle.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).