Commit Graph

152 Commits

Author SHA1 Message Date
Torok Edwin
a156efdf71 Fix OCaml bindings crash, PR8847.
See http://caml.inria.fr/mantis/view.php?id=4166
If we call only external functions from a module, then its 'let _' bindings
don't get executed, which means that the exceptions don't get registered for use
in the C code.
This in turn causes llvm_raise to call raise_with_arg() with a NULL pointer and
cause a segmentation fault.

The workaround is to declare all 'external' functions as 'val' in these .mli
files.

Also added a separate testcase (the testcase must call only external functions
for the bug to occur).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122497 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 15:49:26 +00:00
Eric Christopher
c9f1cddc51 Try to fix ocaml bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116021 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-08 00:36:21 +00:00
Duncan Sands
26bb406c16 Remove the Ada bindings which are unmaintained and unused. The project which
was the main putative user of the binding is actually maintaining its own
different binding, see http://git.ada.cx/cgi-bin/cgit.cgi/draco.git/


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113960 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 08:17:10 +00:00
Dale Johannesen
bb811a2445 Add X86 MMX type to bitcode and Type.
(The Ada bindings probably need it too, but all the
obvious places to change say "do not edit this file".)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113618 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 20:55:01 +00:00
Benjamin Kramer
13ba2f9714 Remove unions from the ocaml bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112363 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 09:47:42 +00:00
Bill Wendling
4e34d50272 - Add the LinkerPrivateWeakDefAutoLinkage to the Ada bindings.
- Support the LinkerWeak*Linkage types in llvm-nm and in LinkModules.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 20:00:52 +00:00
Bob Wilson
d6850b0f37 Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111627 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 14:54:37 +00:00
Erick Tryzelaar
f7af931930 Expose LLVMSetOperand and LLVMGetNumOperands to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111625 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 14:51:22 +00:00
Erick Tryzelaar
e127410550 Fix arguments to ocaml's llvm_params.
Thanks to Jianzhou Zhao for finding this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111624 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 14:51:16 +00:00
Bill Wendling
5e721d7682 Implement the "linker_private_weak" linkage type. This will be used for
Objective-C metadata types which should be marked as "weak", but which the
linker will remove upon final linkage. However, this linkage isn't specific to
Objective-C.

For example, the "objc_msgSend_fixup_alloc" symbol is defined like this:

      .globl l_objc_msgSend_fixup_alloc
      .weak_definition l_objc_msgSend_fixup_alloc
      .section __DATA, __objc_msgrefs, coalesced
      .align 3
l_objc_msgSend_fixup_alloc:
       .quad   _objc_msgSend_fixup
       .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".

Currently only supported on Darwin platforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 21:55:59 +00:00
Bill Wendling
07d3177117 Revert r107205 and r107207.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107215 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 22:34:52 +00:00
Bill Wendling
207855cff9 Introducing the "linker_weak" linkage type. This will be used for Objective-C
metadata types which should be marked as "weak", but which the linker will
remove upon final linkage. For example, the "objc_msgSend_fixup_alloc" symbol is
defined like this:

       .globl l_objc_msgSend_fixup_alloc
       .weak_definition l_objc_msgSend_fixup_alloc
       .section __DATA, __objc_msgrefs, coalesced
       .align 3
l_objc_msgSend_fixup_alloc:
        .quad   _objc_msgSend_fixup
        .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 21:24:00 +00:00
Chris Lattner
0941534c71 add attributes and module level asm to the ocaml bindings,
patch by Patrick Walton!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100932 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-10 17:52:58 +00:00
Erick Tryzelaar
49457b8158 Add OCaml tutorial to the examples.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97966 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 19:32:27 +00:00
Erick Tryzelaar
e623050048 Add a LLVMWriteBitcodeToFD that exposes the raw_fd_ostream options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97858 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-06 00:30:06 +00:00
Erick Tryzelaar
7eb4beb4cd Expose the rest of the llvm-c scalar opts to ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97685 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 23:51:34 +00:00
Erick Tryzelaar
9c7c566efe Rename some ocaml functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97684 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 23:51:30 +00:00
Erick Tryzelaar
7b3afb4547 Expose the external functions for ocaml's execution engine as an optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97683 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 23:51:28 +00:00
Erick Tryzelaar
4ad188ba8d Expose alignment and stack alignment attributes to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97682 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 23:51:25 +00:00
Erick Tryzelaar
6bd7730426 Use the ocaml tag 0 since we are just returning an option value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97612 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 23:59:08 +00:00
Erick Tryzelaar
df75eb64a7 Don't use an ocaml keyword in an ocamldoc comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97611 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 23:59:05 +00:00
Erick Tryzelaar
0dd27da184 Expose the optimization level for the jit in ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97610 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 23:59:03 +00:00
Erick Tryzelaar
16609f3c5c Remove module providers from ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97609 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 23:59:00 +00:00
Erick Tryzelaar
705443ffd3 Add support for use to ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97586 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 20:32:32 +00:00
Erick Tryzelaar
b65c5f2ec3 Add support getting the operands of a User to ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97414 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 20:45:03 +00:00
Erick Tryzelaar
6ba5c56cf5 Add support for global aliases to ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97413 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 20:44:58 +00:00
Erick Tryzelaar
ce89b4e66f Add support for inserting inline asm to ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97412 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 20:44:53 +00:00
Erick Tryzelaar
5b0a7741ad Add support for getting a null pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97380 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 09:46:27 +00:00
Erick Tryzelaar
d80ce75687 Add a way to look up a type by it's name in a module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 09:46:21 +00:00
Erick Tryzelaar
68bab9833d Add replace_all_uses_with to ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97378 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 09:46:16 +00:00
Erick Tryzelaar
8e130b1d0d Add support for global variables in an address space for llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97377 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 09:46:13 +00:00
Erick Tryzelaar
c59286bff1 Add indirect br support to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97376 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 09:46:06 +00:00
Erick Tryzelaar
46c80e0c56 Add metadata functions to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97375 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 09:45:59 +00:00
Erick Tryzelaar
19f047f5f6 Add the new builder arthmetic instructions to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97372 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 05:51:43 +00:00
Erick Tryzelaar
1940dd10dd Add the new union arthmetic instructions to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97371 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 05:51:33 +00:00
Erick Tryzelaar
628b76ecb3 Fix incorrect uses of an ocaml llbuilder without extracting it from ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97368 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 05:51:16 +00:00
Erick Tryzelaar
d2b4aff4bc Remove malloc and free from the ocaml bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97367 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 05:51:09 +00:00
Jeffrey Yasskin
70b7007307 Fix the ocaml bindings for the bitcode reader.
llvm_get_module_provider() was returning a value of the wrong type.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97290 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 00:25:18 +00:00
Erick Tryzelaar
1430425539 Fix some ocaml documentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96323 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 03:45:17 +00:00
Chris Lattner
c3c3be582d fix llvm_build_struct_gep for PR6167, patch by
Peter Hawkins!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95644 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 01:39:46 +00:00
Jakob Stoklund Olesen
570a4a5d9c Reintroduce the InlineHint function attribute.
This time it's for real! I am going to hook this up in the frontends as well.

The inliner has some experimental heuristics for dealing with the inline hint.
When given a -respect-inlinehint option, functions marked with the inline
keyword are given a threshold just above the default for -O3.

We need some experiments to determine if that is the right thing to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95466 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06 01:16:28 +00:00
Chris Lattner
dd7da4f368 This corrects an error in the type of the Llvm.dispose_context function.
Patch by James Woodyatt!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94343 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 00:25:09 +00:00
Erick Tryzelaar
263d989a71 Fix bug 5992: O'Caml's llvm_create_module was treating the context as a string.
Thanks Andy Ray for catching this!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93588 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 23:49:16 +00:00
Eric Christopher
606a1d1f59 Remove the InlineHint attribute. There are no current or planned
users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93558 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 21:36:30 +00:00
Bob Wilson
3994b4b05e Fix another parallel make race condition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 20:12:14 +00:00
Erick Tryzelaar
f24bfa7f79 Expose the rest of the attribute settings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82965 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 04:42:47 +00:00
Erick Tryzelaar
4aee041000 Fix a bug in ocaml bindings that has incorrect linkage options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 04:42:36 +00:00
Erick Tryzelaar
4626268428 Expose initializing the native target for the execution engine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81800 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 21:54:32 +00:00
Bob Wilson
ae77a20148 Fix pr4820: Don't run llvm-config during "make clean" since it may have
already been removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81547 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 18:42:18 +00:00
Erick Tryzelaar
52248ff682 Fix header comment for bindings/ocaml/llvm/Makefile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 23:41:20 +00:00