skip to content
Dévai Gergely @ ELTE
User Tools
Log In
Site Tools
Search
Tools
Show pagesource
Old revisions
Backlinks
Recent Changes
Media Manager
Sitemap
Log In
>
Recent Changes
Media Manager
Sitemap
Trace:
•
Register allocation example
Sidebar
Info
in English
en Esperanto
magyarul
ELTE
Órarend
Timetable
BSc Formális nyelvek és fordítóprogramok (B szakirány)
MSc Fordítóprogramok
BSc Fordítóprogramok (kifutó tárgy)
Compilers
Software Technology Lab
Research
Research
mscfordprog:regalloc
Register allocation example
Rules:
t ← num
mov t,num
t ← var (if var can be stored in reg)
mov t,t_var
t ← Exp1 + Exp2
t1 ← Exp1
t2 ← Exp2
mov t,t1
add t,t2
var := Exp (if var can be in reg)
t_var ← Exp
Example: y := y+1; x := x + 2 - y;
mov t1,ty ;t1 ty
mov t2,1 ;t1 ty t2
mov ty,t1 ;t1 ty t2
add ty,t2 ; ty t2
mov t3,tx ; ty tx t3
mov t4,2 ; ty tx t3 t4
mov t5,t3 ; ty tx t3 t4
add t5,t4 ; ty tx t4 t5
mov t6,ty ; ty tx t5 t6
mov t7,t5 ; tx t6 t7
sub t7,t6 ; tx t6 t7
mov tx,t7 ; tx t7
mscfordprog/regalloc.txt
· Last modified: 2019/02/19 21:23 by
deva
Page Tools
Show pagesource
Old revisions
Backlinks
Back to top