19410f77bSPeter Zotov /*===-- backend_ocaml.c - LLVM OCaml Glue -----------------------*- C++ -*-===*\ 29410f77bSPeter 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 *| 79410f77bSPeter Zotov |* *| 89410f77bSPeter Zotov |*===----------------------------------------------------------------------===*| 99410f77bSPeter Zotov |* *| 109410f77bSPeter Zotov |* This file glues LLVM's OCaml interface to its C interface. These functions *| 119410f77bSPeter Zotov |* are by and large transparent wrappers to the corresponding C functions. *| 129410f77bSPeter Zotov |* *| 139410f77bSPeter Zotov |* Note that these functions intentionally take liberties with the CAMLparamX *| 149410f77bSPeter Zotov |* macros, since most of the parameters are not GC heap objects. *| 159410f77bSPeter Zotov |* *| 169410f77bSPeter Zotov \*===----------------------------------------------------------------------===*/ 179410f77bSPeter Zotov 189410f77bSPeter Zotov #include "llvm-c/Target.h" 199410f77bSPeter Zotov #include "caml/alloc.h" 209410f77bSPeter Zotov #include "caml/memory.h" 219410f77bSPeter Zotov 22662538acSPeter Zotov /* TODO: Figure out how to call these only for targets which support them. 23662538acSPeter Zotov * LLVMInitialize ## target ## AsmPrinter(); 24662538acSPeter Zotov * LLVMInitialize ## target ## AsmParser(); 25662538acSPeter Zotov * LLVMInitialize ## target ## Disassembler(); 26662538acSPeter Zotov */ 27b4fb964bSPeter Zotov 289410f77bSPeter Zotov #define INITIALIZER1(target) \ 29*8e4fc55aSJosh Berdine value llvm_initialize_ ## target(value Unit) { \ 309410f77bSPeter Zotov LLVMInitialize ## target ## TargetInfo(); \ 319410f77bSPeter Zotov LLVMInitialize ## target ## Target(); \ 329410f77bSPeter Zotov LLVMInitialize ## target ## TargetMC(); \ 339410f77bSPeter Zotov return Val_unit; \ 349410f77bSPeter Zotov } 359410f77bSPeter Zotov 369410f77bSPeter Zotov #define INITIALIZER(target) INITIALIZER1(target) 379410f77bSPeter Zotov 389410f77bSPeter Zotov INITIALIZER(TARGET) 39