ruby-llvm 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/ruby-llvm-support/support.cpp +1 -10
- data/lib/llvm/analysis_ffi.rb +1 -1
- data/lib/llvm/config.rb +3 -3
- data/lib/llvm/core/bitcode_ffi.rb +1 -1
- data/lib/llvm/core/module.rb +7 -21
- data/lib/llvm/core/type.rb +1 -1
- data/lib/llvm/core_ffi.rb +250 -95
- data/lib/llvm/execution_engine_ffi.rb +78 -2
- data/lib/llvm/linker_ffi.rb +1 -1
- data/lib/llvm/support.rb +2 -4
- data/lib/llvm/target.rb +1 -1
- data/lib/llvm/target_ffi.rb +133 -51
- data/lib/llvm/transforms/builder_ffi.rb +1 -1
- data/lib/llvm/transforms/ipo_ffi.rb +1 -1
- data/lib/llvm/transforms/scalar_ffi.rb +17 -1
- data/lib/llvm/transforms/vectorize_ffi.rb +1 -1
- data/lib/llvm/version.rb +2 -2
- data/test/module_test.rb +5 -12
- metadata +3 -3
@@ -4,7 +4,7 @@ require 'ffi'
|
|
4
4
|
|
5
5
|
module LLVM::C
|
6
6
|
extend FFI::Library
|
7
|
-
ffi_lib 'LLVM-3.
|
7
|
+
ffi_lib 'LLVM-3.4'
|
8
8
|
|
9
9
|
def self.attach_function(name, *_)
|
10
10
|
begin; super; rescue FFI::NotFoundError => e
|
@@ -43,6 +43,11 @@ module LLVM::C
|
|
43
43
|
layout :dummy, :char
|
44
44
|
end
|
45
45
|
|
46
|
+
# (Not documented)
|
47
|
+
class OpaqueMCJITMemoryManager < FFI::Struct
|
48
|
+
layout :dummy, :char
|
49
|
+
end
|
50
|
+
|
46
51
|
# (Not documented)
|
47
52
|
#
|
48
53
|
# = Fields:
|
@@ -54,11 +59,14 @@ module LLVM::C
|
|
54
59
|
# (Integer)
|
55
60
|
# :enable_fast_i_sel ::
|
56
61
|
# (Integer)
|
62
|
+
# :mcjmm ::
|
63
|
+
# (OpaqueMCJITMemoryManager)
|
57
64
|
class MCJITCompilerOptions < FFI::Struct
|
58
65
|
layout :opt_level, :uint,
|
59
66
|
:code_model, :char,
|
60
67
|
:no_frame_pointer_elim, :int,
|
61
|
-
:enable_fast_i_sel, :int
|
68
|
+
:enable_fast_i_sel, :int,
|
69
|
+
:mcjmm, OpaqueMCJITMemoryManager
|
62
70
|
end
|
63
71
|
|
64
72
|
# ===-- Operations on generic values --------------------------------------===
|
@@ -369,4 +377,72 @@ module LLVM::C
|
|
369
377
|
# @scope class
|
370
378
|
attach_function :get_pointer_to_global, :LLVMGetPointerToGlobal, [OpaqueExecutionEngine, :pointer], :pointer
|
371
379
|
|
380
|
+
# ===-- Operations on memory managers -------------------------------------===
|
381
|
+
#
|
382
|
+
# <em>This entry is only for documentation and no real method.</em>
|
383
|
+
#
|
384
|
+
# @method _callback_memory_manager_allocate_code_section_callback_(opaque, size, alignment, section_id, section_name)
|
385
|
+
# @param [FFI::Pointer(*Void)] opaque
|
386
|
+
# @param [Integer] size
|
387
|
+
# @param [Integer] alignment
|
388
|
+
# @param [Integer] section_id
|
389
|
+
# @param [String] section_name
|
390
|
+
# @return [Integer]
|
391
|
+
# @scope class
|
392
|
+
callback :memory_manager_allocate_code_section_callback, [:pointer, :ulong, :uint, :uint, :string], :uchar
|
393
|
+
|
394
|
+
# (Not documented)
|
395
|
+
#
|
396
|
+
# <em>This entry is only for documentation and no real method.</em>
|
397
|
+
#
|
398
|
+
# @method _callback_memory_manager_allocate_data_section_callback_(opaque, size, alignment, section_id, section_name, is_read_only)
|
399
|
+
# @param [FFI::Pointer(*Void)] opaque
|
400
|
+
# @param [Integer] size
|
401
|
+
# @param [Integer] alignment
|
402
|
+
# @param [Integer] section_id
|
403
|
+
# @param [String] section_name
|
404
|
+
# @param [Integer] is_read_only
|
405
|
+
# @return [Integer]
|
406
|
+
# @scope class
|
407
|
+
callback :memory_manager_allocate_data_section_callback, [:pointer, :ulong, :uint, :uint, :string, :int], :uchar
|
408
|
+
|
409
|
+
# (Not documented)
|
410
|
+
#
|
411
|
+
# <em>This entry is only for documentation and no real method.</em>
|
412
|
+
#
|
413
|
+
# @method _callback_memory_manager_finalize_memory_callback_(opaque, err_msg)
|
414
|
+
# @param [FFI::Pointer(*Void)] opaque
|
415
|
+
# @param [FFI::Pointer(**CharS)] err_msg
|
416
|
+
# @return [Integer]
|
417
|
+
# @scope class
|
418
|
+
callback :memory_manager_finalize_memory_callback, [:pointer, :pointer], :int
|
419
|
+
|
420
|
+
# Create a simple custom MCJIT memory manager. This memory manager can
|
421
|
+
# intercept allocations in a module-oblivious way. This will return NULL
|
422
|
+
# if any of the passed functions are NULL.
|
423
|
+
#
|
424
|
+
# @param Opaque An opaque client object to pass back to the callbacks.
|
425
|
+
# @param AllocateCodeSection Allocate a block of memory for executable code.
|
426
|
+
# @param AllocateDataSection Allocate a block of memory for data.
|
427
|
+
# @param FinalizeMemory Set page permissions and flush cache. Return 0 on
|
428
|
+
# success, 1 on error.
|
429
|
+
#
|
430
|
+
# @method create_simple_mcjit_memory_manager(opaque, allocate_code_section, allocate_data_section, finalize_memory, destroy)
|
431
|
+
# @param [FFI::Pointer(*Void)] opaque
|
432
|
+
# @param [Proc(_callback_memory_manager_allocate_code_section_callback_)] allocate_code_section
|
433
|
+
# @param [Proc(_callback_memory_manager_allocate_data_section_callback_)] allocate_data_section
|
434
|
+
# @param [Proc(_callback_memory_manager_finalize_memory_callback_)] finalize_memory
|
435
|
+
# @param [FFI::Pointer(MemoryManagerDestroyCallback)] destroy
|
436
|
+
# @return [OpaqueMCJITMemoryManager]
|
437
|
+
# @scope class
|
438
|
+
attach_function :create_simple_mcjit_memory_manager, :LLVMCreateSimpleMCJITMemoryManager, [:pointer, :memory_manager_allocate_code_section_callback, :memory_manager_allocate_data_section_callback, :memory_manager_finalize_memory_callback, :pointer], OpaqueMCJITMemoryManager
|
439
|
+
|
440
|
+
# (Not documented)
|
441
|
+
#
|
442
|
+
# @method dispose_mcjit_memory_manager(mm)
|
443
|
+
# @param [OpaqueMCJITMemoryManager] mm
|
444
|
+
# @return [nil]
|
445
|
+
# @scope class
|
446
|
+
attach_function :dispose_mcjit_memory_manager, :LLVMDisposeMCJITMemoryManager, [OpaqueMCJITMemoryManager], :void
|
447
|
+
|
372
448
|
end
|
data/lib/llvm/linker_ffi.rb
CHANGED
data/lib/llvm/support.rb
CHANGED
@@ -19,8 +19,6 @@ module LLVM
|
|
19
19
|
attach_function :load_library_permanently, :LLVMLoadLibraryPermanently, [:string], :int
|
20
20
|
attach_function :has_unnamed_addr, :LLVMHasUnnamedAddr, [OpaqueValue], :int
|
21
21
|
attach_function :set_unnamed_addr, :LLVMSetUnnamedAddr, [OpaqueValue, :int], :void
|
22
|
-
attach_function :dump_type, :LLVMDumpType, [OpaqueType], :void
|
23
|
-
attach_function :print_module, :LLVMPrintModuleToFD, [OpaqueModule, :int, :int, :int], :void
|
24
22
|
|
25
23
|
attach_function :initialize_all_target_infos,
|
26
24
|
:LLVMInitializeAllTargetInfos, [], :void
|
@@ -33,8 +31,8 @@ module LLVM
|
|
33
31
|
|
34
32
|
attach_function :initialize_native_target,
|
35
33
|
:LLVMInitializeNativeTarget, [], :void
|
36
|
-
attach_function :
|
37
|
-
:
|
34
|
+
attach_function :initialize_native_asm_printer,
|
35
|
+
:LLVMInitializeNativeAsmPrinter, [], :void
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
data/lib/llvm/target.rb
CHANGED
@@ -71,7 +71,7 @@ module LLVM
|
|
71
71
|
def self.init_native(asm_printer=false)
|
72
72
|
Support::C.initialize_native_target
|
73
73
|
|
74
|
-
Support::C.
|
74
|
+
Support::C.initialize_native_asm_printer if asm_printer
|
75
75
|
end
|
76
76
|
|
77
77
|
# Enumerate all initialized targets.
|
data/lib/llvm/target_ffi.rb
CHANGED
@@ -4,7 +4,7 @@ require 'ffi'
|
|
4
4
|
|
5
5
|
module LLVM::C
|
6
6
|
extend FFI::Library
|
7
|
-
ffi_lib 'LLVM-3.
|
7
|
+
ffi_lib 'LLVM-3.4'
|
8
8
|
|
9
9
|
def self.attach_function(name, *_)
|
10
10
|
begin; super; rescue FFI::NotFoundError => e
|
@@ -40,11 +40,6 @@ module LLVM::C
|
|
40
40
|
layout :dummy, :char
|
41
41
|
end
|
42
42
|
|
43
|
-
# (Not documented)
|
44
|
-
class StructLayout < FFI::Struct
|
45
|
-
layout :dummy, :char
|
46
|
-
end
|
47
|
-
|
48
43
|
# (Not documented)
|
49
44
|
#
|
50
45
|
# @method initialize_all_target_infos()
|
@@ -98,7 +93,7 @@ module LLVM::C
|
|
98
93
|
attach_function :initialize_all_disassemblers, :LLVMInitializeAllDisassemblers, [], :void
|
99
94
|
|
100
95
|
# LLVMInitializeNativeTarget - The main program should call this function to
|
101
|
-
# initialize the native target corresponding to the host. This is useful
|
96
|
+
# initialize the native target corresponding to the host. This is useful
|
102
97
|
# for JIT applications to ensure that the target gets linked in correctly.
|
103
98
|
#
|
104
99
|
# @method initialize_native_target()
|
@@ -106,6 +101,33 @@ module LLVM::C
|
|
106
101
|
# @scope class
|
107
102
|
attach_function :initialize_native_target, :LLVMInitializeNativeTarget, [], :int
|
108
103
|
|
104
|
+
# LLVMInitializeNativeTargetAsmParser - The main program should call this
|
105
|
+
# function to initialize the parser for the native target corresponding to the
|
106
|
+
# host.
|
107
|
+
#
|
108
|
+
# @method initialize_native_asm_parser()
|
109
|
+
# @return [Integer]
|
110
|
+
# @scope class
|
111
|
+
attach_function :initialize_native_asm_parser, :LLVMInitializeNativeAsmParser, [], :int
|
112
|
+
|
113
|
+
# LLVMInitializeNativeTargetAsmPrinter - The main program should call this
|
114
|
+
# function to initialize the printer for the native target corresponding to
|
115
|
+
# the host.
|
116
|
+
#
|
117
|
+
# @method initialize_native_asm_printer()
|
118
|
+
# @return [Integer]
|
119
|
+
# @scope class
|
120
|
+
attach_function :initialize_native_asm_printer, :LLVMInitializeNativeAsmPrinter, [], :int
|
121
|
+
|
122
|
+
# LLVMInitializeNativeTargetDisassembler - The main program should call this
|
123
|
+
# function to initialize the disassembler for the native target corresponding
|
124
|
+
# to the host.
|
125
|
+
#
|
126
|
+
# @method initialize_native_disassembler()
|
127
|
+
# @return [Integer]
|
128
|
+
# @scope class
|
129
|
+
attach_function :initialize_native_disassembler, :LLVMInitializeNativeDisassembler, [], :int
|
130
|
+
|
109
131
|
# Creates target data from a target layout string.
|
110
132
|
# See the constructor llvm::DataLayout::DataLayout.
|
111
133
|
#
|
@@ -119,9 +141,9 @@ module LLVM::C
|
|
119
141
|
# of the target data.
|
120
142
|
# See the method llvm::PassManagerBase::add.
|
121
143
|
#
|
122
|
-
# @method add_target_data(
|
123
|
-
# @param [OpaqueTargetData]
|
124
|
-
# @param [FFI::Pointer(PassManagerRef)]
|
144
|
+
# @method add_target_data(td, pm)
|
145
|
+
# @param [OpaqueTargetData] td
|
146
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
125
147
|
# @return [nil]
|
126
148
|
# @scope class
|
127
149
|
attach_function :add_target_data, :LLVMAddTargetData, [OpaqueTargetData, :pointer], :void
|
@@ -130,9 +152,9 @@ module LLVM::C
|
|
130
152
|
# ownership of the target library info.
|
131
153
|
# See the method llvm::PassManagerBase::add.
|
132
154
|
#
|
133
|
-
# @method add_target_library_info(
|
134
|
-
# @param [OpaqueTargetLibraryInfotData]
|
135
|
-
# @param [FFI::Pointer(PassManagerRef)]
|
155
|
+
# @method add_target_library_info(tli, pm)
|
156
|
+
# @param [OpaqueTargetLibraryInfotData] tli
|
157
|
+
# @param [FFI::Pointer(PassManagerRef)] pm
|
136
158
|
# @return [nil]
|
137
159
|
# @scope class
|
138
160
|
attach_function :add_target_library_info, :LLVMAddTargetLibraryInfo, [OpaqueTargetLibraryInfotData, :pointer], :void
|
@@ -141,8 +163,8 @@ module LLVM::C
|
|
141
163
|
# with LLVMDisposeMessage.
|
142
164
|
# See the constructor llvm::DataLayout::DataLayout.
|
143
165
|
#
|
144
|
-
# @method copy_string_rep_of_target_data(
|
145
|
-
# @param [OpaqueTargetData]
|
166
|
+
# @method copy_string_rep_of_target_data(td)
|
167
|
+
# @param [OpaqueTargetData] td
|
146
168
|
# @return [String]
|
147
169
|
# @scope class
|
148
170
|
attach_function :copy_string_rep_of_target_data, :LLVMCopyStringRepOfTargetData, [OpaqueTargetData], :string
|
@@ -151,8 +173,8 @@ module LLVM::C
|
|
151
173
|
# LLVMLittleEndian.
|
152
174
|
# See the method llvm::DataLayout::isLittleEndian.
|
153
175
|
#
|
154
|
-
# @method byte_order(
|
155
|
-
# @param [OpaqueTargetData]
|
176
|
+
# @method byte_order(td)
|
177
|
+
# @param [OpaqueTargetData] td
|
156
178
|
# @return [Symbol from _enum_byte_ordering_]
|
157
179
|
# @scope class
|
158
180
|
attach_function :byte_order, :LLVMByteOrder, [OpaqueTargetData], :byte_ordering
|
@@ -160,8 +182,8 @@ module LLVM::C
|
|
160
182
|
# Returns the pointer size in bytes for a target.
|
161
183
|
# See the method llvm::DataLayout::getPointerSize.
|
162
184
|
#
|
163
|
-
# @method pointer_size(
|
164
|
-
# @param [OpaqueTargetData]
|
185
|
+
# @method pointer_size(td)
|
186
|
+
# @param [OpaqueTargetData] td
|
165
187
|
# @return [Integer]
|
166
188
|
# @scope class
|
167
189
|
attach_function :pointer_size, :LLVMPointerSize, [OpaqueTargetData], :uint
|
@@ -170,8 +192,8 @@ module LLVM::C
|
|
170
192
|
# address space.
|
171
193
|
# See the method llvm::DataLayout::getPointerSize.
|
172
194
|
#
|
173
|
-
# @method pointer_size_for_as(
|
174
|
-
# @param [OpaqueTargetData]
|
195
|
+
# @method pointer_size_for_as(td, as)
|
196
|
+
# @param [OpaqueTargetData] td
|
175
197
|
# @param [Integer] as
|
176
198
|
# @return [Integer]
|
177
199
|
# @scope class
|
@@ -180,8 +202,8 @@ module LLVM::C
|
|
180
202
|
# Returns the integer type that is the same size as a pointer on a target.
|
181
203
|
# See the method llvm::DataLayout::getIntPtrType.
|
182
204
|
#
|
183
|
-
# @method int_ptr_type(
|
184
|
-
# @param [OpaqueTargetData]
|
205
|
+
# @method int_ptr_type(td)
|
206
|
+
# @param [OpaqueTargetData] td
|
185
207
|
# @return [FFI::Pointer(TypeRef)]
|
186
208
|
# @scope class
|
187
209
|
attach_function :int_ptr_type, :LLVMIntPtrType, [OpaqueTargetData], :pointer
|
@@ -190,19 +212,41 @@ module LLVM::C
|
|
190
212
|
# This version allows the address space to be specified.
|
191
213
|
# See the method llvm::DataLayout::getIntPtrType.
|
192
214
|
#
|
193
|
-
# @method int_ptr_type_for_as(
|
194
|
-
# @param [OpaqueTargetData]
|
215
|
+
# @method int_ptr_type_for_as(td, as)
|
216
|
+
# @param [OpaqueTargetData] td
|
195
217
|
# @param [Integer] as
|
196
218
|
# @return [FFI::Pointer(TypeRef)]
|
197
219
|
# @scope class
|
198
220
|
attach_function :int_ptr_type_for_as, :LLVMIntPtrTypeForAS, [OpaqueTargetData, :uint], :pointer
|
199
221
|
|
222
|
+
# Returns the integer type that is the same size as a pointer on a target.
|
223
|
+
# See the method llvm::DataLayout::getIntPtrType.
|
224
|
+
#
|
225
|
+
# @method int_ptr_type_in_context(c, td)
|
226
|
+
# @param [FFI::Pointer(ContextRef)] c
|
227
|
+
# @param [OpaqueTargetData] td
|
228
|
+
# @return [FFI::Pointer(TypeRef)]
|
229
|
+
# @scope class
|
230
|
+
attach_function :int_ptr_type_in_context, :LLVMIntPtrTypeInContext, [:pointer, OpaqueTargetData], :pointer
|
231
|
+
|
232
|
+
# Returns the integer type that is the same size as a pointer on a target.
|
233
|
+
# This version allows the address space to be specified.
|
234
|
+
# See the method llvm::DataLayout::getIntPtrType.
|
235
|
+
#
|
236
|
+
# @method int_ptr_type_for_as_in_context(c, td, as)
|
237
|
+
# @param [FFI::Pointer(ContextRef)] c
|
238
|
+
# @param [OpaqueTargetData] td
|
239
|
+
# @param [Integer] as
|
240
|
+
# @return [FFI::Pointer(TypeRef)]
|
241
|
+
# @scope class
|
242
|
+
attach_function :int_ptr_type_for_as_in_context, :LLVMIntPtrTypeForASInContext, [:pointer, OpaqueTargetData, :uint], :pointer
|
243
|
+
|
200
244
|
# Computes the size of a type in bytes for a target.
|
201
245
|
# See the method llvm::DataLayout::getTypeSizeInBits.
|
202
246
|
#
|
203
|
-
# @method size_of_type_in_bits(
|
204
|
-
# @param [OpaqueTargetData]
|
205
|
-
# @param [FFI::Pointer(TypeRef)]
|
247
|
+
# @method size_of_type_in_bits(td, ty)
|
248
|
+
# @param [OpaqueTargetData] td
|
249
|
+
# @param [FFI::Pointer(TypeRef)] ty
|
206
250
|
# @return [Integer]
|
207
251
|
# @scope class
|
208
252
|
attach_function :size_of_type_in_bits, :LLVMSizeOfTypeInBits, [OpaqueTargetData, :pointer], :ulong_long
|
@@ -210,9 +254,9 @@ module LLVM::C
|
|
210
254
|
# Computes the storage size of a type in bytes for a target.
|
211
255
|
# See the method llvm::DataLayout::getTypeStoreSize.
|
212
256
|
#
|
213
|
-
# @method store_size_of_type(
|
214
|
-
# @param [OpaqueTargetData]
|
215
|
-
# @param [FFI::Pointer(TypeRef)]
|
257
|
+
# @method store_size_of_type(td, ty)
|
258
|
+
# @param [OpaqueTargetData] td
|
259
|
+
# @param [FFI::Pointer(TypeRef)] ty
|
216
260
|
# @return [Integer]
|
217
261
|
# @scope class
|
218
262
|
attach_function :store_size_of_type, :LLVMStoreSizeOfType, [OpaqueTargetData, :pointer], :ulong_long
|
@@ -220,9 +264,9 @@ module LLVM::C
|
|
220
264
|
# Computes the ABI size of a type in bytes for a target.
|
221
265
|
# See the method llvm::DataLayout::getTypeAllocSize.
|
222
266
|
#
|
223
|
-
# @method abi_size_of_type(
|
224
|
-
# @param [OpaqueTargetData]
|
225
|
-
# @param [FFI::Pointer(TypeRef)]
|
267
|
+
# @method abi_size_of_type(td, ty)
|
268
|
+
# @param [OpaqueTargetData] td
|
269
|
+
# @param [FFI::Pointer(TypeRef)] ty
|
226
270
|
# @return [Integer]
|
227
271
|
# @scope class
|
228
272
|
attach_function :abi_size_of_type, :LLVMABISizeOfType, [OpaqueTargetData, :pointer], :ulong_long
|
@@ -230,9 +274,9 @@ module LLVM::C
|
|
230
274
|
# Computes the ABI alignment of a type in bytes for a target.
|
231
275
|
# See the method llvm::DataLayout::getTypeABISize.
|
232
276
|
#
|
233
|
-
# @method abi_alignment_of_type(
|
234
|
-
# @param [OpaqueTargetData]
|
235
|
-
# @param [FFI::Pointer(TypeRef)]
|
277
|
+
# @method abi_alignment_of_type(td, ty)
|
278
|
+
# @param [OpaqueTargetData] td
|
279
|
+
# @param [FFI::Pointer(TypeRef)] ty
|
236
280
|
# @return [Integer]
|
237
281
|
# @scope class
|
238
282
|
attach_function :abi_alignment_of_type, :LLVMABIAlignmentOfType, [OpaqueTargetData, :pointer], :uint
|
@@ -240,9 +284,9 @@ module LLVM::C
|
|
240
284
|
# Computes the call frame alignment of a type in bytes for a target.
|
241
285
|
# See the method llvm::DataLayout::getTypeABISize.
|
242
286
|
#
|
243
|
-
# @method call_frame_alignment_of_type(
|
244
|
-
# @param [OpaqueTargetData]
|
245
|
-
# @param [FFI::Pointer(TypeRef)]
|
287
|
+
# @method call_frame_alignment_of_type(td, ty)
|
288
|
+
# @param [OpaqueTargetData] td
|
289
|
+
# @param [FFI::Pointer(TypeRef)] ty
|
246
290
|
# @return [Integer]
|
247
291
|
# @scope class
|
248
292
|
attach_function :call_frame_alignment_of_type, :LLVMCallFrameAlignmentOfType, [OpaqueTargetData, :pointer], :uint
|
@@ -250,9 +294,9 @@ module LLVM::C
|
|
250
294
|
# Computes the preferred alignment of a type in bytes for a target.
|
251
295
|
# See the method llvm::DataLayout::getTypeABISize.
|
252
296
|
#
|
253
|
-
# @method preferred_alignment_of_type(
|
254
|
-
# @param [OpaqueTargetData]
|
255
|
-
# @param [FFI::Pointer(TypeRef)]
|
297
|
+
# @method preferred_alignment_of_type(td, ty)
|
298
|
+
# @param [OpaqueTargetData] td
|
299
|
+
# @param [FFI::Pointer(TypeRef)] ty
|
256
300
|
# @return [Integer]
|
257
301
|
# @scope class
|
258
302
|
attach_function :preferred_alignment_of_type, :LLVMPreferredAlignmentOfType, [OpaqueTargetData, :pointer], :uint
|
@@ -260,8 +304,8 @@ module LLVM::C
|
|
260
304
|
# Computes the preferred alignment of a global variable in bytes for a target.
|
261
305
|
# See the method llvm::DataLayout::getPreferredAlignment.
|
262
306
|
#
|
263
|
-
# @method preferred_alignment_of_global(
|
264
|
-
# @param [OpaqueTargetData]
|
307
|
+
# @method preferred_alignment_of_global(td, global_var)
|
308
|
+
# @param [OpaqueTargetData] td
|
265
309
|
# @param [FFI::Pointer(ValueRef)] global_var
|
266
310
|
# @return [Integer]
|
267
311
|
# @scope class
|
@@ -270,8 +314,8 @@ module LLVM::C
|
|
270
314
|
# Computes the structure element that contains the byte offset for a target.
|
271
315
|
# See the method llvm::StructLayout::getElementContainingOffset.
|
272
316
|
#
|
273
|
-
# @method element_at_offset(
|
274
|
-
# @param [OpaqueTargetData]
|
317
|
+
# @method element_at_offset(td, struct_ty, offset)
|
318
|
+
# @param [OpaqueTargetData] td
|
275
319
|
# @param [FFI::Pointer(TypeRef)] struct_ty
|
276
320
|
# @param [Integer] offset
|
277
321
|
# @return [Integer]
|
@@ -281,8 +325,8 @@ module LLVM::C
|
|
281
325
|
# Computes the byte offset of the indexed struct element for a target.
|
282
326
|
# See the method llvm::StructLayout::getElementContainingOffset.
|
283
327
|
#
|
284
|
-
# @method offset_of_element(
|
285
|
-
# @param [OpaqueTargetData]
|
328
|
+
# @method offset_of_element(td, struct_ty, element)
|
329
|
+
# @param [OpaqueTargetData] td
|
286
330
|
# @param [FFI::Pointer(TypeRef)] struct_ty
|
287
331
|
# @param [Integer] element
|
288
332
|
# @return [Integer]
|
@@ -292,8 +336,8 @@ module LLVM::C
|
|
292
336
|
# Deallocates a TargetData.
|
293
337
|
# See the destructor llvm::DataLayout::~DataLayout.
|
294
338
|
#
|
295
|
-
# @method dispose_target_data(
|
296
|
-
# @param [OpaqueTargetData]
|
339
|
+
# @method dispose_target_data(td)
|
340
|
+
# @param [OpaqueTargetData] td
|
297
341
|
# @return [nil]
|
298
342
|
# @scope class
|
299
343
|
attach_function :dispose_target_data, :LLVMDisposeTargetData, [OpaqueTargetData], :void
|
@@ -434,6 +478,27 @@ module LLVM::C
|
|
434
478
|
# @scope class
|
435
479
|
attach_function :get_next_target, :LLVMGetNextTarget, [Target], Target
|
436
480
|
|
481
|
+
# Finds the target corresponding to the given name and stores it in \p T.
|
482
|
+
# Returns 0 on success.
|
483
|
+
#
|
484
|
+
# @method get_target_from_name(name)
|
485
|
+
# @param [String] name
|
486
|
+
# @return [Target]
|
487
|
+
# @scope class
|
488
|
+
attach_function :get_target_from_name, :LLVMGetTargetFromName, [:string], Target
|
489
|
+
|
490
|
+
# Finds the target corresponding to the given triple and stores it in \p T.
|
491
|
+
# Returns 0 on success. Optionally returns any error in ErrorMessage.
|
492
|
+
# Use LLVMDisposeMessage to dispose the message.
|
493
|
+
#
|
494
|
+
# @method get_target_from_triple(triple, t, error_message)
|
495
|
+
# @param [String] triple
|
496
|
+
# @param [FFI::Pointer(*TargetRef)] t
|
497
|
+
# @param [FFI::Pointer(**CharS)] error_message
|
498
|
+
# @return [Integer]
|
499
|
+
# @scope class
|
500
|
+
attach_function :get_target_from_triple, :LLVMGetTargetFromTriple, [:string, :pointer, :pointer], :int
|
501
|
+
|
437
502
|
# Returns the name of a target. See llvm::Target::getName
|
438
503
|
#
|
439
504
|
# @method get_target_name(t)
|
@@ -543,6 +608,15 @@ module LLVM::C
|
|
543
608
|
# @scope class
|
544
609
|
attach_function :get_target_machine_data, :LLVMGetTargetMachineData, [OpaqueTargetMachine], OpaqueTargetData
|
545
610
|
|
611
|
+
# Set the target machine's ASM verbosity.
|
612
|
+
#
|
613
|
+
# @method set_target_machine_asm_verbosity(t, verbose_asm)
|
614
|
+
# @param [OpaqueTargetMachine] t
|
615
|
+
# @param [Integer] verbose_asm
|
616
|
+
# @return [nil]
|
617
|
+
# @scope class
|
618
|
+
attach_function :set_target_machine_asm_verbosity, :LLVMSetTargetMachineAsmVerbosity, [OpaqueTargetMachine, :int], :void
|
619
|
+
|
546
620
|
# Emits an asm or object file for the given module to the filename. This
|
547
621
|
# wraps several c++ only classes (among them a file stream). Returns any
|
548
622
|
# error in ErrorMessage. Use LLVMDisposeMessage to dispose the message.
|
@@ -569,4 +643,12 @@ module LLVM::C
|
|
569
643
|
# @scope class
|
570
644
|
attach_function :target_machine_emit_to_memory_buffer, :LLVMTargetMachineEmitToMemoryBuffer, [OpaqueTargetMachine, :pointer, :code_gen_file_type, :pointer, :pointer], :int
|
571
645
|
|
646
|
+
# Get a triple for the host machine as a string. The result needs to be
|
647
|
+
# disposed with LLVMDisposeMessage.
|
648
|
+
#
|
649
|
+
# @method get_default_target_triple()
|
650
|
+
# @return [String]
|
651
|
+
# @scope class
|
652
|
+
attach_function :get_default_target_triple, :LLVMGetDefaultTargetTriple, [], :string
|
653
|
+
|
572
654
|
end
|