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

backend: reserve registers not preserved across function calls in RISC-V #2853

Merged
merged 2 commits into from
Jul 6, 2024

Conversation

superlopuh
Copy link
Member

A little correctness improvement, we should only be allocating to s registers if there's a function call, of which there should be 0 for the foreseeable future, but it's nice not to silently miscompile.

@superlopuh superlopuh added the backend Compiler backend in xDSL label Jul 6, 2024
@superlopuh superlopuh self-assigned this Jul 6, 2024
Copy link

codecov bot commented Jul 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.89%. Comparing base (23745a6) to head (f4b4923).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2853      +/-   ##
==========================================
- Coverage   89.89%   89.89%   -0.01%     
==========================================
  Files         398      398              
  Lines       49659    49674      +15     
  Branches     7633     7634       +1     
==========================================
+ Hits        44641    44654      +13     
- Misses       3821     3822       +1     
- Partials     1197     1198       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@zero9178 zero9178 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with small comment

@@ -26,6 +26,12 @@ def gather_allocated(func: riscv_func.FuncOp) -> set[RISCVRegisterType]:
if not isinstance(op, RISCVAsmOperation):
continue

if isinstance(op, riscv_func.CallOp):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth putting a command here as to why this is done for whoever is going to implement call ABI to find and remove this.

@superlopuh superlopuh merged commit 483f332 into main Jul 6, 2024
10 checks passed
@superlopuh superlopuh deleted the sasha/riscv/function-call-t-a-regs branch July 6, 2024 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Compiler backend in xDSL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants