[LLVMdev] C interface
Gordon Henriksen
gordonhenriksen at mac.com
Sun Sep 16 17:07:52 PDT 2007
On Sep 12, 2007, at 01:01, Gordon Henriksen wrote:
> I'm authoring a C interface to the LLVM IR type system. Since this
> is Really Quite Tedious, I would like to solicit opinions before I
> get too far down any paths that seem offensive. I've attached the
> header, where I've mapped a portion of Module and most of Type and
> its subclasses. This is working, and I've built ocaml bindings on
> top of it.
Now with constants and globals variables. Functions and basic blocks
next, then on to LLVMBuilder.
— Gordon
//===-- c-bindings.patch (+730) -------------------------------===//
include/llvm/CHelpers.h (+94)
include/llvm-c/BitWriter.h (+42)
include/llvm-c/Core.h (+221)
lib/Bitcode/Writer/BitWriter.cpp (+51)
lib/VMCore/Core.cpp (+322)
Tedious C bindings for libLLVMCore.a and libLLVMBitWriter.a!
- The naming prefix is LLVM.
- All types are represented using opaque references.
- Functions are not named LLVM{Type}{Method}; the names became
unreadable goop.
Instead, they are named LLVM{ImperativeSentence}.
- Where an attribute only appears once in the class hierarchy (e.g.,
linkage
only applies to values; parameter types only apply to function
types), the
class is omitted from identifiers for brevity. Tastes like methods.
- Strings are C strings or string/length tuples on a case-by-case basis.
- APIs which give the caller ownership of an object are not mapped
(removeFromParent, certain constructor overloads). This keeps
keep memory management as simple as possible.
For each library with bindings:
llvm-c/<LIB>.h - Declares the bindings.
lib/<LIB>/<LIB>.cpp - Implements the bindings.
So just link with the library of your choice and use the C header
instead of the C++ one.
This patch is independent.
//===-- ocaml-make.patch (+380 -27) ---------------------------===//
configure (+111 -25)
Makefile.config.in (+2)
bindings/ocaml/Makefile.ocaml (+263)
Makefile (+2 -2)
autoconf/configure.ac (+2)
I add a generic ocaml Makefile which will be used by the ocaml
language bindings.
configure is schooled how to sniff ocamlc and ocamlopt.
This patch is independent.
//===-- ocaml-bindings.patch (+936) ---------------------------===//
bindings/ocaml/llvm
bindings/ocaml/llvm/llvm.ml (+226)
bindings/ocaml/llvm/llvm_ocaml.c (+394)
bindings/ocaml/llvm/llvm.mli (+168)
bindings/ocaml/llvm/Makefile (+24)
bindings/ocaml/bitwriter
bindings/ocaml/bitwriter/llvm_bitwriter.mli (+18)
bindings/ocaml/bitwriter/bitwriter_ocaml.c (+31)
bindings/ocaml/bitwriter/llvm_bitwriter.ml (+18)
bindings/ocaml/bitwriter/Makefile (+23)
bindings/ocaml/Makefile (+13)
bindings/README.txt (+3)
bindings/Makefile (+18)
Adds ocaml language bindings to LLVM. They are built automatically
if configure detects the ocamlc compiler and are installed to the
ocaml standard library.
This patch depends on c-bindings and ocaml-make.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070916/86097efa/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c-bindings.patch
Type: application/octet-stream
Size: 27943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070916/86097efa/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070916/86097efa/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ocaml-bindings.patch
Type: application/octet-stream
Size: 39129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070916/86097efa/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070916/86097efa/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ocaml-make.patch
Type: application/octet-stream
Size: 21981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070916/86097efa/attachment-0002.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070916/86097efa/attachment-0003.html>
More information about the llvm-dev
mailing list