From: | "Whywhat" <avayvod@gmail.com> |
Newsgroups: | comp.compilers |
Date: | 11 Feb 2006 13:17:06 -0500 |
Organization: | http://groups.google.com |
References: | 06-02-055 |
Keywords: | registers |
Posted-Date: | 11 Feb 2006 13:17:06 EST |
Hello.
Very good book indeed is so called Dragon book by Sethi, Aho and
Ullman:``Compilers Principles, Techniques and Tools''. It's good for
beginners and has a lot of information on almost every topic connected
with compilers. As for Modern Compiler Design - I guess that it is for
more advanced readers though I don't know really as didn't read it.
Anyway it won't be useless for you, I'm sure.
1) I think this is a pretty good way to grow a tree. :)
2) You can download sources of LLVM system and look for register
allocation implementations here (LLVM\lib\CodeGen as far as I remember)
There you'll find improved linear scan algo - so called iterative scan.
Remember that x86 doesn't have enough registers to satisfy your program
needs (I guess, no architecture has enough registers ;)) So some of
your variables will be stored in memory (e.g. on local stack; it's
called spilling). But, of course, they should be loaded on register
when performing operations on them. Thus you should either use two
predefined registers for loading/storing variables from/to memory. Or
modify your code and rerun the allocation algorithm. The latter is
harder to implement.
3) Yep, I think this is the easiest way.
Good luck!!!
Return to the
comp.compilers page.
Search the
comp.compilers archives again.