-
Notifications
You must be signed in to change notification settings - Fork 100
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
[CIR][Codegen] RTTI support for virtual class inheritence #259
Conversation
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.
Thanks for adding RTTI support for vbases
continue; | ||
emitError() << "expected GlobalViewAttr attribute"; | ||
emitError() << "expected GlobalViewAttr or IntAttr attribute"; |
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.
The fact that TypeInfo
now supports a IntAttr seems a bit arbitrary in this PR, what does it mean? Can you add some docs to TypeInfoAttr
?
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.
The integers are for
// Itanium C++ ABI 2.9.5p6c:
// __flags is a word with flags describing details about the class
// structure, which may be referenced by using the __flags_masks
// enumeration. These flags refer to both direct and indirect bases.
unsigned Flags = ComputeVMIClassTypeInfoFlags(RD);
Fields.push_back(mlir::cir::IntAttr::get(UnsignedIntLTy, Flags));
and
// Itanium C++ ABI 2.9.5p6c:
// __base_count is a word with the number of direct proper base class
// descriptions that follow.
Fields.push_back(mlir::cir::IntAttr::get(UnsignedIntLTy, RD->getNumBases()));
Updated doc for TypeInfoAttr
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 was more curious about the meaning of those, which I just explained better in the other comment: use enum kind attributes for the flags.
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.
We can use a enum attribute for the flags, but the int attribute is still needed for getNumBases
?
@@ -303,7 +303,8 @@ def TypeInfoAttr : CIR_Attr<"TypeInfo", "typeinfo", [TypedAttrInterface]> { | |||
|
|||
The verifier enforces that the output type is always a `!cir.struct`, | |||
and that the ArrayAttr element types match the equivalent member type | |||
for the resulting struct. | |||
for the resulting struct, i.e, a GlobalViewAttr for symbol reference or | |||
an IntAttr for flags. |
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 still would prefer not to use an IntAttr but a enum kind attr that contains BCTI_Virtual, BCTI_Public, etc (and incrementally add the enums as we get usecases). Using IntAttr
feels too opaque and already LLVM-like. Are there restrictions to doing such approach?
continue; | ||
emitError() << "expected GlobalViewAttr attribute"; | ||
emitError() << "expected GlobalViewAttr or IntAttr attribute"; |
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 was more curious about the meaning of those, which I just explained better in the other comment: use enum kind attributes for the flags.
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.
LGTM, this is good to go, I'll file some issues so we can later improve specific bits.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on #259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on #259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on #259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on #259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on #259
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on llvm/clangir#259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on #259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on llvm#259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on #259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on #259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on llvm#259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on #259
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on llvm/clangir#259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on llvm#259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on llvm#259
This patch adds RTTI support for C++ virtual inheritance. This patch does not include LLVM lowering support.
Lowering Vtable and RTTI globals. Also lowering AddressPoint. based on #259
This patch adds RTTI support for C++ virtual inheritance.
This patch does not include LLVM lowering support.