-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Refactor IR memory management and pointers. #2449
Comments
When I saw the keyword I also agree with the rest of the proposal. Thanks! |
I haven't dug super deep into what LLVM has needed with opaque pointers, but I was (am?) making the assumption that it resembles their attitude with signedness in arithmetic. I.e., the value itself isn't signed but rather the operation. Same with pointers -- they just represent an address, but what you do with it is up to the operator. Hopefully in a statically typed language we wouldn't come across any ambiguities but there are always edge cases... |
Yeah exactly. LLVM analysis passes also tend to be easier to write without having to worry about needless pointer casts which would potentially improve the quality of the existing passes and enable more optimization opportunities. Also looks like support for them is complete in both Clang and LLVM! So if we have any questions, we can always consult LLVM. |
It looks to me like most of the issues listed here were solved when #2819 was fixed with #4336.
Except this. I don't see that as a priority at the moment ad we should close this issue. @IGI-111 . |
As of #2363 we have explicit reference semantics for mutable args including copy-type args.
Problem
This is a bit of a stop-gap measure though as memory management in the IR is inconsistent and sometimes ambiguous.
In particular:
mem_cpy
ormem_set
.There's probably other things I've forgotten right now.
Proposal
I think to address some of these issues we should change the following:
store
andload
only for integer 64-bit types and with explicit pointer src/dst.mut
keyword needed.get_ptr
as LLVM'sGEP
, update where needed in the land of explicit pointers. Useint_to_ptr
andptr_to_int
instead of casting inget_ptr
.I guess not all of these should be done in a single PR, but much of it will need to be done together to remain workable without intermediate hacks. This is another of those not-urgent-but-should-be-done-sooner-rather-than-later-to-avoid-pain.
The text was updated successfully, but these errors were encountered: