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

LLVM: initial list[i32] implementation #484

Merged
merged 6 commits into from
May 11, 2022
Merged

Conversation

certik
Copy link
Contributor

@certik certik commented May 11, 2022

No description provided.

@certik certik requested a review from namannimmo10 May 11, 2022 18:13
@namannimmo10 namannimmo10 merged commit e5af88a into lcompilers:main May 11, 2022
@certik certik deleted the list branch May 11, 2022 20:51
@Smit-create
Copy link
Collaborator

I was thinking that this design seems to be okay just temporarily, but we can't build much over these because we can create an infinite number of different data types using the combination of basic data types. We might need to think of some alternative?

@certik
Copy link
Contributor Author

certik commented May 12, 2022

Open up an issue to discuss this. I think probably we need to operate on any "value type" that can simply be copied. We just need to know how many bytes. For some types like str, one also needs to deallocate/free them.

@certik
Copy link
Contributor Author

certik commented May 12, 2022

Probably the easiest might end up being doing this using LLVM directly --- we always know the actual types at compile time, so we can generate the proper LLVM code to handle it. So we can create an LLVM equivalent of _lcompilers_list_append_i32, by creating a function in asr_to_llvm, say create_list_append which accepts the actual type as an argument, and internally it generates the LLVM code that appends to the list, of this actual argument type. I think this will not be complicated, definitely doable for a list. For a dictionary that might be more difficult, we should look how Python handles dictionaries of any type.

@namannimmo10
Copy link
Collaborator

Yes, we should definitely see how other compilers handle this part.

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.

3 participants