1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

377 Commits

Author SHA1 Message Date
Jim Grosbach
84b2fe36c8 Tidy up. s/Low Level Virtual Machine/LLVM/.
LLVM isn't an acronym anymore.

llvm-svn: 148985
2012-01-25 22:00:23 +00:00
Bob Wilson
152a507523 Update OCaml bindings for the new half float type.
Patch by Jonathan Ragan-Kelley!

llvm-svn: 147314
2011-12-28 18:51:08 +00:00
Dylan Noblesmith
40dea4f20c drop unneeded config.h includes
llvm-svn: 147197
2011-12-22 23:04:07 +00:00
Daniel Dunbar
30d6a45140 LLVMBuild: Remove trailing newline, which irked me.
llvm-svn: 146409
2011-12-12 19:48:00 +00:00
Wojciech Matyjewicz
b017bc6c32 Minor fixes in Makefiles for the OCaml bindings:
1. Interface files (.mli) are installed before compiled interface
   files (.cmi) to preserve timestamp relation.
2. install-meta should use $(OcamlDir) instead of $(ObjDir).
3. Declared some targets as .PHONY.

Patch by Christophe Raffalli.

llvm-svn: 144183
2011-11-09 12:00:39 +00:00
Daniel Dunbar
3760ebeebb build: Add initial cut at LLVMBuild.txt files.
llvm-svn: 143634
2011-11-03 18:53:17 +00:00
Torok Edwin
ab8624db55 OCaml bindings: add some missing functions and testcases.
The C bindings exposed some APIs that weren't covered by the OCaml bindings

llvm-svn: 141997
2011-10-14 20:38:33 +00:00
Torok Edwin
562d70c5ec OCaml bindings: fix attributes to use all 32 bits
OCaml's int is limited to 31 bits on 32-bit architectures, so use Int32
explicitly.
Also add an unpack_attr, and {function,param,instr}_attr functions to read
the attributes.

llvm-svn: 141996
2011-10-14 20:38:24 +00:00
Torok Edwin
d75f74a0f2 OCaml bindings: add icmp_predicate
llvm-svn: 141995
2011-10-14 20:38:19 +00:00
Torok Edwin
39d89ea3b3 OCaml bindings: fix infinite recursion on string_of_lltype
llvm-svn: 141994
2011-10-14 20:38:14 +00:00
Torok Edwin
4beae25e5a bindings: named struct support
llvm-svn: 141993
2011-10-14 20:38:08 +00:00
Torok Edwin
50c1b48b4c ocaml bindings: add findlib META support
This makes it easier to link against LLVM libs, especially if you are using
_oasis.

llvm-svn: 141992
2011-10-14 20:38:02 +00:00
Torok Edwin
5ea77f1df2 ocaml bindings: introduce classify_value
llvm-svn: 141991
2011-10-14 20:37:56 +00:00
Torok Edwin
47a6a6a1fc ocaml bindings: add getopcode for constant and instruction, and int64_of_const.
llvm-svn: 141990
2011-10-14 20:37:49 +00:00
Torok Edwin
463c360a11 bindings: tab and indentation fixes of my previous commits
llvm-svn: 141989
2011-10-14 20:37:42 +00:00
Torok Edwin
e5135b07e8 ocaml/C bindings: type->isSized()
llvm-svn: 141288
2011-10-06 12:13:28 +00:00
Torok Edwin
413276a992 add binding to read icmp predicate
llvm-svn: 141287
2011-10-06 12:13:20 +00:00
Torok Edwin
b0b404e35f ocaml/C bindings: getmdstring, add num_op, get_op should work on metadata too
llvm-svn: 141286
2011-10-06 12:13:11 +00:00
Torok Edwin
76fc6a1a53 C/OCaml API to retrieve struct name.
llvm-svn: 141285
2011-10-06 12:12:50 +00:00
Torok Edwin
be951e90d4 ocaml bindings: add llvm_ipo based on IPO.h
llvm-svn: 141284
2011-10-06 12:12:27 +00:00
Torok Edwin
b7495041db attempt to fix ocaml bindings: landing pads
llvm-svn: 140991
2011-10-03 06:41:46 +00:00
Peter Collingbourne
7f188438d5 Remove the build_unwind function from the OCaml bindings.
llvm-svn: 137193
2011-08-10 01:10:17 +00:00
Benjamin Kramer
801c887f01 Remove InvalidateStructLayoutInfo from the ocaml bindings.
llvm-svn: 136582
2011-07-31 01:12:39 +00:00
Nick Lewycky
73c4468632 Update OCaml bindings. Opaque types are gone, type holders are gone and the
module operations that operate on type names are gone.

llvm-svn: 134839
2011-07-09 18:29:33 +00:00
Erick Tryzelaar
4a621556e4 Fix compiling the ocaml kaleidoscope tutorials
llvm-svn: 125202
2011-02-09 18:32:02 +00:00
Torok Edwin
2acdd67db2 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).

llvm-svn: 122497
2010-12-23 15:49:26 +00:00
Eric Christopher
4d10241635 Try to fix ocaml bindings.
llvm-svn: 116021
2010-10-08 00:36:21 +00:00
Duncan Sands
2b3ed03649 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/

llvm-svn: 113960
2010-09-15 08:17:10 +00:00
Dale Johannesen
b3df2ff13d 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".)

llvm-svn: 113618
2010-09-10 20:55:01 +00:00
Benjamin Kramer
4c15ccc237 Remove unions from the ocaml bindings.
llvm-svn: 112363
2010-08-28 09:47:42 +00:00
Bill Wendling
9e3d8d1a60 - Add the LinkerPrivateWeakDefAutoLinkage to the Ada bindings.
- Support the LinkerWeak*Linkage types in llvm-nm and in LinkModules.cpp.

llvm-svn: 111952
2010-08-24 20:00:52 +00:00
Bob Wilson
20b6ec47d1 Fix a typo.
llvm-svn: 111627
2010-08-20 14:54:37 +00:00
Erick Tryzelaar
68c31295f7 Expose LLVMSetOperand and LLVMGetNumOperands to llvm-c and ocaml.
llvm-svn: 111625
2010-08-20 14:51:22 +00:00
Erick Tryzelaar
429605f7cc Fix arguments to ocaml's llvm_params.
Thanks to Jianzhou Zhao for finding this.

llvm-svn: 111624
2010-08-20 14:51:16 +00:00
Bill Wendling
90b6422f2f 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.

llvm-svn: 107433
2010-07-01 21:55:59 +00:00
Bill Wendling
59ef9bcc6d Revert r107205 and r107207.
llvm-svn: 107215
2010-06-29 22:34:52 +00:00
Bill Wendling
05a4c0b1f2 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".

llvm-svn: 107205
2010-06-29 21:24:00 +00:00
Chris Lattner
caf521c6b4 add attributes and module level asm to the ocaml bindings,
patch by Patrick Walton!

llvm-svn: 100932
2010-04-10 17:52:58 +00:00
Erick Tryzelaar
0e12fd5fc2 Add OCaml tutorial to the examples.
llvm-svn: 97966
2010-03-08 19:32:27 +00:00
Erick Tryzelaar
a71d3b252d Add a LLVMWriteBitcodeToFD that exposes the raw_fd_ostream options.
llvm-svn: 97858
2010-03-06 00:30:06 +00:00
Erick Tryzelaar
0b21835716 Expose the rest of the llvm-c scalar opts to ocaml.
llvm-svn: 97685
2010-03-03 23:51:34 +00:00
Erick Tryzelaar
c99098f20d Rename some ocaml functions.
llvm-svn: 97684
2010-03-03 23:51:30 +00:00
Erick Tryzelaar
d513bd7f7d Expose the external functions for ocaml's execution engine as an optimization.
llvm-svn: 97683
2010-03-03 23:51:28 +00:00
Erick Tryzelaar
2825c880af Expose alignment and stack alignment attributes to llvm-c and ocaml.
llvm-svn: 97682
2010-03-03 23:51:25 +00:00
Erick Tryzelaar
9a8b7c41c3 Use the ocaml tag 0 since we are just returning an option value.
llvm-svn: 97612
2010-03-02 23:59:08 +00:00
Erick Tryzelaar
481b9b1d9f Don't use an ocaml keyword in an ocamldoc comment.
llvm-svn: 97611
2010-03-02 23:59:05 +00:00
Erick Tryzelaar
99a0f1ebff Expose the optimization level for the jit in ocaml.
llvm-svn: 97610
2010-03-02 23:59:03 +00:00
Erick Tryzelaar
f04f234444 Remove module providers from ocaml.
llvm-svn: 97609
2010-03-02 23:59:00 +00:00
Erick Tryzelaar
0b0e6ace2c Add support for use to ocaml.
llvm-svn: 97586
2010-03-02 20:32:32 +00:00
Erick Tryzelaar
264323d31e Add support getting the operands of a User to ocaml.
llvm-svn: 97414
2010-02-28 20:45:03 +00:00
Erick Tryzelaar
ff1a75de6d Add support for global aliases to ocaml.
llvm-svn: 97413
2010-02-28 20:44:58 +00:00
Erick Tryzelaar
c0bff2bbc9 Add support for inserting inline asm to ocaml.
llvm-svn: 97412
2010-02-28 20:44:53 +00:00
Erick Tryzelaar
7d687cbb84 Add support for getting a null pointer.
llvm-svn: 97380
2010-02-28 09:46:27 +00:00
Erick Tryzelaar
17cb74d29a Add a way to look up a type by it's name in a module.
llvm-svn: 97379
2010-02-28 09:46:21 +00:00
Erick Tryzelaar
ab9a70c845 Add replace_all_uses_with to ocaml.
llvm-svn: 97378
2010-02-28 09:46:16 +00:00
Erick Tryzelaar
c6e78e3503 Add support for global variables in an address space for llvm-c and ocaml.
llvm-svn: 97377
2010-02-28 09:46:13 +00:00
Erick Tryzelaar
08d9f8e8fe Add indirect br support to llvm-c and ocaml.
llvm-svn: 97376
2010-02-28 09:46:06 +00:00
Erick Tryzelaar
9401ea01cc Add metadata functions to llvm-c and ocaml.
llvm-svn: 97375
2010-02-28 09:45:59 +00:00
Erick Tryzelaar
f7bbb83b17 Add the new builder arthmetic instructions to llvm-c and ocaml.
llvm-svn: 97372
2010-02-28 05:51:43 +00:00
Erick Tryzelaar
9c6bd15491 Add the new union arthmetic instructions to llvm-c and ocaml.
llvm-svn: 97371
2010-02-28 05:51:33 +00:00
Erick Tryzelaar
6aacf8ecde Fix incorrect uses of an ocaml llbuilder without extracting it from ocaml.
llvm-svn: 97368
2010-02-28 05:51:16 +00:00
Erick Tryzelaar
5baff36f22 Remove malloc and free from the ocaml bindings.
llvm-svn: 97367
2010-02-28 05:51:09 +00:00
Jeffrey Yasskin
9093c94bbe Fix the ocaml bindings for the bitcode reader.
llvm_get_module_provider() was returning a value of the wrong type.

llvm-svn: 97290
2010-02-27 00:25:18 +00:00
Erick Tryzelaar
f6e2c05ad6 Fix some ocaml documentation
llvm-svn: 96323
2010-02-16 03:45:17 +00:00
Chris Lattner
fbda857b5c fix llvm_build_struct_gep for PR6167, patch by
Peter Hawkins!

llvm-svn: 95644
2010-02-09 01:39:46 +00:00
Jakob Stoklund Olesen
83ebc265b3 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.

llvm-svn: 95466
2010-02-06 01:16:28 +00:00
Chris Lattner
1e19ffa26d This corrects an error in the type of the Llvm.dispose_context function.
Patch by James Woodyatt!

llvm-svn: 94343
2010-01-24 00:25:09 +00:00
Erick Tryzelaar
562dfbef93 Fix bug 5992: O'Caml's llvm_create_module was treating the context as a string.
Thanks Andy Ray for catching this!

llvm-svn: 93588
2010-01-15 23:49:16 +00:00
Eric Christopher
3c5d9dc0e3 Remove the InlineHint attribute. There are no current or planned
users.

llvm-svn: 93558
2010-01-15 21:36:30 +00:00
Bob Wilson
93f8ae1d35 Fix another parallel make race condition.
llvm-svn: 91709
2009-12-18 20:12:14 +00:00
Erick Tryzelaar
e59452b328 Expose the rest of the attribute settings.
llvm-svn: 82965
2009-09-28 04:42:47 +00:00
Erick Tryzelaar
9212efe029 Fix a bug in ocaml bindings that has incorrect linkage options.
llvm-svn: 82964
2009-09-28 04:42:36 +00:00
Erick Tryzelaar
cd5ce50e17 Expose initializing the native target for the execution engine.
llvm-svn: 81800
2009-09-14 21:54:32 +00:00
Bob Wilson
5e2c59df82 Fix pr4820: Don't run llvm-config during "make clean" since it may have
already been removed.

llvm-svn: 81547
2009-09-11 18:42:18 +00:00
Erick Tryzelaar
af1b2037d3 Fix header comment for bindings/ocaml/llvm/Makefile.
llvm-svn: 80526
2009-08-30 23:41:20 +00:00
Erick Tryzelaar
c20463016c Convert the rest of the ocaml types and functions to use context.
llvm-svn: 79430
2009-08-19 17:32:24 +00:00
Erick Tryzelaar
7122c0e368 Add the ocaml binding to LLVMBuildAggregateRet.
llvm-svn: 79414
2009-08-19 08:37:00 +00:00
Erick Tryzelaar
fe080c15ce Allow passing around LLVMContext in ocaml.
llvm-svn: 79410
2009-08-19 06:40:29 +00:00
Edward O'Callaghan
cea86566ee LLVM Ada language bindings. Credit to Rod Kay and the AuroraUX team.
llvm-svn: 79295
2009-08-18 00:24:36 +00:00
Erick Tryzelaar
5c0946f3a2 Expose creating constant ints and floats from strings to ocaml.
llvm-svn: 79214
2009-08-16 23:37:03 +00:00
Erick Tryzelaar
175dd821cc Add an llvm-c function that lets you insert an instruction with a name.
llvm-svn: 79163
2009-08-16 02:20:57 +00:00
Erick Tryzelaar
ed8dffc10b Expose most of the Constant creation functions to ocaml.
llvm-svn: 79162
2009-08-16 02:20:37 +00:00
Erick Tryzelaar
57dcc1e1a3 Expose most of the IRBuilder functionality to ocaml.
llvm-svn: 79161
2009-08-16 02:20:24 +00:00
Erick Tryzelaar
886b353b90 Fix comment in llvm.mli.
llvm-svn: 78591
2009-08-10 19:45:00 +00:00
Erick Tryzelaar
04e1294ada Fix docstring for ocaml binding's const_float.
llvm-svn: 78589
2009-08-10 19:44:45 +00:00
Bob Wilson
7f3ffe1e45 Reorder the "Metadata" entry to match the C bindings.
This fixes a regression in the vmcore.ml dejagnu test.

llvm-svn: 76657
2009-07-21 21:52:57 +00:00
Reid Kleckner
5460ad390c Add EngineBuilder to ExecutionEngine in favor of the five optional argument EE::create().
Also a test commit.

llvm-svn: 76276
2009-07-18 00:42:18 +00:00
Bob Wilson
653f309975 Fix the Ocaml bindings for the ExecutionEngine: with the change to build
libraries instead of relinked objects, the interpreter, JIT, and native
target libraries were not being linked in to an ocaml program using the
ExecutionEngine.

llvm-svn: 74117
2009-06-24 21:09:18 +00:00
Chris Lattner
eba5c29922 remove dead makefile flags.
llvm-svn: 74064
2009-06-24 05:28:55 +00:00
Nick Lewycky
a9de2f1c81 Give embedded metadata its own type instead of relying on EmptyStructTy.
llvm-svn: 72610
2009-05-30 05:06:04 +00:00
Duncan Sands
5982924b04 Hopefully fix the build for people with ocaml.
llvm-svn: 72254
2009-05-22 09:22:17 +00:00
Duncan Sands
316352b541 Add a getAlignOf helper for getting the ABI alignment of a
type as a target independent constant expression.  I confess
that I didn't check that this method works as intended (though
I did test the equivalent hand-written IR a little).  But what
could possibly go wrong!

llvm-svn: 72213
2009-05-21 15:52:21 +00:00
Duncan Sands
f7af13b2d4 Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.

llvm-svn: 71349
2009-05-09 07:06:46 +00:00
Duncan Sands
28e07fdaa2 OCaml parameter attribute bindings from PR2752.
Incomplete, but better than nothing.

llvm-svn: 71081
2009-05-06 12:21:17 +00:00
Bill Wendling
68ac27094d Fix the JIT bindings for ocaml.
llvm-svn: 70454
2009-04-30 00:43:39 +00:00
Nick Lewycky
d84e130ecf Fix ocaml bindings; add "available_externally" linkage type.
llvm-svn: 68945
2009-04-13 07:02:32 +00:00
Bob Wilson
fbcb5235b0 Fix a parallel make race condition by swapping the order of -I directories.
The .cmi files are generated in $(ObjDir) and then copied to $(OcamlDir).
The ocamldep output references the .cmi files in $(ObjDir), so make kicks
off a dependent compile as soon as the local copy is generated.  If the
copy to $(OcamlDir) is not complete at that point, the compiler will read
the partially copied file and complain about a "Corrupted compiled
interface".  Searching $(ObjDir) first avoids this.

llvm-svn: 66217
2009-03-06 00:00:58 +00:00
Nick Lewycky
bc0bb948cc Remove libtool.
llvm-svn: 65517
2009-02-26 07:44:16 +00:00
Duncan Sands
bcdbfb63dc Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.

llvm-svn: 62099
2009-01-12 20:38:59 +00:00
Gordon Henriksen
3324b5c3ca PR2731: C and Ocaml bindings for setTailCall and isTailCall.
Based on patch by Giorgos Korfiatis.

llvm-svn: 55570
2008-08-30 16:34:54 +00:00
Gordon Henriksen
2cc861a6c1 Rename some GC classes so that their roll will hopefully be clearer.
In particular, Collector was confusing to implementors. Several
thought that this compile-time class was the place to implement
their runtime GC heap. Of course, it doesn't even exist at runtime.
Specifically, the renames are:

  Collector               -> GCStrategy
  CollectorMetadata       -> GCFunctionInfo
  CollectorModuleMetadata -> GCModuleInfo
  CollectorRegistry       -> GCRegistry
  Function::getCollector  -> getGC (setGC, hasGC, clearGC)

Several accessors and nested types have also been renamed to be
consistent. These changes should be obvious.

llvm-svn: 54899
2008-08-17 18:44:35 +00:00
Gordon Henriksen
78a53c516d Delete a redundant binding, LLVMHasInitializer.
Please use !LLVMIsDeclaration instead.

llvm-svn: 54572
2008-08-09 02:13:58 +00:00
Gordon Henriksen
b3806a3386 [PR-2610] Adding Ocaml bindings for Switch::addCase.
llvm-svn: 54571
2008-08-09 01:55:52 +00:00
Gordon Henriksen
b0ee2172b0 Fix the LLVMCreateJITCompiler C binding.
Evan broke it in r54523 by adding a parameter in the implementation without
updating the header correspondingly.

llvm-svn: 54555
2008-08-08 20:49:28 +00:00
Gordon Henriksen
a1f7004038 Remove a duplicative binding. Patch by Mahadevan R.
llvm-svn: 51238
2008-05-19 05:47:10 +00:00
Duncan Sands
c5f548f784 Merge LLVMBuilder and FoldingBuilder, calling
the result IRBuilder.  Patch by Dominic Hamon.

llvm-svn: 49604
2008-04-13 06:22:09 +00:00
Erick Tryzelaar
847ee3e279 Expose Function::viewCFG and Function::viewCFGOnly to bindings.
llvm-svn: 48982
2008-03-31 16:22:09 +00:00
Erick Tryzelaar
0efea4df76 Expose ExecutionEngine::getTargetData() to c and ocaml bindings.
llvm-svn: 48851
2008-03-27 00:27:14 +00:00
Gordon Henriksen
44ed585350 Extend the builder interface to use the new instruction positioning code.
This adds support for instruction iterators, as well as rewriting the
builder code to use these new functions. This lets us eliminate the C
bindings for moving around the builder.

Patch by Erick Tryzelaar!

llvm-svn: 48774
2008-03-25 16:26:51 +00:00
Gordon Henriksen
8a5623e18b Another typo.
llvm-svn: 48713
2008-03-23 22:52:51 +00:00
Gordon Henriksen
b62aec2b95 Fix a typo.
llvm-svn: 48712
2008-03-23 22:37:22 +00:00
Gordon Henriksen
52f3a08237 Objective Caml bindings for basic block, function, global, and arg iterators.
llvm-svn: 48711
2008-03-23 22:21:29 +00:00
Gordon Henriksen
dca0a5c5dc C and Objective Caml bindings for mem2reg and reg2mem.
Patch by Erick Tryzelaar.

llvm-svn: 48602
2008-03-20 17:16:03 +00:00
Gordon Henriksen
15006d5da0 C and Objective Caml bindings for the various getParent methods of the IR.
Based on Erick Tryzelaar's patch.

llvm-svn: 48523
2008-03-19 01:11:35 +00:00
Bill Wendling
b1456f259d Fix for "make install" of ocaml docs. Patch by Erick Tryzelaar!
llvm-svn: 48451
2008-03-17 07:49:23 +00:00
Gordon Henriksen
04a60ddcd2 C and Objective Caml bindings for the TargetData class.
llvm-svn: 48422
2008-03-16 20:08:03 +00:00
Gordon Henriksen
8c33afc50c C and Objective Caml bindings for several scalar transforms.
Patch originally by Erick Tryzelaar, but has been modified somewhat.

llvm-svn: 48419
2008-03-16 16:32:40 +00:00
Gordon Henriksen
caeafc4911 C and Objective Caml bindings for PassManagers.
llvm-svn: 48413
2008-03-16 04:20:44 +00:00
Gordon Henriksen
51d9464f58 Minor documentation fix.
Patch by Erick Tryzelaar.

llvm-svn: 48382
2008-03-15 00:26:23 +00:00
Gordon Henriksen
7ebaba8579 Expose Module::dump via C and Ocaml.
Patch by Erick Tryzelaar.

llvm-svn: 48379
2008-03-14 23:58:56 +00:00
Gordon Henriksen
630bd4f98b Expose Module::dump via C and Ocaml.
Patch by Erick Tryzelaar.

llvm-svn: 48378
2008-03-14 23:52:53 +00:00
Gordon Henriksen
2bedc8476d Refresh Makefile.ocaml in objdir if it is modified in srcdir.
Patch by Erick Tryzelaar!

llvm-svn: 48150
2008-03-10 16:15:32 +00:00
Gordon Henriksen
d42b23a2d9 Refresh Makefile.ocaml in objdir if it is modified in srcdir.
Patch by Erick Tryzelaar!

llvm-svn: 48149
2008-03-10 15:58:40 +00:00
Gordon Henriksen
7af7f7f186 Adding ocamldoc generation.
Patch by Erick Tryzelaar.

llvm-svn: 48147
2008-03-10 15:49:16 +00:00
Gordon Henriksen
a6d10e21f7 Formatting improvements.
llvm-svn: 48146
2008-03-10 15:47:03 +00:00
Gordon Henriksen
773ba13395 This patch cleans up the OCaml bindings so that they format nicely with
ocamldoc. It does not yet hook into the build system, though.

Patch by Erick Tryzelaar!

llvm-svn: 48095
2008-03-09 07:17:38 +00:00
Gordon Henriksen
5da39fa644 Cleanup some comments in the OCaml bindings.
Patch by Erick Tryzelaar.

llvm-svn: 48014
2008-03-07 19:13:06 +00:00
Gordon Henriksen
20c6e292a5 Fix a typo. 'make clean' in bindings/ocaml would leave an output.
llvm-svn: 48012
2008-03-07 18:43:51 +00:00
Gordon Henriksen
1850fc4fa2 Fix a typo noticed by Erick Tryzelaar,
llvm-svn: 47886
2008-03-04 14:52:05 +00:00
Gordon Henriksen
87171d82dc Modify Makefile.rules to allow makefiles to prepend to C.Flags and
fiends. Change Makefile.ocaml to not touch CFLAGS.

llvm-svn: 45663
2008-01-06 21:54:35 +00:00
Gordon Henriksen
bc89f424b7 Fix a typo in llvm.mli noticed by Alain Frisch.
llvm-svn: 45585
2008-01-04 13:21:02 +00:00
Gordon Henriksen
35d9fcb448 Quote a path in the Ocaml makefile which is likely to include spaces on Windows.
llvm-svn: 45580
2008-01-04 11:55:57 +00:00
Gordon Henriksen
2d87c21eff Trying r45451 again, but this time warning-free on 3.10.x.
llvm-svn: 45452
2007-12-30 18:12:41 +00:00
Gordon Henriksen
28347a471e Remove some lines that are nonportable to Ocaml 3.06.
llvm-svn: 45451
2007-12-30 17:48:11 +00:00
Chris Lattner
7a9b0bf0eb remove attribution from a variety of miscellaneous files.
llvm-svn: 45425
2007-12-29 22:59:10 +00:00
Gordon Henriksen
36da9ea958 Bindings for instruction calling conventions.
llvm-svn: 45422
2007-12-29 20:45:00 +00:00
Chris Lattner
6aece93d5c remove attributions from the rest of the llvm makefiles.
llvm-svn: 45416
2007-12-29 20:11:13 +00:00
Gordon Henriksen
86e98275ff Adding bindings for target triple and data layout.
llvm-svn: 45369
2007-12-27 20:13:47 +00:00
Gordon Henriksen
997a800e99 Adding an uninitialized builder constructor to the Ocaml bindings.
llvm-svn: 45362
2007-12-26 21:21:51 +00:00
Gordon Henriksen
653a9e4c7f Disabling -g for ocaml builds; it's not downwards compatible.
llvm-svn: 45352
2007-12-25 08:37:43 +00:00
Gordon Henriksen
2d254558ca Fix some Ocaml GC errors noticed upon review.
llvm-svn: 45336
2007-12-23 17:10:23 +00:00
Gordon Henriksen
606ac32019 C and Ocaml bindings for ExecutionEngine (i.e., the JIT compiler).
llvm-svn: 45335
2007-12-23 16:59:28 +00:00
Gordon Henriksen
4c9ef1e54f Use a module to group calling convention values, too.
llvm-svn: 45236
2007-12-20 00:13:26 +00:00
Gordon Henriksen
fe94b95046 Using modules to group enumerations in Ocaml bindings.
llvm-svn: 45229
2007-12-19 22:54:12 +00:00
Gordon Henriksen
46137f1e2e Adding bindings for memory buffers and module providers. Switching
to exceptions rather than variants for error handling in Ocaml.

llvm-svn: 45226
2007-12-19 22:30:40 +00:00
Gordon Henriksen
ef2c27d164 C and Ocaml bindings for address spaces, for that burgeoning market
for Ocaml-based compilers targeting embedded devices. :)

llvm-svn: 45096
2007-12-17 16:08:32 +00:00
Gordon Henriksen
3f070cf3b9 Add (very basic) bindings for ModuleProvider.
llvm-svn: 44899
2007-12-12 01:04:30 +00:00
Gordon Henriksen
aff6e2bba2 Adding Ocaml bindings for the bitreader as requested by Sarah
Thompson. Usage should be something like this:

open Llvm
open Llvm_bitreader

match read_bitcode_file fn with
  | Bitreader_failure msg ->
      prerr_endline msg
  | Bitreader_success m -> 
      ...;
      dispose_module m

Compile with: ocamlc llvm.cma llvm_bitreader.cma
              ocamlopt llvm.cmxa llvm_bitreader.cmxa

llvm-svn: 44824
2007-12-11 00:20:48 +00:00
Gordon Henriksen
5d201e0bcc Adding a collector name attribute to Function in the IR. These
methods are new to Function:

  bool hasCollector() const;
  const std::string &getCollector() const;
  void setCollector(const std::string &);
  void clearCollector();

The assembly representation is as such:

  define void @f() gc "shadow-stack" { ...

The implementation uses an on-the-side table to map Functions to 
collector names, such that there is no overhead. A StringPool is 
further used to unique collector names, which are extremely
likely to be unique per process.

llvm-svn: 44769
2007-12-10 03:18:06 +00:00
Gordon Henriksen
0e02790ad5 Fix bug in constructing Ocaml option types in the bindings.
llvm-svn: 44704
2007-12-08 16:55:43 +00:00
Gordon Henriksen
90d6c0aea2 Track dependencies when creating symlinks to LLVM libraries next
to the ocaml bindings. This is required on Windows where 'ln -sf'
actually creates a copy. Thanks to Alain Frisch for noticing this.

llvm-svn: 44547
2007-12-03 21:15:53 +00:00
Gordon Henriksen
a01c1e3dd5 Adding ocamldoc-style comments for the Ocaml bindings.
llvm-svn: 44494
2007-12-01 21:01:15 +00:00
Gordon Henriksen
acf0aac0c1 Fix ocaml bindings for picky linkers. :)
Thanks to Török Edvin for helping to track this down.

llvm-svn: 42927
2007-10-12 19:48:13 +00:00
Gordon Henriksen
84b068154b C and Objective Caml bindings for PHINode::addIncoming etc.
llvm-svn: 42760
2007-10-08 18:14:39 +00:00
Gordon Henriksen
739a5252cb Fixed downrev Ocaml compatibility.
llvm-svn: 42744
2007-10-08 12:16:59 +00:00
Gordon Henriksen
8d8fae73c5 C and Objective Caml bindings for getFunction and getNamedGlobal. Also enhanced
the Objective Caml 'declare_*' functions to behave more or less like
getOrInsertFunction.

llvm-svn: 42740
2007-10-08 03:45:09 +00:00
Gordon Henriksen
454d171c26 C and Objective Caml bindings for GlobalVariable::isConstant.
llvm-svn: 42736
2007-10-07 17:31:42 +00:00
Gordon Henriksen
99c0e2918b C and Objective Caml bindings for PATypeHolder.
llvm-svn: 42713
2007-10-07 00:13:35 +00:00
Gordon Henriksen
06eeba26c1 Bindings for the verifier.
llvm-svn: 42707
2007-10-06 21:00:36 +00:00
Gordon Henriksen
64b6555e60 Deleting some unnecessary glue.
llvm-svn: 42702
2007-10-06 17:10:44 +00:00
Gordon Henriksen
36d61a4b79 Adopting a uniform naming convention for type constructors in
bindings (part le deux).

llvm-svn: 42701
2007-10-06 16:56:09 +00:00
Gordon Henriksen
ee9c8932e4 Adopting a uniform naming convention for type constructors in bindings.
llvm-svn: 42698
2007-10-06 16:05:20 +00:00
Gordon Henriksen
574434313a Adopting a uniform naming convention for constant constructors in bindings.
llvm-svn: 42697
2007-10-06 15:11:06 +00:00
Gordon Henriksen
65ce7c3085 Adding C and Ocaml bindings for ConstantExpr.
llvm-svn: 42696
2007-10-06 14:29:36 +00:00
Gordon Henriksen
8d97ababb0 Wrapping Value::dump.
llvm-svn: 42668
2007-10-06 00:08:49 +00:00
Gordon Henriksen
e2d253991d Do use the actual ocaml stdlib (not the install dir) to find the
caml/*.h headers.

llvm-svn: 42599
2007-10-04 00:07:50 +00:00
Gordon Henriksen
eca47fe7df Providing --with-ocaml-libdir for ./configure. The default is the
stdlib if it's beneath --prefix, and is libdir/ocaml otherwise.

If someone has a better way than this to test whether $B is a path
within $A, I'd love to hear it:

  if test "$A" \< "$B" -a "$B" \< "${A}~"

llvm-svn: 42532
2007-10-02 16:42:10 +00:00
Gordon Henriksen
7e22335299 Add explicit --enable-bindings option to configure.
llvm-svn: 42526
2007-10-02 09:50:18 +00:00
Gordon Henriksen
368316dc1c Remove debugging.
llvm-svn: 42385
2007-09-27 02:47:27 +00:00
Gordon Henriksen
c73d5c73a6 Added C and Ocaml bindings for functions, basic blocks, and
instruction creation. No support yet for instruction introspection.

Also eliminated allocas from the Ocaml bindings for portability,
and avoided unnecessary casts.

llvm-svn: 42367
2007-09-26 20:56:12 +00:00
Gordon Henriksen
7b659bff9c Fix srcdir <> objdir builds with ocaml 2.10. Downrev versions don't care whether
'dir' exists in 'ocamldep -I dir ...', but recent ones demand that it actually
exists.

llvm-svn: 42245
2007-09-23 13:37:44 +00:00
Gordon Henriksen
0728757caf Incorporating review feedback for GC verifier patch.
llvm-svn: 42163
2007-09-20 16:47:41 +00:00
Gabor Greif
d65f36fb5d use typenames equivalent to
(u)intval, because latter are not
present in older caml/mlvalues.h
(e.g. 2004/07/07, 1.48.6.1)

Using this as a workaround for now,
until --without-ocaml works
or we settle on a better solution

llvm-svn: 42160
2007-09-20 10:20:34 +00:00
Gabor Greif
b366bd7fb6 include alloca.h if available. this helps Solaris, but intnat and uintnat types are still undefined, causing errors
llvm-svn: 42129
2007-09-19 09:29:58 +00:00
Gordon Henriksen
9deea8ed1a Tests of the ocaml (and thus C) bindings for constants.
llvm-svn: 42101
2007-09-18 18:07:51 +00:00
Gordon Henriksen
29fe360b5a Adding ocaml language bindings for the vmcore and bitwriter libraries. These are
built atop the C language bindings, and user programs can link with them as 
such:

  # Bytecode
  ocamlc -cc g++ llvm.cma llvmbitwriter.cma -o example example.ml
  # Native
  ocamlopt -cc g++ llvm.cmxa llvmbitwriter.cmxa -o example.opt example.ml

The vmcore.ml test exercises most/all of the APIs thus far bound. Unfortunately,
they're not yet numerous enough to write hello world. But:

  $ cat example.ml
  (* example.ml *)
  
  open Llvm
  open Llvm_bitwriter
  
  let _ =
    let filename = Sys.argv.(1) in
    let m = create_module filename in
    
    let v = make_int_constant i32_type 42 false in
    let g = define_global "hello_world" v m in
    
    if not (write_bitcode_file m filename) then exit 1;
    
    dispose_module m;

  $ ocamlc -cc g++ llvm.cma llvm_bitwriter.cma -o example example.ml
  File "example.ml", line 11, characters 6-7:
  Warning Y: unused variable g.
  $ ./example example.bc
  $ llvm-dis < example.bc
  ; ModuleID = '<stdin>'
  @hello_world = global i32 42            ; <i32*> [#uses=0]

The ocaml test cases provide effective tests for the C interfaces.

llvm-svn: 42093
2007-09-18 12:49:39 +00:00
Gordon Henriksen
a8db66a37a (no commit message)
llvm-svn: 42090
2007-09-18 12:26:17 +00:00