[clang] [CIR] Add VTableAddrPointOp (PR #148730)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 15 04:59:09 PDT 2025
================
@@ -515,5 +515,35 @@ def BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
];
}
+//===----------------------------------------------------------------------===//
+// AddressPointAttr
+//===----------------------------------------------------------------------===//
+
+def AddressPointAttr : CIR_Attr<"AddressPoint", "address_point"> {
+ let summary = "Address point attribute";
+
+ let description = [{
+ Attribute specifying the address point within a C++ virtual table (vtable).
+
+ The `index` (vtable index) parameter identifies which vtable to use within a
+ vtable group, while the `offset` (address point index) specifies the offset
+ within that vtable where the address begins.
+
+ Example:
+ ```mlir
+ cir.global linkonce_odr @_ZTV1B = ...
+ ...
+ %3 = cir.vtable.address_point(@_ZTV1B, address_point = <index = 0, offset = 2>)
+ : !cir.ptr<!cir.ptr<() -> i32>>
+ ```
----------------
xlauko wrote:
```suggestion
Attribute specifying the address point within a C++ virtual table (vtable).
The `index` (vtable index) parameter identifies which vtable to use within a
vtable group, while the `offset` (address point index) specifies the offset
within that vtable where the address begins.
Example:
```mlir
cir.global linkonce_odr @_ZTV1B = ...
...
%3 = cir.vtable.address_point(@_ZTV1B, address_point = <index = 0, offset = 2>)
: !cir.ptr<!cir.ptr<() -> i32>>
```
```
https://github.com/llvm/llvm-project/pull/148730
More information about the cfe-commits
mailing list