xref: /llvm-project/llvm/bindings/ocaml/all_backends/all_backends_ocaml.c (revision 8e4fc55a0e544d7d370a2d7689dbb622b2caefca)
1bf8a9ac7SPeter Zotov /*===-- all_backends_ocaml.c - LLVM OCaml Glue ------------------*- C++ -*-===*\
2bf8a9ac7SPeter Zotov |*                                                                            *|
32946cd70SChandler Carruth |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
42946cd70SChandler Carruth |* Exceptions.                                                                *|
52946cd70SChandler Carruth |* See https://llvm.org/LICENSE.txt for license information.                  *|
62946cd70SChandler Carruth |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
7bf8a9ac7SPeter Zotov |*                                                                            *|
8bf8a9ac7SPeter Zotov |*===----------------------------------------------------------------------===*|
9bf8a9ac7SPeter Zotov |*                                                                            *|
10bf8a9ac7SPeter Zotov |* This file glues LLVM's OCaml interface to its C interface. These functions *|
11bf8a9ac7SPeter Zotov |* are by and large transparent wrappers to the corresponding C functions.    *|
12bf8a9ac7SPeter Zotov |*                                                                            *|
13bf8a9ac7SPeter Zotov |* Note that these functions intentionally take liberties with the CAMLparamX *|
14bf8a9ac7SPeter Zotov |* macros, since most of the parameters are not GC heap objects.              *|
15bf8a9ac7SPeter Zotov |*                                                                            *|
16bf8a9ac7SPeter Zotov \*===----------------------------------------------------------------------===*/
17bf8a9ac7SPeter Zotov 
18bf8a9ac7SPeter Zotov #include "llvm-c/Target.h"
19bf8a9ac7SPeter Zotov #include "caml/alloc.h"
20bf8a9ac7SPeter Zotov #include "caml/fail.h"
21bf8a9ac7SPeter Zotov #include "caml/memory.h"
22bf8a9ac7SPeter Zotov #include "caml/custom.h"
23bf8a9ac7SPeter Zotov 
24bf8a9ac7SPeter Zotov /* unit -> unit */
llvm_initialize_all(value Unit)25*8e4fc55aSJosh Berdine value llvm_initialize_all(value Unit) {
26bf8a9ac7SPeter Zotov   LLVMInitializeAllTargetInfos();
27bf8a9ac7SPeter Zotov   LLVMInitializeAllTargets();
28bf8a9ac7SPeter Zotov   LLVMInitializeAllTargetMCs();
29bf8a9ac7SPeter Zotov   LLVMInitializeAllAsmPrinters();
30bf8a9ac7SPeter Zotov   LLVMInitializeAllAsmParsers();
31bf8a9ac7SPeter Zotov   return Val_unit;
32bf8a9ac7SPeter Zotov }
33