linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Given <dg@cowlark.com>
To: linux-sparse@vger.kernel.org
Subject: Re: Writing compilers, and example.c vs compile-i386.c
Date: Sat, 21 Jun 2008 00:46:24 +0100	[thread overview]
Message-ID: <485C4150.2080508@cowlark.com> (raw)
In-Reply-To: <70318cbf0806171741g4d099e92vf0c0e9d7588fd7d6@mail.gmail.com>

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

Christopher Li wrote:
[...]
> BTW, you shouldn't take example.c too seriously per Linus' suggestion.

It does show the telltale signs of being hacked together on an
experimental basis, but it's proving invaluable as a source for getting
my own stuff working --- and it *is* working, I can actually generate
more or less correct code! (Assuming you like adding numbers together,
of course.) The register allocation algorithm example.c uses is
extremely noddy but seems to be reasonably effective; as my
'architecture' has a large but finite number of 'registers', all I
really need is something to cause dead registers to be reused, for which
this is perfectly adequate.

(I suspect that bolting on a real register allocator ought to be very
easy given that the code's already in SSA form. Maybe at some stage I'll
have a look, but register allocators really aren't my strong point.)

I do, however, still have a few other queries...

- how do you determine the scalar type of a pseudo?

For example, I haven't found any way yet of distinguishing between an
int and a float. I need to generate different code for these, but there
don't seem to be any relevant fields in pseudo_t. There isn't even
anything in the pseudo's storage structure. The instruction sometimes
has a size field, but these aren't unique. I may need this for other
things than float support; for example, I may need to generate special
pointer arithmetic code.

- if I wish to rewrite a basic block's instruction list --- for example,
to decompose instructions that use a non-register pseudo into two
instructions --- do I need to do anything other than iterate through the
bb's list and insert instruction nodes? Is there any additional
housekeeping to do? Naturally, I'd do this *before* calling
track_pseudo_death()...

- what does expand_symbol() do?

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

  reply	other threads:[~2008-06-20 23:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-16 23:04 Writing compilers, and example.c vs compile-i386.c David Given
2008-06-16 23:50 ` Mike Frysinger
2008-06-17  0:49 ` Christopher Li
2008-06-17 23:35   ` David Given
2008-06-18  0:41     ` Christopher Li
2008-06-20 23:46       ` David Given [this message]
2008-06-21  1:40         ` Christopher Li
2008-06-24 13:29           ` David Given

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=485C4150.2080508@cowlark.com \
    --to=dg@cowlark.com \
    --cc=linux-sparse@vger.kernel.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 NNTP newsgroup(s).