Re: Help on code generation and register allocation

"Whywhat" <avayvod@gmail.com>
11 Feb 2006 13:17:06 -0500

          From comp.compilers

Related articles
Help on code generation and register allocation Forum.Thomas.Krause@gmx.de (Thomas Krause) (2006-02-07)
Re: Help on code generation and register allocation d148f3wg02@sneakemail.com (Karsten Nyblad) (2006-02-11)
Re: Help on code generation and register allocation kym@ukato.freeshell.org (russell kym horsell) (2006-02-11)
Re: Help on code generation and register allocation avayvod@gmail.com (Whywhat) (2006-02-11)
Re: Help on code generation and register allocation u.hobelmann@web.de (Ulrich Hobelmann) (2006-02-12)
Re: Help on code generation and register allocation avayvod@gmail.com (Whywhat) (2006-02-14)
Re: Help on code generation and register allocation u.hobelmann@web.de (Ulrich Hobelmann) (2006-02-14)
Re: Help on code generation and register allocation torbenm@app-5.diku.dk (2006-02-17)
Re: Help on code generation and register allocation boldyrev@cgitftp.uiggm.nsc.ru (Ivan Boldyrev) (2006-02-17)
Re: Help on code generation and register allocation fw@deneb.enyo.de (Florian Weimer) (2006-02-17)
[1 later articles]
| List of all articles for this month |

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

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!!!



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.