[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"> {
----------------
xlauko wrote:

Is there any reason to have this as a special attribute and not just two `I32Attr` in `VTableAddrPointOp`? 

I scanned through incubator codebase and all uses I found it is always accessed directly to index or offset, e.g. `op.getAddressPointAttr().getIndex()`, `op.getAddressPointAttr().getOffset()`.

Therefore I believe we can remove the attribute entirely and just have `op.getAddressPointIndex()` and `op.gettAddressPointOffset()`? 

This can clean up address point op assembly as weel to something like:
```
cir.vtable_address_point @_ZTV1B [index = 0, offset = 2] : !cir.ptr<!cir.ptr<() -> i32>>
```

^ This just my suggestion removing also some parenthesis and adding `_` after `vtable` in op name.

https://github.com/llvm/llvm-project/pull/148730


More information about the cfe-commits mailing list