-
Notifications
You must be signed in to change notification settings - Fork 162
[CIR][NFC] Change GetMemberOp index type #1811
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
Conversation
I haven’t looked exactly, but I think this could also be done for:
clangir/clang/include/clang/CIR/Dialect/IR/CIROps.td Lines 3046 to 3049 in 3abcc2c
And for InsertMemberOp: clangir/clang/include/clang/CIR/Dialect/IR/CIROps.td Lines 3103 to 3105 in 3abcc2c
I can add this in a future PR. |
Would this impact targets where |
That's not a bad question, but since we were always converting the IndexAttr to a int64_t value during lowering, this isn't introducing a new problem. For GetMemberOp in particular, we are indexing into a structure, and when that gets lowered to LLVM IR, the index has to be an i32 value. |
In both InsertMember and ExtractMember lowering we already cast the field index to std::int64_t: clangir/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp Lines 3774 to 3777 in 80d52d7
clangir/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp Lines 3745 to 3748 in 80d52d7
So, at lowering time, we’re explicitly on 64-bit regardless. And in the definition of def I64Attr : TypedSignlessIntegerAttrBase<
I64, "uint64_t", "64-bit signless integer attribute">; The |
This PR, similar to #1811 changes the index type for `ExtractMemberOp` and `InsertMemberOp`. This modification enables automatic generation of the getIndex method and removes the need for a custom builder.
This PR is inspired by the discussion in #1745 (comment).
When changing the type of
in
GetMemberOp
, thegetIndex
method becomes auto-generated.This allows us to remove the custom builder previously defined for this operation.