This is the mail archive of the cgen@sourceware.org mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] intrinsics: switch from C to RTL.


GCC no longer uses C-based intrinsics; they're defined in RTL (*.md)
files now.  This accomodates that.  Committed.

2009-05-13  DJ Delorie  <dj@redhat.com>

	* intrinsics.scm (insns.md): Add RTL predicates.
	(intrinsics.h): Remove old C intrinsics.

Index: intrinsics.scm
===================================================================
RCS file: /cvs/src/src/cgen/intrinsics.scm,v
retrieving revision 1.2
diff -p -U3 -r1.2 intrinsics.scm
--- intrinsics.scm	20 Apr 2009 19:38:09 -0000	1.2
+++ intrinsics.scm	14 May 2009 01:38:44 -0000
@@ -1245,6 +1245,25 @@
    "\n\n")
   (analyze-intrinsics!)
   (message "Generating .md file...\n")
+
+  (init-immediate-predicate!)
+  (for-each-argument note-immediates)
+
+  ;; Define the immediate predicates.
+  (for-each
+   (lambda (entry)
+     (let* ((op (cdr entry))
+	    (align-mask (- (md-operand:alignment op) 1)))
+       (string-write
+	"(define_predicate \""
+	(car entry) "\"\n"
+	"  (and (match_code \"const_int\")\n"
+	"        (match_test \"(INTVAL (op) & " (st align-mask) ") == 0\n"
+	"                   && INTVAL (op) >= " (st (md-operand:lower-bound op)) "\n"
+	"                   && INTVAL (op) < " (st (md-operand:upper-bound op)) "\")))\n"
+	"\n")))
+   immediate-predicate-table)
+
   (for-each-md-insn write-insn)
   (string-write "\n")
   "")
@@ -1365,13 +1384,6 @@
 		(string-write "\"$shadow" (st (car entry)) "\"")))
   (string-write "\n\n")
 
-  ;; Declare the immediate predicates in a form suitable for PREDICATE_CODES.
-  (string-write "#define IMMEDIATE_PREDICATE_CODES")
-  (for-each
-   (lambda (entry)
-     (string-write "  \\\n  {\"" (car entry) "\", {CONST_INT}},"))
-   immediate-predicate-table)
-
   ;; Declare the index values for well-known intrinsics.
   (string-write "\n\n#ifndef __MEP__\n")
   (string-write "enum {\n")
@@ -1462,22 +1474,6 @@
 
   (string-write "#ifdef WANT_GCC_DEFINITIONS\n")
 
-  ;; Define the immediate predicates.
-  (for-each
-   (lambda (entry)
-     (let* ((op (cdr entry))
-	    (align-mask (- (md-operand:alignment op) 1)))
-       (string-write
-	"int\n"
-	(car entry) " (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)\n"
-	"{\n"
-	"  return (GET_CODE (op) == CONST_INT\n"
-	"          && (INTVAL (op) & " (st align-mask) ") == 0\n"
-	"          && INTVAL (op) >= " (st (md-operand:lower-bound op)) "\n"
-	"          && INTVAL (op) < " (st (md-operand:upper-bound op)) ");\n"
-	"}\n\n")))
-   immediate-predicate-table)
-
   ;; Create an array describing the range and alignment of immediate
   ;; predicates.
   (string-write


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]