[PATCH] D128417: [llvm-c] Add LLVMGetAggregateElement() function
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 23 02:53:29 PDT 2022
nikic created this revision.
nikic added reviewers: deadalnix, nhaehnle.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This adds `LLVMGetAggregateElement` as a wrapper for `Constant::getAggregateElement`, which allows fetching a struct/array/vector element without handling different possible underlying representations.
As the changed echo test shows, previously you for example had to treat `ConstantArray` (use `LLVMGetOperand`) and `ConstantDataArray` (use `LLVMGetElementAsConstant`) separately, not to mention all the other possible representations (like `PoisonValue`).
I've deprecated `LLVMGetElementAsConstant` in favor of the new function, which is strictly more powerful (but I could be convinced to drop the deprecation).
This is partly motivated by https://reviews.llvm.org/D125795, which drops `LLVMConstExtractValue` because the underlying constant expression no longer exists. This function could previously be used as a poor man's getAggregateElement().
https://reviews.llvm.org/D128417
Files:
llvm/docs/ReleaseNotes.rst
llvm/include/llvm-c/Core.h
llvm/lib/IR/Core.cpp
llvm/tools/llvm-c-test/echo.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128417.439296.patch
Type: text/x-patch
Size: 5289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220623/2f5e2adb/attachment.bin>
More information about the llvm-commits
mailing list