public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Schmidt <bernds@codesourcery.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: C6X port 9/11: Allow defining attributes in terms of another
Date: Tue, 10 May 2011 16:54:00 -0000	[thread overview]
Message-ID: <4DC95DFE.5050902@codesourcery.com> (raw)
In-Reply-To: <4DC956D0.3040306@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

I've found it useful to use a construct such as the following:

(define_attr "units64"
  "unknown,d,d_addr,l,m,s,dl,ds,dls,ls"
  (const_string "unknown"))

(define_attr "units64p"
  "unknown,d,d_addr,l,m,s,dl,ds,dls,ls"
  (attr "units64"))

to define one attribute in terms of another by default, allowing
individual insn patterns to override the definition of "units64p" where
necessary. This patch adds support for this in genattrtab.


Bernd

[-- Attachment #2: ga-attr.diff --]
[-- Type: text/plain, Size: 1141 bytes --]

	* genattrtab.c (evaluate_eq_attr): Allow an attribute to be defined
	in terms of another.

Index: genattrtab.c
===================================================================
--- genattrtab.c.orig
+++ genattrtab.c
@@ -1916,6 +1916,37 @@ evaluate_eq_attr (rtx exp, struct attr_d
   rtx newexp;
   int i;
 
+  while (GET_CODE (value) == ATTR)
+    {
+      struct attr_value *av = NULL;
+
+      attr = find_attr (&XSTR (value, 0), 0);
+
+      if (insn_code_values)
+        {
+          struct attr_value_list *iv;
+          for (iv = insn_code_values[insn_code]; iv; iv = iv->next)
+            if (iv->attr == attr)
+              {
+                av = iv->av;
+                break;
+              }
+        }
+      else
+        {
+          struct insn_ent *ie;
+          for (av = attr->first_value; av; av = av->next)
+            for (ie = av->first_insn; ie; ie = ie->next)
+              if (ie->def->insn_code == insn_code)
+                goto got_av;
+        }
+      if (av)
+        {
+        got_av:
+          value = av->value;
+        }
+    }
+
   switch (GET_CODE (value))
     {
     case CONST_STRING:

  parent reply	other threads:[~2011-05-10 15:48 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10 15:36 The TI C6X port Bernd Schmidt
2011-05-10 15:38 ` C6X port 1/11: Reorganize schedule_block Bernd Schmidt
2011-05-10 15:40 ` C6X port 2/11: Use a structure for schedule_block variables Bernd Schmidt
2011-05-10 15:41 ` C6X port 3/11: Cache dependency costs Bernd Schmidt
2011-05-10 15:48 ` C6X port 4/11: Backtracking scheduler Bernd Schmidt
2011-05-11  9:14   ` Richard Sandiford
2011-05-11 11:24     ` Bernd Schmidt
2011-05-25 10:16   ` Hans-Peter Nilsson
2011-05-10 15:54 ` C6X port 5/11: Track predication conditions more accurately Bernd Schmidt
2011-05-11 12:26   ` Alexander Monakov
2011-05-12 18:31     ` Bernd Schmidt
2011-05-31 20:34   ` Steve Ellcey
     [not found]     ` <4DE5489F.4020005@hotbox.ru>
2011-06-01  8:19       ` Andrey Belevantsev
2011-06-01 15:40         ` Steve Ellcey
2011-06-02 11:30           ` Initialize INSN_COND (was: C6X port 5/11: Track predication conditions more accurately) Alexander Monakov
2011-06-02 11:35             ` Initialize INSN_COND Bernd Schmidt
2011-06-03 17:44               ` Alexander Monakov
2011-06-03 17:50                 ` Bernd Schmidt
2011-06-07 17:40                   ` Alexander Monakov
2011-06-07 18:11                     ` Gary Funck
2011-06-07 18:28                       ` Gary Funck
2011-06-07 18:35                       ` Gary Funck
2011-06-07 18:56                       ` Alexander Monakov
2011-06-07 20:45                     ` Bernd Schmidt
2011-06-02 22:30             ` Initialize INSN_COND (was: C6X port 5/11: Track predication conditions more accurately) Steve Ellcey
2011-06-03 17:38               ` Steve Ellcey
2011-06-03 18:04                 ` Steve Ellcey
2011-05-10 16:16 ` C6X port 6/11: REG_WORDS_BIG_ENDIAN Bernd Schmidt
2011-05-10 16:51 ` C6X port 8/11: A new FUNCTION_ARG macro Bernd Schmidt
2011-05-10 18:55   ` Joseph S. Myers
2011-05-12 18:20     ` Bernd Schmidt
2011-05-17  7:19       ` Paolo Bonzini
2011-05-27 17:40         ` Bernd Schmidt
2011-05-27 23:26           ` Paolo Bonzini
2011-05-10 16:54 ` Bernd Schmidt [this message]
2011-05-16 18:35   ` C6X port 9/11: Allow defining attributes in terms of another Bernd Schmidt
2011-05-25 10:27   ` Hans-Peter Nilsson
2011-05-25 12:03     ` Bernd Schmidt
2011-05-25 14:22       ` Hans-Peter Nilsson
2011-05-26 13:51         ` Bernd Schmidt
2011-05-10 16:56 ` C6X port 11/11: Testcases Bernd Schmidt
2011-07-15 10:06   ` Bernd Schmidt
2011-07-15 12:48     ` H.J. Lu
2011-07-15 12:50       ` Bernd Schmidt
2011-07-15 18:23     ` Mike Stump
2011-05-10 17:02 ` C6X port 10/11: The port Bernd Schmidt
2011-05-10 22:51   ` Joseph S. Myers
2011-05-13 13:59     ` Bernd Schmidt
2011-05-13 15:52       ` Joseph S. Myers
2011-05-13 16:00         ` Bernd Schmidt
2011-05-13 16:08           ` Joseph S. Myers
2011-05-16 18:45         ` Bernd Schmidt
2011-06-16 21:45           ` Joseph S. Myers
2011-05-10 18:29 ` The TI C6X port Joseph S. Myers
2011-05-11 12:18   ` Bernd Schmidt
2011-05-11 12:21     ` Joseph S. Myers
2011-05-13 14:57   ` C6X port 13/11: MAINTAINERS Bernd Schmidt
2011-05-22 18:26     ` Gerald Pfeifer
2011-05-13 13:59 ` Prefixes for libgcc symbols (C6X 9.5/11) Bernd Schmidt
2011-05-13 15:23   ` Joseph S. Myers
2011-05-13 18:24     ` Bernd Schmidt
2011-05-25 14:00       ` H.J. Lu
2011-05-25 14:20         ` Bernd Schmidt
2011-05-25 14:26           ` H.J. Lu
2011-05-25 14:29             ` Bernd Schmidt
2011-05-25 15:14               ` Jakub Jelinek
2011-05-25 17:28               ` H.J. Lu
2011-05-25 17:30                 ` Bernd Schmidt
2011-05-17  7:20   ` Paolo Bonzini
2011-05-24 10:33   ` Ian Lance Taylor
2011-05-26 12:56     ` Bernd Schmidt
2011-05-27  6:23       ` Jack Howarth
2011-05-27  9:59         ` Bernd Schmidt
2011-05-13 14:26 ` C6X port 12/11: htdocs Bernd Schmidt
2011-05-13 15:53   ` Joseph S. Myers
2011-05-13 16:28     ` Bernd Schmidt
2011-05-14  0:53       ` Gerald Pfeifer
2011-05-23 10:26 ` The TI C6X port Bernd Schmidt
2011-05-25  7:15   ` Vladimir Makarov
2011-05-27 16:33     ` Bernd Schmidt
2011-07-13 10:26     ` Bernd Schmidt
2011-05-23 10:33 ` Ping: C6X miscellaneous new hooks Bernd Schmidt
2011-05-23 10:44 ` Ping: C6X libgcc changes Bernd Schmidt
2011-05-30 11:21 ` Ping: The TI C6X port Bernd Schmidt
2011-06-06 11:26   ` Bernd Schmidt
2011-06-14 11:18     ` Bernd Schmidt
2011-06-19  1:10       ` Richard Henderson
2011-06-27 10:20       ` Bernd Schmidt
2011-07-07 22:32         ` Bernd Schmidt
2011-07-07 22:36           ` Richard Henderson
2011-07-07 22:37           ` Richard Henderson
2011-06-14 21:33     ` Vladimir Makarov
2011-07-14 12:15       ` Bernd Schmidt
2011-06-06 12:54   ` Gerald Pfeifer
2011-06-06 13:02     ` Bernd Schmidt
2011-07-11 11:03     ` Bernd Schmidt
2011-07-11 16:05       ` Mike Stump
2011-07-11 16:24         ` Gerald Pfeifer
2011-07-15  9:42           ` Bernd Schmidt

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=4DC95DFE.5050902@codesourcery.com \
    --to=bernds@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).