public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* intrinsics.scm patch
@ 2009-04-08 21:09 DJ Delorie
  2009-04-09 15:29 ` Dave Brolley
  0 siblings, 1 reply; 7+ messages in thread
From: DJ Delorie @ 2009-04-08 21:09 UTC (permalink / raw)
  To: cgen


The routines in intrinsics.scm exist to provide intrinsics definitions
to GCC.  However, the way GCC's internals work has changed since they
were written, and some aspects are no longer supportable.  This patch
updates the intrinsics support as such:

* COP* modes are not going to be supported in FSF gcc.  Instead,
  regular modes will be used and GCC will manage the allocation of
  registers according to the insns' needs.

* "pass by reference" no longer works as optimizations are handled at
  the tree stage, before we have a chance to insert our
  pass-by-reference semantics.  Intead, the user must pass the address
  of a variable.  This happens to make the .h file includable.

* I also add "--syscall--" to the list of "don't make these intrinsics".

The corresponding gcc patch is here:

	http://gcc.gnu.org/ml/gcc-patches/2009-03/msg01725.html

Comments?  Ok to install?


	* intrinsics.scm (guess-mode): Drop COP* syntax.
	(need-insn): Add "--syscall--" to the list.
	(enum-type): Drop COP* syntax.
	(intrinsics.h): Likewise.
	(intrinsic-protos.h): Change file header to allow it to be
	included.

Index: intrinsics.scm
===================================================================
RCS file: /cvs/src/src/cgen/intrinsics.scm,v
retrieving revision 1.1
diff -p -U3 -r1.1 intrinsics.scm
--- intrinsics.scm	5 Nov 2007 15:46:19 -0000	1.1
+++ intrinsics.scm	8 Apr 2009 20:58:36 -0000
@@ -274,8 +274,8 @@
   (cond
    ((equal? (md-operand:cdata op) 'FMAX_INT) "SI")
    ((equal? (md-operand:cdata op) 'FMAX_FLOAT) "SF")
-   ((is-h-cr64? (md-operand:hw op)) "COPDI")
-   ((is-h-cr? (md-operand:hw op)) "COPSI")
+   ((is-h-cr64? (md-operand:hw op)) "DI")
+   ((is-h-cr? (md-operand:hw op)) "SI")
    ((not (memory? (md-operand:type op))) "SI")
    (else #f)))
 
@@ -1038,7 +1038,7 @@
 
 ;; Return true if the given insn should be included in the output files.
 (define (need-insn? insn)
-  (not (member (insn-mnemonic insn) '("--unused--" "--reserved--"))))
+  (not (member (insn-mnemonic insn) '("--unused--" "--reserved--" "--syscall--"))))
 
 ;; Set up global variables, if we haven't already.
 (define (analyze-intrinsics!)
@@ -1268,8 +1268,8 @@
 
 (define (enum-type op)
   (cond
-   ((is-h-cr64? (md-operand:hw op)) "cgen_regnum_operand_type_COPDI")
-   ((is-h-cr?   (md-operand:hw op)) "cgen_regnum_operand_type_COPSI")
+   ((is-h-cr64? (md-operand:hw op)) "cgen_regnum_operand_type_DI")
+   ((is-h-cr?   (md-operand:hw op)) "cgen_regnum_operand_type_SI")
    (else
     (case (md-operand:cdata op)
       ((POINTER)         "cgen_regnum_operand_type_POINTER") 
@@ -1395,8 +1395,8 @@
    "  cgen_regnum_operand_type_USHORT,          /* unsigned short  */\n"
    "  cgen_regnum_operand_type_CHAR,            /* char            */\n"
    "  cgen_regnum_operand_type_UCHAR,           /* unsigned char   */\n"
-   "  cgen_regnum_operand_type_COPSI,           /* __cop long      */\n"
-   "  cgen_regnum_operand_type_COPDI,           /* __cop long long */\n"
+   "  cgen_regnum_operand_type_SI,           /* __cop long      */\n"
+   "  cgen_regnum_operand_type_DI,           /* __cop long long */\n"
    "  cgen_regnum_operand_type_CP_DATA_BUS_INT, /* cp_data_bus_int */\n"
    "  cgen_regnum_operand_type_DEFAULT = cgen_regnum_operand_type_LONG\n"
    "};\n"
@@ -1530,20 +1530,14 @@
 	(else "long"))
       (if (and (not (equal? (md-operand:cdata op) 'REGNUM))
 	       (md-operand:write-index op))
-	  "&" "")))
+	  "*" "")))
 
 (define (intrinsic-protos.h) ; i.e., intrinsics.h
   (string-write 
    "\n\n"
    "/* DO NOT EDIT: This file is automatically generated by CGEN.\n"
    "   Any changes you make will be discarded when it is next regenerated.\n"
-   "\n"
-   "   FURTHERMORE: this file serves only as documentation and must not be included\n "
-   "   in any application code which wishes to use intrinsics. */\n"
-   "\n\n"
-   "#error \"This file must not be included in any application code which uses intrinsics.\"\n"
-   "#error \"It is here for documentation purposes ONLY.\"\n"
-   "\n\n"
+   "*/\n\n"
    "#if __MEP_CONFIG_CP_DATA_BUS_WIDTH == 64\n"
    "  typedef long long cp_data_bus_int;\n"
    "#else\n"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: intrinsics.scm patch
  2009-04-08 21:09 intrinsics.scm patch DJ Delorie
@ 2009-04-09 15:29 ` Dave Brolley
  2009-04-17  2:07   ` DJ Delorie
  0 siblings, 1 reply; 7+ messages in thread
From: Dave Brolley @ 2009-04-09 15:29 UTC (permalink / raw)
  To: DJ Delorie; +Cc: cgen

Hi DJ,

I can't comment on this, having never worked with it. Probably you and 
Richard Sandiford are the only ones who have worked on this.

Dave

DJ Delorie wrote:
> The routines in intrinsics.scm exist to provide intrinsics definitions
> to GCC.  However, the way GCC's internals work has changed since they
> were written, and some aspects are no longer supportable.  This patch
> updates the intrinsics support as such:
>
> * COP* modes are not going to be supported in FSF gcc.  Instead,
>   regular modes will be used and GCC will manage the allocation of
>   registers according to the insns' needs.
>
> * "pass by reference" no longer works as optimizations are handled at
>   the tree stage, before we have a chance to insert our
>   pass-by-reference semantics.  Intead, the user must pass the address
>   of a variable.  This happens to make the .h file includable.
>
> * I also add "--syscall--" to the list of "don't make these intrinsics".
>
> The corresponding gcc patch is here:
>
> 	http://gcc.gnu.org/ml/gcc-patches/2009-03/msg01725.html
>
> Comments?  Ok to install?
>
>
> 	* intrinsics.scm (guess-mode): Drop COP* syntax.
> 	(need-insn): Add "--syscall--" to the list.
> 	(enum-type): Drop COP* syntax.
> 	(intrinsics.h): Likewise.
> 	(intrinsic-protos.h): Change file header to allow it to be
> 	included.
>
> Index: intrinsics.scm
> ===================================================================
> RCS file: /cvs/src/src/cgen/intrinsics.scm,v
> retrieving revision 1.1
> diff -p -U3 -r1.1 intrinsics.scm
> --- intrinsics.scm	5 Nov 2007 15:46:19 -0000	1.1
> +++ intrinsics.scm	8 Apr 2009 20:58:36 -0000
> @@ -274,8 +274,8 @@
>    (cond
>     ((equal? (md-operand:cdata op) 'FMAX_INT) "SI")
>     ((equal? (md-operand:cdata op) 'FMAX_FLOAT) "SF")
> -   ((is-h-cr64? (md-operand:hw op)) "COPDI")
> -   ((is-h-cr? (md-operand:hw op)) "COPSI")
> +   ((is-h-cr64? (md-operand:hw op)) "DI")
> +   ((is-h-cr? (md-operand:hw op)) "SI")
>     ((not (memory? (md-operand:type op))) "SI")
>     (else #f)))
>  
> @@ -1038,7 +1038,7 @@
>  
>  ;; Return true if the given insn should be included in the output files.
>  (define (need-insn? insn)
> -  (not (member (insn-mnemonic insn) '("--unused--" "--reserved--"))))
> +  (not (member (insn-mnemonic insn) '("--unused--" "--reserved--" "--syscall--"))))
>  
>  ;; Set up global variables, if we haven't already.
>  (define (analyze-intrinsics!)
> @@ -1268,8 +1268,8 @@
>  
>  (define (enum-type op)
>    (cond
> -   ((is-h-cr64? (md-operand:hw op)) "cgen_regnum_operand_type_COPDI")
> -   ((is-h-cr?   (md-operand:hw op)) "cgen_regnum_operand_type_COPSI")
> +   ((is-h-cr64? (md-operand:hw op)) "cgen_regnum_operand_type_DI")
> +   ((is-h-cr?   (md-operand:hw op)) "cgen_regnum_operand_type_SI")
>     (else
>      (case (md-operand:cdata op)
>        ((POINTER)         "cgen_regnum_operand_type_POINTER") 
> @@ -1395,8 +1395,8 @@
>     "  cgen_regnum_operand_type_USHORT,          /* unsigned short  */\n"
>     "  cgen_regnum_operand_type_CHAR,            /* char            */\n"
>     "  cgen_regnum_operand_type_UCHAR,           /* unsigned char   */\n"
> -   "  cgen_regnum_operand_type_COPSI,           /* __cop long      */\n"
> -   "  cgen_regnum_operand_type_COPDI,           /* __cop long long */\n"
> +   "  cgen_regnum_operand_type_SI,           /* __cop long      */\n"
> +   "  cgen_regnum_operand_type_DI,           /* __cop long long */\n"
>     "  cgen_regnum_operand_type_CP_DATA_BUS_INT, /* cp_data_bus_int */\n"
>     "  cgen_regnum_operand_type_DEFAULT = cgen_regnum_operand_type_LONG\n"
>     "};\n"
> @@ -1530,20 +1530,14 @@
>  	(else "long"))
>        (if (and (not (equal? (md-operand:cdata op) 'REGNUM))
>  	       (md-operand:write-index op))
> -	  "&" "")))
> +	  "*" "")))
>  
>  (define (intrinsic-protos.h) ; i.e., intrinsics.h
>    (string-write 
>     "\n\n"
>     "/* DO NOT EDIT: This file is automatically generated by CGEN.\n"
>     "   Any changes you make will be discarded when it is next regenerated.\n"
> -   "\n"
> -   "   FURTHERMORE: this file serves only as documentation and must not be included\n "
> -   "   in any application code which wishes to use intrinsics. */\n"
> -   "\n\n"
> -   "#error \"This file must not be included in any application code which uses intrinsics.\"\n"
> -   "#error \"It is here for documentation purposes ONLY.\"\n"
> -   "\n\n"
> +   "*/\n\n"
>     "#if __MEP_CONFIG_CP_DATA_BUS_WIDTH == 64\n"
>     "  typedef long long cp_data_bus_int;\n"
>     "#else\n"
>   

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: intrinsics.scm patch
  2009-04-09 15:29 ` Dave Brolley
@ 2009-04-17  2:07   ` DJ Delorie
  2009-04-18  7:49     ` Richard Sandiford
  0 siblings, 1 reply; 7+ messages in thread
From: DJ Delorie @ 2009-04-17  2:07 UTC (permalink / raw)
  To: Dave Brolley, Richard Sandiford; +Cc: cgen


> I can't comment on this, having never worked with it. Probably you and 
> Richard Sandiford are the only ones who have worked on this.

As far as I know, only MeP uses it (or will, once the port is
accepted).  Richard, do you have any comments on the patch?  Or would
you like me to take over intrinsics.scm?

I did add another change, to include aliases in the intrinsics list.

2009-04-16  DJ Delorie  <dj@redhat.com>

	* intrinsics.scm (intrinsics-analyze!): Include aliases.
	(guess-mode): Drop COP* syntax.
	(need-insn): Add "--syscall--" to the list.
	(enum-type): Drop COP* syntax.
	(intrinsics.h): Likewise.
	(intrinsic-protos.h): Change file header to allow it to be
	included.

Index: intrinsics.scm
===================================================================
RCS file: /cvs/src/src/cgen/intrinsics.scm,v
retrieving revision 1.1
diff -p -U3 -r1.1 intrinsics.scm
--- intrinsics.scm	5 Nov 2007 15:46:19 -0000	1.1
+++ intrinsics.scm	17 Apr 2009 01:53:27 -0000
@@ -26,7 +26,7 @@
 
 (define (intrinsics-analyze!)
   (arch-analyze-insns! CURRENT-ARCH
-		       #f ; don't include aliases
+		       #t  ; include aliases
 		       #t) ; do analyze the semantics
   )
 
@@ -274,8 +274,8 @@
   (cond
    ((equal? (md-operand:cdata op) 'FMAX_INT) "SI")
    ((equal? (md-operand:cdata op) 'FMAX_FLOAT) "SF")
-   ((is-h-cr64? (md-operand:hw op)) "COPDI")
-   ((is-h-cr? (md-operand:hw op)) "COPSI")
+   ((is-h-cr64? (md-operand:hw op)) "DI")
+   ((is-h-cr? (md-operand:hw op)) "SI")
    ((not (memory? (md-operand:type op))) "SI")
    (else #f)))
 
@@ -1038,7 +1038,7 @@
 
 ;; Return true if the given insn should be included in the output files.
 (define (need-insn? insn)
-  (not (member (insn-mnemonic insn) '("--unused--" "--reserved--"))))
+  (not (member (insn-mnemonic insn) '("--unused--" "--reserved--" "--syscall--"))))
 
 ;; Set up global variables, if we haven't already.
 (define (analyze-intrinsics!)
@@ -1268,8 +1268,8 @@
 
 (define (enum-type op)
   (cond
-   ((is-h-cr64? (md-operand:hw op)) "cgen_regnum_operand_type_COPDI")
-   ((is-h-cr?   (md-operand:hw op)) "cgen_regnum_operand_type_COPSI")
+   ((is-h-cr64? (md-operand:hw op)) "cgen_regnum_operand_type_DI")
+   ((is-h-cr?   (md-operand:hw op)) "cgen_regnum_operand_type_SI")
    (else
     (case (md-operand:cdata op)
       ((POINTER)         "cgen_regnum_operand_type_POINTER") 
@@ -1395,8 +1395,8 @@
    "  cgen_regnum_operand_type_USHORT,          /* unsigned short  */\n"
    "  cgen_regnum_operand_type_CHAR,            /* char            */\n"
    "  cgen_regnum_operand_type_UCHAR,           /* unsigned char   */\n"
-   "  cgen_regnum_operand_type_COPSI,           /* __cop long      */\n"
-   "  cgen_regnum_operand_type_COPDI,           /* __cop long long */\n"
+   "  cgen_regnum_operand_type_SI,           /* __cop long      */\n"
+   "  cgen_regnum_operand_type_DI,           /* __cop long long */\n"
    "  cgen_regnum_operand_type_CP_DATA_BUS_INT, /* cp_data_bus_int */\n"
    "  cgen_regnum_operand_type_DEFAULT = cgen_regnum_operand_type_LONG\n"
    "};\n"
@@ -1530,20 +1530,14 @@
 	(else "long"))
       (if (and (not (equal? (md-operand:cdata op) 'REGNUM))
 	       (md-operand:write-index op))
-	  "&" "")))
+	  "*" "")))
 
 (define (intrinsic-protos.h) ; i.e., intrinsics.h
   (string-write 
    "\n\n"
    "/* DO NOT EDIT: This file is automatically generated by CGEN.\n"
    "   Any changes you make will be discarded when it is next regenerated.\n"
-   "\n"
-   "   FURTHERMORE: this file serves only as documentation and must not be included\n "
-   "   in any application code which wishes to use intrinsics. */\n"
-   "\n\n"
-   "#error \"This file must not be included in any application code which uses intrinsics.\"\n"
-   "#error \"It is here for documentation purposes ONLY.\"\n"
-   "\n\n"
+   "*/\n\n"
    "#if __MEP_CONFIG_CP_DATA_BUS_WIDTH == 64\n"
    "  typedef long long cp_data_bus_int;\n"
    "#else\n"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: intrinsics.scm patch
  2009-04-17  2:07   ` DJ Delorie
@ 2009-04-18  7:49     ` Richard Sandiford
  2009-04-19  1:03       ` DJ Delorie
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Sandiford @ 2009-04-18  7:49 UTC (permalink / raw)
  To: DJ Delorie; +Cc: Dave Brolley, cgen

DJ Delorie <dj@redhat.com> writes:
>> I can't comment on this, having never worked with it. Probably you and 
>> Richard Sandiford are the only ones who have worked on this.
>
> As far as I know, only MeP uses it (or will, once the port is
> accepted).  Richard, do you have any comments on the patch?  Or would
> you like me to take over intrinsics.scm?

The patch looks fine.  Out of interest, are you maintaining
the distinction between cgen_regnum_operand_type_LONG and
cgen_regnum_operand_type_(COP)SI for purely documentational reasons,
or is there a correctness reason too?

As far as taking it over goes, that's certainly OK with me.
I've fond memories of the MeP work, but I was never an official
FSF maintainer of intrinsics.scm, and I've been out of the loop for
too long to be of much use.

Richard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: intrinsics.scm patch
  2009-04-18  7:49     ` Richard Sandiford
@ 2009-04-19  1:03       ` DJ Delorie
  2009-04-20 15:13         ` Dave Brolley
  0 siblings, 1 reply; 7+ messages in thread
From: DJ Delorie @ 2009-04-19  1:03 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: brolley, cgen


> The patch looks fine.  Out of interest, are you maintaining the
> distinction between cgen_regnum_operand_type_LONG and
> cgen_regnum_operand_type_(COP)SI for purely documentational reasons,
> or is there a correctness reason too?

Minimal change, that's all.  I suspect we need to keep the difference
intact elsewhere to get constraints right, though.

> As far as taking it over goes, that's certainly OK with me.  I've
> fond memories of the MeP work, but I was never an official FSF
> maintainer of intrinsics.scm, and I've been out of the loop for too
> long to be of much use.

Ok, if Dave doesn't mind I'll take it over for now.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: intrinsics.scm patch
  2009-04-19  1:03       ` DJ Delorie
@ 2009-04-20 15:13         ` Dave Brolley
  2009-04-20 19:38           ` DJ Delorie
  0 siblings, 1 reply; 7+ messages in thread
From: Dave Brolley @ 2009-04-20 15:13 UTC (permalink / raw)
  To: DJ Delorie; +Cc: Richard Sandiford, cgen

DJ Delorie wrote:
>
> Ok, if Dave doesn't mind I'll take it over for now.
>   
I don't mind.

Dave

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: intrinsics.scm patch
  2009-04-20 15:13         ` Dave Brolley
@ 2009-04-20 19:38           ` DJ Delorie
  0 siblings, 0 replies; 7+ messages in thread
From: DJ Delorie @ 2009-04-20 19:38 UTC (permalink / raw)
  To: Dave Brolley; +Cc: rdsandiford, cgen


> I don't mind.

Committed then.  Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-20 19:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-08 21:09 intrinsics.scm patch DJ Delorie
2009-04-09 15:29 ` Dave Brolley
2009-04-17  2:07   ` DJ Delorie
2009-04-18  7:49     ` Richard Sandiford
2009-04-19  1:03       ` DJ Delorie
2009-04-20 15:13         ` Dave Brolley
2009-04-20 19:38           ` DJ Delorie

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).