[PATCH] D125183: Add opaque pointers to the llvm-c API

Nicolas Abram via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 7 23:42:33 PDT 2022


nico-abram created this revision.
nico-abram added reviewers: deadalnix, opaque-pointers.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nico-abram requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is based on https://reviews.llvm.org/D125168 which adds a wrapper to allow use of opaque pointers from the C API.

I added an opaque pointer mode test to echo.ll , and to fix assertions that forbid the use of mixed typed and opaque pointers that were triggering in it I had to also add wrappers for setOpaquePointers and supportsTypedPointers.

I also changed echo.ll to remove a `bitcast i32* %x to i8*`, because passing it through llvm-as and llvm-dis was generating a `%0 = bitcast ptr %x to ptr`, but when building that same bitcast in echo.cpp it was getting elided by IRBuilderBase::CreateCast (https://github.com/llvm/llvm-project/blob/08ac66124874d70dab63c731da0244f9e29ef168/llvm/include/llvm/IR/IRBuilder.h#L1998-L1999).

cc @lerno


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125183

Files:
  llvm/include/llvm-c/Core.h
  llvm/lib/IR/Core.cpp
  llvm/test/Bindings/llvm-c/echo.bc
  llvm/test/Bindings/llvm-c/echo.ll
  llvm/tools/llvm-c-test/echo.cpp
  llvm/tools/llvm-c-test/llvm-c-test.h
  llvm/tools/llvm-c-test/main.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125183.427907.patch
Type: text/x-patch
Size: 7122 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220508/c0a68235/attachment.bin>


More information about the llvm-commits mailing list