ruby-llvm 3.0.0 → 3.1.0.beta.1
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.
- data/README.rdoc +1 -1
- data/ext/ruby-llvm-support/Rakefile +1 -1
- data/lib/llvm.rb +1 -1
- data/lib/llvm/analysis_ffi.rb +26 -19
- data/lib/llvm/core/bitcode_ffi.rb +24 -18
- data/lib/llvm/core/builder.rb +15 -3
- data/lib/llvm/core/type.rb +16 -1
- data/lib/llvm/core/value.rb +25 -2
- data/lib/llvm/core_ffi.rb +3014 -2470
- data/lib/llvm/execution_engine_ffi.rb +101 -99
- data/lib/llvm/support.rb +1 -1
- data/lib/llvm/target_ffi.rb +155 -93
- data/lib/llvm/transforms/ipo_ffi.rb +23 -17
- data/lib/llvm/transforms/scalar_ffi.rb +39 -33
- data/lib/llvm/version.rb +2 -2
- data/test/array_test.rb +2 -2
- data/test/vector_test.rb +2 -2
- metadata +93 -89
@@ -4,307 +4,309 @@ require 'ffi'
|
|
4
4
|
|
5
5
|
module LLVM::C
|
6
6
|
extend FFI::Library
|
7
|
-
ffi_lib 'LLVM-3.
|
8
|
-
|
7
|
+
ffi_lib 'LLVM-3.1'
|
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
|
+
|
9
15
|
# (Not documented)
|
10
16
|
#
|
11
17
|
# @method link_in_jit()
|
12
18
|
# @return [nil]
|
13
19
|
# @scope class
|
14
20
|
attach_function :link_in_jit, :LLVMLinkInJIT, [], :void
|
15
|
-
|
21
|
+
|
16
22
|
# (Not documented)
|
17
23
|
#
|
18
24
|
# @method link_in_interpreter()
|
19
25
|
# @return [nil]
|
20
26
|
# @scope class
|
21
27
|
attach_function :link_in_interpreter, :LLVMLinkInInterpreter, [], :void
|
22
|
-
|
28
|
+
|
23
29
|
# (Not documented)
|
24
|
-
#
|
25
|
-
# = Fields:
|
26
|
-
#
|
27
30
|
class OpaqueGenericValue < FFI::Struct
|
31
|
+
layout :dummy, :char
|
28
32
|
end
|
29
|
-
|
33
|
+
|
30
34
|
# (Not documented)
|
31
|
-
#
|
32
|
-
# = Fields:
|
33
|
-
#
|
34
35
|
class OpaqueExecutionEngine < FFI::Struct
|
36
|
+
layout :dummy, :char
|
35
37
|
end
|
36
|
-
|
38
|
+
|
37
39
|
# ===-- Operations on generic values --------------------------------------===
|
38
40
|
#
|
39
41
|
# @method create_generic_value_of_int(ty, n, is_signed)
|
40
42
|
# @param [FFI::Pointer(TypeRef)] ty
|
41
43
|
# @param [Integer] n
|
42
44
|
# @param [Integer] is_signed
|
43
|
-
# @return [
|
45
|
+
# @return [OpaqueGenericValue]
|
44
46
|
# @scope class
|
45
|
-
attach_function :create_generic_value_of_int, :LLVMCreateGenericValueOfInt, [:pointer, :ulong_long, :int],
|
46
|
-
|
47
|
+
attach_function :create_generic_value_of_int, :LLVMCreateGenericValueOfInt, [:pointer, :ulong_long, :int], OpaqueGenericValue
|
48
|
+
|
47
49
|
# (Not documented)
|
48
50
|
#
|
49
51
|
# @method create_generic_value_of_pointer(p)
|
50
52
|
# @param [FFI::Pointer(*Void)] p
|
51
|
-
# @return [
|
53
|
+
# @return [OpaqueGenericValue]
|
52
54
|
# @scope class
|
53
|
-
attach_function :create_generic_value_of_pointer, :LLVMCreateGenericValueOfPointer, [:pointer],
|
54
|
-
|
55
|
+
attach_function :create_generic_value_of_pointer, :LLVMCreateGenericValueOfPointer, [:pointer], OpaqueGenericValue
|
56
|
+
|
55
57
|
# (Not documented)
|
56
58
|
#
|
57
59
|
# @method create_generic_value_of_float(ty, n)
|
58
60
|
# @param [FFI::Pointer(TypeRef)] ty
|
59
61
|
# @param [Float] n
|
60
|
-
# @return [
|
62
|
+
# @return [OpaqueGenericValue]
|
61
63
|
# @scope class
|
62
|
-
attach_function :create_generic_value_of_float, :LLVMCreateGenericValueOfFloat, [:pointer, :double],
|
63
|
-
|
64
|
+
attach_function :create_generic_value_of_float, :LLVMCreateGenericValueOfFloat, [:pointer, :double], OpaqueGenericValue
|
65
|
+
|
64
66
|
# (Not documented)
|
65
67
|
#
|
66
68
|
# @method generic_value_int_width(gen_val_ref)
|
67
|
-
# @param [
|
69
|
+
# @param [OpaqueGenericValue] gen_val_ref
|
68
70
|
# @return [Integer]
|
69
71
|
# @scope class
|
70
|
-
attach_function :generic_value_int_width, :LLVMGenericValueIntWidth, [
|
71
|
-
|
72
|
+
attach_function :generic_value_int_width, :LLVMGenericValueIntWidth, [OpaqueGenericValue], :uint
|
73
|
+
|
72
74
|
# (Not documented)
|
73
75
|
#
|
74
76
|
# @method generic_value_to_int(gen_val, is_signed)
|
75
|
-
# @param [
|
77
|
+
# @param [OpaqueGenericValue] gen_val
|
76
78
|
# @param [Integer] is_signed
|
77
79
|
# @return [Integer]
|
78
80
|
# @scope class
|
79
|
-
attach_function :generic_value_to_int, :LLVMGenericValueToInt, [
|
80
|
-
|
81
|
+
attach_function :generic_value_to_int, :LLVMGenericValueToInt, [OpaqueGenericValue, :int], :ulong_long
|
82
|
+
|
81
83
|
# (Not documented)
|
82
84
|
#
|
83
85
|
# @method generic_value_to_pointer(gen_val)
|
84
|
-
# @param [
|
86
|
+
# @param [OpaqueGenericValue] gen_val
|
85
87
|
# @return [FFI::Pointer(*Void)]
|
86
88
|
# @scope class
|
87
|
-
attach_function :generic_value_to_pointer, :LLVMGenericValueToPointer, [
|
88
|
-
|
89
|
+
attach_function :generic_value_to_pointer, :LLVMGenericValueToPointer, [OpaqueGenericValue], :pointer
|
90
|
+
|
89
91
|
# (Not documented)
|
90
92
|
#
|
91
93
|
# @method generic_value_to_float(ty_ref, gen_val)
|
92
94
|
# @param [FFI::Pointer(TypeRef)] ty_ref
|
93
|
-
# @param [
|
95
|
+
# @param [OpaqueGenericValue] gen_val
|
94
96
|
# @return [Float]
|
95
97
|
# @scope class
|
96
|
-
attach_function :generic_value_to_float, :LLVMGenericValueToFloat, [:pointer,
|
97
|
-
|
98
|
+
attach_function :generic_value_to_float, :LLVMGenericValueToFloat, [:pointer, OpaqueGenericValue], :double
|
99
|
+
|
98
100
|
# (Not documented)
|
99
101
|
#
|
100
102
|
# @method dispose_generic_value(gen_val)
|
101
|
-
# @param [
|
103
|
+
# @param [OpaqueGenericValue] gen_val
|
102
104
|
# @return [nil]
|
103
105
|
# @scope class
|
104
|
-
attach_function :dispose_generic_value, :LLVMDisposeGenericValue, [
|
105
|
-
|
106
|
+
attach_function :dispose_generic_value, :LLVMDisposeGenericValue, [OpaqueGenericValue], :void
|
107
|
+
|
106
108
|
# ===-- Operations on execution engines -----------------------------------===
|
107
109
|
#
|
108
110
|
# @method create_execution_engine_for_module(out_ee, m, out_error)
|
109
111
|
# @param [FFI::Pointer(*ExecutionEngineRef)] out_ee
|
110
112
|
# @param [FFI::Pointer(ModuleRef)] m
|
111
|
-
# @param [FFI::Pointer(**
|
113
|
+
# @param [FFI::Pointer(**CharS)] out_error
|
112
114
|
# @return [Integer]
|
113
115
|
# @scope class
|
114
116
|
attach_function :create_execution_engine_for_module, :LLVMCreateExecutionEngineForModule, [:pointer, :pointer, :pointer], :int
|
115
|
-
|
117
|
+
|
116
118
|
# (Not documented)
|
117
119
|
#
|
118
120
|
# @method create_interpreter_for_module(out_interp, m, out_error)
|
119
121
|
# @param [FFI::Pointer(*ExecutionEngineRef)] out_interp
|
120
122
|
# @param [FFI::Pointer(ModuleRef)] m
|
121
|
-
# @param [FFI::Pointer(**
|
123
|
+
# @param [FFI::Pointer(**CharS)] out_error
|
122
124
|
# @return [Integer]
|
123
125
|
# @scope class
|
124
126
|
attach_function :create_interpreter_for_module, :LLVMCreateInterpreterForModule, [:pointer, :pointer, :pointer], :int
|
125
|
-
|
127
|
+
|
126
128
|
# (Not documented)
|
127
129
|
#
|
128
130
|
# @method create_jit_compiler_for_module(out_jit, m, opt_level, out_error)
|
129
131
|
# @param [FFI::Pointer(*ExecutionEngineRef)] out_jit
|
130
132
|
# @param [FFI::Pointer(ModuleRef)] m
|
131
133
|
# @param [Integer] opt_level
|
132
|
-
# @param [FFI::Pointer(**
|
134
|
+
# @param [FFI::Pointer(**CharS)] out_error
|
133
135
|
# @return [Integer]
|
134
136
|
# @scope class
|
135
137
|
attach_function :create_jit_compiler_for_module, :LLVMCreateJITCompilerForModule, [:pointer, :pointer, :uint, :pointer], :int
|
136
|
-
|
138
|
+
|
137
139
|
# Deprecated: Use LLVMCreateExecutionEngineForModule instead.
|
138
140
|
#
|
139
141
|
# @method create_execution_engine(out_ee, mp, out_error)
|
140
142
|
# @param [FFI::Pointer(*ExecutionEngineRef)] out_ee
|
141
143
|
# @param [FFI::Pointer(ModuleProviderRef)] mp
|
142
|
-
# @param [FFI::Pointer(**
|
144
|
+
# @param [FFI::Pointer(**CharS)] out_error
|
143
145
|
# @return [Integer]
|
144
146
|
# @scope class
|
145
147
|
attach_function :create_execution_engine, :LLVMCreateExecutionEngine, [:pointer, :pointer, :pointer], :int
|
146
|
-
|
148
|
+
|
147
149
|
# Deprecated: Use LLVMCreateInterpreterForModule instead.
|
148
150
|
#
|
149
151
|
# @method create_interpreter(out_interp, mp, out_error)
|
150
152
|
# @param [FFI::Pointer(*ExecutionEngineRef)] out_interp
|
151
153
|
# @param [FFI::Pointer(ModuleProviderRef)] mp
|
152
|
-
# @param [FFI::Pointer(**
|
154
|
+
# @param [FFI::Pointer(**CharS)] out_error
|
153
155
|
# @return [Integer]
|
154
156
|
# @scope class
|
155
157
|
attach_function :create_interpreter, :LLVMCreateInterpreter, [:pointer, :pointer, :pointer], :int
|
156
|
-
|
158
|
+
|
157
159
|
# Deprecated: Use LLVMCreateJITCompilerForModule instead.
|
158
160
|
#
|
159
161
|
# @method create_jit_compiler(out_jit, mp, opt_level, out_error)
|
160
162
|
# @param [FFI::Pointer(*ExecutionEngineRef)] out_jit
|
161
163
|
# @param [FFI::Pointer(ModuleProviderRef)] mp
|
162
164
|
# @param [Integer] opt_level
|
163
|
-
# @param [FFI::Pointer(**
|
165
|
+
# @param [FFI::Pointer(**CharS)] out_error
|
164
166
|
# @return [Integer]
|
165
167
|
# @scope class
|
166
168
|
attach_function :create_jit_compiler, :LLVMCreateJITCompiler, [:pointer, :pointer, :uint, :pointer], :int
|
167
|
-
|
169
|
+
|
168
170
|
# (Not documented)
|
169
171
|
#
|
170
172
|
# @method dispose_execution_engine(ee)
|
171
|
-
# @param [
|
173
|
+
# @param [OpaqueExecutionEngine] ee
|
172
174
|
# @return [nil]
|
173
175
|
# @scope class
|
174
|
-
attach_function :dispose_execution_engine, :LLVMDisposeExecutionEngine, [
|
175
|
-
|
176
|
+
attach_function :dispose_execution_engine, :LLVMDisposeExecutionEngine, [OpaqueExecutionEngine], :void
|
177
|
+
|
176
178
|
# (Not documented)
|
177
179
|
#
|
178
180
|
# @method run_static_constructors(ee)
|
179
|
-
# @param [
|
181
|
+
# @param [OpaqueExecutionEngine] ee
|
180
182
|
# @return [nil]
|
181
183
|
# @scope class
|
182
|
-
attach_function :run_static_constructors, :LLVMRunStaticConstructors, [
|
183
|
-
|
184
|
+
attach_function :run_static_constructors, :LLVMRunStaticConstructors, [OpaqueExecutionEngine], :void
|
185
|
+
|
184
186
|
# (Not documented)
|
185
187
|
#
|
186
188
|
# @method run_static_destructors(ee)
|
187
|
-
# @param [
|
189
|
+
# @param [OpaqueExecutionEngine] ee
|
188
190
|
# @return [nil]
|
189
191
|
# @scope class
|
190
|
-
attach_function :run_static_destructors, :LLVMRunStaticDestructors, [
|
191
|
-
|
192
|
+
attach_function :run_static_destructors, :LLVMRunStaticDestructors, [OpaqueExecutionEngine], :void
|
193
|
+
|
192
194
|
# (Not documented)
|
193
195
|
#
|
194
196
|
# @method run_function_as_main(ee, f, arg_c, arg_v, env_p)
|
195
|
-
# @param [
|
197
|
+
# @param [OpaqueExecutionEngine] ee
|
196
198
|
# @param [FFI::Pointer(ValueRef)] f
|
197
199
|
# @param [Integer] arg_c
|
198
|
-
# @param [FFI::Pointer(**
|
199
|
-
# @param [FFI::Pointer(**
|
200
|
+
# @param [FFI::Pointer(**CharS)] arg_v
|
201
|
+
# @param [FFI::Pointer(**CharS)] env_p
|
200
202
|
# @return [Integer]
|
201
203
|
# @scope class
|
202
|
-
attach_function :run_function_as_main, :LLVMRunFunctionAsMain, [
|
203
|
-
|
204
|
+
attach_function :run_function_as_main, :LLVMRunFunctionAsMain, [OpaqueExecutionEngine, :pointer, :uint, :pointer, :pointer], :int
|
205
|
+
|
204
206
|
# (Not documented)
|
205
207
|
#
|
206
208
|
# @method run_function(ee, f, num_args, args)
|
207
|
-
# @param [
|
209
|
+
# @param [OpaqueExecutionEngine] ee
|
208
210
|
# @param [FFI::Pointer(ValueRef)] f
|
209
211
|
# @param [Integer] num_args
|
210
212
|
# @param [FFI::Pointer(*GenericValueRef)] args
|
211
|
-
# @return [
|
213
|
+
# @return [OpaqueGenericValue]
|
212
214
|
# @scope class
|
213
|
-
attach_function :run_function, :LLVMRunFunction, [
|
214
|
-
|
215
|
+
attach_function :run_function, :LLVMRunFunction, [OpaqueExecutionEngine, :pointer, :uint, :pointer], OpaqueGenericValue
|
216
|
+
|
215
217
|
# (Not documented)
|
216
218
|
#
|
217
219
|
# @method free_machine_code_for_function(ee, f)
|
218
|
-
# @param [
|
220
|
+
# @param [OpaqueExecutionEngine] ee
|
219
221
|
# @param [FFI::Pointer(ValueRef)] f
|
220
222
|
# @return [nil]
|
221
223
|
# @scope class
|
222
|
-
attach_function :free_machine_code_for_function, :LLVMFreeMachineCodeForFunction, [
|
223
|
-
|
224
|
+
attach_function :free_machine_code_for_function, :LLVMFreeMachineCodeForFunction, [OpaqueExecutionEngine, :pointer], :void
|
225
|
+
|
224
226
|
# (Not documented)
|
225
227
|
#
|
226
228
|
# @method add_module(ee, m)
|
227
|
-
# @param [
|
229
|
+
# @param [OpaqueExecutionEngine] ee
|
228
230
|
# @param [FFI::Pointer(ModuleRef)] m
|
229
231
|
# @return [nil]
|
230
232
|
# @scope class
|
231
|
-
attach_function :add_module, :LLVMAddModule, [
|
232
|
-
|
233
|
+
attach_function :add_module, :LLVMAddModule, [OpaqueExecutionEngine, :pointer], :void
|
234
|
+
|
233
235
|
# Deprecated: Use LLVMAddModule instead.
|
234
236
|
#
|
235
237
|
# @method add_module_provider(ee, mp)
|
236
|
-
# @param [
|
238
|
+
# @param [OpaqueExecutionEngine] ee
|
237
239
|
# @param [FFI::Pointer(ModuleProviderRef)] mp
|
238
240
|
# @return [nil]
|
239
241
|
# @scope class
|
240
|
-
attach_function :add_module_provider, :LLVMAddModuleProvider, [
|
241
|
-
|
242
|
+
attach_function :add_module_provider, :LLVMAddModuleProvider, [OpaqueExecutionEngine, :pointer], :void
|
243
|
+
|
242
244
|
# (Not documented)
|
243
245
|
#
|
244
246
|
# @method remove_module(ee, m, out_mod, out_error)
|
245
|
-
# @param [
|
247
|
+
# @param [OpaqueExecutionEngine] ee
|
246
248
|
# @param [FFI::Pointer(ModuleRef)] m
|
247
249
|
# @param [FFI::Pointer(*ModuleRef)] out_mod
|
248
|
-
# @param [FFI::Pointer(**
|
250
|
+
# @param [FFI::Pointer(**CharS)] out_error
|
249
251
|
# @return [Integer]
|
250
252
|
# @scope class
|
251
|
-
attach_function :remove_module, :LLVMRemoveModule, [
|
252
|
-
|
253
|
+
attach_function :remove_module, :LLVMRemoveModule, [OpaqueExecutionEngine, :pointer, :pointer, :pointer], :int
|
254
|
+
|
253
255
|
# Deprecated: Use LLVMRemoveModule instead.
|
254
256
|
#
|
255
257
|
# @method remove_module_provider(ee, mp, out_mod, out_error)
|
256
|
-
# @param [
|
258
|
+
# @param [OpaqueExecutionEngine] ee
|
257
259
|
# @param [FFI::Pointer(ModuleProviderRef)] mp
|
258
260
|
# @param [FFI::Pointer(*ModuleRef)] out_mod
|
259
|
-
# @param [FFI::Pointer(**
|
261
|
+
# @param [FFI::Pointer(**CharS)] out_error
|
260
262
|
# @return [Integer]
|
261
263
|
# @scope class
|
262
|
-
attach_function :remove_module_provider, :LLVMRemoveModuleProvider, [
|
263
|
-
|
264
|
+
attach_function :remove_module_provider, :LLVMRemoveModuleProvider, [OpaqueExecutionEngine, :pointer, :pointer, :pointer], :int
|
265
|
+
|
264
266
|
# (Not documented)
|
265
267
|
#
|
266
268
|
# @method find_function(ee, name, out_fn)
|
267
|
-
# @param [
|
269
|
+
# @param [OpaqueExecutionEngine] ee
|
268
270
|
# @param [String] name
|
269
271
|
# @param [FFI::Pointer(*ValueRef)] out_fn
|
270
272
|
# @return [Integer]
|
271
273
|
# @scope class
|
272
|
-
attach_function :find_function, :LLVMFindFunction, [
|
273
|
-
|
274
|
+
attach_function :find_function, :LLVMFindFunction, [OpaqueExecutionEngine, :string, :pointer], :int
|
275
|
+
|
274
276
|
# (Not documented)
|
275
277
|
#
|
276
278
|
# @method recompile_and_relink_function(ee, fn)
|
277
|
-
# @param [
|
279
|
+
# @param [OpaqueExecutionEngine] ee
|
278
280
|
# @param [FFI::Pointer(ValueRef)] fn
|
279
281
|
# @return [FFI::Pointer(*Void)]
|
280
282
|
# @scope class
|
281
|
-
attach_function :recompile_and_relink_function, :LLVMRecompileAndRelinkFunction, [
|
282
|
-
|
283
|
+
attach_function :recompile_and_relink_function, :LLVMRecompileAndRelinkFunction, [OpaqueExecutionEngine, :pointer], :pointer
|
284
|
+
|
283
285
|
# (Not documented)
|
284
286
|
#
|
285
287
|
# @method get_execution_engine_target_data(ee)
|
286
|
-
# @param [
|
288
|
+
# @param [OpaqueExecutionEngine] ee
|
287
289
|
# @return [FFI::Pointer(TargetDataRef)]
|
288
290
|
# @scope class
|
289
|
-
attach_function :get_execution_engine_target_data, :LLVMGetExecutionEngineTargetData, [
|
290
|
-
|
291
|
+
attach_function :get_execution_engine_target_data, :LLVMGetExecutionEngineTargetData, [OpaqueExecutionEngine], :pointer
|
292
|
+
|
291
293
|
# (Not documented)
|
292
294
|
#
|
293
295
|
# @method add_global_mapping(ee, global, addr)
|
294
|
-
# @param [
|
296
|
+
# @param [OpaqueExecutionEngine] ee
|
295
297
|
# @param [FFI::Pointer(ValueRef)] global
|
296
298
|
# @param [FFI::Pointer(*Void)] addr
|
297
299
|
# @return [nil]
|
298
300
|
# @scope class
|
299
|
-
attach_function :add_global_mapping, :LLVMAddGlobalMapping, [
|
300
|
-
|
301
|
+
attach_function :add_global_mapping, :LLVMAddGlobalMapping, [OpaqueExecutionEngine, :pointer, :pointer], :void
|
302
|
+
|
301
303
|
# (Not documented)
|
302
304
|
#
|
303
305
|
# @method get_pointer_to_global(ee, global)
|
304
|
-
# @param [
|
306
|
+
# @param [OpaqueExecutionEngine] ee
|
305
307
|
# @param [FFI::Pointer(ValueRef)] global
|
306
308
|
# @return [FFI::Pointer(*Void)]
|
307
309
|
# @scope class
|
308
|
-
attach_function :get_pointer_to_global, :LLVMGetPointerToGlobal, [
|
309
|
-
|
310
|
-
end
|
310
|
+
attach_function :get_pointer_to_global, :LLVMGetPointerToGlobal, [OpaqueExecutionEngine, :pointer], :pointer
|
311
|
+
|
312
|
+
end
|
data/lib/llvm/support.rb
CHANGED
@@ -7,7 +7,7 @@ module LLVM
|
|
7
7
|
File.join(
|
8
8
|
File.dirname(__FILE__),
|
9
9
|
'../',
|
10
|
-
FFI.map_library_name('RubyLLVMSupport-3.
|
10
|
+
FFI.map_library_name('RubyLLVMSupport-3.1.0')))
|
11
11
|
ffi_lib [support_lib]
|
12
12
|
attach_function :load_library_permanently, :LLVMLoadLibraryPermanently, [:string], :int
|
13
13
|
end
|
data/lib/llvm/target_ffi.rb
CHANGED
@@ -4,214 +4,276 @@ require 'ffi'
|
|
4
4
|
|
5
5
|
module LLVM::C
|
6
6
|
extend FFI::Library
|
7
|
-
ffi_lib 'LLVM-3.
|
8
|
-
|
7
|
+
ffi_lib 'LLVM-3.1'
|
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
|
+
|
9
15
|
# (Not documented)
|
10
16
|
#
|
17
|
+
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:byte_ordering).</em>
|
18
|
+
#
|
11
19
|
# === Options:
|
12
|
-
# :
|
20
|
+
# :big_endian ::
|
13
21
|
#
|
14
|
-
# :
|
22
|
+
# :little_endian ::
|
15
23
|
#
|
16
|
-
#
|
17
|
-
# @
|
18
|
-
|
19
|
-
|
20
|
-
end
|
24
|
+
#
|
25
|
+
# @method _enum_byte_ordering_
|
26
|
+
# @return [Symbol]
|
27
|
+
# @scope class
|
21
28
|
enum :byte_ordering, [
|
22
|
-
:
|
23
|
-
:
|
29
|
+
:big_endian, 0,
|
30
|
+
:little_endian, 1
|
24
31
|
]
|
25
|
-
|
32
|
+
|
26
33
|
# (Not documented)
|
27
|
-
#
|
28
|
-
# = Fields:
|
29
|
-
#
|
30
34
|
class OpaqueTargetData < FFI::Struct
|
35
|
+
layout :dummy, :char
|
31
36
|
end
|
32
|
-
|
37
|
+
|
33
38
|
# (Not documented)
|
34
|
-
#
|
35
|
-
# = Fields:
|
36
|
-
#
|
37
39
|
class OpaqueTargetLibraryInfotData < FFI::Struct
|
40
|
+
layout :dummy, :char
|
38
41
|
end
|
39
|
-
|
42
|
+
|
40
43
|
# (Not documented)
|
41
|
-
#
|
42
|
-
# = Fields:
|
43
|
-
#
|
44
44
|
class StructLayout < FFI::Struct
|
45
|
+
layout :dummy, :char
|
45
46
|
end
|
46
|
-
|
47
|
+
|
48
|
+
# (Not documented)
|
49
|
+
#
|
50
|
+
# @method initialize_all_target_infos()
|
51
|
+
# @return [nil]
|
52
|
+
# @scope class
|
53
|
+
attach_function :initialize_all_target_infos, :LLVMInitializeAllTargetInfos, [], :void
|
54
|
+
|
55
|
+
# LLVMInitializeAllTargets - The main program should call this function if it
|
56
|
+
# wants to link in all available targets that LLVM is configured to
|
57
|
+
# support.
|
58
|
+
#
|
59
|
+
# @method initialize_all_targets()
|
60
|
+
# @return [nil]
|
61
|
+
# @scope class
|
62
|
+
attach_function :initialize_all_targets, :LLVMInitializeAllTargets, [], :void
|
63
|
+
|
64
|
+
# LLVMInitializeAllTargetMCs - The main program should call this function if
|
65
|
+
# it wants access to all available target MC that LLVM is configured to
|
66
|
+
# support.
|
67
|
+
#
|
68
|
+
# @method initialize_all_target_m_cs()
|
69
|
+
# @return [nil]
|
70
|
+
# @scope class
|
71
|
+
attach_function :initialize_all_target_m_cs, :LLVMInitializeAllTargetMCs, [], :void
|
72
|
+
|
73
|
+
# LLVMInitializeAllAsmPrinters - The main program should call this function if
|
74
|
+
# it wants all asm printers that LLVM is configured to support, to make them
|
75
|
+
# available via the TargetRegistry.
|
76
|
+
#
|
77
|
+
# @method initialize_all_asm_printers()
|
78
|
+
# @return [nil]
|
79
|
+
# @scope class
|
80
|
+
attach_function :initialize_all_asm_printers, :LLVMInitializeAllAsmPrinters, [], :void
|
81
|
+
|
82
|
+
# LLVMInitializeAllAsmParsers - The main program should call this function if
|
83
|
+
# it wants all asm parsers that LLVM is configured to support, to make them
|
84
|
+
# available via the TargetRegistry.
|
85
|
+
#
|
86
|
+
# @method initialize_all_asm_parsers()
|
87
|
+
# @return [nil]
|
88
|
+
# @scope class
|
89
|
+
attach_function :initialize_all_asm_parsers, :LLVMInitializeAllAsmParsers, [], :void
|
90
|
+
|
91
|
+
# LLVMInitializeAllDisassemblers - The main program should call this function
|
92
|
+
# if it wants all disassemblers that LLVM is configured to support, to make
|
93
|
+
# them available via the TargetRegistry.
|
94
|
+
#
|
95
|
+
# @method initialize_all_disassemblers()
|
96
|
+
# @return [nil]
|
97
|
+
# @scope class
|
98
|
+
attach_function :initialize_all_disassemblers, :LLVMInitializeAllDisassemblers, [], :void
|
99
|
+
|
100
|
+
# LLVMInitializeNativeTarget - The main program should call this function to
|
101
|
+
# initialize the native target corresponding to the host. This is useful
|
102
|
+
# for JIT applications to ensure that the target gets linked in correctly.
|
103
|
+
#
|
104
|
+
# @method initialize_native_target()
|
105
|
+
# @return [Integer]
|
106
|
+
# @scope class
|
107
|
+
attach_function :initialize_native_target, :LLVMInitializeNativeTarget, [], :int
|
108
|
+
|
47
109
|
# Creates target data from a target layout string.
|
48
110
|
# See the constructor llvm::TargetData::TargetData.
|
49
111
|
#
|
50
112
|
# @method create_target_data(string_rep)
|
51
113
|
# @param [String] string_rep
|
52
|
-
# @return [
|
114
|
+
# @return [OpaqueTargetData]
|
53
115
|
# @scope class
|
54
|
-
attach_function :create_target_data, :LLVMCreateTargetData, [:string],
|
55
|
-
|
116
|
+
attach_function :create_target_data, :LLVMCreateTargetData, [:string], OpaqueTargetData
|
117
|
+
|
56
118
|
# Adds target data information to a pass manager. This does not take ownership
|
57
119
|
# of the target data.
|
58
120
|
# See the method llvm::PassManagerBase::add.
|
59
121
|
#
|
60
|
-
# @method add_target_data(
|
61
|
-
# @param [
|
122
|
+
# @method add_target_data(opaque_target_data, pass_manager_ref)
|
123
|
+
# @param [OpaqueTargetData] opaque_target_data
|
62
124
|
# @param [FFI::Pointer(PassManagerRef)] pass_manager_ref
|
63
125
|
# @return [nil]
|
64
126
|
# @scope class
|
65
|
-
attach_function :add_target_data, :LLVMAddTargetData, [
|
66
|
-
|
127
|
+
attach_function :add_target_data, :LLVMAddTargetData, [OpaqueTargetData, :pointer], :void
|
128
|
+
|
67
129
|
# Adds target library information to a pass manager. This does not take
|
68
130
|
# ownership of the target library info.
|
69
131
|
# See the method llvm::PassManagerBase::add.
|
70
132
|
#
|
71
|
-
# @method add_target_library_info(
|
72
|
-
# @param [
|
133
|
+
# @method add_target_library_info(opaque_target_library_infot_data, pass_manager_ref)
|
134
|
+
# @param [OpaqueTargetLibraryInfotData] opaque_target_library_infot_data
|
73
135
|
# @param [FFI::Pointer(PassManagerRef)] pass_manager_ref
|
74
136
|
# @return [nil]
|
75
137
|
# @scope class
|
76
|
-
attach_function :add_target_library_info, :LLVMAddTargetLibraryInfo, [
|
77
|
-
|
138
|
+
attach_function :add_target_library_info, :LLVMAddTargetLibraryInfo, [OpaqueTargetLibraryInfotData, :pointer], :void
|
139
|
+
|
78
140
|
# Converts target data to a target layout string. The string must be disposed
|
79
141
|
# with LLVMDisposeMessage.
|
80
142
|
# See the constructor llvm::TargetData::TargetData.
|
81
143
|
#
|
82
|
-
# @method copy_string_rep_of_target_data(
|
83
|
-
# @param [
|
144
|
+
# @method copy_string_rep_of_target_data(opaque_target_data)
|
145
|
+
# @param [OpaqueTargetData] opaque_target_data
|
84
146
|
# @return [String]
|
85
147
|
# @scope class
|
86
|
-
attach_function :copy_string_rep_of_target_data, :LLVMCopyStringRepOfTargetData, [
|
87
|
-
|
148
|
+
attach_function :copy_string_rep_of_target_data, :LLVMCopyStringRepOfTargetData, [OpaqueTargetData], :string
|
149
|
+
|
88
150
|
# Returns the byte order of a target, either LLVMBigEndian or
|
89
151
|
# LLVMLittleEndian.
|
90
152
|
# See the method llvm::TargetData::isLittleEndian.
|
91
153
|
#
|
92
|
-
# @method byte_order(
|
93
|
-
# @param [
|
94
|
-
# @return [Symbol from
|
154
|
+
# @method byte_order(opaque_target_data)
|
155
|
+
# @param [OpaqueTargetData] opaque_target_data
|
156
|
+
# @return [Symbol from _enum_byte_ordering_]
|
95
157
|
# @scope class
|
96
|
-
attach_function :byte_order, :LLVMByteOrder, [
|
97
|
-
|
158
|
+
attach_function :byte_order, :LLVMByteOrder, [OpaqueTargetData], :byte_ordering
|
159
|
+
|
98
160
|
# Returns the pointer size in bytes for a target.
|
99
161
|
# See the method llvm::TargetData::getPointerSize.
|
100
162
|
#
|
101
|
-
# @method pointer_size(
|
102
|
-
# @param [
|
163
|
+
# @method pointer_size(opaque_target_data)
|
164
|
+
# @param [OpaqueTargetData] opaque_target_data
|
103
165
|
# @return [Integer]
|
104
166
|
# @scope class
|
105
|
-
attach_function :pointer_size, :LLVMPointerSize, [
|
106
|
-
|
167
|
+
attach_function :pointer_size, :LLVMPointerSize, [OpaqueTargetData], :uint
|
168
|
+
|
107
169
|
# Returns the integer type that is the same size as a pointer on a target.
|
108
170
|
# See the method llvm::TargetData::getIntPtrType.
|
109
171
|
#
|
110
|
-
# @method int_ptr_type(
|
111
|
-
# @param [
|
172
|
+
# @method int_ptr_type(opaque_target_data)
|
173
|
+
# @param [OpaqueTargetData] opaque_target_data
|
112
174
|
# @return [FFI::Pointer(TypeRef)]
|
113
175
|
# @scope class
|
114
|
-
attach_function :int_ptr_type, :LLVMIntPtrType, [
|
115
|
-
|
176
|
+
attach_function :int_ptr_type, :LLVMIntPtrType, [OpaqueTargetData], :pointer
|
177
|
+
|
116
178
|
# Computes the size of a type in bytes for a target.
|
117
179
|
# See the method llvm::TargetData::getTypeSizeInBits.
|
118
180
|
#
|
119
|
-
# @method size_of_type_in_bits(
|
120
|
-
# @param [
|
181
|
+
# @method size_of_type_in_bits(opaque_target_data, type_ref)
|
182
|
+
# @param [OpaqueTargetData] opaque_target_data
|
121
183
|
# @param [FFI::Pointer(TypeRef)] type_ref
|
122
184
|
# @return [Integer]
|
123
185
|
# @scope class
|
124
|
-
attach_function :size_of_type_in_bits, :LLVMSizeOfTypeInBits, [
|
125
|
-
|
186
|
+
attach_function :size_of_type_in_bits, :LLVMSizeOfTypeInBits, [OpaqueTargetData, :pointer], :ulong_long
|
187
|
+
|
126
188
|
# Computes the storage size of a type in bytes for a target.
|
127
189
|
# See the method llvm::TargetData::getTypeStoreSize.
|
128
190
|
#
|
129
|
-
# @method store_size_of_type(
|
130
|
-
# @param [
|
191
|
+
# @method store_size_of_type(opaque_target_data, type_ref)
|
192
|
+
# @param [OpaqueTargetData] opaque_target_data
|
131
193
|
# @param [FFI::Pointer(TypeRef)] type_ref
|
132
194
|
# @return [Integer]
|
133
195
|
# @scope class
|
134
|
-
attach_function :store_size_of_type, :LLVMStoreSizeOfType, [
|
135
|
-
|
196
|
+
attach_function :store_size_of_type, :LLVMStoreSizeOfType, [OpaqueTargetData, :pointer], :ulong_long
|
197
|
+
|
136
198
|
# Computes the ABI size of a type in bytes for a target.
|
137
199
|
# See the method llvm::TargetData::getTypeAllocSize.
|
138
200
|
#
|
139
|
-
# @method abi_size_of_type(
|
140
|
-
# @param [
|
201
|
+
# @method abi_size_of_type(opaque_target_data, type_ref)
|
202
|
+
# @param [OpaqueTargetData] opaque_target_data
|
141
203
|
# @param [FFI::Pointer(TypeRef)] type_ref
|
142
204
|
# @return [Integer]
|
143
205
|
# @scope class
|
144
|
-
attach_function :abi_size_of_type, :LLVMABISizeOfType, [
|
145
|
-
|
206
|
+
attach_function :abi_size_of_type, :LLVMABISizeOfType, [OpaqueTargetData, :pointer], :ulong_long
|
207
|
+
|
146
208
|
# Computes the ABI alignment of a type in bytes for a target.
|
147
209
|
# See the method llvm::TargetData::getTypeABISize.
|
148
210
|
#
|
149
|
-
# @method abi_alignment_of_type(
|
150
|
-
# @param [
|
211
|
+
# @method abi_alignment_of_type(opaque_target_data, type_ref)
|
212
|
+
# @param [OpaqueTargetData] opaque_target_data
|
151
213
|
# @param [FFI::Pointer(TypeRef)] type_ref
|
152
214
|
# @return [Integer]
|
153
215
|
# @scope class
|
154
|
-
attach_function :abi_alignment_of_type, :LLVMABIAlignmentOfType, [
|
155
|
-
|
216
|
+
attach_function :abi_alignment_of_type, :LLVMABIAlignmentOfType, [OpaqueTargetData, :pointer], :uint
|
217
|
+
|
156
218
|
# Computes the call frame alignment of a type in bytes for a target.
|
157
219
|
# See the method llvm::TargetData::getTypeABISize.
|
158
220
|
#
|
159
|
-
# @method call_frame_alignment_of_type(
|
160
|
-
# @param [
|
221
|
+
# @method call_frame_alignment_of_type(opaque_target_data, type_ref)
|
222
|
+
# @param [OpaqueTargetData] opaque_target_data
|
161
223
|
# @param [FFI::Pointer(TypeRef)] type_ref
|
162
224
|
# @return [Integer]
|
163
225
|
# @scope class
|
164
|
-
attach_function :call_frame_alignment_of_type, :LLVMCallFrameAlignmentOfType, [
|
165
|
-
|
226
|
+
attach_function :call_frame_alignment_of_type, :LLVMCallFrameAlignmentOfType, [OpaqueTargetData, :pointer], :uint
|
227
|
+
|
166
228
|
# Computes the preferred alignment of a type in bytes for a target.
|
167
229
|
# See the method llvm::TargetData::getTypeABISize.
|
168
230
|
#
|
169
|
-
# @method preferred_alignment_of_type(
|
170
|
-
# @param [
|
231
|
+
# @method preferred_alignment_of_type(opaque_target_data, type_ref)
|
232
|
+
# @param [OpaqueTargetData] opaque_target_data
|
171
233
|
# @param [FFI::Pointer(TypeRef)] type_ref
|
172
234
|
# @return [Integer]
|
173
235
|
# @scope class
|
174
|
-
attach_function :preferred_alignment_of_type, :LLVMPreferredAlignmentOfType, [
|
175
|
-
|
236
|
+
attach_function :preferred_alignment_of_type, :LLVMPreferredAlignmentOfType, [OpaqueTargetData, :pointer], :uint
|
237
|
+
|
176
238
|
# Computes the preferred alignment of a global variable in bytes for a target.
|
177
239
|
# See the method llvm::TargetData::getPreferredAlignment.
|
178
240
|
#
|
179
|
-
# @method preferred_alignment_of_global(
|
180
|
-
# @param [
|
241
|
+
# @method preferred_alignment_of_global(opaque_target_data, global_var)
|
242
|
+
# @param [OpaqueTargetData] opaque_target_data
|
181
243
|
# @param [FFI::Pointer(ValueRef)] global_var
|
182
244
|
# @return [Integer]
|
183
245
|
# @scope class
|
184
|
-
attach_function :preferred_alignment_of_global, :LLVMPreferredAlignmentOfGlobal, [
|
185
|
-
|
246
|
+
attach_function :preferred_alignment_of_global, :LLVMPreferredAlignmentOfGlobal, [OpaqueTargetData, :pointer], :uint
|
247
|
+
|
186
248
|
# Computes the structure element that contains the byte offset for a target.
|
187
249
|
# See the method llvm::StructLayout::getElementContainingOffset.
|
188
250
|
#
|
189
|
-
# @method element_at_offset(
|
190
|
-
# @param [
|
251
|
+
# @method element_at_offset(opaque_target_data, struct_ty, offset)
|
252
|
+
# @param [OpaqueTargetData] opaque_target_data
|
191
253
|
# @param [FFI::Pointer(TypeRef)] struct_ty
|
192
254
|
# @param [Integer] offset
|
193
255
|
# @return [Integer]
|
194
256
|
# @scope class
|
195
|
-
attach_function :element_at_offset, :LLVMElementAtOffset, [
|
196
|
-
|
257
|
+
attach_function :element_at_offset, :LLVMElementAtOffset, [OpaqueTargetData, :pointer, :ulong_long], :uint
|
258
|
+
|
197
259
|
# Computes the byte offset of the indexed struct element for a target.
|
198
260
|
# See the method llvm::StructLayout::getElementContainingOffset.
|
199
261
|
#
|
200
|
-
# @method offset_of_element(
|
201
|
-
# @param [
|
262
|
+
# @method offset_of_element(opaque_target_data, struct_ty, element)
|
263
|
+
# @param [OpaqueTargetData] opaque_target_data
|
202
264
|
# @param [FFI::Pointer(TypeRef)] struct_ty
|
203
265
|
# @param [Integer] element
|
204
266
|
# @return [Integer]
|
205
267
|
# @scope class
|
206
|
-
attach_function :offset_of_element, :LLVMOffsetOfElement, [
|
207
|
-
|
268
|
+
attach_function :offset_of_element, :LLVMOffsetOfElement, [OpaqueTargetData, :pointer, :uint], :ulong_long
|
269
|
+
|
208
270
|
# Deallocates a TargetData.
|
209
271
|
# See the destructor llvm::TargetData::~TargetData.
|
210
272
|
#
|
211
|
-
# @method dispose_target_data(
|
212
|
-
# @param [
|
273
|
+
# @method dispose_target_data(opaque_target_data)
|
274
|
+
# @param [OpaqueTargetData] opaque_target_data
|
213
275
|
# @return [nil]
|
214
276
|
# @scope class
|
215
|
-
attach_function :dispose_target_data, :LLVMDisposeTargetData, [
|
216
|
-
|
217
|
-
end
|
277
|
+
attach_function :dispose_target_data, :LLVMDisposeTargetData, [OpaqueTargetData], :void
|
278
|
+
|
279
|
+
end
|