ruby-llvm-next 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +30 -0
- data/README.md +67 -0
- data/ext/ruby-llvm-support/Rakefile +110 -0
- data/ext/ruby-llvm-support/support.cpp +32 -0
- data/lib/llvm.rb +29 -0
- data/lib/llvm/analysis.rb +49 -0
- data/lib/llvm/analysis_ffi.rb +77 -0
- data/lib/llvm/config.rb +10 -0
- data/lib/llvm/core.rb +97 -0
- data/lib/llvm/core/bitcode.rb +84 -0
- data/lib/llvm/core/bitcode_ffi.rb +132 -0
- data/lib/llvm/core/builder.rb +944 -0
- data/lib/llvm/core/context.rb +24 -0
- data/lib/llvm/core/module.rb +240 -0
- data/lib/llvm/core/pass_manager.rb +80 -0
- data/lib/llvm/core/type.rb +210 -0
- data/lib/llvm/core/value.rb +1005 -0
- data/lib/llvm/core_ffi.rb +6021 -0
- data/lib/llvm/execution_engine.rb +323 -0
- data/lib/llvm/execution_engine_ffi.rb +421 -0
- data/lib/llvm/linker.rb +16 -0
- data/lib/llvm/linker_ffi.rb +44 -0
- data/lib/llvm/support.rb +38 -0
- data/lib/llvm/target.rb +318 -0
- data/lib/llvm/target_ffi.rb +628 -0
- data/lib/llvm/transforms/builder.rb +107 -0
- data/lib/llvm/transforms/builder_ffi.rb +117 -0
- data/lib/llvm/transforms/ipo.rb +78 -0
- data/lib/llvm/transforms/ipo_ffi.rb +127 -0
- data/lib/llvm/transforms/scalar.rb +152 -0
- data/lib/llvm/transforms/scalar_ffi.rb +344 -0
- data/lib/llvm/transforms/vectorize.rb +22 -0
- data/lib/llvm/transforms/vectorize_ffi.rb +38 -0
- data/lib/llvm/version.rb +5 -0
- data/test/array_test.rb +38 -0
- data/test/basic_block_test.rb +87 -0
- data/test/binary_operations_test.rb +58 -0
- data/test/bitcode_test.rb +24 -0
- data/test/branch_test.rb +57 -0
- data/test/call_test.rb +82 -0
- data/test/comparisons_test.rb +66 -0
- data/test/conversions_test.rb +92 -0
- data/test/double_test.rb +34 -0
- data/test/equality_test.rb +89 -0
- data/test/function_test.rb +100 -0
- data/test/generic_value_test.rb +22 -0
- data/test/instruction_test.rb +30 -0
- data/test/ipo_test.rb +53 -0
- data/test/linker_test.rb +37 -0
- data/test/mcjit_test.rb +94 -0
- data/test/memory_access_test.rb +38 -0
- data/test/module_test.rb +93 -0
- data/test/parameter_collection_test.rb +28 -0
- data/test/pass_manager_builder_test.rb +53 -0
- data/test/phi_test.rb +33 -0
- data/test/select_test.rb +22 -0
- data/test/struct_test.rb +98 -0
- data/test/target_test.rb +113 -0
- data/test/test_helper.rb +62 -0
- data/test/type_test.rb +15 -0
- data/test/vector_test.rb +64 -0
- metadata +240 -0
@@ -0,0 +1,344 @@
|
|
1
|
+
# Generated by ffi_gen. Please do not change this file by hand.
|
2
|
+
|
3
|
+
require 'ffi'
|
4
|
+
|
5
|
+
module LLVM::C
|
6
|
+
extend FFI::Library
|
7
|
+
ffi_lib ["libLLVM-10.so.1", "LLVM-10"]
|
8
|
+
|
9
|
+
def self.attach_function(name, *_)
|
10
|
+
begin; super; rescue FFI::NotFoundError => e
|
11
|
+
(class << self; self; end).class_eval { define_method(name) { |*_| raise e } }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# See llvm::createAggressiveDCEPass function.
|
16
|
+
#
|
17
|
+
# @method add_aggressive_dce_pass(pm)
|
18
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
19
|
+
# @return [nil]
|
20
|
+
# @scope class
|
21
|
+
attach_function :add_aggressive_dce_pass, :LLVMAddAggressiveDCEPass, [:pointer], :void
|
22
|
+
|
23
|
+
# See llvm::createBitTrackingDCEPass function.
|
24
|
+
#
|
25
|
+
# @method add_bit_tracking_dce_pass(pm)
|
26
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
27
|
+
# @return [nil]
|
28
|
+
# @scope class
|
29
|
+
attach_function :add_bit_tracking_dce_pass, :LLVMAddBitTrackingDCEPass, [:pointer], :void
|
30
|
+
|
31
|
+
# See llvm::createAlignmentFromAssumptionsPass function.
|
32
|
+
#
|
33
|
+
# @method add_alignment_from_assumptions_pass(pm)
|
34
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
35
|
+
# @return [nil]
|
36
|
+
# @scope class
|
37
|
+
attach_function :add_alignment_from_assumptions_pass, :LLVMAddAlignmentFromAssumptionsPass, [:pointer], :void
|
38
|
+
|
39
|
+
# See llvm::createCFGSimplificationPass function.
|
40
|
+
#
|
41
|
+
# @method add_cfg_simplification_pass(pm)
|
42
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
43
|
+
# @return [nil]
|
44
|
+
# @scope class
|
45
|
+
attach_function :add_cfg_simplification_pass, :LLVMAddCFGSimplificationPass, [:pointer], :void
|
46
|
+
|
47
|
+
# See llvm::createLateCFGSimplificationPass function.
|
48
|
+
#
|
49
|
+
# @method add_late_cfg_simplification_pass(pm)
|
50
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
51
|
+
# @return [nil]
|
52
|
+
# @scope class
|
53
|
+
attach_function :add_late_cfg_simplification_pass, :LLVMAddLateCFGSimplificationPass, [:pointer], :void
|
54
|
+
|
55
|
+
# See llvm::createDeadStoreEliminationPass function.
|
56
|
+
#
|
57
|
+
# @method add_dead_store_elimination_pass(pm)
|
58
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
59
|
+
# @return [nil]
|
60
|
+
# @scope class
|
61
|
+
attach_function :add_dead_store_elimination_pass, :LLVMAddDeadStoreEliminationPass, [:pointer], :void
|
62
|
+
|
63
|
+
# See llvm::createScalarizerPass function.
|
64
|
+
#
|
65
|
+
# @method add_scalarizer_pass(pm)
|
66
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
67
|
+
# @return [nil]
|
68
|
+
# @scope class
|
69
|
+
attach_function :add_scalarizer_pass, :LLVMAddScalarizerPass, [:pointer], :void
|
70
|
+
|
71
|
+
# See llvm::createMergedLoadStoreMotionPass function.
|
72
|
+
#
|
73
|
+
# @method add_merged_load_store_motion_pass(pm)
|
74
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
75
|
+
# @return [nil]
|
76
|
+
# @scope class
|
77
|
+
attach_function :add_merged_load_store_motion_pass, :LLVMAddMergedLoadStoreMotionPass, [:pointer], :void
|
78
|
+
|
79
|
+
# See llvm::createGVNPass function.
|
80
|
+
#
|
81
|
+
# @method add_gvn_pass(pm)
|
82
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
83
|
+
# @return [nil]
|
84
|
+
# @scope class
|
85
|
+
attach_function :add_gvn_pass, :LLVMAddGVNPass, [:pointer], :void
|
86
|
+
|
87
|
+
# See llvm::createGVNPass function.
|
88
|
+
#
|
89
|
+
# @method add_new_gvn_pass(pm)
|
90
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
91
|
+
# @return [nil]
|
92
|
+
# @scope class
|
93
|
+
attach_function :add_new_gvn_pass, :LLVMAddNewGVNPass, [:pointer], :void
|
94
|
+
|
95
|
+
# See llvm::createIndVarSimplifyPass function.
|
96
|
+
#
|
97
|
+
# @method add_ind_var_simplify_pass(pm)
|
98
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
99
|
+
# @return [nil]
|
100
|
+
# @scope class
|
101
|
+
attach_function :add_ind_var_simplify_pass, :LLVMAddIndVarSimplifyPass, [:pointer], :void
|
102
|
+
|
103
|
+
# See llvm::createInstructionCombiningPass function.
|
104
|
+
#
|
105
|
+
# @method add_instruction_combining_pass(pm)
|
106
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
107
|
+
# @return [nil]
|
108
|
+
# @scope class
|
109
|
+
attach_function :add_instruction_combining_pass, :LLVMAddInstructionCombiningPass, [:pointer], :void
|
110
|
+
|
111
|
+
# See llvm::createJumpThreadingPass function.
|
112
|
+
#
|
113
|
+
# @method add_jump_threading_pass(pm)
|
114
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
115
|
+
# @return [nil]
|
116
|
+
# @scope class
|
117
|
+
attach_function :add_jump_threading_pass, :LLVMAddJumpThreadingPass, [:pointer], :void
|
118
|
+
|
119
|
+
# See llvm::createLICMPass function.
|
120
|
+
#
|
121
|
+
# @method add_licm_pass(pm)
|
122
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
123
|
+
# @return [nil]
|
124
|
+
# @scope class
|
125
|
+
attach_function :add_licm_pass, :LLVMAddLICMPass, [:pointer], :void
|
126
|
+
|
127
|
+
# See llvm::createLoopDeletionPass function.
|
128
|
+
#
|
129
|
+
# @method add_loop_deletion_pass(pm)
|
130
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
131
|
+
# @return [nil]
|
132
|
+
# @scope class
|
133
|
+
attach_function :add_loop_deletion_pass, :LLVMAddLoopDeletionPass, [:pointer], :void
|
134
|
+
|
135
|
+
# See llvm::createLoopIdiomPass function
|
136
|
+
#
|
137
|
+
# @method add_loop_idiom_pass(pm)
|
138
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
139
|
+
# @return [nil]
|
140
|
+
# @scope class
|
141
|
+
attach_function :add_loop_idiom_pass, :LLVMAddLoopIdiomPass, [:pointer], :void
|
142
|
+
|
143
|
+
# See llvm::createLoopRotatePass function.
|
144
|
+
#
|
145
|
+
# @method add_loop_rotate_pass(pm)
|
146
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
147
|
+
# @return [nil]
|
148
|
+
# @scope class
|
149
|
+
attach_function :add_loop_rotate_pass, :LLVMAddLoopRotatePass, [:pointer], :void
|
150
|
+
|
151
|
+
# See llvm::createLoopRerollPass function.
|
152
|
+
#
|
153
|
+
# @method add_loop_reroll_pass(pm)
|
154
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
155
|
+
# @return [nil]
|
156
|
+
# @scope class
|
157
|
+
attach_function :add_loop_reroll_pass, :LLVMAddLoopRerollPass, [:pointer], :void
|
158
|
+
|
159
|
+
# See llvm::createLoopUnrollPass function.
|
160
|
+
#
|
161
|
+
# @method add_loop_unroll_pass(pm)
|
162
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
163
|
+
# @return [nil]
|
164
|
+
# @scope class
|
165
|
+
attach_function :add_loop_unroll_pass, :LLVMAddLoopUnrollPass, [:pointer], :void
|
166
|
+
|
167
|
+
# See llvm::createLoopUnswitchPass function.
|
168
|
+
#
|
169
|
+
# @method add_loop_unswitch_pass(pm)
|
170
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
171
|
+
# @return [nil]
|
172
|
+
# @scope class
|
173
|
+
attach_function :add_loop_unswitch_pass, :LLVMAddLoopUnswitchPass, [:pointer], :void
|
174
|
+
|
175
|
+
# See llvm::createMemCpyOptPass function.
|
176
|
+
#
|
177
|
+
# @method add_mem_cpy_opt_pass(pm)
|
178
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
179
|
+
# @return [nil]
|
180
|
+
# @scope class
|
181
|
+
attach_function :add_mem_cpy_opt_pass, :LLVMAddMemCpyOptPass, [:pointer], :void
|
182
|
+
|
183
|
+
# See llvm::createPartiallyInlineLibCallsPass function.
|
184
|
+
#
|
185
|
+
# @method add_partially_inline_lib_calls_pass(pm)
|
186
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
187
|
+
# @return [nil]
|
188
|
+
# @scope class
|
189
|
+
attach_function :add_partially_inline_lib_calls_pass, :LLVMAddPartiallyInlineLibCallsPass, [:pointer], :void
|
190
|
+
|
191
|
+
# See llvm::createLowerSwitchPass function.
|
192
|
+
#
|
193
|
+
# @method add_lower_switch_pass(pm)
|
194
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
195
|
+
# @return [nil]
|
196
|
+
# @scope class
|
197
|
+
attach_function :add_lower_switch_pass, :LLVMAddLowerSwitchPass, [:pointer], :void
|
198
|
+
|
199
|
+
# See llvm::createPromoteMemoryToRegisterPass function.
|
200
|
+
#
|
201
|
+
# @method add_promote_memory_to_register_pass(pm)
|
202
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
203
|
+
# @return [nil]
|
204
|
+
# @scope class
|
205
|
+
attach_function :add_promote_memory_to_register_pass, :LLVMAddPromoteMemoryToRegisterPass, [:pointer], :void
|
206
|
+
|
207
|
+
# See llvm::createReassociatePass function.
|
208
|
+
#
|
209
|
+
# @method add_reassociate_pass(pm)
|
210
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
211
|
+
# @return [nil]
|
212
|
+
# @scope class
|
213
|
+
attach_function :add_reassociate_pass, :LLVMAddReassociatePass, [:pointer], :void
|
214
|
+
|
215
|
+
# See llvm::createSCCPPass function.
|
216
|
+
#
|
217
|
+
# @method add_sccp_pass(pm)
|
218
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
219
|
+
# @return [nil]
|
220
|
+
# @scope class
|
221
|
+
attach_function :add_sccp_pass, :LLVMAddSCCPPass, [:pointer], :void
|
222
|
+
|
223
|
+
# See llvm::createSROAPass function.
|
224
|
+
#
|
225
|
+
# @method add_scalar_repl_aggregates_pass(pm)
|
226
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
227
|
+
# @return [nil]
|
228
|
+
# @scope class
|
229
|
+
attach_function :add_scalar_repl_aggregates_pass, :LLVMAddScalarReplAggregatesPass, [:pointer], :void
|
230
|
+
|
231
|
+
# See llvm::createSROAPass function.
|
232
|
+
#
|
233
|
+
# @method add_scalar_repl_aggregates_pass_ssa(pm)
|
234
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
235
|
+
# @return [nil]
|
236
|
+
# @scope class
|
237
|
+
attach_function :add_scalar_repl_aggregates_pass_ssa, :LLVMAddScalarReplAggregatesPassSSA, [:pointer], :void
|
238
|
+
|
239
|
+
# See llvm::createSROAPass function.
|
240
|
+
#
|
241
|
+
# @method add_scalar_repl_aggregates_pass_with_threshold(pm, threshold)
|
242
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
243
|
+
# @param [Integer] threshold
|
244
|
+
# @return [nil]
|
245
|
+
# @scope class
|
246
|
+
attach_function :add_scalar_repl_aggregates_pass_with_threshold, :LLVMAddScalarReplAggregatesPassWithThreshold, [:pointer, :int], :void
|
247
|
+
|
248
|
+
# See llvm::createSimplifyLibCallsPass function.
|
249
|
+
#
|
250
|
+
# @method add_simplify_lib_calls_pass(pm)
|
251
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
252
|
+
# @return [nil]
|
253
|
+
# @scope class
|
254
|
+
attach_function :add_simplify_lib_calls_pass, :LLVMAddSimplifyLibCallsPass, [:pointer], :void
|
255
|
+
|
256
|
+
# See llvm::createTailCallEliminationPass function.
|
257
|
+
#
|
258
|
+
# @method add_tail_call_elimination_pass(pm)
|
259
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
260
|
+
# @return [nil]
|
261
|
+
# @scope class
|
262
|
+
attach_function :add_tail_call_elimination_pass, :LLVMAddTailCallEliminationPass, [:pointer], :void
|
263
|
+
|
264
|
+
# See llvm::createConstantPropagationPass function.
|
265
|
+
#
|
266
|
+
# @method add_constant_propagation_pass(pm)
|
267
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
268
|
+
# @return [nil]
|
269
|
+
# @scope class
|
270
|
+
attach_function :add_constant_propagation_pass, :LLVMAddConstantPropagationPass, [:pointer], :void
|
271
|
+
|
272
|
+
# See llvm::demotePromoteMemoryToRegisterPass function.
|
273
|
+
#
|
274
|
+
# @method add_demote_memory_to_register_pass(pm)
|
275
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
276
|
+
# @return [nil]
|
277
|
+
# @scope class
|
278
|
+
attach_function :add_demote_memory_to_register_pass, :LLVMAddDemoteMemoryToRegisterPass, [:pointer], :void
|
279
|
+
|
280
|
+
# See llvm::createVerifierPass function.
|
281
|
+
#
|
282
|
+
# @method add_verifier_pass(pm)
|
283
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
284
|
+
# @return [nil]
|
285
|
+
# @scope class
|
286
|
+
attach_function :add_verifier_pass, :LLVMAddVerifierPass, [:pointer], :void
|
287
|
+
|
288
|
+
# See llvm::createCorrelatedValuePropagationPass function
|
289
|
+
#
|
290
|
+
# @method add_correlated_value_propagation_pass(pm)
|
291
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
292
|
+
# @return [nil]
|
293
|
+
# @scope class
|
294
|
+
attach_function :add_correlated_value_propagation_pass, :LLVMAddCorrelatedValuePropagationPass, [:pointer], :void
|
295
|
+
|
296
|
+
# See llvm::createEarlyCSEPass function
|
297
|
+
#
|
298
|
+
# @method add_early_cse_pass(pm)
|
299
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
300
|
+
# @return [nil]
|
301
|
+
# @scope class
|
302
|
+
attach_function :add_early_cse_pass, :LLVMAddEarlyCSEPass, [:pointer], :void
|
303
|
+
|
304
|
+
# See llvm::createEarlyCSEPass function
|
305
|
+
#
|
306
|
+
# @method add_early_cse_mem_ssa_pass(pm)
|
307
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
308
|
+
# @return [nil]
|
309
|
+
# @scope class
|
310
|
+
attach_function :add_early_cse_mem_ssa_pass, :LLVMAddEarlyCSEMemSSAPass, [:pointer], :void
|
311
|
+
|
312
|
+
# See llvm::createLowerExpectIntrinsicPass function
|
313
|
+
#
|
314
|
+
# @method add_lower_expect_intrinsic_pass(pm)
|
315
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
316
|
+
# @return [nil]
|
317
|
+
# @scope class
|
318
|
+
attach_function :add_lower_expect_intrinsic_pass, :LLVMAddLowerExpectIntrinsicPass, [:pointer], :void
|
319
|
+
|
320
|
+
# See llvm::createTypeBasedAliasAnalysisPass function
|
321
|
+
#
|
322
|
+
# @method add_type_based_alias_analysis_pass(pm)
|
323
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
324
|
+
# @return [nil]
|
325
|
+
# @scope class
|
326
|
+
attach_function :add_type_based_alias_analysis_pass, :LLVMAddTypeBasedAliasAnalysisPass, [:pointer], :void
|
327
|
+
|
328
|
+
# See llvm::createScopedNoAliasAAPass function
|
329
|
+
#
|
330
|
+
# @method add_scoped_no_alias_aa_pass(pm)
|
331
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
332
|
+
# @return [nil]
|
333
|
+
# @scope class
|
334
|
+
attach_function :add_scoped_no_alias_aa_pass, :LLVMAddScopedNoAliasAAPass, [:pointer], :void
|
335
|
+
|
336
|
+
# See llvm::createBasicAliasAnalysisPass function
|
337
|
+
#
|
338
|
+
# @method add_basic_alias_analysis_pass(pm)
|
339
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
340
|
+
# @return [nil]
|
341
|
+
# @scope class
|
342
|
+
attach_function :add_basic_alias_analysis_pass, :LLVMAddBasicAliasAnalysisPass, [:pointer], :void
|
343
|
+
|
344
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'llvm'
|
2
|
+
require 'llvm/core'
|
3
|
+
require 'llvm/transforms/vectorize_ffi'
|
4
|
+
|
5
|
+
module LLVM
|
6
|
+
class PassManager
|
7
|
+
# @LLVMpass bb_vectorize
|
8
|
+
def bb_vectorize!
|
9
|
+
C.add_bb_vectorize_pass(self)
|
10
|
+
end
|
11
|
+
|
12
|
+
# @LLVMpass loop_vectorize
|
13
|
+
def loop_vectorize!
|
14
|
+
C.add_loop_vectorize_pass(self)
|
15
|
+
end
|
16
|
+
|
17
|
+
# @LLVMpass slp_vectorize
|
18
|
+
def slp_vectorize!
|
19
|
+
C.add_slp_vectorize_pass(self)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Generated by ffi_gen. Please do not change this file by hand.
|
2
|
+
|
3
|
+
require 'ffi'
|
4
|
+
|
5
|
+
module LLVM::C
|
6
|
+
extend FFI::Library
|
7
|
+
ffi_lib ["libLLVM-10.so.1", "LLVM-10"]
|
8
|
+
|
9
|
+
def self.attach_function(name, *_)
|
10
|
+
begin; super; rescue FFI::NotFoundError => e
|
11
|
+
(class << self; self; end).class_eval { define_method(name) { |*_| raise e } }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# DEPRECATED - Use LLVMAddSLPVectorizePass
|
16
|
+
#
|
17
|
+
# @method add_bb_vectorize_pass(pm)
|
18
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
19
|
+
# @return [nil]
|
20
|
+
# @scope class
|
21
|
+
attach_function :add_bb_vectorize_pass, :LLVMAddBBVectorizePass, [:pointer], :void
|
22
|
+
|
23
|
+
# See llvm::createLoopVectorizePass function.
|
24
|
+
#
|
25
|
+
# @method add_loop_vectorize_pass(pm)
|
26
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
27
|
+
# @return [nil]
|
28
|
+
# @scope class
|
29
|
+
attach_function :add_loop_vectorize_pass, :LLVMAddLoopVectorizePass, [:pointer], :void
|
30
|
+
|
31
|
+
# See llvm::createSLPVectorizerPass function.
|
32
|
+
#
|
33
|
+
# @method add_slp_vectorize_pass(pm)
|
34
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
35
|
+
# @return [nil]
|
36
|
+
# @scope class
|
37
|
+
attach_function :add_slp_vectorize_pass, :LLVMAddSLPVectorizePass, [:pointer], :void
|
38
|
+
end
|
data/lib/llvm/version.rb
ADDED
data/test/array_test.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class ArrayTestCase < Minitest::Test
|
4
|
+
|
5
|
+
def setup
|
6
|
+
LLVM.init_jit
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_constant_array_from_size
|
10
|
+
array = LLVM::ConstantArray.const(LLVM::Int, 2) { |i| LLVM::Int(i) }
|
11
|
+
assert_instance_of LLVM::ConstantArray, array
|
12
|
+
assert_equal 2, array.size
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_constant_array_from_array
|
16
|
+
array = LLVM::ConstantArray.const(LLVM::Int, [LLVM::Int(0), LLVM::Int(1)])
|
17
|
+
assert_instance_of LLVM::ConstantArray, array
|
18
|
+
assert_equal 2, array.size
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_array_values
|
22
|
+
assert_equal 2 + 3, run_array_values(2, 3).to_i
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_array_values(value1, value2)
|
26
|
+
run_function([LLVM::Int, LLVM::Int], [value1, value2], LLVM::Int) do |builder, function, *arguments|
|
27
|
+
entry = function.basic_blocks.append
|
28
|
+
builder.position_at_end(entry)
|
29
|
+
pointer = builder.alloca(LLVM::Array(LLVM::Int, 2))
|
30
|
+
array = builder.load(pointer)
|
31
|
+
array = builder.insert_value(array, arguments.first, 0)
|
32
|
+
array = builder.insert_value(array, arguments.last, 1)
|
33
|
+
builder.ret(builder.add(builder.extract_value(array, 0),
|
34
|
+
builder.extract_value(array, 1)))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|