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 class/type lowering, add static calls #312
Conversation
Adding qualifiers as an MLIR attribute to function declarations.
ef0ff1a
to
8e93a60
Compare
This is a massive change, but it's one that moves towards simpler code and IR. The main changes are: 1. There are no special types any more Integer, float, bool are all "classes" and they get casted to whatever needed for arguments and return values. All numeric types will be coded like classes with dynamic calls in the future, so that fits better with the model. Lowering of native arithmetic will be done when lowering to LLVM, with special lowering for known patterns. 2. The DescriptorType was created That's a handler to a class for static calls. Unlike dynamic calls, we don't have an object to infer what the type is, so we create this type that will hold a (global, unique) handler to lower a call in the same way as dynamic calls, but with that handler instead of an object. 3. Two new operations were created: Call and Static Call implements both dynamic and static calls, by taking the handlers (descriptor or object) and call a method by name and arguments. Static gets the descriptor of a type, to be able to call its static methods.
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.
Some minor nits, nothing that should block a merge. This looks like a big improvement and will make it fairly trivial to support things like U27 as storage-only types and U32 as types with operations defined on them.
There are a few bits where the terminology in the compiler appears to be diverging from the terminology in the language, we should try to unify those.
- Clean up some misleading comments - Only add function attributes if non-empy
} | ||
|
||
UnknownType UnknownType::get(MLIRContext* ctx) | ||
Type StaticClassType::getTypes() const |
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.
This shouldn't be in the plural form.
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.
good catch, I'll fix it.
This is a massive change, but it's one that moves towards simpler code
and IR. The main changes are:
Integer, float, bool are all "classes" and they get casted to whatever
needed for arguments and return values. All numeric types will be coded
like classes with dynamic calls in the future, so that fits better with
the model.
Lowering of native arithmetic will be done when lowering to LLVM, with
special lowering for known patterns.
That's a handler to a class for static calls. Unlike dynamic calls, we
don't have an object to infer what the type is, so we create this type
that will hold a (global, unique) handler to lower a call in the same
way as dynamic calls, but with that handler instead of an object.
Call implements both dynamic and static calls, by taking the handlers
(descriptor or object) and call a method by name and arguments.
Static gets the descriptor of a type, to be able to call its static
methods.
We should start annotating our nodes with the extra information that
comes from the AST and the difference between static and dynamic
calls is an important one.
The implementation is not limited to it, but so far, we only have examples
to that one.
VeronaTypes.h
)Please check to make sure my comments are accurate.
Fixes #280