diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-03-31 13:51:00 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-03-31 13:51:00 -0400 |
commit | 868667ea27271660eba1128886cfeea5ffbc4f5c (patch) | |
tree | e0be09b6b2900edca39c186620d7786594484111 /lo2.ml | |
parent | 6d6b1ef4b076e72623a46f45308aba80edc2b4e5 (diff) | |
download | roux-868667ea27271660eba1128886cfeea5ffbc4f5c.tar.gz |
add move constant to spill
Diffstat (limited to 'lo2.ml')
-rw-r--r-- | lo2.ml | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lo2.ml b/lo2.ml index d068e01..7333ea1 100644 --- a/lo2.ml +++ b/lo2.ml @@ -122,7 +122,7 @@ let regalloc (p: iprog): rprog = let bb = ref [] in (* Basic block in construction. *) let emiti l i = bb := {ri_res=l; ri_ins=i} :: !bb in let act = H.create 101 in (* The active list. *) - let free = ref [0;1;2;3] in (* Free registers. *) + let free = ref [0;1] in (* Free registers. *) let nspill = ref 0 in let newspill () = incr nspill; !nspill - 1 in @@ -423,6 +423,12 @@ let codegen (p: mprog): string = let move l l1 = match l, l1 with | (LReg _ as r), LCon k -> oins 0xc7 0 (regn r); outs (lite k) + | LSpill s, LCon k -> assert (s<256/8); + outb 0x48; + outb 0xc7; + outb (modrm ~md:1 0 5); + outb (s*4); + outs (lite k) | (LReg _ as r), (LReg _ as r1) -> let rex, r1, r = rexp (regn r1) (regn r) in outb rex; outb 0x89; outb (modrm r1 r) |