Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
/*===-- ipo_ocaml.c - LLVM OCaml Glue ---------------------------*- C++ -*-===*\ | /*===-- ipo_ocaml.c - LLVM OCaml Glue ---------------------------*- C++ -*-===*\ | ||||
|* *| | |* *| | ||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| | |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| | ||||
|* Exceptions. *| | |* Exceptions. *| | ||||
|* See https://llvm.org/LICENSE.txt for license information. *| | |* See https://llvm.org/LICENSE.txt for license information. *| | ||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| | |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| | ||||
|* *| | |* *| | ||||
|*===----------------------------------------------------------------------===*| | |*===----------------------------------------------------------------------===*| | ||||
|* *| | |* *| | ||||
|* This file glues LLVM's OCaml interface to its C interface. These functions *| | |* This file glues LLVM's OCaml interface to its C interface. These functions *| | ||||
|* are by and large transparent wrappers to the corresponding C functions. *| | |* are by and large transparent wrappers to the corresponding C functions. *| | ||||
|* *| | |* *| | ||||
|* Note that these functions intentionally take liberties with the CAMLparamX *| | |||||
|* macros, since most of the parameters are not GC heap objects. *| | |||||
|* *| | |||||
\*===----------------------------------------------------------------------===*/ | \*===----------------------------------------------------------------------===*/ | ||||
#include "llvm-c/Transforms/IPO.h" | #include "caml/memory.h" | ||||
#include "caml/mlvalues.h" | |||||
#include "caml/misc.h" | #include "caml/misc.h" | ||||
#include "caml/mlvalues.h" | |||||
#include "llvm_ocaml.h" | |||||
#include "llvm-c/Transforms/IPO.h" | |||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_constant_merge(LLVMPassManagerRef PM) { | value llvm_add_constant_merge(value PM) { | ||||
LLVMAddConstantMergePass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddConstantMergePass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_merge_functions(LLVMPassManagerRef PM) { | value llvm_add_merge_functions(value PM) { | ||||
LLVMAddMergeFunctionsPass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddMergeFunctionsPass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_dead_arg_elimination(LLVMPassManagerRef PM) { | value llvm_add_dead_arg_elimination(value PM) { | ||||
LLVMAddDeadArgEliminationPass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddDeadArgEliminationPass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_function_attrs(LLVMPassManagerRef PM) { | value llvm_add_function_attrs(value PM) { | ||||
LLVMAddFunctionAttrsPass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddFunctionAttrsPass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_function_inlining(LLVMPassManagerRef PM) { | value llvm_add_function_inlining(value PM) { | ||||
LLVMAddFunctionInliningPass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddFunctionInliningPass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_always_inliner(LLVMPassManagerRef PM) { | value llvm_add_always_inliner(value PM) { | ||||
LLVMAddAlwaysInlinerPass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddAlwaysInlinerPass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_global_dce(LLVMPassManagerRef PM) { | value llvm_add_global_dce(value PM) { | ||||
LLVMAddGlobalDCEPass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddGlobalDCEPass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_global_optimizer(LLVMPassManagerRef PM) { | value llvm_add_global_optimizer(value PM) { | ||||
LLVMAddGlobalOptimizerPass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddGlobalOptimizerPass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_ipsccp(LLVMPassManagerRef PM) { | value llvm_add_ipsccp(value PM) { | ||||
LLVMAddIPSCCPPass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddIPSCCPPass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> all_but_main:bool -> unit */ | /* [`Module] Llvm.PassManager.t -> all_but_main:bool -> unit */ | ||||
value llvm_add_internalize(LLVMPassManagerRef PM, value AllButMain) { | value llvm_add_internalize(value PM, value AllButMain) { | ||||
LLVMAddInternalizePass(PM, Bool_val(AllButMain)); | CAMLparam2(PM, AllButMain); | ||||
return Val_unit; | LLVMAddInternalizePass(PassManager_val(PM), Bool_val(AllButMain)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_strip_dead_prototypes(LLVMPassManagerRef PM) { | value llvm_add_strip_dead_prototypes(value PM) { | ||||
LLVMAddStripDeadPrototypesPass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddStripDeadPrototypesPass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } | ||||
/* [`Module] Llvm.PassManager.t -> unit */ | /* [`Module] Llvm.PassManager.t -> unit */ | ||||
value llvm_add_strip_symbols(LLVMPassManagerRef PM) { | value llvm_add_strip_symbols(value PM) { | ||||
LLVMAddStripSymbolsPass(PM); | CAMLparam1(PM); | ||||
return Val_unit; | LLVMAddStripSymbolsPass(PassManager_val(PM)); | ||||
CAMLreturn(Val_unit); | |||||
} | } |