Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use allocas for variables #68

Merged
merged 1 commit into from
Jan 10, 2024
Merged

Conversation

edg-l
Copy link
Member

@edg-l edg-l commented Jan 10, 2024

Depends on #67

The previous version used always registers, which will make some future things not quite possible, using allocas is the way to avoid some limitations of SSA and makes easier to implement branches.

Ultimately though, the simple.con program gets compiled to the same code.

The add_plus_two function:

0000000000000030 <add_plus_two>:
  30:   8d 44 37 02             lea    eax,[rdi+rsi*1+0x2]
  34:   c7 44 24 fc 02 00 00    mov    DWORD PTR [rsp-0x4],0x2
  3b:   00 
  3c:   c3                      ret

Base automatically changed from basic_codegen to main January 10, 2024 21:30
@unbalancedparentheses unbalancedparentheses merged commit a55b079 into main Jan 10, 2024
4 checks passed
@edg-l edg-l deleted the locals_use_allocas branch May 8, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants