1 /*===-- ipo_ocaml.c - LLVM OCaml Glue ---------------------------*- C++ -*-===*\
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
5 |* See https://llvm.org/LICENSE.txt for license information. *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
8 |*===----------------------------------------------------------------------===*|
10 |* This file glues LLVM's OCaml interface to its C interface. These functions *|
11 |* are by and large transparent wrappers to the corresponding C functions. *|
13 |* Note that these functions intentionally take liberties with the CAMLparamX *|
14 |* macros, since most of the parameters are not GC heap objects. *|
16 \*===----------------------------------------------------------------------===*/
18 #include "llvm-c/Transforms/IPO.h"
19 #include "caml/mlvalues.h"
20 #include "caml/misc.h"
22 /* [`Module] Llvm.PassManager.t -> unit */
23 CAMLprim value
llvm_add_argument_promotion(LLVMPassManagerRef PM
) {
24 LLVMAddArgumentPromotionPass(PM
);
28 /* [`Module] Llvm.PassManager.t -> unit */
29 CAMLprim value
llvm_add_constant_merge(LLVMPassManagerRef PM
) {
30 LLVMAddConstantMergePass(PM
);
34 /* [`Module] Llvm.PassManager.t -> unit */
35 CAMLprim value
llvm_add_merge_functions(LLVMPassManagerRef PM
) {
36 LLVMAddMergeFunctionsPass(PM
);
40 /* [`Module] Llvm.PassManager.t -> unit */
41 CAMLprim value
llvm_add_dead_arg_elimination(LLVMPassManagerRef PM
) {
42 LLVMAddDeadArgEliminationPass(PM
);
46 /* [`Module] Llvm.PassManager.t -> unit */
47 CAMLprim value
llvm_add_function_attrs(LLVMPassManagerRef PM
) {
48 LLVMAddFunctionAttrsPass(PM
);
52 /* [`Module] Llvm.PassManager.t -> unit */
53 CAMLprim value
llvm_add_function_inlining(LLVMPassManagerRef PM
) {
54 LLVMAddFunctionInliningPass(PM
);
58 /* [`Module] Llvm.PassManager.t -> unit */
59 CAMLprim value
llvm_add_always_inliner(LLVMPassManagerRef PM
) {
60 LLVMAddAlwaysInlinerPass(PM
);
64 /* [`Module] Llvm.PassManager.t -> unit */
65 CAMLprim value
llvm_add_global_dce(LLVMPassManagerRef PM
) {
66 LLVMAddGlobalDCEPass(PM
);
70 /* [`Module] Llvm.PassManager.t -> unit */
71 CAMLprim value
llvm_add_global_optimizer(LLVMPassManagerRef PM
) {
72 LLVMAddGlobalOptimizerPass(PM
);
76 /* [`Module] Llvm.PassManager.t -> unit */
77 CAMLprim value
llvm_add_ip_constant_propagation(LLVMPassManagerRef PM
) {
78 LLVMAddIPConstantPropagationPass(PM
);
82 /* [`Module] Llvm.PassManager.t -> unit */
83 CAMLprim value
llvm_add_prune_eh(LLVMPassManagerRef PM
) {
84 LLVMAddPruneEHPass(PM
);
88 /* [`Module] Llvm.PassManager.t -> unit */
89 CAMLprim value
llvm_add_ipsccp(LLVMPassManagerRef PM
) {
90 LLVMAddIPSCCPPass(PM
);
94 /* [`Module] Llvm.PassManager.t -> all_but_main:bool -> unit */
95 CAMLprim value
llvm_add_internalize(LLVMPassManagerRef PM
, value AllButMain
) {
96 LLVMAddInternalizePass(PM
, Bool_val(AllButMain
));
100 /* [`Module] Llvm.PassManager.t -> unit */
101 CAMLprim value
llvm_add_strip_dead_prototypes(LLVMPassManagerRef PM
) {
102 LLVMAddStripDeadPrototypesPass(PM
);
106 /* [`Module] Llvm.PassManager.t -> unit */
107 CAMLprim value
llvm_add_strip_symbols(LLVMPassManagerRef PM
) {
108 LLVMAddStripSymbolsPass(PM
);