summaryrefslogtreecommitdiffstats
path: root/llvm/bindings/ocaml
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Remove multiple semicolonsMandeep Singh Grang2017-06-281-1/+1
| | | | | | | | | | | | Reviewers: bogner, whitequark, mgrang Reviewed By: mgrang Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34785 llvm-svn: 306613
* [LLVM-C] [OCaml] Expose Type::subtypes.whitequark2017-06-053-0/+19
| | | | | | | | | | | | | The C functions added are LLVMGetNumContainedTypes and LLVMGetSubtypes. The OCaml function added is Llvm.subtypes. Patch by Ekaterina Vaartis. Differential Revision: https://reviews.llvm.org/D33677 llvm-svn: 304709
* [OCaml] Adapt to the new attribute C API.whitequark2016-11-123-226/+279
| | | | llvm-svn: 286705
* cmake: Install the OCaml libraries into a more correct pathMichal Gorny2016-09-304-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a OCAML_INSTALL_PATH variable that can be used to control the install path for OCaml libraries. The new variable defaults to ${OCAML_STDLIB_PATH}, i.e. the OCaml library path obtained from the OCaml compiler. Install libraries into "llvm" subdirectory. This fixes two issues: 1. OCaml library directories differ between systems, and 'lib/ocaml' is incorrect e.g. on amd64 Gentoo where OCaml is installed in 'lib64/ocaml'. Therefore, obtain the library path from the OCaml compiler using 'ocamlc -where' (which is already used to set OCAML_STDLIB_PATH), which is the method used commonly in OCaml packages. 2. The top-level directory is reserved for the standard library, and has precedence over local directory in search path. As a result, OCaml preferred the files installed along with previous LLVM version over the source tree when building a new version, resulting in two versions being mixed during the build. The new layout is used commonly by other OCaml packages, and findlib is able to find the LLVM libraries successfully. Bug: https://bugs.gentoo.org/559134 Bug: https://bugs.gentoo.org/559624 Differential Revision: https://reviews.llvm.org/D24354 llvm-svn: 282895
* [CMake] [OCaml] Allow building OCaml bindings out of tree.Peter Zotov2016-09-051-0/+29
| | | | | | | | | That is, add build system support for building the OCaml bindings against preinstalled LLVM libraries. This is important for package managers such as OPAM, because OCaml libraries need to be built against a specific OCaml compiler installation. llvm-svn: 280642
* [OCaml] Add functions for accessing metadata nodes.Peter Zotov2016-06-223-0/+17
| | | | | | | | Patch by Xinyu Zhuang. Differential Revision: http://reviews.llvm.org/D19309 llvm-svn: 273370
* Remove the ScalarReplAggregates passDavid Majnemer2016-06-151-3/+3
| | | | | | | | | | Nearly all the changes to this pass have been done while maintaining and updating other parts of LLVM. LLVM has had another pass, SROA, which has superseded ScalarReplAggregates for quite some time. Differential Revision: http://reviews.llvm.org/D21316 llvm-svn: 272737
* Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini2016-04-141-1/+1
| | | | | | | | | | | At the same time, fixes InstructionsTest::CastInst unittest: yes you can leave the IR in an invalid state and exit when you don't destroy the context (like the global one), no longer now. This is the first part of http://reviews.llvm.org/D19094 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266379
* [OCaml] Expose the LLVM diagnostic handlerJeroen Ketema2016-04-103-1/+93
| | | | | | Differential Revision: http://reviews.llvm.org/D18891 llvm-svn: 265897
* [OCaml] Use LLVMCreateMessage with constant strings when calling llvm_raiseJeroen Ketema2016-04-014-4/+7
| | | | | | | | | | | The llvm_string_of_message function, called by llvm_raise, calls LLVMDisposeMessage, which expects the message to be dynamically allocated; it fails freeing the message otherwise. So always dynamically allocate with LLVMCreateMessage. Differential Revision: http://reviews.llvm.org/D18675 llvm-svn: 265116
* [OCaml] Reinstate data_layoutJeroen Ketema2016-04-013-0/+11
| | | | | | | | | | | | Expose LLVMCreateTargetMachineData as data_layout. As r263530 did for go. From that commit: "LLVMGetTargetDataLayout was removed from the C API, and then TargetMachine.TargetData was removed. Later, LLVMCreateTargetMachineData was added to the C API" Differential Revision: http://reviews.llvm.org/D18677 llvm-svn: 265115
* Silence warnings in OCaml bindingsJeroen Ketema2016-03-315-16/+3
| | | | | | | | | * LLVMDisposeMessage lives in llvm-c/Core.h, include this file where necessary * LLVMAddTargetData has been removed, follow suit in the bindings Differential Revision: http://reviews.llvm.org/D18633 llvm-svn: 265001
* Remove LLVMGetTargetMachineData leftovers.Benjamin Kramer2016-02-123-24/+0
| | | | llvm-svn: 260720
* Remove autoconf supportChris Bieneman2016-01-2619-940/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* Deprecate a few C APIs.Rafael Espindola2015-12-181-6/+4
| | | | | | | | | | | | | This deprecates: * LLVMParseBitcode * LLVMParseBitcodeInContext * LLVMGetBitcodeModuleInContext * LLVMGetBitcodeModule They are replaced with the functions with a 2 suffix which do not record a diagnostic. llvm-svn: 256065
* Change linkInModule to take a std::unique_ptr.Rafael Espindola2015-12-163-9/+7
| | | | | | | Passing in a std::unique_ptr should help find errors when the module is used after being linked into another module. llvm-svn: 255842
* Fix `llvm-config` to adapt to the install environment.Richard Diamond2015-11-091-0/+2
| | | | | | | | | | | | | | | | | | | | | Summary: This patch does a couple of things: - Adds a new argument `--shared-mode` which accepts a list of components and prints whether or not the provided components need to be linked statically or shared. - Fixes `--libnames` when CMake BUILD_SHARED_LIBS is used. - Fixes `--libnames`, `--libs`, and `--libfiles` for dylib when static components aren't installed. - Fixes `--libnames`, `--libs`, `--libfiles`, and `--components` to use LLVM_DYLIB_COMPONENTS as the component manifest for dylib linking. - Uses the host platform's usual convention for filename extensions and such, instead of always defaulting to Unix-izms. Because I don't own a Mac, I am not able to test the Mac platform dependent stuff locally. If someone would be willing to run a build for me on their machine (unless there's a better option), I'd appreciate it. Reviewers: jfb, brad.king, whitequark, beanz Subscribers: beanz, jauhien, llvm-commits Differential Revision: http://reviews.llvm.org/D13198 llvm-svn: 252532
* [OCaml] Expose Llvm.{set_,}unnamed_addr.Peter Zotov2015-10-213-0/+23
| | | | | | Patch by Jacques-Pascal Deplaix <jp.deplaix@gmail.com> llvm-svn: 250912
* Revert "Fix `llvm-config` to emit the linker flag for the combined shared ↵Richard Diamond2015-08-051-2/+0
| | | | | | | | | | object built by autoconfig/make instead of the individual components." It seems I was wrong thinking `autoconf`/`make` only installed shared libraries if configured with `--enable-shared`, even if `--disable-static` is present. I'll re-address with a followup patch. This reverts commit r243297 for causing PR#24154. llvm-svn: 244108
* Fix `llvm-config` to emit the linker flag for the combined shared object ↵JF Bastien2015-07-271-0/+2
| | | | | | | | | | | | | | | | | | | built by autoconfig/make instead of the individual components. Summary: When LLVM is configured to build shared libraries, CMake builds each component as it's own shared object, while autoconfig/make builds them statically and then links them all together to create a single shared object. This change adds compile time config flags to `llvm-config` so it can know whether LLVM's components are separated or not and act accordingly. This fixes `llvm-config` instead of fixing the makefiles to behave like CMake because, AIUI, LLVM's autoconfig/make build system is on the way out anyway. This change only affects `llvm-config` from builds that use autoconfig/make. Reviewers: jfb Subscribers: echristo, dschuff, llvm-commits Differential Revision: http://reviews.llvm.org/D11392 llvm-svn: 243297
* Revert "Update LLVM bindings after r239940. ..."Reid Kleckner2015-07-161-1/+1
| | | | | | | | | | | Revert the changes to the C API LLVMBuildLandingPad that were part of the personality function move. We now set the personality on the parent function when the C API attempts to construct a landingpad with a personality. This reverts commit r240010. llvm-svn: 242372
* [OCaml] Bump ctypes dependency to 0.4.Peter Zotov2015-06-271-5/+5
| | | | | | | | | | | | ctypes 0.3 and earlier contains an interface-definig bug: its ptr_of_raw_address accepts Int64 and not Nativeint. ctypes 0.4 was not released during the 3.6 cycle, and because of that, LLVM 3.6 was released with ctypes 0.3 as a dependency, which now breaks the build on modern ctypes. Unbreak. llvm-svn: 240882
* Update LLVM bindings after r239940. Apparently these aren't included inDaniel Jasper2015-06-181-1/+1
| | | | | | | | | any tests and I even don't know how to run the tests. This seems like a minimal change to make them work again, although I can't really verify at this point. Additionally, it probably makes sense to propagate the personality parameter removal further. llvm-svn: 240010
* [OCaml] Add Llvm.build_empty_phi.Peter Zotov2015-02-063-0/+17
| | | | llvm-svn: 228395
* [OCaml] Allow out-of-tree builds of LLVM bindings.Peter Zotov2015-01-131-2/+9
| | | | | | | | | | | | In order to use this feature, configure LLVM as usual, but then build and install it as: make all install SYSTEM_LLVM_CONFIG=llvm-config where llvm-config is the llvm-config binary installed on your system (possibly llvm-config-VERSION on e.g. Debian). llvm-svn: 225787
* [OCaml] Use $CAMLORIGIN, an rpath-$ORIGIN-like mechanism in OCaml.Peter Zotov2015-01-131-4/+10
| | | | | | | | | | | | | | | As a result, installations of LLVM in non-standard locations will not require passing custom -ccopt -L flags when building the binary, nor absolute paths would be embedded in the cma/cmxa files. Additionally, the executables will not require changes to LD_LIBRARY_PATH, although CAML_LD_LIBRARY_PATH still has to be set for ocamlc without -custom. See http://caml.inria.fr/mantis/view.php?id=6642. Note that the patch is approved, but not merged yet. It will be released in 4.03 and likely 4.02. llvm-svn: 225778
* [OCaml] [cmake] Use LLVM_LIBRARY_DIR instead of LLVM_LIBRARY_OUTPUT_INTDIR.Peter Zotov2014-12-302-4/+4
| | | | | | | | The latter variable is internal. Original patch by Ramkumar Ramachandra <artagnon@gmail.com> llvm-svn: 224977
* [OCaml] Expose Llvm_executionengine.get_{global_value,function}_address.Peter Zotov2014-12-243-15/+40
| | | | | | | | | Patch by Ramkumar Ramachandra <artagnon@gmail.com>. Also remove Llvm_executionengine.get_pointer_to_global, as it is actually deprecated and didn't appear in a stable release. llvm-svn: 224801
* Finish removing DestroySource.Rafael Espindola2014-12-233-18/+5
| | | | | | Fixes pr21901. llvm-svn: 224782
* [OCaml] PR22014: OCaml bindings didn't link to libLLVM-*.so with -Wl,--as-neededPeter Zotov2014-12-231-2/+2
| | | | | | Patch by Evangelos Foutras <evangelos@foutrelis.com>. llvm-svn: 224766
* [OCaml] Add Llvm.mdnull.Peter Zotov2014-12-023-0/+9
| | | | | | Patch by Gideon Smeding <gideon.smeding@3ds.com>. llvm-svn: 223129
* [OCaml] Move Llvm.clone_module to its own Llvm_transform_utils module.Peter Zotov2014-12-0112-7/+94
| | | | | | | This way most code won't link this (substantially large) library, if compiled statically with LLVM. llvm-svn: 223072
* [OCaml] [cmake] Add CMake buildsystem for OCaml.Peter Zotov2014-12-0116-0/+114
| | | | | | Closes PR15325. llvm-svn: 223071
* [OCaml] Fix mismatched CAMLparam/CAMLreturn.Peter Zotov2014-11-031-4/+3
| | | | | | | Also, revert r221142--it was an incorrect fix to this bug which fixed tests by accident. llvm-svn: 221149
* [OCaml] Add -g on DEBUG_SYMBOLS=1, not ENABLE_OPTIMIZED.Peter Zotov2014-11-031-1/+1
| | | | | | Thanks echristo for pointing this out. llvm-svn: 221145
* [OCaml] Don't use deprecated non-caml_namespaced functions.Peter Zotov2014-11-031-7/+7
| | | | llvm-svn: 221143
* [OCaml] Initialize local roots prior to raising.Peter Zotov2014-11-031-3/+4
| | | | | | On 4.02, the OCaml unwinder otherwise gets confused and segfaults. llvm-svn: 221142
* [OCaml] Core package should depend on LLVMTransformUtils for LLVMCloneModule.Peter Zotov2014-11-031-1/+1
| | | | llvm-svn: 221141
* [OCaml] Fix ocamlc -custom builds when configured as --enable-shared.Peter Zotov2014-11-031-2/+3
| | | | llvm-svn: 221140
* [OCaml] Avoid embedding absolute paths into executables.Peter Zotov2014-11-031-14/+14
| | | | | | | | | | | | Bindings built out-of-tree, e.g. via OPAM, should append a line to META.llvm like the following: linkopts = "-cclib -L$libdir -cclib -Wl,-rpath,$libdir" where $libdir is the lib/ directory where LLVM libraries are installed. llvm-svn: 221139
* [OCaml] Don't build stub libraries twice.Peter Zotov2014-11-031-0/+3
| | | | | | | The default Makefile.rules BUILD_ARCHIVE machinery was unintentionally enabled. llvm-svn: 221138
* [OCaml] META: remove exists_if(toplevel).Peter Zotov2014-11-032-2/+0
| | | | | | | ocamlfind ignores the predicates in this case, making the package unavailable for batch compilation as well. llvm-svn: 221136
* [OCaml] ExecutionEngine package should not depend on interpreter.Peter Zotov2014-11-031-1/+1
| | | | | | Interpreter support was removed in r220957. llvm-svn: 221135
* [OCaml] Ensure consistent naming.Peter Zotov2014-10-316-3/+3
| | | | | | | | | Specifically: * Directories match module names. * Test names match module names. * The language is called "OCaml", not "Ocaml". llvm-svn: 220958
* [OCaml] Rework Llvm_executionengine using ctypes.Peter Zotov2014-10-316-527/+145
| | | | | | | | | | | | | | | | | | | | | | | | Since JIT->MCJIT migration, most of the ExecutionEngine interface became deprecated and/or broken. This especially affected the OCaml bindings, as runFunction is no longer available, and unlike in C, it is not possible to coerce a pointer to a function and call it in OCaml. In practice, LLVM 3.5 shipped completely unusable Llvm_executionengine. The GenericValue interface and runFunction were essentially a poor man's FFI. As such, this interface was removed and instead a dependency on ctypes >=0.3 added, which handled platform-specific aspects of accessing data and calling functions. The new interface does not expose JIT (which is a shim around MCJIT), as well as the interpreter (which can't handle a lot of valid IR). Llvm_executionengine.add_global_mapping is currently unusable due to PR20656. llvm-svn: 220957
* [OCaml] Expose LLVMCloneModule.Peter Zotov2014-10-302-0/+4
| | | | llvm-svn: 220903
* [OCaml] Expose LLVM{Get,Set}DLLStorageClass.Peter Zotov2014-10-303-0/+37
| | | | llvm-svn: 220902
* [OCaml] [autoconf] Migrate to ocamlfind.Peter Zotov2014-10-301-46/+18
| | | | | | | | | | | | | | | | | | | | | | This commit updates the OCaml bindings and tests to use ocamlfind. The bindings are migrated in order to use ctypes, which are now required for MCJIT-backed Llvm_executionengine. The tests are migrated in order to use OUnit and to verify that the distributed META.llvm allows to build working executables. Every OCaml toolchain invocation is now chained through ocamlfind, which (in theory) allows to cross-compile the OCaml bindings. The configure script now checks for ctypes (>= 0.2.3) and OUnit (>= 2). The code depending on these libraries will be added later. The configure script does not check the package versions in order to keep changes less invasive. Additionally, OCaml bindings will now be automatically enabled if ocamlfind is detected on the system, rather than ocamlc, as it was before. llvm-svn: 220899
* [OCaml] De-duplicate llvm_raise and llvm_string_of_message.Peter Zotov2014-10-307-71/+14
| | | | llvm-svn: 220898
* [OCaml] Expose Llvm.parse_command_line_options.Peter Zotov2014-10-293-0/+21
| | | | llvm-svn: 220847
OpenPOWER on IntegriCloud