ruby-llvm 3.3.0 → 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.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +19 -4
  3. data/ext/ruby-llvm-support/Rakefile +20 -8
  4. data/ext/ruby-llvm-support/support.cpp +1 -30
  5. data/lib/llvm.rb +0 -6
  6. data/lib/llvm/analysis_ffi.rb +30 -28
  7. data/lib/llvm/config.rb +4 -4
  8. data/lib/llvm/core.rb +45 -2
  9. data/lib/llvm/core/bitcode.rb +10 -10
  10. data/lib/llvm/core/bitcode_ffi.rb +92 -70
  11. data/lib/llvm/core/builder.rb +2 -3
  12. data/lib/llvm/core/context.rb +1 -1
  13. data/lib/llvm/core/module.rb +7 -21
  14. data/lib/llvm/core/pass_manager.rb +4 -2
  15. data/lib/llvm/core/type.rb +3 -3
  16. data/lib/llvm/core/value.rb +155 -28
  17. data/lib/llvm/core_ffi.rb +4041 -3564
  18. data/lib/llvm/execution_engine.rb +176 -8
  19. data/lib/llvm/execution_engine_ffi.rb +271 -222
  20. data/lib/llvm/linker.rb +2 -19
  21. data/lib/llvm/linker_ffi.rb +24 -25
  22. data/lib/llvm/support.rb +6 -16
  23. data/lib/llvm/target.rb +12 -18
  24. data/lib/llvm/target_ffi.rb +386 -330
  25. data/lib/llvm/transforms/builder.rb +8 -3
  26. data/lib/llvm/transforms/builder_ffi.rb +57 -58
  27. data/lib/llvm/transforms/ipo.rb +1 -1
  28. data/lib/llvm/transforms/ipo_ffi.rb +60 -61
  29. data/lib/llvm/transforms/scalar_ffi.rb +216 -128
  30. data/lib/llvm/transforms/vectorize_ffi.rb +15 -16
  31. data/lib/llvm/version.rb +3 -2
  32. data/test/basic_block_test.rb +0 -1
  33. data/test/bitcode_test.rb +1 -2
  34. data/test/call_test.rb +1 -1
  35. data/test/double_test.rb +8 -7
  36. data/test/equality_test.rb +2 -4
  37. data/test/function_test.rb +27 -0
  38. data/test/generic_value_test.rb +1 -1
  39. data/test/instruction_test.rb +0 -2
  40. data/test/ipo_test.rb +1 -1
  41. data/test/linker_test.rb +0 -9
  42. data/test/mcjit_test.rb +94 -0
  43. data/test/module_test.rb +33 -10
  44. data/test/pass_manager_builder_test.rb +23 -3
  45. data/test/target_test.rb +7 -24
  46. data/test/test_helper.rb +4 -1
  47. metadata +113 -93
@@ -9,25 +9,8 @@ module LLVM
9
9
  # @return [nil, String] human-readable error if linking has failed
10
10
  def link_into(other)
11
11
  LLVM.with_message_output do |msg|
12
- # HACK ALERT: ffi-gen missed LLVMLinkerPreserveSource enumeration for
13
- # some reason. It is inlined as a constant here.
14
-
15
- # C.link_modules(mod, self, :linker_preserve_source, msg)
16
- C.link_modules(other, self, 1, msg)
17
- end
18
- end
19
-
20
- # Link the current module into +other+, and dispose the current module.
21
- #
22
- # @return [nil, String] human-readable error if linking has failed
23
- def link_into_and_destroy(other)
24
- result = LLVM.with_message_output do |msg|
25
- C.link_modules(other, self, :linker_destroy_source, msg)
12
+ C.link_modules2(other, self)
26
13
  end
27
-
28
- @ptr = nil
29
-
30
- result
31
14
  end
32
15
  end
33
- end
16
+ end
@@ -4,42 +4,41 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib 'LLVM-3.3'
8
-
7
+ ffi_lib ["libLLVM-10.so.1", "LLVM-10"]
8
+
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
11
11
  (class << self; self; end).class_eval { define_method(name) { |*_| raise e } }
12
12
  end
13
13
  end
14
-
15
- # (Not documented)
16
- #
14
+
15
+ # This enum is provided for backwards-compatibility only. It has no effect.
16
+ #
17
17
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:linker_mode).</em>
18
- #
18
+ #
19
19
  # === Options:
20
- # :linker_destroy_source ::
21
- #
22
- #
20
+ # :destroy_source ::
21
+ #
22
+ # :preserve_source_removed ::
23
+ # This is the default behavior.
24
+ #
23
25
  # @method _enum_linker_mode_
24
26
  # @return [Symbol]
25
27
  # @scope class
26
28
  enum :linker_mode, [
27
- :linker_destroy_source, 0
29
+ :destroy_source, 0,
30
+ :preserve_source_removed, 1
28
31
  ]
29
-
30
- # Links the source module into the destination module, taking ownership
31
- # of the source module away from the caller. Optionally returns a
32
- # human-readable description of any errors that occurred in linking.
33
- # OutMessage must be disposed with LLVMDisposeMessage. The return value
34
- # is true if an error occurred, false otherwise.
35
- #
36
- # @method link_modules(dest, src, mode, out_message)
37
- # @param [FFI::Pointer(ModuleRef)] dest
38
- # @param [FFI::Pointer(ModuleRef)] src
39
- # @param [Symbol from _enum_linker_mode_] mode
40
- # @param [FFI::Pointer(**CharS)] out_message
41
- # @return [Integer]
32
+
33
+ # Links the source module into the destination module. The source module is
34
+ # destroyed.
35
+ # The return value is true if an error occurred, false otherwise.
36
+ # Use the diagnostic handler to get any diagnostic message.
37
+ #
38
+ # @method link_modules2(dest, src)
39
+ # @param [FFI::Pointer(ModuleRef)] dest
40
+ # @param [FFI::Pointer(ModuleRef)] src
41
+ # @return [Integer]
42
42
  # @scope class
43
- attach_function :link_modules, :LLVMLinkModules, [:pointer, :pointer, :linker_mode, :pointer], :int
44
-
43
+ attach_function :link_modules2, :LLVMLinkModules2, [:pointer, :pointer], :int
45
44
  end
@@ -8,20 +8,10 @@ module LLVM
8
8
  module C
9
9
  extend FFI::Library
10
10
 
11
- OpaqueValue = LLVM::C::OpaqueValue
12
- OpaqueType = LLVM::C::OpaqueType
13
- OpaqueModule = LLVM::C::OpaqueModule
14
-
15
11
  lib_name = FFI.map_library_name("RubyLLVMSupport-#{LLVM_VERSION}")
16
12
  lib_path = File.expand_path("../../ext/ruby-llvm-support/#{lib_name}", File.dirname(__FILE__))
17
13
  ffi_lib [lib_path]
18
14
 
19
- attach_function :load_library_permanently, :LLVMLoadLibraryPermanently, [:string], :int
20
- attach_function :has_unnamed_addr, :LLVMHasUnnamedAddr, [OpaqueValue], :int
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
-
25
15
  attach_function :initialize_all_target_infos,
26
16
  :LLVMInitializeAllTargetInfos, [], :void
27
17
  attach_function :initialize_all_targets,
@@ -33,16 +23,16 @@ module LLVM
33
23
 
34
24
  attach_function :initialize_native_target,
35
25
  :LLVMInitializeNativeTarget, [], :void
36
- attach_function :initialize_native_target_asm_printer,
37
- :LLVMInitializeNativeTargetAsmPrinter, [], :void
26
+ attach_function :initialize_native_asm_printer,
27
+ :LLVMInitializeNativeAsmPrinter, [], :void
38
28
  end
39
29
  end
40
30
 
41
- def load_library(libname)
42
- Support::C.load_library_permanently(libname)
31
+ def self.load_library(libname)
32
+ if C.load_library_permanently(libname) != 0
33
+ raise "LLVM::Support.load_library failed"
34
+ end
43
35
 
44
36
  nil
45
37
  end
46
-
47
- module_function :load_library
48
38
  end
@@ -4,8 +4,8 @@ require 'llvm/target_ffi'
4
4
 
5
5
  module LLVM
6
6
  # A shorthand for {LLVM::Target.init_native}
7
- def self.init_jit
8
- LLVM::Target.init_native
7
+ def self.init_jit(*args)
8
+ LLVM::Target.init_native(*args)
9
9
  end
10
10
 
11
11
  # @deprecated Use LLVM.init_jit or LLVM::Target.init('X86').
@@ -20,7 +20,7 @@ module LLVM
20
20
  #
21
21
  # @param [String] target Target name in LLVM format, e.g. "X86", "ARM" or "PowerPC".
22
22
  # @param [true, false] asm_printer Initialize corresponding AsmPrinter.
23
- def self.init(target, asm_printer=false)
23
+ def self.init(target, asm_printer = false)
24
24
  C.module_eval do
25
25
  attach_function :"initialize_target_info_#{target}",
26
26
  :"LLVMInitialize#{target}TargetInfo", [], :void
@@ -57,7 +57,7 @@ module LLVM
57
57
  # Initializes all available targets.
58
58
  #
59
59
  # @param [true, false] asm_printer Initialize corresponding AsmPrinters.
60
- def self.init_all(asm_printer=false)
60
+ def self.init_all(asm_printer = false)
61
61
  Support::C.initialize_all_target_infos
62
62
  Support::C.initialize_all_targets
63
63
  Support::C.initialize_all_target_mcs
@@ -68,10 +68,11 @@ module LLVM
68
68
  # Initializes native target. Useful for JIT applications.
69
69
  #
70
70
  # @param [true, false] asm_printer Initialize corresponding AsmPrinter.
71
- def self.init_native(asm_printer=false)
71
+ # True by default, as this is required for MCJIT to function.
72
+ def self.init_native(asm_printer = true)
72
73
  Support::C.initialize_native_target
73
74
 
74
- Support::C.initialize_native_target_asm_printer if asm_printer
75
+ Support::C.initialize_native_asm_printer if asm_printer
75
76
  end
76
77
 
77
78
  # Enumerate all initialized targets.
@@ -144,8 +145,8 @@ module LLVM
144
145
  # @param [Symbol] reloc :default, :static, :pic, :dynamic_no_pic
145
146
  # @param [Symbol] code_model :default, :jit_default, :small, :kernel, :medium, :large
146
147
  # @return [TargetMachine]
147
- def create_machine(triple, cpu="", features="",
148
- opt_level=:default, reloc=:default, code_model=:default)
148
+ def create_machine(triple, cpu = "", features = "",
149
+ opt_level = :default, reloc = :default, code_model = :default)
149
150
  TargetMachine.from_ptr(C.create_target_machine(self,
150
151
  triple, cpu, features, opt_level, reloc, code_model))
151
152
  end
@@ -191,17 +192,10 @@ module LLVM
191
192
  C.get_target_machine_feature_string(self)
192
193
  end
193
194
 
194
- # Returns the data layout used for this target machine.
195
- #
196
- # @return [TargetDataLayout]
197
- def data_layout
198
- TargetDataLayout.from_ptr(C.get_target_machine_data(self))
199
- end
200
-
201
195
  # Emits an asm or object file for the given module.
202
196
  #
203
197
  # @param [Symbol] codegen :assembly, :object
204
- def emit(mod, filename, codegen=:assembly)
198
+ def emit(mod, filename, codegen = :assembly)
205
199
  LLVM.with_error_output do |err|
206
200
  C.target_machine_emit_to_file(self, mod, filename.to_s, codegen, err)
207
201
  end
@@ -262,14 +256,14 @@ module LLVM
262
256
  # Returns the pointer size in bytes for a target.
263
257
  #
264
258
  # @param [Integer] addr_space address space number
265
- def pointer_size(addr_space=0)
259
+ def pointer_size(addr_space = 0)
266
260
  C.pointer_size_for_as(self, addr_space)
267
261
  end
268
262
 
269
263
  # Returns the integer type that is the same size as a pointer on a target.
270
264
  #
271
265
  # @param [Integer] addr_space address space number
272
- def int_ptr_type(addr_space=0)
266
+ def int_ptr_type(addr_space = 0)
273
267
  Type.from_ptr(C.int_ptr_type_for_as(self, addr_space), :integer)
274
268
  end
275
269
 
@@ -4,24 +4,24 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib 'LLVM-3.3'
8
-
7
+ ffi_lib ["libLLVM-10.so.1", "LLVM-10"]
8
+
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
11
11
  (class << self; self; end).class_eval { define_method(name) { |*_| raise e } }
12
12
  end
13
13
  end
14
-
14
+
15
15
  # (Not documented)
16
- #
16
+ #
17
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
- #
18
+ #
19
19
  # === Options:
20
20
  # :big_endian ::
21
- #
21
+ #
22
22
  # :little_endian ::
23
- #
24
- #
23
+ #
24
+ #
25
25
  # @method _enum_byte_ordering_
26
26
  # @return [Symbol]
27
27
  # @scope class
@@ -29,314 +29,323 @@ module LLVM::C
29
29
  :big_endian, 0,
30
30
  :little_endian, 1
31
31
  ]
32
-
32
+
33
33
  # (Not documented)
34
34
  class OpaqueTargetData < FFI::Struct
35
35
  layout :dummy, :char
36
36
  end
37
-
37
+
38
38
  # (Not documented)
39
39
  class OpaqueTargetLibraryInfotData < FFI::Struct
40
40
  layout :dummy, :char
41
41
  end
42
-
43
- # (Not documented)
44
- class StructLayout < FFI::Struct
45
- layout :dummy, :char
46
- end
47
-
42
+
48
43
  # (Not documented)
49
- #
44
+ #
50
45
  # @method initialize_all_target_infos()
51
- # @return [nil]
46
+ # @return [nil]
52
47
  # @scope class
53
48
  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
- #
49
+
50
+ # (Not documented)
51
+ #
59
52
  # @method initialize_all_targets()
60
- # @return [nil]
53
+ # @return [nil]
61
54
  # @scope class
62
55
  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
- #
56
+
57
+ # (Not documented)
58
+ #
68
59
  # @method initialize_all_target_m_cs()
69
- # @return [nil]
60
+ # @return [nil]
70
61
  # @scope class
71
62
  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
- #
63
+
64
+ # (Not documented)
65
+ #
77
66
  # @method initialize_all_asm_printers()
78
- # @return [nil]
67
+ # @return [nil]
79
68
  # @scope class
80
69
  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
- #
70
+
71
+ # (Not documented)
72
+ #
86
73
  # @method initialize_all_asm_parsers()
87
- # @return [nil]
74
+ # @return [nil]
88
75
  # @scope class
89
76
  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
- #
77
+
78
+ # (Not documented)
79
+ #
95
80
  # @method initialize_all_disassemblers()
96
- # @return [nil]
81
+ # @return [nil]
97
82
  # @scope class
98
83
  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
- #
84
+
85
+ # (Not documented)
86
+ #
104
87
  # @method initialize_native_target()
105
- # @return [Integer]
88
+ # @return [Integer]
106
89
  # @scope class
107
90
  attach_function :initialize_native_target, :LLVMInitializeNativeTarget, [], :int
108
-
109
- # Creates target data from a target layout string.
110
- # See the constructor llvm::DataLayout::DataLayout.
111
- #
91
+
92
+ # (Not documented)
93
+ #
94
+ # @method initialize_native_asm_parser()
95
+ # @return [Integer]
96
+ # @scope class
97
+ attach_function :initialize_native_asm_parser, :LLVMInitializeNativeAsmParser, [], :int
98
+
99
+ # (Not documented)
100
+ #
101
+ # @method initialize_native_asm_printer()
102
+ # @return [Integer]
103
+ # @scope class
104
+ attach_function :initialize_native_asm_printer, :LLVMInitializeNativeAsmPrinter, [], :int
105
+
106
+ # (Not documented)
107
+ #
108
+ # @method initialize_native_disassembler()
109
+ # @return [Integer]
110
+ # @scope class
111
+ attach_function :initialize_native_disassembler, :LLVMInitializeNativeDisassembler, [], :int
112
+
113
+ # (Not documented)
114
+ #
115
+ # @method get_module_data_layout(m)
116
+ # @param [FFI::Pointer(ModuleRef)] m
117
+ # @return [OpaqueTargetData]
118
+ # @scope class
119
+ attach_function :get_module_data_layout, :LLVMGetModuleDataLayout, [:pointer], OpaqueTargetData
120
+
121
+ # (Not documented)
122
+ #
123
+ # @method set_module_data_layout(m, dl)
124
+ # @param [FFI::Pointer(ModuleRef)] m
125
+ # @param [OpaqueTargetData] dl
126
+ # @return [nil]
127
+ # @scope class
128
+ attach_function :set_module_data_layout, :LLVMSetModuleDataLayout, [:pointer, OpaqueTargetData], :void
129
+
130
+ # (Not documented)
131
+ #
112
132
  # @method create_target_data(string_rep)
113
- # @param [String] string_rep
114
- # @return [OpaqueTargetData]
133
+ # @param [String] string_rep
134
+ # @return [OpaqueTargetData]
115
135
  # @scope class
116
136
  attach_function :create_target_data, :LLVMCreateTargetData, [:string], OpaqueTargetData
117
-
118
- # Adds target data information to a pass manager. This does not take ownership
119
- # of the target data.
120
- # See the method llvm::PassManagerBase::add.
121
- #
122
- # @method add_target_data(opaque_target_data, pass_manager_ref)
123
- # @param [OpaqueTargetData] opaque_target_data
124
- # @param [FFI::Pointer(PassManagerRef)] pass_manager_ref
125
- # @return [nil]
126
- # @scope class
127
- attach_function :add_target_data, :LLVMAddTargetData, [OpaqueTargetData, :pointer], :void
128
-
129
- # Adds target library information to a pass manager. This does not take
130
- # ownership of the target library info.
131
- # See the method llvm::PassManagerBase::add.
132
- #
133
- # @method add_target_library_info(opaque_target_library_infot_data, pass_manager_ref)
134
- # @param [OpaqueTargetLibraryInfotData] opaque_target_library_infot_data
135
- # @param [FFI::Pointer(PassManagerRef)] pass_manager_ref
136
- # @return [nil]
137
+
138
+ # (Not documented)
139
+ #
140
+ # @method dispose_target_data(td)
141
+ # @param [OpaqueTargetData] td
142
+ # @return [nil]
143
+ # @scope class
144
+ attach_function :dispose_target_data, :LLVMDisposeTargetData, [OpaqueTargetData], :void
145
+
146
+ # (Not documented)
147
+ #
148
+ # @method add_target_library_info(tli, pm)
149
+ # @param [OpaqueTargetLibraryInfotData] tli
150
+ # @param [FFI::Pointer(PassManagerRef)] pm
151
+ # @return [nil]
137
152
  # @scope class
138
153
  attach_function :add_target_library_info, :LLVMAddTargetLibraryInfo, [OpaqueTargetLibraryInfotData, :pointer], :void
139
-
140
- # Converts target data to a target layout string. The string must be disposed
141
- # with LLVMDisposeMessage.
142
- # See the constructor llvm::DataLayout::DataLayout.
143
- #
144
- # @method copy_string_rep_of_target_data(opaque_target_data)
145
- # @param [OpaqueTargetData] opaque_target_data
146
- # @return [String]
154
+
155
+ # (Not documented)
156
+ #
157
+ # @method copy_string_rep_of_target_data(td)
158
+ # @param [OpaqueTargetData] td
159
+ # @return [String]
147
160
  # @scope class
148
161
  attach_function :copy_string_rep_of_target_data, :LLVMCopyStringRepOfTargetData, [OpaqueTargetData], :string
149
-
150
- # Returns the byte order of a target, either LLVMBigEndian or
151
- # LLVMLittleEndian.
152
- # See the method llvm::DataLayout::isLittleEndian.
153
- #
154
- # @method byte_order(opaque_target_data)
155
- # @param [OpaqueTargetData] opaque_target_data
156
- # @return [Symbol from _enum_byte_ordering_]
162
+
163
+ # (Not documented)
164
+ #
165
+ # @method byte_order(td)
166
+ # @param [OpaqueTargetData] td
167
+ # @return [Symbol from _enum_byte_ordering_]
157
168
  # @scope class
158
169
  attach_function :byte_order, :LLVMByteOrder, [OpaqueTargetData], :byte_ordering
159
-
160
- # Returns the pointer size in bytes for a target.
161
- # See the method llvm::DataLayout::getPointerSize.
162
- #
163
- # @method pointer_size(opaque_target_data)
164
- # @param [OpaqueTargetData] opaque_target_data
165
- # @return [Integer]
170
+
171
+ # (Not documented)
172
+ #
173
+ # @method pointer_size(td)
174
+ # @param [OpaqueTargetData] td
175
+ # @return [Integer]
166
176
  # @scope class
167
177
  attach_function :pointer_size, :LLVMPointerSize, [OpaqueTargetData], :uint
168
-
169
- # Returns the pointer size in bytes for a target for a specified
170
- # address space.
171
- # See the method llvm::DataLayout::getPointerSize.
172
- #
173
- # @method pointer_size_for_as(opaque_target_data, as)
174
- # @param [OpaqueTargetData] opaque_target_data
175
- # @param [Integer] as
176
- # @return [Integer]
178
+
179
+ # (Not documented)
180
+ #
181
+ # @method pointer_size_for_as(td, as)
182
+ # @param [OpaqueTargetData] td
183
+ # @param [Integer] as
184
+ # @return [Integer]
177
185
  # @scope class
178
186
  attach_function :pointer_size_for_as, :LLVMPointerSizeForAS, [OpaqueTargetData, :uint], :uint
179
-
180
- # Returns the integer type that is the same size as a pointer on a target.
181
- # See the method llvm::DataLayout::getIntPtrType.
182
- #
183
- # @method int_ptr_type(opaque_target_data)
184
- # @param [OpaqueTargetData] opaque_target_data
185
- # @return [FFI::Pointer(TypeRef)]
187
+
188
+ # (Not documented)
189
+ #
190
+ # @method int_ptr_type(td)
191
+ # @param [OpaqueTargetData] td
192
+ # @return [FFI::Pointer(TypeRef)]
186
193
  # @scope class
187
194
  attach_function :int_ptr_type, :LLVMIntPtrType, [OpaqueTargetData], :pointer
188
-
189
- # Returns the integer type that is the same size as a pointer on a target.
190
- # This version allows the address space to be specified.
191
- # See the method llvm::DataLayout::getIntPtrType.
192
- #
193
- # @method int_ptr_type_for_as(opaque_target_data, as)
194
- # @param [OpaqueTargetData] opaque_target_data
195
- # @param [Integer] as
196
- # @return [FFI::Pointer(TypeRef)]
195
+
196
+ # (Not documented)
197
+ #
198
+ # @method int_ptr_type_for_as(td, as)
199
+ # @param [OpaqueTargetData] td
200
+ # @param [Integer] as
201
+ # @return [FFI::Pointer(TypeRef)]
197
202
  # @scope class
198
203
  attach_function :int_ptr_type_for_as, :LLVMIntPtrTypeForAS, [OpaqueTargetData, :uint], :pointer
199
-
200
- # Computes the size of a type in bytes for a target.
201
- # See the method llvm::DataLayout::getTypeSizeInBits.
202
- #
203
- # @method size_of_type_in_bits(opaque_target_data, type_ref)
204
- # @param [OpaqueTargetData] opaque_target_data
205
- # @param [FFI::Pointer(TypeRef)] type_ref
206
- # @return [Integer]
204
+
205
+ # (Not documented)
206
+ #
207
+ # @method int_ptr_type_in_context(c, td)
208
+ # @param [FFI::Pointer(ContextRef)] c
209
+ # @param [OpaqueTargetData] td
210
+ # @return [FFI::Pointer(TypeRef)]
211
+ # @scope class
212
+ attach_function :int_ptr_type_in_context, :LLVMIntPtrTypeInContext, [:pointer, OpaqueTargetData], :pointer
213
+
214
+ # (Not documented)
215
+ #
216
+ # @method int_ptr_type_for_as_in_context(c, td, as)
217
+ # @param [FFI::Pointer(ContextRef)] c
218
+ # @param [OpaqueTargetData] td
219
+ # @param [Integer] as
220
+ # @return [FFI::Pointer(TypeRef)]
221
+ # @scope class
222
+ attach_function :int_ptr_type_for_as_in_context, :LLVMIntPtrTypeForASInContext, [:pointer, OpaqueTargetData, :uint], :pointer
223
+
224
+ # (Not documented)
225
+ #
226
+ # @method size_of_type_in_bits(td, ty)
227
+ # @param [OpaqueTargetData] td
228
+ # @param [FFI::Pointer(TypeRef)] ty
229
+ # @return [Integer]
207
230
  # @scope class
208
231
  attach_function :size_of_type_in_bits, :LLVMSizeOfTypeInBits, [OpaqueTargetData, :pointer], :ulong_long
209
-
210
- # Computes the storage size of a type in bytes for a target.
211
- # See the method llvm::DataLayout::getTypeStoreSize.
212
- #
213
- # @method store_size_of_type(opaque_target_data, type_ref)
214
- # @param [OpaqueTargetData] opaque_target_data
215
- # @param [FFI::Pointer(TypeRef)] type_ref
216
- # @return [Integer]
232
+
233
+ # (Not documented)
234
+ #
235
+ # @method store_size_of_type(td, ty)
236
+ # @param [OpaqueTargetData] td
237
+ # @param [FFI::Pointer(TypeRef)] ty
238
+ # @return [Integer]
217
239
  # @scope class
218
240
  attach_function :store_size_of_type, :LLVMStoreSizeOfType, [OpaqueTargetData, :pointer], :ulong_long
219
-
220
- # Computes the ABI size of a type in bytes for a target.
221
- # See the method llvm::DataLayout::getTypeAllocSize.
222
- #
223
- # @method abi_size_of_type(opaque_target_data, type_ref)
224
- # @param [OpaqueTargetData] opaque_target_data
225
- # @param [FFI::Pointer(TypeRef)] type_ref
226
- # @return [Integer]
241
+
242
+ # (Not documented)
243
+ #
244
+ # @method abi_size_of_type(td, ty)
245
+ # @param [OpaqueTargetData] td
246
+ # @param [FFI::Pointer(TypeRef)] ty
247
+ # @return [Integer]
227
248
  # @scope class
228
249
  attach_function :abi_size_of_type, :LLVMABISizeOfType, [OpaqueTargetData, :pointer], :ulong_long
229
-
230
- # Computes the ABI alignment of a type in bytes for a target.
231
- # See the method llvm::DataLayout::getTypeABISize.
232
- #
233
- # @method abi_alignment_of_type(opaque_target_data, type_ref)
234
- # @param [OpaqueTargetData] opaque_target_data
235
- # @param [FFI::Pointer(TypeRef)] type_ref
236
- # @return [Integer]
250
+
251
+ # (Not documented)
252
+ #
253
+ # @method abi_alignment_of_type(td, ty)
254
+ # @param [OpaqueTargetData] td
255
+ # @param [FFI::Pointer(TypeRef)] ty
256
+ # @return [Integer]
237
257
  # @scope class
238
258
  attach_function :abi_alignment_of_type, :LLVMABIAlignmentOfType, [OpaqueTargetData, :pointer], :uint
239
-
240
- # Computes the call frame alignment of a type in bytes for a target.
241
- # See the method llvm::DataLayout::getTypeABISize.
242
- #
243
- # @method call_frame_alignment_of_type(opaque_target_data, type_ref)
244
- # @param [OpaqueTargetData] opaque_target_data
245
- # @param [FFI::Pointer(TypeRef)] type_ref
246
- # @return [Integer]
259
+
260
+ # (Not documented)
261
+ #
262
+ # @method call_frame_alignment_of_type(td, ty)
263
+ # @param [OpaqueTargetData] td
264
+ # @param [FFI::Pointer(TypeRef)] ty
265
+ # @return [Integer]
247
266
  # @scope class
248
267
  attach_function :call_frame_alignment_of_type, :LLVMCallFrameAlignmentOfType, [OpaqueTargetData, :pointer], :uint
249
-
250
- # Computes the preferred alignment of a type in bytes for a target.
251
- # See the method llvm::DataLayout::getTypeABISize.
252
- #
253
- # @method preferred_alignment_of_type(opaque_target_data, type_ref)
254
- # @param [OpaqueTargetData] opaque_target_data
255
- # @param [FFI::Pointer(TypeRef)] type_ref
256
- # @return [Integer]
268
+
269
+ # (Not documented)
270
+ #
271
+ # @method preferred_alignment_of_type(td, ty)
272
+ # @param [OpaqueTargetData] td
273
+ # @param [FFI::Pointer(TypeRef)] ty
274
+ # @return [Integer]
257
275
  # @scope class
258
276
  attach_function :preferred_alignment_of_type, :LLVMPreferredAlignmentOfType, [OpaqueTargetData, :pointer], :uint
259
-
260
- # Computes the preferred alignment of a global variable in bytes for a target.
261
- # See the method llvm::DataLayout::getPreferredAlignment.
262
- #
263
- # @method preferred_alignment_of_global(opaque_target_data, global_var)
264
- # @param [OpaqueTargetData] opaque_target_data
265
- # @param [FFI::Pointer(ValueRef)] global_var
266
- # @return [Integer]
277
+
278
+ # (Not documented)
279
+ #
280
+ # @method preferred_alignment_of_global(td, global_var)
281
+ # @param [OpaqueTargetData] td
282
+ # @param [FFI::Pointer(ValueRef)] global_var
283
+ # @return [Integer]
267
284
  # @scope class
268
285
  attach_function :preferred_alignment_of_global, :LLVMPreferredAlignmentOfGlobal, [OpaqueTargetData, :pointer], :uint
269
-
270
- # Computes the structure element that contains the byte offset for a target.
271
- # See the method llvm::StructLayout::getElementContainingOffset.
272
- #
273
- # @method element_at_offset(opaque_target_data, struct_ty, offset)
274
- # @param [OpaqueTargetData] opaque_target_data
275
- # @param [FFI::Pointer(TypeRef)] struct_ty
276
- # @param [Integer] offset
277
- # @return [Integer]
286
+
287
+ # (Not documented)
288
+ #
289
+ # @method element_at_offset(td, struct_ty, offset)
290
+ # @param [OpaqueTargetData] td
291
+ # @param [FFI::Pointer(TypeRef)] struct_ty
292
+ # @param [Integer] offset
293
+ # @return [Integer]
278
294
  # @scope class
279
295
  attach_function :element_at_offset, :LLVMElementAtOffset, [OpaqueTargetData, :pointer, :ulong_long], :uint
280
-
281
- # Computes the byte offset of the indexed struct element for a target.
282
- # See the method llvm::StructLayout::getElementContainingOffset.
283
- #
284
- # @method offset_of_element(opaque_target_data, struct_ty, element)
285
- # @param [OpaqueTargetData] opaque_target_data
286
- # @param [FFI::Pointer(TypeRef)] struct_ty
287
- # @param [Integer] element
288
- # @return [Integer]
296
+
297
+ # (Not documented)
298
+ #
299
+ # @method offset_of_element(td, struct_ty, element)
300
+ # @param [OpaqueTargetData] td
301
+ # @param [FFI::Pointer(TypeRef)] struct_ty
302
+ # @param [Integer] element
303
+ # @return [Integer]
289
304
  # @scope class
290
305
  attach_function :offset_of_element, :LLVMOffsetOfElement, [OpaqueTargetData, :pointer, :uint], :ulong_long
291
-
292
- # Deallocates a TargetData.
293
- # See the destructor llvm::DataLayout::~DataLayout.
294
- #
295
- # @method dispose_target_data(opaque_target_data)
296
- # @param [OpaqueTargetData] opaque_target_data
297
- # @return [nil]
298
- # @scope class
299
- attach_function :dispose_target_data, :LLVMDisposeTargetData, [OpaqueTargetData], :void
300
-
306
+
301
307
  # (Not documented)
302
308
  class OpaqueTargetMachine < FFI::Struct
303
309
  layout :dummy, :char
304
310
  end
305
-
311
+
306
312
  # (Not documented)
307
313
  module TargetWrappers
314
+ # @return [Integer]
308
315
  def has_jit()
309
316
  LLVM::C.target_has_jit(self)
310
317
  end
311
-
318
+
319
+ # @return [Integer]
312
320
  def has_target_machine()
313
321
  LLVM::C.target_has_target_machine(self)
314
322
  end
315
-
323
+
324
+ # @return [Integer]
316
325
  def has_asm_backend()
317
326
  LLVM::C.target_has_asm_backend(self)
318
327
  end
319
328
  end
320
-
329
+
321
330
  class Target < FFI::Struct
322
331
  include TargetWrappers
323
332
  layout :dummy, :char
324
333
  end
325
-
334
+
326
335
  # (Not documented)
327
- #
336
+ #
328
337
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:code_gen_opt_level).</em>
329
- #
338
+ #
330
339
  # === Options:
331
340
  # :none ::
332
- #
341
+ #
333
342
  # :less ::
334
- #
343
+ #
335
344
  # :default ::
336
- #
345
+ #
337
346
  # :aggressive ::
338
- #
339
- #
347
+ #
348
+ #
340
349
  # @method _enum_code_gen_opt_level_
341
350
  # @return [Symbol]
342
351
  # @scope class
@@ -346,21 +355,21 @@ module LLVM::C
346
355
  :default, 2,
347
356
  :aggressive, 3
348
357
  ]
349
-
358
+
350
359
  # (Not documented)
351
- #
360
+ #
352
361
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:reloc_mode).</em>
353
- #
362
+ #
354
363
  # === Options:
355
364
  # :default ::
356
- #
365
+ #
357
366
  # :static ::
358
- #
367
+ #
359
368
  # :pic ::
360
- #
369
+ #
361
370
  # :dynamic_no_pic ::
362
- #
363
- #
371
+ #
372
+ #
364
373
  # @method _enum_reloc_mode_
365
374
  # @return [Symbol]
366
375
  # @scope class
@@ -370,25 +379,25 @@ module LLVM::C
370
379
  :pic, 2,
371
380
  :dynamic_no_pic, 3
372
381
  ]
373
-
382
+
374
383
  # (Not documented)
375
- #
384
+ #
376
385
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:code_model).</em>
377
- #
386
+ #
378
387
  # === Options:
379
388
  # :default ::
380
- #
389
+ #
381
390
  # :jit_default ::
382
- #
391
+ #
383
392
  # :small ::
384
- #
393
+ #
385
394
  # :kernel ::
386
- #
395
+ #
387
396
  # :medium ::
388
- #
397
+ #
389
398
  # :large ::
390
- #
391
- #
399
+ #
400
+ #
392
401
  # @method _enum_code_model_
393
402
  # @return [Symbol]
394
403
  # @scope class
@@ -400,17 +409,17 @@ module LLVM::C
400
409
  :medium, 4,
401
410
  :large, 5
402
411
  ]
403
-
412
+
404
413
  # (Not documented)
405
- #
414
+ #
406
415
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:code_gen_file_type).</em>
407
- #
416
+ #
408
417
  # === Options:
409
418
  # :assembly ::
410
- #
419
+ #
411
420
  # :object ::
412
- #
413
- #
421
+ #
422
+ #
414
423
  # @method _enum_code_gen_file_type_
415
424
  # @return [Symbol]
416
425
  # @scope class
@@ -418,155 +427,202 @@ module LLVM::C
418
427
  :assembly, 0,
419
428
  :object, 1
420
429
  ]
421
-
430
+
422
431
  # Returns the first llvm::Target in the registered targets list.
423
- #
432
+ #
424
433
  # @method get_first_target()
425
- # @return [Target]
434
+ # @return [Target]
426
435
  # @scope class
427
436
  attach_function :get_first_target, :LLVMGetFirstTarget, [], Target
428
-
437
+
429
438
  # Returns the next llvm::Target given a previous one (or null if there's none)
430
- #
439
+ #
431
440
  # @method get_next_target(t)
432
- # @param [Target] t
433
- # @return [Target]
441
+ # @param [Target] t
442
+ # @return [Target]
434
443
  # @scope class
435
444
  attach_function :get_next_target, :LLVMGetNextTarget, [Target], Target
436
-
445
+
446
+ # Finds the target corresponding to the given name and stores it in \p T.
447
+ # Returns 0 on success.
448
+ #
449
+ # @method get_target_from_name(name)
450
+ # @param [String] name
451
+ # @return [Target]
452
+ # @scope class
453
+ attach_function :get_target_from_name, :LLVMGetTargetFromName, [:string], Target
454
+
455
+ # Finds the target corresponding to the given triple and stores it in \p T.
456
+ # Returns 0 on success. Optionally returns any error in ErrorMessage.
457
+ # Use LLVMDisposeMessage to dispose the message.
458
+ #
459
+ # @method get_target_from_triple(triple, t, error_message)
460
+ # @param [String] triple
461
+ # @param [FFI::Pointer(*TargetRef)] t
462
+ # @param [FFI::Pointer(**CharS)] error_message
463
+ # @return [Integer]
464
+ # @scope class
465
+ attach_function :get_target_from_triple, :LLVMGetTargetFromTriple, [:string, :pointer, :pointer], :int
466
+
437
467
  # Returns the name of a target. See llvm::Target::getName
438
- #
468
+ #
439
469
  # @method get_target_name(t)
440
- # @param [Target] t
441
- # @return [String]
470
+ # @param [Target] t
471
+ # @return [String]
442
472
  # @scope class
443
473
  attach_function :get_target_name, :LLVMGetTargetName, [Target], :string
444
-
474
+
445
475
  # Returns the description of a target. See llvm::Target::getDescription
446
- #
476
+ #
447
477
  # @method get_target_description(t)
448
- # @param [Target] t
449
- # @return [String]
478
+ # @param [Target] t
479
+ # @return [String]
450
480
  # @scope class
451
481
  attach_function :get_target_description, :LLVMGetTargetDescription, [Target], :string
452
-
482
+
453
483
  # Returns if the target has a JIT
454
- #
484
+ #
455
485
  # @method target_has_jit(t)
456
- # @param [Target] t
457
- # @return [Integer]
486
+ # @param [Target] t
487
+ # @return [Integer]
458
488
  # @scope class
459
489
  attach_function :target_has_jit, :LLVMTargetHasJIT, [Target], :int
460
-
490
+
461
491
  # Returns if the target has a TargetMachine associated
462
- #
492
+ #
463
493
  # @method target_has_target_machine(t)
464
- # @param [Target] t
465
- # @return [Integer]
494
+ # @param [Target] t
495
+ # @return [Integer]
466
496
  # @scope class
467
497
  attach_function :target_has_target_machine, :LLVMTargetHasTargetMachine, [Target], :int
468
-
498
+
469
499
  # Returns if the target as an ASM backend (required for emitting output)
470
- #
500
+ #
471
501
  # @method target_has_asm_backend(t)
472
- # @param [Target] t
473
- # @return [Integer]
502
+ # @param [Target] t
503
+ # @return [Integer]
474
504
  # @scope class
475
505
  attach_function :target_has_asm_backend, :LLVMTargetHasAsmBackend, [Target], :int
476
-
506
+
477
507
  # Creates a new llvm::TargetMachine. See llvm::Target::createTargetMachine
478
- #
508
+ #
479
509
  # @method create_target_machine(t, triple, cpu, features, level, reloc, code_model)
480
- # @param [Target] t
481
- # @param [String] triple
482
- # @param [String] cpu
483
- # @param [String] features
484
- # @param [Symbol from _enum_code_gen_opt_level_] level
485
- # @param [Symbol from _enum_reloc_mode_] reloc
486
- # @param [Symbol from _enum_code_model_] code_model
487
- # @return [OpaqueTargetMachine]
510
+ # @param [Target] t
511
+ # @param [String] triple
512
+ # @param [String] cpu
513
+ # @param [String] features
514
+ # @param [Symbol from _enum_code_gen_opt_level_] level
515
+ # @param [Symbol from _enum_reloc_mode_] reloc
516
+ # @param [Symbol from _enum_code_model_] code_model
517
+ # @return [OpaqueTargetMachine]
488
518
  # @scope class
489
519
  attach_function :create_target_machine, :LLVMCreateTargetMachine, [Target, :string, :string, :string, :code_gen_opt_level, :reloc_mode, :code_model], OpaqueTargetMachine
490
-
520
+
491
521
  # Dispose the LLVMTargetMachineRef instance generated by
492
522
  # LLVMCreateTargetMachine.
493
- #
523
+ #
494
524
  # @method dispose_target_machine(t)
495
- # @param [OpaqueTargetMachine] t
496
- # @return [nil]
525
+ # @param [OpaqueTargetMachine] t
526
+ # @return [nil]
497
527
  # @scope class
498
528
  attach_function :dispose_target_machine, :LLVMDisposeTargetMachine, [OpaqueTargetMachine], :void
499
-
529
+
500
530
  # Returns the Target used in a TargetMachine
501
- #
531
+ #
502
532
  # @method get_target_machine_target(t)
503
- # @param [OpaqueTargetMachine] t
504
- # @return [Target]
533
+ # @param [OpaqueTargetMachine] t
534
+ # @return [Target]
505
535
  # @scope class
506
536
  attach_function :get_target_machine_target, :LLVMGetTargetMachineTarget, [OpaqueTargetMachine], Target
507
-
537
+
508
538
  # Returns the triple used creating this target machine. See
509
539
  # llvm::TargetMachine::getTriple. The result needs to be disposed with
510
540
  # LLVMDisposeMessage.
511
- #
541
+ #
512
542
  # @method get_target_machine_triple(t)
513
- # @param [OpaqueTargetMachine] t
514
- # @return [String]
543
+ # @param [OpaqueTargetMachine] t
544
+ # @return [String]
515
545
  # @scope class
516
546
  attach_function :get_target_machine_triple, :LLVMGetTargetMachineTriple, [OpaqueTargetMachine], :string
517
-
547
+
518
548
  # Returns the cpu used creating this target machine. See
519
549
  # llvm::TargetMachine::getCPU. The result needs to be disposed with
520
550
  # LLVMDisposeMessage.
521
- #
551
+ #
522
552
  # @method get_target_machine_cpu(t)
523
- # @param [OpaqueTargetMachine] t
524
- # @return [String]
553
+ # @param [OpaqueTargetMachine] t
554
+ # @return [String]
525
555
  # @scope class
526
556
  attach_function :get_target_machine_cpu, :LLVMGetTargetMachineCPU, [OpaqueTargetMachine], :string
527
-
557
+
528
558
  # Returns the feature string used creating this target machine. See
529
559
  # llvm::TargetMachine::getFeatureString. The result needs to be disposed with
530
560
  # LLVMDisposeMessage.
531
- #
561
+ #
532
562
  # @method get_target_machine_feature_string(t)
533
- # @param [OpaqueTargetMachine] t
534
- # @return [String]
563
+ # @param [OpaqueTargetMachine] t
564
+ # @return [String]
535
565
  # @scope class
536
566
  attach_function :get_target_machine_feature_string, :LLVMGetTargetMachineFeatureString, [OpaqueTargetMachine], :string
537
-
538
- # Returns the llvm::DataLayout used for this llvm:TargetMachine.
539
- #
540
- # @method get_target_machine_data(t)
541
- # @param [OpaqueTargetMachine] t
542
- # @return [OpaqueTargetData]
543
- # @scope class
544
- attach_function :get_target_machine_data, :LLVMGetTargetMachineData, [OpaqueTargetMachine], OpaqueTargetData
545
-
567
+
568
+ # Create a DataLayout based on the targetMachine.
569
+ #
570
+ # @method create_target_data_layout(t)
571
+ # @param [OpaqueTargetMachine] t
572
+ # @return [OpaqueTargetData]
573
+ # @scope class
574
+ attach_function :create_target_data_layout, :LLVMCreateTargetDataLayout, [OpaqueTargetMachine], OpaqueTargetData
575
+
576
+ # Set the target machine's ASM verbosity.
577
+ #
578
+ # @method set_target_machine_asm_verbosity(t, verbose_asm)
579
+ # @param [OpaqueTargetMachine] t
580
+ # @param [Integer] verbose_asm
581
+ # @return [nil]
582
+ # @scope class
583
+ attach_function :set_target_machine_asm_verbosity, :LLVMSetTargetMachineAsmVerbosity, [OpaqueTargetMachine, :int], :void
584
+
546
585
  # Emits an asm or object file for the given module to the filename. This
547
586
  # wraps several c++ only classes (among them a file stream). Returns any
548
587
  # error in ErrorMessage. Use LLVMDisposeMessage to dispose the message.
549
- #
588
+ #
550
589
  # @method target_machine_emit_to_file(t, m, filename, codegen, error_message)
551
- # @param [OpaqueTargetMachine] t
552
- # @param [FFI::Pointer(ModuleRef)] m
553
- # @param [String] filename
554
- # @param [Symbol from _enum_code_gen_file_type_] codegen
555
- # @param [FFI::Pointer(**CharS)] error_message
556
- # @return [Integer]
590
+ # @param [OpaqueTargetMachine] t
591
+ # @param [FFI::Pointer(ModuleRef)] m
592
+ # @param [String] filename
593
+ # @param [Symbol from _enum_code_gen_file_type_] codegen
594
+ # @param [FFI::Pointer(**CharS)] error_message
595
+ # @return [Integer]
557
596
  # @scope class
558
597
  attach_function :target_machine_emit_to_file, :LLVMTargetMachineEmitToFile, [OpaqueTargetMachine, :pointer, :string, :code_gen_file_type, :pointer], :int
559
-
598
+
560
599
  # Compile the LLVM IR stored in \p M and store the result in \p OutMemBuf.
561
- #
600
+ #
562
601
  # @method target_machine_emit_to_memory_buffer(t, m, codegen, error_message, out_mem_buf)
563
- # @param [OpaqueTargetMachine] t
564
- # @param [FFI::Pointer(ModuleRef)] m
565
- # @param [Symbol from _enum_code_gen_file_type_] codegen
566
- # @param [FFI::Pointer(**CharS)] error_message
567
- # @param [FFI::Pointer(*MemoryBufferRef)] out_mem_buf
568
- # @return [Integer]
602
+ # @param [OpaqueTargetMachine] t
603
+ # @param [FFI::Pointer(ModuleRef)] m
604
+ # @param [Symbol from _enum_code_gen_file_type_] codegen
605
+ # @param [FFI::Pointer(**CharS)] error_message
606
+ # @param [FFI::Pointer(*MemoryBufferRef)] out_mem_buf
607
+ # @return [Integer]
569
608
  # @scope class
570
609
  attach_function :target_machine_emit_to_memory_buffer, :LLVMTargetMachineEmitToMemoryBuffer, [OpaqueTargetMachine, :pointer, :code_gen_file_type, :pointer, :pointer], :int
571
-
610
+
611
+ # Get a triple for the host machine as a string. The result needs to be
612
+ # disposed with LLVMDisposeMessage.
613
+ #
614
+ # @method get_default_target_triple()
615
+ # @return [String]
616
+ # @scope class
617
+ attach_function :get_default_target_triple, :LLVMGetDefaultTargetTriple, [], :string
618
+
619
+ # Adds the target-specific analysis passes to the pass manager.
620
+ #
621
+ # @method add_analysis_passes(t, pm)
622
+ # @param [OpaqueTargetMachine] t
623
+ # @param [FFI::Pointer(PassManagerRef)] pm
624
+ # @return [nil]
625
+ # @scope class
626
+ attach_function :add_analysis_passes, :LLVMAddAnalysisPasses, [OpaqueTargetMachine, :pointer], :void
627
+
572
628
  end