Closed Laity000 closed 2 months ago
I think we need some further discussions on the typing of vtables. CIRGen currently follows the original clang CodeGen scheme which represents vtables as arrays of pointers. Although most elements in a vtable are indeed pointers, elements such as offset-to-top are not. Representing these elements as pointers requires ugly hack as shown in this commit (i.e.
#cir.ptr<-8>
).
Thank you for your review.
I've reviewed the Itanium C++ ABI document:
Offsets are of type ptrdiff_t unless otherwise stated. We call it the address point of the virtual table. The virtual table may therefore contain components at either positive or negative offsets from its address point.
So, I'm not sure whether to use ptrdiff_t, ptr
This might require a further discussion. @Lancern @bcardosolopes
@lanza rebased over the weekend, sorry for the churn. Can you rebase this PR again?
This PR adds Vtable support for C++ multiple inheritance without thunk. This change contains the CIR codegen and lowering work:
VTableAttr
should allow adding multipleArrayAttr
for multi-inheritance.VTableAddrPointOpLowering
has been fixed for the multi-vtable during the MLIR lowering phase.Example: