-
Notifications
You must be signed in to change notification settings - Fork 2
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
TIR: Intrinsic overhaul, remove hash-intrinsics
and make everything more declarative
#969
Conversation
hash-intrinsics
and making everything more declarativehash-intrinsics
and make everything more declarative
use hash_tir::intrinsics::definitions::{ | ||
BinOp as TirBinOp, CondBinOp as TirCondBinOp, | ||
ShortCircuitingBoolOp as TirShortCircuitingBoolOp, UnOp as TirUnOp, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, verbose naming 💯
I feel like we should unify operators in hash-source
, especially since we will kind of need to do that if we want to share using the Const
representation across the compiler. Perhaps, even define it in hash-token
?
It would eliminate:
ir::BinOp
ir::UnOp
ast::BinOp
ast::UnOp
tir::BinOp
tir::UnOp
But maybe the separation makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a bit different because the operators defined in the AST do not necessarily correlate with the "intrinsic" operations that can be defined on TIR terms. For example, with the new constant stuff a lot of the intrinsics will greatly simplify/become redundant. I think I will first adapt to Const
in another PR and then we can consider this separation more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we do integrate the new constant stuff, we will still have to define some kind of common operator kinds, I guess for now the IR can just rely on them and the TIR can define conversions for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I agree that there should be some unification here.. Yet another todo item
Co-authored-by: Alexander Fedotov <alexander.fedotov.uk@gmail.com>
hash_tir::intrinsics::definitions
in a declarative syntax that mirrors Hash.Term::Intrinsic
is added, which accepts a single enum argument that represents the chosen intrinsic.Ok(None)
to signal that the call to the intrinsic cannot be simplified.Closes #963
@feds01 I have left a
@@Todo
in the function discoverer for lowering, I am not sure if I should discover the intrinsics as well or that isn't needed anymore.