Commit Graph

260 Commits

Author SHA1 Message Date
Peter Zotov
53e72030fd [OCaml] Add an ocamlfind package llvm.all_backends.
This package is useful for architecture-independent tools like llc.

Patch by Jacques-Pascal Deplaix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207793 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-01 21:00:52 +00:00
Anders Waldenborg
53258e6f9e [python] Fix getting section contents.
The returnvalue was handled as c_char_p which ment that ctypes
handled it as a NUL-terminated string making it cut the contents
at first NUL (or even worse - overrunning the buffer if it doesn't
contain a NUL).

Differential Revision: http://reviews.llvm.org/D3474



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207199 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-25 06:25:15 +00:00
Anders Waldenborg
99bf4b758f [python] Fix python bindings tests
Broke after the changes related to the LLVMGetSymbolFileOffset
removal in r206750


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207018 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 20:32:03 +00:00
Rafael Espindola
7426771280 Convert getFileOffset to getOffset and move it to its only user.
We normally don't drop functions from the C API's, but in this case I think we
can:

* The old implementation of getFileOffset was fairly broken
* The introduction of LLVMGetSymbolFileOffset was itself a C api breaking
  change as it removed LLVMGetSymbolOffset.
* It is an incredibly specialized use case. The only reason MCJIT needs it is
  because of its odd position of being a dynamic linker of .o files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206750 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21 13:45:32 +00:00
Michael Gottesman
ea06d9762c [python-bindings] Remove some cruft that snuck in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201966 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-23 04:43:26 +00:00
Michael Gottesman
0ee9a84cac [python-bindings] Added OpCode like support for all enumerations with unittests.
Also fixed some trailing whitespace issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201929 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-22 05:39:35 +00:00
NAKAMURA Takumi
da031f7bd9 Makefile.ocaml: Tweak to use --system-libs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197758 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-20 00:36:59 +00:00
Alp Toker
baf8c08693 Fix documentation typos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197757 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-20 00:33:39 +00:00
Peter Zotov
e8631023b5 [OCaml] Add a slash accidentally omitted from Makefile
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195912 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-28 09:03:28 +00:00
Peter Zotov
4e05282ec5 [OCaml] Embed rpath into stub libraries and native executables
This commit embeds a set of linker flags with hardcoded paths to
the LLVM shared library on --enable-shared builds into .cmxa files
and stub dynamic libraries. This solution closely follows existing
rules for rpath in the LLVM tools, which had to be modified because
of differences in toolchain.

Without this patch, OCaml tests as well as opam bindings broke,
as neither of those updates LD_LIBRARY_PATH to include
the $prefix/lib directory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195834 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-27 11:03:18 +00:00
Peter Zotov
46f89920ce [OCaml] Embed the flags necessary for linking with libLLVM.so into .cmxa files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195782 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 20:40:34 +00:00
Peter Zotov
0bafaacfc9 [OCaml] Unbreak make install by providing ocamldoc target
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195336 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 10:10:16 +00:00
Anders Waldenborg
e8a957d2a9 python: Fix check for disasm creation failure
Check should be for pointer being NULL, not what it points to.

Also adds a test for this case.

Reviewed By: indygreg

Differential Revision: http://llvm-reviews.chandlerc.com/D1878



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194965 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-17 15:40:57 +00:00
Anders Waldenborg
60e4d7f618 python: Properly initialize before trying to create disasm
As the "LLVMInitializeAll*" functions are not available as symbols in
the shared library they can't be used, and as a workaround a list of
the targets is kept and the individual symbols tried. As soon as the
"All"-functions are changed to proper symbols (as opposed to static
inlines in the headers) this hack will be replace with simple calls
to the corresponding "LLVMInitializeAll*" functions.

Reviewed By: indygreg

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1879



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194964 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-17 15:17:08 +00:00
Peter Zotov
b6703ff81b [OCaml] Add Target and TargetMachine bindings to Llvm_target
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194774 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 02:51:57 +00:00
Peter Zotov
04deb4957a [OCaml] Refactor Llvm_target interface
This commit brings the module structure, argument order and
primitive names in Llvm_target in order with the rest of the bindings,
in preparation for adding TargetMachine API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194773 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 02:51:44 +00:00
Peter Zotov
68f4dae1c0 [OCaml] Fix building of stub libraries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194772 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 02:51:27 +00:00
Peter Zotov
2bdf881ee4 [OCaml] Build stub OCaml libraries for all configured targets
This allows to only link in the needed targets, reducing binary
size and more importantly link time.

Note that this is an incomplete implementation: currently,
LLVM does not have the plumbing which would allow to conditionally
link in AsmPrinter, AsmParser and Disassembler for the targets
which support them. This should be improved in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194670 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-14 06:34:21 +00:00
Peter Zotov
a69773cead [OCaml] Expose LLVM's fatal error and stacktrace APIs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194669 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-14 06:34:13 +00:00
Peter Zotov
1ba15ab134 [OCaml] Dynamically link LLVM on --enable-shared builds
This commit significantly speeds up both bytecode and native
builds of LLVM clients (from ~20 second to sub-second link time),
and allows to invoke LLVM functions from OCaml toplevel.

The behavior for --disable-shared builds is unchanged.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194509 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-12 20:55:49 +00:00
Peter Zotov
850b520114 [OCaml] Fix a typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194508 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-12 20:55:42 +00:00
Peter Zotov
fa6ab4393e [OCaml] Add missing Llvm_target functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194382 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-11 14:47:28 +00:00
Peter Zotov
786a43e2d8 [OCaml] Accept context explicitly in Llvm_target functions
Llvm_target.intptr_type used to implicitly use global context. As
none of other functions in OCaml bindings do, it is changed to
accept context explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194381 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-11 14:47:20 +00:00
Peter Zotov
26f3bd8966 [OCaml] Make Llvm_target.DataLayout.t automatically managed
This breaks the API by removing Llvm_target.DataLayout.dispose.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194380 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-11 14:47:11 +00:00
Peter Zotov
ec7270c966 [OCaml] Impement Llvm_irreader, bindings to LLVM assembly parser
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194138 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-06 09:21:25 +00:00
Peter Zotov
ba0c7cd012 [OCaml] Implement Llvm.string_of_llvalue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194136 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-06 09:21:08 +00:00
Peter Zotov
34b4a84261 [OCaml] (PR16190) Add ValueKinds for ConstantDataSequential and subclasses
Original patch by David Monniaux

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194075 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-05 12:55:43 +00:00
Peter Zotov
c8ac229cc8 [OCaml] (PR16318) Add missing argument to Llvm.const_intcast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194065 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-05 11:56:20 +00:00
Peter Zotov
150c95eab5 [OCaml] (PR11717) Make declare_qualified_global respect address argument
Original patch by Jonathan Ragan-Kelley

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194064 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-05 11:56:13 +00:00
Peter Zotov
19648c00d6 [OCaml] Properly tag the custom operations of Llvm.llbuilder
All other custom operations tags have LLVM prefix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194058 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-05 09:13:46 +00:00
Peter Zotov
9a62ec7308 [OCaml] Llvm_linker: do not use external in module interface
Workaround for an OCaml bug:
http://caml.inria.fr/mantis/view.php?id=4166

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194057 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-05 09:13:39 +00:00
Peter Zotov
4ebe64ae7e [OCaml] implement Llvm_passmgr_builder, bindings for PassManagerBuilder
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193968 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-04 01:39:42 +00:00
Peter Zotov
6b8416192a [OCaml] Documentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193967 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-04 01:39:31 +00:00
Peter Zotov
8a3bdd6a3f [OCaml] Implement missing LLVMCore APIs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193966 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-04 01:39:26 +00:00
Peter Zotov
e5de63c7de [OCaml] Formatting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193965 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-04 01:39:18 +00:00
Peter Zotov
f00a9e0f79 [OCaml] Implement Llvm.MemoryBuffer.{of_string,as_string}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193953 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-03 08:27:45 +00:00
Peter Zotov
88d74c3093 [OCaml] Fix ABI incompatibility
OCaml's type unit is not compatible with C's type void.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193952 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-03 08:27:37 +00:00
Peter Zotov
9d33bf70c2 [OCaml] Implement Llvm_linker, bindings for the IR linker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193951 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-03 08:27:32 +00:00
Peter Zotov
1185582dfd [OCaml] Implement Llvm_vectorize bindings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193950 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-03 08:27:22 +00:00
Peter Zotov
fed0b34142 [OCaml] Llvm_target: fix typo (Int_val instead of Int64_val)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193948 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-03 08:27:08 +00:00
Peter Zotov
30288ac402 [OCaml] Llvm_scalar_opts: add missing transforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193946 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-03 07:54:17 +00:00
Peter Zotov
630109d30c [OCaml] Llvm_ipo: add missing transforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193945 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-03 07:54:08 +00:00
Sylvestre Ledru
9fd6ef28a3 OCaml bindings: fix typo
Patch by Peter Zotov



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193851 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-01 02:29:13 +00:00
Sylvestre Ledru
40a461d547 OCaml bindings: remove unused DONT_BUILD_RELINKED from Makefiles
Patch by Peter Zotov




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193847 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-01 01:14:24 +00:00
Sylvestre Ledru
3d841cb9d3 OCaml bindings: fix typo
Patch by Peter Zotov



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193845 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-01 01:10:58 +00:00
Sylvestre Ledru
e239d20d36 OCaml bindings: fix typo in documentation
Patch by Peter Zotov



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193838 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-01 00:30:02 +00:00
Sylvestre Ledru
dfc58e3bcf OCaml bindings: formatting
This commit only changes comments and documentation in OCaml bindings. The official name of the language is OCaml, and the usage is now consistent.

Patch by Peter Zotov



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193836 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-01 00:26:01 +00:00
Michael Gottesman
abaa85d88d [python-bindings] Added support for getting/setting operands of values and getting the number of operands of a value.
Also in the process did some cleanups for BasicBlock.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190477 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 01:38:12 +00:00
Michael Gottesman
73c382f7fd [python-bindings] Added support for iterating over a basic blocks instructions, getting their name/dumping them, f/b iteration.
Tests are included.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190475 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 01:17:38 +00:00
Michael Gottesman
e23fa984f5 [python-bindings] Added support for iterating over a function's basic blocks, dumping/getting names of those bb, f/w iteration.
Tests are included.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190473 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 01:01:40 +00:00