[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / bindings / ocaml / transforms / scalar_opts / scalar_opts_ocaml.c
blob8d10989bd667163b1194a76b09f43638569d0871
1 /*===-- scalar_opts_ocaml.c - LLVM OCaml Glue -------------------*- C++ -*-===*\
2 |* *|
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
4 |* Exceptions. *|
5 |* See https://llvm.org/LICENSE.txt for license information. *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
7 |* *|
8 |*===----------------------------------------------------------------------===*|
9 |* *|
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. *|
12 |* *|
13 |* Note that these functions intentionally take liberties with the CAMLparamX *|
14 |* macros, since most of the parameters are not GC heap objects. *|
15 |* *|
16 \*===----------------------------------------------------------------------===*/
18 #include "llvm-c/Transforms/Scalar.h"
19 #include "llvm-c/Transforms/Utils.h"
20 #include "caml/mlvalues.h"
21 #include "caml/misc.h"
23 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
24 CAMLprim value llvm_add_aggressive_dce(LLVMPassManagerRef PM) {
25 LLVMAddAggressiveDCEPass(PM);
26 return Val_unit;
29 CAMLprim value llvm_add_dce(LLVMPassManagerRef PM) {
30 LLVMAddDCEPass(PM);
31 return Val_unit;
34 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
35 CAMLprim value llvm_add_alignment_from_assumptions(LLVMPassManagerRef PM) {
36 LLVMAddAlignmentFromAssumptionsPass(PM);
37 return Val_unit;
40 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
41 CAMLprim value llvm_add_cfg_simplification(LLVMPassManagerRef PM) {
42 LLVMAddCFGSimplificationPass(PM);
43 return Val_unit;
46 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
47 CAMLprim value llvm_add_dead_store_elimination(LLVMPassManagerRef PM) {
48 LLVMAddDeadStoreEliminationPass(PM);
49 return Val_unit;
52 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
53 CAMLprim value llvm_add_scalarizer(LLVMPassManagerRef PM) {
54 LLVMAddScalarizerPass(PM);
55 return Val_unit;
58 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
59 CAMLprim value llvm_add_merged_load_store_motion(LLVMPassManagerRef PM) {
60 LLVMAddMergedLoadStoreMotionPass(PM);
61 return Val_unit;
64 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
65 CAMLprim value llvm_add_gvn(LLVMPassManagerRef PM) {
66 LLVMAddGVNPass(PM);
67 return Val_unit;
70 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
71 CAMLprim value llvm_add_ind_var_simplify(LLVMPassManagerRef PM) {
72 LLVMAddIndVarSimplifyPass(PM);
73 return Val_unit;
76 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
77 CAMLprim value llvm_add_instruction_combining(LLVMPassManagerRef PM) {
78 LLVMAddInstructionCombiningPass(PM);
79 return Val_unit;
82 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
83 CAMLprim value llvm_add_jump_threading(LLVMPassManagerRef PM) {
84 LLVMAddJumpThreadingPass(PM);
85 return Val_unit;
88 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
89 CAMLprim value llvm_add_licm(LLVMPassManagerRef PM) {
90 LLVMAddLICMPass(PM);
91 return Val_unit;
94 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
95 CAMLprim value llvm_add_loop_deletion(LLVMPassManagerRef PM) {
96 LLVMAddLoopDeletionPass(PM);
97 return Val_unit;
100 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
101 CAMLprim value llvm_add_loop_idiom(LLVMPassManagerRef PM) {
102 LLVMAddLoopIdiomPass(PM);
103 return Val_unit;
106 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
107 CAMLprim value llvm_add_loop_rotate(LLVMPassManagerRef PM) {
108 LLVMAddLoopRotatePass(PM);
109 return Val_unit;
112 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
113 CAMLprim value llvm_add_loop_reroll(LLVMPassManagerRef PM) {
114 LLVMAddLoopRerollPass(PM);
115 return Val_unit;
118 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
119 CAMLprim value llvm_add_loop_unroll(LLVMPassManagerRef PM) {
120 LLVMAddLoopUnrollPass(PM);
121 return Val_unit;
124 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
125 CAMLprim value llvm_add_loop_unswitch(LLVMPassManagerRef PM) {
126 LLVMAddLoopUnswitchPass(PM);
127 return Val_unit;
130 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
131 CAMLprim value llvm_add_memcpy_opt(LLVMPassManagerRef PM) {
132 LLVMAddMemCpyOptPass(PM);
133 return Val_unit;
136 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
137 CAMLprim value llvm_add_partially_inline_lib_calls(LLVMPassManagerRef PM) {
138 LLVMAddPartiallyInlineLibCallsPass(PM);
139 return Val_unit;
142 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
143 CAMLprim value llvm_add_lower_atomic(LLVMPassManagerRef PM) {
144 LLVMAddLowerAtomicPass(PM);
145 return Val_unit;
148 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
149 CAMLprim value llvm_add_lower_switch(LLVMPassManagerRef PM) {
150 LLVMAddLowerSwitchPass(PM);
151 return Val_unit;
154 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
155 CAMLprim value llvm_add_promote_memory_to_register(LLVMPassManagerRef PM) {
156 LLVMAddPromoteMemoryToRegisterPass(PM);
157 return Val_unit;
160 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
161 CAMLprim value llvm_add_reassociation(LLVMPassManagerRef PM) {
162 LLVMAddReassociatePass(PM);
163 return Val_unit;
166 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
167 CAMLprim value llvm_add_sccp(LLVMPassManagerRef PM) {
168 LLVMAddSCCPPass(PM);
169 return Val_unit;
172 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
173 CAMLprim value llvm_add_scalar_repl_aggregates(LLVMPassManagerRef PM) {
174 LLVMAddScalarReplAggregatesPass(PM);
175 return Val_unit;
178 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
179 CAMLprim value llvm_add_scalar_repl_aggregates_ssa(LLVMPassManagerRef PM) {
180 LLVMAddScalarReplAggregatesPassSSA(PM);
181 return Val_unit;
184 /* int -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
185 CAMLprim value llvm_add_scalar_repl_aggregates_with_threshold(value threshold,
186 LLVMPassManagerRef PM) {
187 LLVMAddScalarReplAggregatesPassWithThreshold(PM, Int_val(threshold));
188 return Val_unit;
191 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
192 CAMLprim value llvm_add_simplify_lib_calls(LLVMPassManagerRef PM) {
193 LLVMAddSimplifyLibCallsPass(PM);
194 return Val_unit;
197 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
198 CAMLprim value llvm_add_tail_call_elimination(LLVMPassManagerRef PM) {
199 LLVMAddTailCallEliminationPass(PM);
200 return Val_unit;
203 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
204 CAMLprim value llvm_add_constant_propagation(LLVMPassManagerRef PM) {
205 LLVMAddConstantPropagationPass(PM);
206 return Val_unit;
209 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
210 CAMLprim value llvm_add_demote_memory_to_register(LLVMPassManagerRef PM) {
211 LLVMAddDemoteMemoryToRegisterPass(PM);
212 return Val_unit;
215 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
216 CAMLprim value llvm_add_verifier(LLVMPassManagerRef PM) {
217 LLVMAddVerifierPass(PM);
218 return Val_unit;
221 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
222 CAMLprim value llvm_add_correlated_value_propagation(LLVMPassManagerRef PM) {
223 LLVMAddCorrelatedValuePropagationPass(PM);
224 return Val_unit;
227 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
228 CAMLprim value llvm_add_early_cse(LLVMPassManagerRef PM) {
229 LLVMAddEarlyCSEPass(PM);
230 return Val_unit;
233 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
234 CAMLprim value llvm_add_lower_expect_intrinsic(LLVMPassManagerRef PM) {
235 LLVMAddLowerExpectIntrinsicPass(PM);
236 return Val_unit;
239 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
240 CAMLprim value llvm_add_lower_constant_intrinsics(LLVMPassManagerRef PM) {
241 LLVMAddLowerConstantIntrinsicsPass(PM);
242 return Val_unit;
245 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
246 CAMLprim value llvm_add_type_based_alias_analysis(LLVMPassManagerRef PM) {
247 LLVMAddTypeBasedAliasAnalysisPass(PM);
248 return Val_unit;
251 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
252 CAMLprim value llvm_add_scoped_no_alias_aa(LLVMPassManagerRef PM) {
253 LLVMAddScopedNoAliasAAPass(PM);
254 return Val_unit;
257 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
258 CAMLprim value llvm_add_basic_alias_analysis(LLVMPassManagerRef PM) {
259 LLVMAddBasicAliasAnalysisPass(PM);
260 return Val_unit;
263 /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
264 CAMLprim value llvm_add_unify_function_exit_nodes(LLVMPassManagerRef PM) {
265 LLVMAddUnifyFunctionExitNodesPass(PM);
266 return Val_unit;