Skip to content

Commit

Permalink
Try to fix call stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Yey007 committed May 15, 2024
1 parent 5bc0725 commit 920d552
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
![CI Status](https://github.com/ethanuppal/cs3110_compiler/actions/workflows/ci.yaml/badge.svg)

> "x86 is simple trust me bro"
> Last updated: 2024-05-15 00:08:30.197268
> Last updated: 2024-05-15 00:23:21.691740
```
$ ./main -h
Expand Down
6 changes: 5 additions & 1 deletion lib/backend/asm_emit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ let emit_cfg ~text cfg regalloc =
(Asm.Label.make ~is_global:true ~is_external:false
(mangle (Cfg.name_of cfg))));
Asm.Section.add_all text
[ Push (Register RBP); Mov (Register RBP, Register RSP) ];
[
Push (Register RBP);
Mov (Register RBP, Register RSP);
Sub (Register RSP, Intermediate (align_offset var_size));
];
(* restore is done at returns *)
emit_save_registers text Asm.Register.callee_saved_data_registers;
Cfg.blocks_of cfg |> List.iter (emit_bb text cfg regalloc)

0 comments on commit 920d552

Please sign in to comment.