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