1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
Commit Graph

268 Commits

Author SHA1 Message Date
Peter Zotov
b21759952e [OCaml] Allow out-of-tree builds of LLVM bindings.
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
2015-01-13 12:17:56 +00:00
Peter Zotov
807dc63755 [OCaml] Use $CAMLORIGIN, an rpath-$ORIGIN-like mechanism in OCaml.
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
2015-01-13 09:47:59 +00:00
Peter Zotov
f7e64121ed [OCaml] [cmake] Use LLVM_LIBRARY_DIR instead of LLVM_LIBRARY_OUTPUT_INTDIR.
The latter variable is internal.

Original patch by Ramkumar Ramachandra <artagnon@gmail.com>

llvm-svn: 224977
2014-12-30 03:24:07 +00:00
Peter Zotov
52abf62de2 [OCaml] Expose Llvm_executionengine.get_{global_value,function}_address.
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
2014-12-24 01:52:51 +00:00
Rafael Espindola
e3ea3709d0 Finish removing DestroySource.
Fixes pr21901.

llvm-svn: 224782
2014-12-23 19:16:45 +00:00
Peter Zotov
41942af9a1 [OCaml] PR22014: OCaml bindings didn't link to libLLVM-*.so with -Wl,--as-needed
Patch by Evangelos Foutras <evangelos@foutrelis.com>.

llvm-svn: 224766
2014-12-23 13:09:59 +00:00
Peter Zotov
a5a15255cc [OCaml] Add Llvm.mdnull.
Patch by Gideon Smeding <gideon.smeding@3ds.com>.

llvm-svn: 223129
2014-12-02 17:35:26 +00:00
Peter Zotov
a7ec66eea2 [OCaml] Move Llvm.clone_module to its own Llvm_transform_utils module.
This way most code won't link this (substantially large) library,
if compiled statically with LLVM.

llvm-svn: 223072
2014-12-01 19:50:39 +00:00
Peter Zotov
a05f11b29b [OCaml] [cmake] Add CMake buildsystem for OCaml.
Closes PR15325.

llvm-svn: 223071
2014-12-01 19:50:23 +00:00
Peter Zotov
9d80aec36c [OCaml] Fix mismatched CAMLparam/CAMLreturn.
Also, revert r221142--it was an incorrect fix to this bug
which fixed tests by accident.

llvm-svn: 221149
2014-11-03 11:47:14 +00:00
Peter Zotov
260d1b1b77 [OCaml] Add -g on DEBUG_SYMBOLS=1, not ENABLE_OPTIMIZED.
Thanks echristo for pointing this out.

llvm-svn: 221145
2014-11-03 10:06:19 +00:00
Peter Zotov
7c29a0fdaf [OCaml] Don't use deprecated non-caml_namespaced functions.
llvm-svn: 221143
2014-11-03 09:51:47 +00:00
Peter Zotov
bbaea64b40 [OCaml] Initialize local roots prior to raising.
On 4.02, the OCaml unwinder otherwise gets confused and segfaults.

llvm-svn: 221142
2014-11-03 09:51:44 +00:00
Peter Zotov
772c8edf96 [OCaml] Core package should depend on LLVMTransformUtils for LLVMCloneModule.
llvm-svn: 221141
2014-11-03 09:51:41 +00:00
Peter Zotov
b4e4fed74d [OCaml] Fix ocamlc -custom builds when configured as --enable-shared.
llvm-svn: 221140
2014-11-03 09:51:37 +00:00
Peter Zotov
3c929e8a6a [OCaml] Avoid embedding absolute paths into executables.
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
2014-11-03 09:51:34 +00:00
Peter Zotov
ee1171d3fa [OCaml] Don't build stub libraries twice.
The default Makefile.rules BUILD_ARCHIVE machinery was
unintentionally enabled.

llvm-svn: 221138
2014-11-03 09:51:28 +00:00
Peter Zotov
3ab83ce133 [OCaml] META: remove exists_if(toplevel).
ocamlfind ignores the predicates in this case, making the package
unavailable for batch compilation as well.

llvm-svn: 221136
2014-11-03 09:50:02 +00:00
Peter Zotov
3d9a356a60 [OCaml] ExecutionEngine package should not depend on interpreter.
Interpreter support was removed in r220957.

llvm-svn: 221135
2014-11-03 09:49:42 +00:00
Peter Zotov
c92484316f [OCaml] Ensure consistent naming.
Specifically:
  * Directories match module names.
  * Test names match module names.
  * The language is called "OCaml", not "Ocaml".

llvm-svn: 220958
2014-10-31 09:19:03 +00:00
Peter Zotov
5dda7d9855 [OCaml] Rework Llvm_executionengine using ctypes.
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
2014-10-31 09:05:36 +00:00
Peter Zotov
6107c0888e [OCaml] Expose LLVMCloneModule.
llvm-svn: 220903
2014-10-30 08:30:12 +00:00
Peter Zotov
63938c8558 [OCaml] Expose LLVM{Get,Set}DLLStorageClass.
llvm-svn: 220902
2014-10-30 08:30:08 +00:00
Peter Zotov
c22ad454f5 [OCaml] [autoconf] Migrate to ocamlfind.
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
2014-10-30 08:29:45 +00:00
Peter Zotov
c758afd8d3 [OCaml] De-duplicate llvm_raise and llvm_string_of_message.
llvm-svn: 220898
2014-10-30 08:29:29 +00:00
Peter Zotov
baffd2af6d [OCaml] Expose Llvm.parse_command_line_options.
llvm-svn: 220847
2014-10-29 08:16:18 +00:00
Peter Zotov
f1fa95c061 [OCaml] Expose Llvm_target.TargetMachine.add_analysis_passes.
llvm-svn: 220846
2014-10-29 08:16:14 +00:00
Peter Zotov
7624f67acb [OCaml] If compiled without --enable-shared, hide packages from toplevel.
Pretend they do not exist using exists_if. This is better than
the current situation, which is the error:

    Error: The external function `llvm_global_succ' is not available

but still somewhat confusing.

llvm-svn: 220845
2014-10-29 08:16:06 +00:00
Peter Zotov
abfbb4539f [OCaml] Expose Llvm_bitwriter.write_bitcode_to_memory_buffer.
llvm-svn: 220844
2014-10-29 08:16:01 +00:00
Peter Zotov
92738ae9a2 [OCaml] Drop support for 3.12.1 and earlier.
In practice this means:
  * Always using -g flag.
  * Embedding -cclib -lstdc++ into the corresponding cma/cmxa file.
    This also moves -lstdc++ in a single place.
  * Using caml_named_value instead of a homegrown mechanism.

llvm-svn: 220843
2014-10-29 08:15:54 +00:00
Peter Zotov
f7af23baaa [OCaml] Synchronize transformations with LLVM-C.
Also, rearrange the functions in a way that allows to quickly
compare C headers and .mli/glue files.

llvm-svn: 220842
2014-10-29 08:15:21 +00:00
Peter Zotov
3a56d6667a [OCaml] PR19859: Add functions to query and modify branches.
Patch by Gabriel Radanne <drupyog@zoho.com>.

llvm-svn: 220818
2014-10-28 19:47:02 +00:00
Peter Zotov
927677ad96 [OCaml] PR19859: Add Llvm.{fcmp_predicate,float_of_const}.
Patch by Gabriel Radanne <drupyog@zoho.com>.

llvm-svn: 220815
2014-10-28 19:46:48 +00:00
Peter Zotov
da5425e252 [OCaml] Enable -g for debug builds.
We don't care about pre-3.12.1 anymore.

llvm-svn: 220767
2014-10-28 06:15:41 +00:00
Peter Zotov
41625b6878 [OCaml] Fix whitespace.
llvm-svn: 220766
2014-10-28 06:15:18 +00:00
Peter Zotov
7de838bfe6 [OCaml] Expose existing documentation in ocamldoc.
Patch by Gabriel Radanne <drupyog@zoho.com>.

llvm-svn: 220648
2014-10-26 20:45:22 +00:00
Peter Zotov
a9b429237d [OCaml] Unbreak Llvm_executionengine.initialize_native_target.
First, return true on success, as it is the OCaml convention.
Second, also initialize the native assembly printer, which is,
despite the name, required for MCJIT operation.

Since this function did not initialize the assembly printer earlier
and no function to initialize native assembly printer was available
elsewhere, it is safe to break its interface: it means that it
simply could not be used successfully before.

llvm-svn: 220620
2014-10-25 18:50:02 +00:00
Peter Zotov
4e58408520 [OCaml] Expose Llvm_executionengine.ExecutionEngine.create_mcjit.
llvm-svn: 220619
2014-10-25 18:49:56 +00:00
Peter Zotov
f8c5e569b2 [OCaml] Fix a typo in documentation.
llvm-svn: 220377
2014-10-22 10:24:05 +00:00
Peter Zotov
c5418e39bd [OCaml] Add Llvm.instr_clone.
llvm-svn: 220008
2014-10-17 01:02:40 +00:00
Eric Christopher
2f6f860aaa Reinstate "Nuke the old JIT."
Approved by Jim Grosbach, Lang Hames, Rafael Espindola.

This reinstates commits r215111, 215115, 215116, 215117, 215136.

llvm-svn: 216982
2014-09-02 22:28:02 +00:00
Peter Zotov
637a91873c [OCaml] Expose Llvm.get_operand_use.
Patch by Gabriel Radanne <drupyog@zoho.com>

llvm-svn: 215420
2014-08-12 02:55:45 +00:00
Eric Christopher
378bc328f0 Temporarily Revert "Nuke the old JIT." as it's not quite ready to
be deleted. This will be reapplied as soon as possible and before
the 3.6 branch date at any rate.

Approved by Jim Grosbach, Lang Hames, Rafael Espindola.

This reverts commits r215111, 215115, 215116, 215117, 215136.

llvm-svn: 215154
2014-08-07 22:02:54 +00:00
Rafael Espindola
3b51160f99 Fix the ocaml bindings.
llvm-svn: 215117
2014-08-07 14:48:13 +00:00
Peter Zotov
4fc6b74b35 [OCaml] Add Llvm.{string_of_const,const_element}.
llvm-svn: 214677
2014-08-03 23:54:22 +00:00
Peter Zotov
f79b84b24e [OCaml] Don't truncate constants over 32 bits in Llvm.const_int.
llvm-svn: 213655
2014-07-22 13:55:20 +00:00
Gerolf Hoflehner
5fa7774dfd MergedLoadStoreMotion pass
Merges equivalent loads on both sides of a hammock/diamond
and hoists into into the header.
Merges equivalent stores on both sides of a hammock/diamond
and sinks it to the footer.
Can enable if conversion and tolerate better load misses
and store operand latencies.

llvm-svn: 213396
2014-07-18 19:13:09 +00:00
Peter Zotov
171cddf9b3 [OCaml] Documentation improvements.
Patch by Julien Sagot

llvm-svn: 212230
2014-07-02 22:17:20 +00:00
Peter Zotov
f99a42bc31 [OCaml] Documentation improvements.
llvm-svn: 212048
2014-06-30 16:53:53 +00:00
Peter Zotov
5c56850c1f [OCaml] Unbreak Llvm_target.TargetMachine.set_verbose_asm
Patch by Jacques-Pascal Deplaix

llvm-svn: 210480
2014-06-09 17:34:34 +00:00