Re: Writing compilers, and example.c vs compile-i386.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux