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

feat: Lower arrays #82

Merged
merged 1 commit into from
Aug 27, 2024
Merged

feat: Lower arrays #82

merged 1 commit into from
Aug 27, 2024

Conversation

mark-koch
Copy link
Contributor

Closes #24

@mark-koch mark-koch requested a review from a team as a code owner August 21, 2024 12:39
@mark-koch mark-koch requested a review from croyzor August 21, 2024 12:39
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 80.95238% with 8 lines in your changes missing coverage. Please review.

Project coverage is 82.92%. Comparing base (97ee196) to head (2c91ee9).

Files Patch % Lines
src/custom/prelude.rs 80.95% 2 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
- Coverage   82.97%   82.92%   -0.05%     
==========================================
  Files          18       18              
  Lines        2390     2431      +41     
  Branches     2390     2431      +41     
==========================================
+ Hits         1983     2016      +33     
- Misses        253      255       +2     
- Partials      154      160       +6     
Flag Coverage Δ
rust 82.92% <80.95%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@@ -174,6 +209,12 @@ impl<'c, H: HugrView, PCG: PreludeCodegen> CodegenExtension<'c, H>
let signal_ty = ctx.i32_type().into();
let message_ty = ctx.i8_type().ptr_type(AddressSpace::default()).into();
Ok(ctx.struct_type(&[signal_ty, message_ty], false).into())
} else if hugr_type.name() == "array" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prelude unfortunately doesn't export a name constant for the array type

&self,
_session: &TypingSession<'c, H>,
elem_ty: BasicTypeEnum<'c>,
size: u64,
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this arg should be a u32

Copy link
Contributor Author

@mark-koch mark-koch Aug 27, 2024

Choose a reason for hiding this comment

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

Hugr's TypeArg::BoundedNat which is used to specify array lengths is u64. Other implementors of PreludeCodegen might have different ways of interpreting this number, so I'd prefer to leave the conversion to implementors of the trait

@mark-koch mark-koch added this pull request to the merge queue Aug 27, 2024
Merged via the queue into main with commit f6db62c Aug 27, 2024
10 checks passed
@mark-koch mark-koch deleted the feat/array branch August 27, 2024 16:13
@hugrbot hugrbot mentioned this pull request Aug 27, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 27, 2024
## 🤖 New release
* `hugr-llvm`: 0.2.1 -> 0.3.0

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.3.0](v0.2.1...v0.3.0) -
2024-08-27

### New Features
- [**breaking**] Lower string, print, and panic
([#78](#78))
- Lower float operations
([#83](#83))
- Lower logic extension
([#81](#81))
- Lower arrays ([#82](#82))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).
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.

Implement codegen extension for prelude
3 participants