public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@transmeta.com>
To: Hans-Peter Nilsson <hans-peter.nilsson@axis.com>
Cc: cgen@sources.redhat.com
Subject: [RFA:] Simplification transformations in semantics.scm
Date: Fri, 13 Dec 2002 06:10:00 -0000	[thread overview]
Message-ID: <15865.59974.251811.291863@xris-athlon.transmeta.com> (raw)
In-Reply-To: <200212070354.gB73s0b2019391@ignucius.axis.se>

Hans-Peter Nilsson writes:
 > Another way (independently correct AFAICT) to make model support
 > work for me would be to make the model machinery just ignore the
 > semantics of the insn and use the operands I *tell it* to use in
 > the model description, as long as it can find them in the format
 > description.  Right now inputs and outputs of units are filtered
 > through whatever is collected from the semantic compilation, so
 > "op" in (set (reg h-hw (index-of (operand op))) src) is *not*
 > marked as an output operand.  Subsequently, with (op INT -1) in
 > a unit output list, the model function for that unit always get
 > -1 for that operand; op is listed as an input but not as an
 > output.  Gah!  That's a bug, I think; the unit input and output
 > should override what the semantic compiler thinks.

One way to solve this which I thought I implemented (but now can't
find it) is something along these lines.

Suppose you could give names to expressions in the semantic code
and use these names in the model description.
Note that I don't think you want to use the format description
as some operands can be implicit.

e.g. something like

;[sr,dr are operands]

(dni add-gr-13
  ...
  (sequence ((QI tmp))
    (set tmp (rename QI foo (reg QI h-gr 13)))
    (set dr (add tmp sr)))
  ((model-baz (unit u-exec (in src1 sr) (in src2 foo) (out dr #f))))
)

Here `rename' is being used to attach a name to something that is then
referenced by the model parameters of the dni.

semantic operand sr -> u-exec input src1
semantic operand foo -> u-exec input src2
semantic operand dr -> u-exec output dr

[The `tmp' is unnecessary of course.]

I _think_ this will be very easy to implement and very flexible.
Thoughts?

 > In summary, this patch simplifies (as the comments say):
 > 
 > (reg XMODE h-hw (index-of YMODE (operand XMODE op)))
 >  into
 > (operand XMODE op)))
 > 
 > (SET (if IFMODE COND ltrue lfalse) src)
 >  into (for SET = {set, set-quiet}):
 > (if COND (SET ltrue dst) (SET lfalse dst))
 > 
 > (reg h-hw RMODE (if COND ntrue nfalse))
 >  into
 > (if RMODE COND (reg h-hw RMODE ntrue)
 > 	       (reg h-hw RMODE nfalse))
 >  but only if simplification makes that latter expression
 >  not take that form, i.e. (if COND (reg...) (reg...))

How much pain would it be if we continue to disallow
conditions in the left side of `set'?
I don't mind adding something that let's one write such
conditions as long as they get removed before the rtl parser sees them.
By that I mean above the rtl language we can play some games,
but at the level of the rtl language, conditions in the left side
of `set' do not exist.  E.g. maybe a special form or macro
that makes things look "as if" there's a condition present.
I think it's more or less what you already have, except I want
the transformations to live above the rtl language line, not below it.
Sound reasonable?


[ok, now I'm off to get some sleep ...]

  parent reply	other threads:[~2002-12-13 14:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-06 19:54 Hans-Peter Nilsson
2002-12-06 20:29 ` Hans-Peter Nilsson
2002-12-06 21:26 ` Doug Evans
2002-12-13 21:44   ` Hans-Peter Nilsson
2002-12-13  6:10 ` Doug Evans [this message]
2002-12-13  6:56   ` Hans-Peter Nilsson
2002-12-13 16:52     ` Doug Evans
2002-12-13 17:40       ` Hans-Peter Nilsson

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=15865.59974.251811.291863@xris-athlon.transmeta.com \
    --to=dje@transmeta.com \
    --cc=cgen@sources.redhat.com \
    --cc=hans-peter.nilsson@axis.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).