[PATCH] D60161: Expose non-trivial struct helpers for Swift.

Tony Allevato via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 3 15:01:09 PDT 2019


allevato added inline comments.


================
Comment at: clang/include/clang/CodeGen/CodeGenABITypes.h:93
+    llvm::BasicBlock::iterator InsertPoint, llvm::Value *Dst,
+    CharUnits Alignment, QualType QT);
+
----------------
rjmccall wrote:
> Hmm.  I think it might be better to just have this return a function pointer; emitting a call in a different frontend's function can be pretty fraught if that frontend wants to handle e.g. unwinding.  The interface should document the ABI of the returned function pointer.  Callers might be able to take advantage of a function pointer in different ways, e.g. by using it directly in Swift's value-witness tables on targets where the calling conventions align.
> 
> In the long run, I'd definitely like to make this interface capable of doing some limited code-generation tasks, e.g. to load or store bit-fields, but I suspect that we'll need to think about that a bit more carefully and that we might want to avoid anything that involves a call.
That makes sense—getting this working was a bit tricky and passing the BB and insert point didn't exactly seem like the cleanest approach.

I'll work on the alternate approach you suggested and circle back around when I have it working with the corresponding Swift changes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60161/new/

https://reviews.llvm.org/D60161





More information about the cfe-commits mailing list