ruby-llvm 3.0.0.beta → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,8 +1,8 @@
1
1
  = LLVM
2
2
 
3
3
  Author:: Jeremy Voorhis
4
- Contributors:: Evan Phoenix, David Holroyd, Takanori Ishikawa, Ronaldo M. Ferraz, Mac Malone, Chris Wailes, Ary Borenszweig
5
- Copyright:: Copyright (c) 2010-2011 Jeremy Voorhis
4
+ Contributors:: Evan Phoenix, David Holroyd, Takanori Ishikawa, Ronaldo M. Ferraz, Mac Malone, Chris Wailes, Ary Borenszweig, Richard Musiol
5
+ Copyright:: Copyright (c) 2010-2012 Jeremy Voorhis
6
6
  License:: BSD 3-clause (see LICENSE)
7
7
 
8
8
  This package contains Ruby bindings to the LLVM api, enabling users to
@@ -10,7 +10,7 @@ make use of LLVM's optimization passes and JIT compilation for
10
10
  implementing compiled DSLs, callback functions, or fast Ruby method
11
11
  implementations.
12
12
 
13
- ruby-llvm has been tested on Mac OS X 10.6 using the following Ruby interpreters:
13
+ ruby-llvm has been tested on OS X 10.7 using the following Ruby interpreters:
14
14
 
15
15
  * MRI 1.8.7-p174
16
16
  * MRI 1.9.2-p290
@@ -23,6 +23,9 @@ If using MRI, ffi >= 1.0.7 is recommended (only ffi >= 1.0.0 is required).
23
23
  * LLVM 3.0, including libLLVM-3.0 (compile LLVM with --enable-shared).
24
24
  * In order to ensure the usability of JIT features (i.e. create_jit_compiler), compile LLVM with --enable-jit as well.
25
25
 
26
+ == Homebrew
27
+ LLVM can be installed with Homebrew by executing `brew install llvm --shared`
28
+
26
29
  == About version numbers
27
30
 
28
31
  The first two digits of ruby-llvm's version number refer to the required
@@ -1,4 +1,5 @@
1
1
  require 'rake/clean'
2
+ require 'rubygems'
2
3
  require 'ffi'
3
4
 
4
5
  CC = "g++"
data/lib/llvm/analysis.rb CHANGED
@@ -1,20 +1,9 @@
1
1
  require 'llvm'
2
2
  require 'llvm/core'
3
3
  require 'llvm/target'
4
+ require 'llvm/analysis_ffi'
4
5
 
5
6
  module LLVM
6
- # @private
7
- module C
8
- enum :verifier_failure_action, [
9
- :abort_process,
10
- :print_message,
11
- :return_status
12
- ]
13
-
14
- attach_function :LLVMVerifyModule, [:pointer, :verifier_failure_action, :pointer], :int
15
- attach_function :LLVMVerifyFunction, [:pointer, :verifier_failure_action], :int
16
- end
17
-
18
7
  class Module
19
8
  # Verify that the module is valid.
20
9
  # @return [nil, String] human-readable description of any invalid
@@ -31,12 +20,13 @@ module LLVM
31
20
 
32
21
  private
33
22
  def do_verification(action)
34
- str = FFI::MemoryPointer.new(FFI.type_size(:pointer))
35
- status = C.LLVMVerifyModule(self, action, str)
36
- case status
37
- when 1 then str.read_string
38
- else nil
23
+ result = nil
24
+ FFI::MemoryPointer.new(FFI.type_size(:pointer)) do |str|
25
+ status = C.verify_module(self, action, str)
26
+ result = str.read_string if status == 1
27
+ C.dispose_message str.read_pointer
39
28
  end
29
+ result
40
30
  end
41
31
  end
42
32
 
@@ -56,7 +46,7 @@ module LLVM
56
46
  private
57
47
 
58
48
  def do_verification(action)
59
- C.LLVMVerifyFunction(self, action) != 0
49
+ C.verify_function(self, action) != 0
60
50
  end
61
51
  end
62
52
  end
@@ -0,0 +1,68 @@
1
+ # Generated by ffi_gen. Please do not change this file by hand.
2
+
3
+ require 'ffi'
4
+
5
+ module LLVM::C
6
+ extend FFI::Library
7
+ ffi_lib 'LLVM-3.0'
8
+
9
+ # (Not documented)
10
+ #
11
+ # === Options:
12
+ # :abort_process ::
13
+ #
14
+ # :print_message ::
15
+ # verifier will print to stderr and abort()
16
+ # :return_status ::
17
+ # verifier will print to stderr and return 1
18
+ #
19
+ # @return [Array<Symbol>]
20
+ def self.verifier_failure_action_enum
21
+ [:abort_process, :print_message, :return_status]
22
+ end
23
+ enum :verifier_failure_action, [
24
+ :abort_process,
25
+ :print_message,
26
+ :return_status
27
+ ]
28
+
29
+ # Verifies that a module is valid, taking the specified action if not.
30
+ # Optionally returns a human-readable description of any invalid constructs.
31
+ # OutMessage must be disposed with LLVMDisposeMessage.
32
+ #
33
+ # @method verify_module(m, action, out_message)
34
+ # @param [FFI::Pointer(ModuleRef)] m
35
+ # @param [Symbol from verifier_failure_action_enum] action
36
+ # @param [FFI::Pointer(**Char_S)] out_message
37
+ # @return [Integer]
38
+ # @scope class
39
+ attach_function :verify_module, :LLVMVerifyModule, [:pointer, :verifier_failure_action, :pointer], :int
40
+
41
+ # Verifies that a single function is valid, taking the specified action. Useful
42
+ # for debugging.
43
+ #
44
+ # @method verify_function(fn, action)
45
+ # @param [FFI::Pointer(ValueRef)] fn
46
+ # @param [Symbol from verifier_failure_action_enum] action
47
+ # @return [Integer]
48
+ # @scope class
49
+ attach_function :verify_function, :LLVMVerifyFunction, [:pointer, :verifier_failure_action], :int
50
+
51
+ # Open up a ghostview window that displays the CFG of the current function.
52
+ # Useful for debugging.
53
+ #
54
+ # @method view_function_cfg(fn)
55
+ # @param [FFI::Pointer(ValueRef)] fn
56
+ # @return [nil]
57
+ # @scope class
58
+ attach_function :view_function_cfg, :LLVMViewFunctionCFG, [:pointer], :void
59
+
60
+ # (Not documented)
61
+ #
62
+ # @method view_function_cfg_only(fn)
63
+ # @param [FFI::Pointer(ValueRef)] fn
64
+ # @return [nil]
65
+ # @scope class
66
+ attach_function :view_function_cfg_only, :LLVMViewFunctionCFGOnly, [:pointer], :void
67
+
68
+ end
data/lib/llvm/core.rb CHANGED
@@ -1,606 +1,10 @@
1
1
  require 'llvm'
2
+ require 'llvm/core_ffi'
2
3
 
3
4
  module LLVM
4
5
  # @private
5
6
  module C
6
- enum :attribute, [
7
- :ext, 1 << 0,
8
- :sext, 1 << 1,
9
- :no_return, 1 << 2,
10
- :in_reg, 1 << 3,
11
- :struct_ret, 1 << 4,
12
- :no_unwind, 1 << 5,
13
- :no_alias, 1 << 6,
14
- :by_val, 1 << 7,
15
- :nest, 1 << 8,
16
- :read_none, 1 << 9,
17
- :read_only, 1 << 10,
18
- :no_inline, 1 << 11,
19
- :always_inline, 1 << 12,
20
- :optimize_for_size, 1 << 13,
21
- :stack_protect, 1 << 14,
22
- :stack_protect_req, 1 << 15,
23
- :alignment, 31 << 16,
24
- :no_capture, 1 << 21,
25
- :no_red_zone, 1 << 22,
26
- :no_implicit_float, 1 << 23,
27
- :naked, 1 << 24,
28
- :inline_hint, 1 << 25,
29
- :stack_alignment, 7 << 26,
30
- :returns_twice, 1 << 29,
31
- :uw_table, 1 << 30,
32
- :non_lazy_bind, 1 << 31
33
- ]
34
-
35
- enum :opcode, [
36
- # Terminator Instructions
37
- :ret, 1,
38
- :br, 2,
39
- :switch, 3,
40
- :indirectbr, 4,
41
- :invoke, 5,
42
- # removed 6 due to API changes
43
- :unreachable, 7,
44
-
45
- # Standard Binary Operators
46
- :add, 8,
47
- :fadd, 9,
48
- :sub, 10,
49
- :fsub, 11,
50
- :mul, 12,
51
- :fmul, 13,
52
- :udiv, 14,
53
- :sdiv, 15,
54
- :fdiv, 16,
55
- :urem, 17,
56
- :srem, 18,
57
- :frem, 19,
58
-
59
- # Logical Operators
60
- :shl, 20,
61
- :lshr, 21,
62
- :ashr, 22,
63
- :and, 23,
64
- :or, 24,
65
- :xor, 25,
66
-
67
- # Memory Operators
68
- :alloca, 26,
69
- :load, 27,
70
- :store, 28,
71
- :getelementptr, 29,
72
-
73
- # Cast Operators
74
- :trunc, 30,
75
- :zext, 31,
76
- :sext, 32,
77
- :fptoui, 33,
78
- :fptosi, 34,
79
- :uitofp, 35,
80
- :sitofp, 36,
81
- :fptrunc, 37,
82
- :fpext, 38,
83
- :ptrtoint, 39,
84
- :inttoptr, 40,
85
- :bitcast, 41,
86
-
87
- # Other Operators
88
- :icmp, 42,
89
- :fcmp, 43,
90
- :phi, 44,
91
- :call, 45,
92
- :select, 46,
93
- :user_op_1, 47,
94
- :user_op_2, 48,
95
- :vaarg, 49,
96
- :extractelement, 50,
97
- :insertelement, 51,
98
- :shufflevector, 52,
99
- :extractvalue, 53,
100
- :insertvalue, 54,
101
-
102
- # Atomic Operators
103
- :fence, 55,
104
- :atomic_cmp_xchg, 56,
105
- :atomic_rmw, 57,
106
-
107
- # Exception Handling Operators
108
- :resume, 58,
109
- :landing_pad, 59,
110
- :unwind, 60
111
- ]
112
-
113
- enum :type_kind, [
114
- :void,
115
- :float,
116
- :double,
117
- :x86_fp80,
118
- :fp128,
119
- :ppc_fp128,
120
- :label,
121
- :integer,
122
- :function,
123
- :struct,
124
- :array,
125
- :pointer,
126
- :vector,
127
- :metadata,
128
- :x86_mmx
129
- ]
130
-
131
- enum :linkage, [
132
- :external,
133
- :available_externally,
134
- :link_once_any,
135
- :link_once_odr,
136
- :weak_any,
137
- :weak_odr,
138
- :appending,
139
- :internal,
140
- :private,
141
- :dll_import,
142
- :dll_export,
143
- :external_weak,
144
- :ghost,
145
- :common,
146
- :linker_private
147
- ]
148
-
149
- enum :visibility, [
150
- :default,
151
- :hidden,
152
- :protected
153
- ]
154
-
155
- enum :call_conv, [
156
- :ccall, 0,
157
- :fastcall, 8,
158
- :coldcall, 9,
159
- :x86_stdcall, 64,
160
- :x86_fastcall, 65
161
- ]
162
-
163
- enum :int_predicate, [
164
- :eq, 32,
165
- :ne, 33,
166
- :ugt, 34,
167
- :uge, 35,
168
- :ult, 36,
169
- :ule, 37,
170
- :sgt, 38,
171
- :sge, 39,
172
- :slt, 40,
173
- :sle, 41
174
- ]
175
-
176
- enum :real_predicate, [
177
- :false,
178
- :oeq,
179
- :ogt,
180
- :oge,
181
- :olt,
182
- :ole,
183
- :one,
184
- :ord,
185
- :uno,
186
- :ueq,
187
- :ugt,
188
- :uge,
189
- :ult,
190
- :ule,
191
- :une,
192
- :true
193
- ]
194
-
195
- enum :landing_pad_clause_type, [
196
- :catch,
197
- :filter
198
- ]
199
-
200
- # Error handling
201
- attach_function :LLVMDisposeMessage, [:pointer], :void
202
-
203
- # Contexts
204
- attach_function :LLVMContextCreate, [], :pointer
205
- attach_function :LLVMGetGlobalContext, [], :pointer
206
- attach_function :LLVMContextDispose, [:pointer], :void
207
-
208
- # Modules
209
- attach_function :LLVMModuleCreateWithName, [:string], :pointer
210
- attach_function :LLVMModuleCreateWithNameInContext, [:string, :pointer], :pointer
211
- attach_function :LLVMDisposeModule, [:pointer], :void
212
- attach_function :LLVMGetDataLayout, [:pointer], :string
213
- attach_function :LLVMSetDataLayout, [:pointer, :string], :void
214
- attach_function :LLVMGetTarget, [:pointer], :string
215
- attach_function :LLVMSetTarget, [:pointer, :string], :void
216
- attach_function :LLVMGetTypeByName, [:pointer, :string], :pointer
217
- attach_function :LLVMDumpModule, [:pointer], :void
218
-
219
- # Types
220
- attach_function :LLVMGetTypeKind, [:pointer], :type_kind
221
- attach_function :LLVMTypeIsSized, [:pointer], :int
222
- attach_function :LLVMGetTypeContext, [:pointer], :pointer
223
-
224
- # Integer types
225
- attach_function :LLVMInt1TypeInContext, [:pointer], :pointer
226
- attach_function :LLVMInt8TypeInContext, [:pointer], :pointer
227
- attach_function :LLVMInt16TypeInContext, [:pointer], :pointer
228
- attach_function :LLVMInt32TypeInContext, [:pointer], :pointer
229
- attach_function :LLVMInt64TypeInContext, [:pointer], :pointer
230
- attach_function :LLVMIntTypeInContext, [:pointer, :uint], :pointer
231
-
232
- attach_function :LLVMInt1Type, [], :pointer
233
- attach_function :LLVMInt8Type, [], :pointer
234
- attach_function :LLVMInt16Type, [], :pointer
235
- attach_function :LLVMInt32Type, [], :pointer
236
- attach_function :LLVMInt64Type, [], :pointer
237
- attach_function :LLVMIntType, [:uint], :pointer
238
- attach_function :LLVMGetIntTypeWidth, [:pointer], :uint
239
-
240
- # Real types
241
- attach_function :LLVMFloatTypeInContext, [:pointer], :pointer
242
- attach_function :LLVMDoubleTypeInContext, [:pointer], :pointer
243
- attach_function :LLVMX86FP80TypeInContext, [:pointer], :pointer
244
- attach_function :LLVMFP128TypeInContext, [:pointer], :pointer
245
- attach_function :LLVMPPCFP128TypeInContext, [:pointer], :pointer
246
-
247
- attach_function :LLVMFloatType, [], :pointer
248
- attach_function :LLVMDoubleType, [], :pointer
249
- attach_function :LLVMX86FP80Type, [], :pointer
250
- attach_function :LLVMFP128Type, [], :pointer
251
- attach_function :LLVMPPCFP128Type, [], :pointer
252
-
253
- # Function types
254
- attach_function :LLVMFunctionType, [:pointer, :pointer, :uint, :int], :pointer
255
- attach_function :LLVMIsFunctionVarArg, [:pointer], :int
256
- attach_function :LLVMGetReturnType, [:pointer], :pointer
257
- attach_function :LLVMCountParamTypes, [:pointer], :uint
258
- attach_function :LLVMGetParamTypes, [:pointer, :pointer], :void
259
-
260
- # Struct types
261
- attach_function :LLVMStructTypeInContext, [:pointer, :pointer, :uint, :int], :pointer
262
- attach_function :LLVMStructType, [:pointer, :uint, :int], :pointer
263
- attach_function :LLVMStructCreateNamed, [:pointer, :string], :pointer
264
- attach_function :LLVMGetStructName, [:pointer], :string
265
- attach_function :LLVMStructSetBody, [:pointer, :pointer, :uint, :int], :void
266
- attach_function :LLVMCountStructElementTypes, [:pointer], :uint
267
- attach_function :LLVMGetStructElementTypes, [:pointer, :pointer], :void
268
- attach_function :LLVMIsPackedStruct, [:pointer], :int
269
- attach_function :LLVMIsOpaqueStruct, [:pointer], :int
270
- attach_function :LLVMGetTypeByName, [:pointer, :string], :pointer
271
-
272
- # Array, pointer and vector types (sequence types)
273
- attach_function :LLVMArrayType, [:pointer, :uint], :pointer
274
- attach_function :LLVMPointerType, [:pointer, :uint], :pointer
275
- attach_function :LLVMVectorType, [:pointer, :uint], :pointer
276
-
277
- attach_function :LLVMGetElementType, [:pointer], :pointer
278
- attach_function :LLVMGetArrayLength, [:pointer], :uint
279
- attach_function :LLVMGetPointerAddressSpace, [:pointer], :uint
280
- attach_function :LLVMGetVectorSize, [:pointer], :uint
281
-
282
- # All other types
283
- attach_function :LLVMVoidTypeInContext, [:pointer], :pointer
284
- attach_function :LLVMLabelTypeInContext, [:pointer], :pointer
285
-
286
- attach_function :LLVMVoidType, [], :pointer
287
- attach_function :LLVMLabelType, [], :pointer
288
-
289
- # All values
290
- attach_function :LLVMTypeOf, [:pointer], :pointer
291
- attach_function :LLVMGetValueName, [:pointer], :string
292
- attach_function :LLVMSetValueName, [:pointer, :string], :void
293
- attach_function :LLVMDumpValue, [:pointer], :void
294
-
295
- # Operations on Users
296
- attach_function :LLVMGetOperand, [:pointer, :int], :pointer
297
- attach_function :LLVMSetOperand, [:pointer, :int, :pointer], :void
298
- attach_function :LLVMGetNumOperands, [:pointer], :int
299
-
300
- # Constants of any type
301
- attach_function :LLVMConstNull, [:pointer], :pointer
302
- attach_function :LLVMConstAllOnes, [:pointer], :pointer
303
- attach_function :LLVMGetUndef, [:pointer], :pointer
304
- attach_function :LLVMIsConstant, [:pointer], :int
305
- attach_function :LLVMIsNull, [:pointer], :int
306
- attach_function :LLVMIsUndef, [:pointer], :int
307
- attach_function :LLVMConstPointerNull, [:pointer], :pointer
308
-
309
- # Scalar constants
310
- attach_function :LLVMConstInt, [:pointer, :ulong_long, :int], :pointer
311
- attach_function :LLVMConstIntOfString, [:pointer, :string, :uint8], :pointer
312
- attach_function :LLVMConstIntOfStringAndSize, [:pointer, :string, :uint, :uint8], :pointer
313
- attach_function :LLVMConstReal, [:pointer, :double], :pointer
314
- attach_function :LLVMConstRealOfString, [:pointer, :string], :pointer
315
- attach_function :LLVMConstRealOfStringAndSize, [:pointer, :string, :uint], :pointer
316
-
317
- # Composite constants
318
- attach_function :LLVMConstStringInContext, [:pointer, :string, :uint, :int], :pointer
319
- attach_function :LLVMConstStructInContext, [:pointer, :pointer, :uint, :int], :pointer
320
-
321
- attach_function :LLVMConstString, [:string, :uint, :int], :pointer
322
- attach_function :LLVMConstArray, [:pointer, :pointer, :uint], :pointer
323
- attach_function :LLVMConstStruct, [:pointer, :uint, :int], :pointer
324
- attach_function :LLVMConstVector, [:pointer, :uint], :pointer
325
-
326
- # Constant expressions
327
- attach_function :LLVMGetConstOpcode, [:pointer], :opcode
328
- attach_function :LLVMAlignOf, [:pointer], :pointer
329
- attach_function :LLVMSizeOf, [:pointer], :pointer
330
- attach_function :LLVMConstNeg, [:pointer], :pointer
331
- attach_function :LLVMConstFNeg, [:pointer], :pointer
332
- attach_function :LLVMConstNot, [:pointer], :pointer
333
- attach_function :LLVMConstAdd, [:pointer, :pointer], :pointer
334
- attach_function :LLVMConstNSWAdd, [:pointer, :pointer], :pointer
335
- attach_function :LLVMConstFAdd, [:pointer, :pointer], :pointer
336
- attach_function :LLVMConstSub, [:pointer, :pointer], :pointer
337
- attach_function :LLVMConstFSub, [:pointer, :pointer], :pointer
338
- attach_function :LLVMConstMul, [:pointer, :pointer], :pointer
339
- attach_function :LLVMConstFMul, [:pointer, :pointer], :pointer
340
- attach_function :LLVMConstUDiv, [:pointer, :pointer], :pointer
341
- attach_function :LLVMConstSDiv, [:pointer, :pointer], :pointer
342
- attach_function :LLVMConstExactSDiv, [:pointer, :pointer], :pointer
343
- attach_function :LLVMConstFDiv, [:pointer, :pointer], :pointer
344
- attach_function :LLVMConstURem, [:pointer, :pointer], :pointer
345
- attach_function :LLVMConstSRem, [:pointer, :pointer], :pointer
346
- attach_function :LLVMConstFRem, [:pointer, :pointer], :pointer
347
- attach_function :LLVMConstAnd, [:pointer, :pointer], :pointer
348
- attach_function :LLVMConstOr, [:pointer, :pointer], :pointer
349
- attach_function :LLVMConstXor, [:pointer, :pointer], :pointer
350
- attach_function :LLVMConstICmp, [:int, :pointer, :pointer], :pointer
351
- attach_function :LLVMConstFCmp, [:int, :pointer, :pointer], :pointer
352
- attach_function :LLVMConstShl, [:pointer, :pointer], :pointer
353
- attach_function :LLVMConstLShr, [:pointer, :pointer], :pointer
354
- attach_function :LLVMConstAShr, [:pointer, :pointer], :pointer
355
- attach_function :LLVMConstGEP, [:pointer, :pointer, :uint], :pointer
356
- attach_function :LLVMConstInBoundsGEP, [:pointer, :pointer, :uint], :pointer
357
- attach_function :LLVMConstTrunc, [:pointer, :pointer], :pointer
358
- attach_function :LLVMConstSExt, [:pointer, :pointer], :pointer
359
- attach_function :LLVMConstZExt, [:pointer, :pointer], :pointer
360
- attach_function :LLVMConstFPTrunc, [:pointer, :pointer], :pointer
361
- attach_function :LLVMConstFPExt, [:pointer, :pointer], :pointer
362
- attach_function :LLVMConstUIToFP, [:pointer, :pointer], :pointer
363
- attach_function :LLVMConstSIToFP, [:pointer, :pointer], :pointer
364
- attach_function :LLVMConstFPToUI, [:pointer, :pointer], :pointer
365
- attach_function :LLVMConstFPToSI, [:pointer, :pointer], :pointer
366
- attach_function :LLVMConstPtrToInt, [:pointer, :pointer], :pointer
367
- attach_function :LLVMConstIntToPtr, [:pointer, :pointer], :pointer
368
- attach_function :LLVMConstBitCast, [:pointer, :pointer], :pointer
369
- attach_function :LLVMConstZExtOrBitCast, [:pointer, :pointer], :pointer
370
- attach_function :LLVMConstSExtOrBitCast, [:pointer, :pointer], :pointer
371
- attach_function :LLVMConstTruncOrBitCast, [:pointer, :pointer], :pointer
372
- attach_function :LLVMConstPointerCast, [:pointer, :pointer], :pointer
373
- attach_function :LLVMConstIntCast, [:pointer, :pointer, :uint], :pointer
374
- attach_function :LLVMConstFPCast, [:pointer, :pointer], :pointer
375
- attach_function :LLVMConstSelect, [:pointer, :pointer, :pointer], :pointer
376
- attach_function :LLVMConstExtractElement, [:pointer, :pointer], :pointer
377
- attach_function :LLVMConstInsertElement, [:pointer, :pointer], :pointer
378
- attach_function :LLVMConstShuffleVector, [:pointer, :pointer, :pointer], :pointer
379
- attach_function :LLVMConstExtractValue, [:pointer, :pointer, :uint], :pointer
380
- attach_function :LLVMConstInsertValue, [:pointer, :pointer, :pointer, :uint], :pointer
381
- attach_function :LLVMConstInlineAsm, [:pointer, :string, :string, :int], :pointer
382
-
383
- # Global variables, functions and aliases (globals)
384
- attach_function :LLVMGetGlobalParent, [:pointer], :pointer
385
- attach_function :LLVMIsDeclaration, [:pointer], :int
386
- attach_function :LLVMGetLinkage, [:pointer], :linkage
387
- attach_function :LLVMSetLinkage, [:pointer, :linkage], :void
388
- attach_function :LLVMGetSection, [:pointer], :string
389
- attach_function :LLVMSetSection, [:pointer, :string], :void
390
- attach_function :LLVMGetVisibility, [:pointer], :visibility
391
- attach_function :LLVMSetVisibility, [:pointer, :visibility], :void
392
- attach_function :LLVMGetAlignment, [:pointer], :uint
393
- attach_function :LLVMSetAlignment, [:pointer, :uint], :void
394
-
395
- attach_function :LLVMAddGlobal, [:pointer, :pointer, :string], :pointer
396
- attach_function :LLVMGetNamedGlobal, [:pointer, :string], :pointer
397
- attach_function :LLVMGetFirstGlobal, [:pointer], :pointer
398
- attach_function :LLVMGetLastGlobal, [:pointer], :pointer
399
- attach_function :LLVMGetNextGlobal, [:pointer], :pointer
400
- attach_function :LLVMGetPreviousGlobal, [:pointer], :pointer
401
- attach_function :LLVMDeleteGlobal, [:pointer], :void
402
- attach_function :LLVMGetInitializer, [:pointer], :pointer
403
- attach_function :LLVMSetInitializer, [:pointer, :pointer], :void
404
- attach_function :LLVMIsThreadLocal, [:pointer], :bool
405
- attach_function :LLVMSetThreadLocal, [:pointer, :int], :void
406
- attach_function :LLVMIsGlobalConstant, [:pointer], :bool
407
- attach_function :LLVMSetGlobalConstant, [:pointer, :bool], :void
408
-
409
- # Aliases
410
- attach_function :LLVMAddAlias, [:pointer, :pointer, :pointer, :string], :pointer
411
-
412
- # Function operations
413
- attach_function :LLVMAddFunction, [:pointer, :string, :pointer], :pointer
414
- attach_function :LLVMGetNamedFunction, [:pointer, :string], :pointer
415
- attach_function :LLVMGetFirstFunction, [:pointer], :pointer
416
- attach_function :LLVMGetLastFunction, [:pointer], :pointer
417
- attach_function :LLVMGetNextFunction, [:pointer], :pointer
418
- attach_function :LLVMGetPreviousFunction, [:pointer], :pointer
419
- attach_function :LLVMDeleteFunction, [:pointer], :void
420
- attach_function :LLVMGetIntrinsicID, [:pointer], :uint
421
- attach_function :LLVMGetFunctionCallConv, [:pointer], :call_conv
422
- attach_function :LLVMSetFunctionCallConv, [:pointer, :call_conv], :void
423
- attach_function :LLVMGetGC, [:pointer], :string
424
- attach_function :LLVMSetGC, [:pointer, :string], :void
425
- attach_function :LLVMAddFunctionAttr, [:pointer, :attribute], :void
426
- attach_function :LLVMRemoveFunctionAttr, [:pointer, :attribute], :void
427
-
428
- # Parameters
429
- attach_function :LLVMCountParams, [:pointer], :uint
430
- attach_function :LLVMGetParams, [:pointer, :pointer], :void
431
- attach_function :LLVMGetParam, [:pointer, :uint], :pointer
432
- attach_function :LLVMGetParamParent, [:pointer], :pointer
433
- attach_function :LLVMGetFirstParam, [:pointer], :pointer
434
- attach_function :LLVMGetLastParam, [:pointer], :pointer
435
- attach_function :LLVMGetNextParam, [:pointer], :pointer
436
- attach_function :LLVMGetPreviousParam, [:pointer], :pointer
437
- attach_function :LLVMAddAttribute, [:pointer, :attribute], :void
438
- attach_function :LLVMRemoveAttribute, [:pointer, :attribute], :void
439
- attach_function :LLVMSetParamAlignment, [:pointer, :uint], :void
440
-
441
- # Basic blocks
442
- attach_function :LLVMBasicBlockAsValue, [:pointer], :pointer
443
- attach_function :LLVMValueIsBasicBlock, [:pointer], :int
444
- attach_function :LLVMValueAsBasicBlock, [:pointer], :pointer
445
- attach_function :LLVMGetBasicBlockParent, [:pointer], :pointer
446
- attach_function :LLVMCountBasicBlocks, [:pointer], :uint
447
- attach_function :LLVMGetBasicBlocks, [:pointer, :pointer], :void
448
- attach_function :LLVMGetFirstBasicBlock, [:pointer], :pointer
449
- attach_function :LLVMGetLastBasicBlock, [:pointer], :pointer
450
- attach_function :LLVMGetNextBasicBlock, [:pointer], :pointer
451
- attach_function :LLVMGetPreviousBasicBlock, [:pointer], :pointer
452
- attach_function :LLVMGetEntryBasicBlock, [:pointer], :pointer
453
-
454
- attach_function :LLVMAppendBasicBlockInContext, [:pointer, :pointer, :string], :pointer
455
- attach_function :LLVMInsertBasicBlockInContext, [:pointer, :pointer, :string], :pointer
456
-
457
- attach_function :LLVMAppendBasicBlock, [:pointer, :string], :pointer
458
- attach_function :LLVMDeleteBasicBlock, [:pointer], :void
459
-
460
- # Instructions
461
- attach_function :LLVMGetInstructionParent, [:pointer], :pointer
462
- attach_function :LLVMGetFirstInstruction, [:pointer], :pointer
463
- attach_function :LLVMGetLastInstruction, [:pointer], :pointer
464
- attach_function :LLVMGetNextInstruction, [:pointer], :pointer
465
- attach_function :LLVMGetPreviousInstruction, [:pointer], :pointer
466
-
467
- # Call sites
468
- attach_function :LLVMSetInstructionCallConv, [:pointer, :call_conv], :void
469
- attach_function :LLVMGetInstructionCallConv, [:pointer], :call_conv
470
- attach_function :LLVMAddInstrAttribute, [:pointer, :uint, :attribute], :void
471
- attach_function :LLVMRemoveInstrAttribute, [:pointer, :uint, :attribute], :void
472
- attach_function :LLVMSetInstrParamAlignment, [:pointer, :uint, :uint], :void
473
-
474
- # Call instructions
475
- attach_function :LLVMIsTailCall, [:pointer], :int
476
- attach_function :LLVMSetTailCall, [:pointer, :int], :void
477
-
478
- # Phi nodes
479
- attach_function :LLVMAddIncoming, [:pointer, :pointer, :pointer, :uint], :void
480
- attach_function :LLVMCountIncoming, [:pointer], :uint
481
- attach_function :LLVMGetIncomingValue, [:pointer, :uint], :pointer
482
- attach_function :LLVMGetIncomingBlock, [:pointer, :uint], :pointer
483
-
484
- # Instruction builders
485
- attach_function :LLVMCreateBuilderInContext, [:pointer], :pointer
486
- attach_function :LLVMCreateBuilder, [], :pointer
487
- attach_function :LLVMPositionBuilder, [:pointer, :pointer, :pointer], :void
488
- attach_function :LLVMPositionBuilderBefore, [:pointer, :pointer], :void
489
- attach_function :LLVMPositionBuilderAtEnd, [:pointer, :pointer], :void
490
- attach_function :LLVMGetInsertBlock, [:pointer], :pointer
491
- attach_function :LLVMClearInsertionPosition, [:pointer], :void
492
- attach_function :LLVMInsertIntoBuilder, [:pointer, :pointer], :void
493
- attach_function :LLVMInsertIntoBuilderWithName, [:pointer, :pointer, :string], :void
494
- attach_function :LLVMDisposeBuilder, [:pointer], :void
495
-
496
- # Terminators
497
- attach_function :LLVMBuildRetVoid, [:pointer], :pointer
498
- attach_function :LLVMBuildRet, [:pointer, :pointer], :pointer
499
- attach_function :LLVMBuildAggregateRet, [:pointer, :pointer, :uint], :pointer
500
- attach_function :LLVMBuildBr, [:pointer, :pointer], :pointer
501
- attach_function :LLVMBuildCondBr, [:pointer, :pointer, :pointer, :pointer], :pointer
502
- attach_function :LLVMBuildSwitch, [:pointer, :pointer, :pointer, :uint], :pointer
503
- attach_function :LLVMBuildInvoke, [:pointer, :pointer, :pointer, :uint, :pointer, :pointer, :string], :pointer
504
- attach_function :LLVMBuildUnreachable, [:pointer], :pointer
505
-
506
- # Switch instruction
507
- attach_function :LLVMAddCase, [:pointer, :pointer, :pointer], :void
508
-
509
- # Arithmetic
510
- attach_function :LLVMBuildAdd, [:pointer, :pointer, :pointer, :string], :pointer
511
- attach_function :LLVMBuildNSWAdd, [:pointer, :pointer, :pointer, :string], :pointer
512
- attach_function :LLVMBuildFAdd, [:pointer, :pointer, :pointer, :string], :pointer
513
- attach_function :LLVMBuildSub, [:pointer, :pointer, :pointer, :string], :pointer
514
- attach_function :LLVMBuildFSub, [:pointer, :pointer, :pointer, :string], :pointer
515
- attach_function :LLVMBuildMul, [:pointer, :pointer, :pointer, :string], :pointer
516
- attach_function :LLVMBuildFMul, [:pointer, :pointer, :pointer, :string], :pointer
517
- attach_function :LLVMBuildUDiv, [:pointer, :pointer, :pointer, :string], :pointer
518
- attach_function :LLVMBuildSDiv, [:pointer, :pointer, :pointer, :string], :pointer
519
- attach_function :LLVMBuildExactSDiv, [:pointer, :pointer, :pointer, :string], :pointer
520
- attach_function :LLVMBuildFDiv, [:pointer, :pointer, :pointer, :string], :pointer
521
- attach_function :LLVMBuildURem, [:pointer, :pointer, :pointer, :string], :pointer
522
- attach_function :LLVMBuildSRem, [:pointer, :pointer, :pointer, :string], :pointer
523
- attach_function :LLVMBuildFRem, [:pointer, :pointer, :pointer, :string], :pointer
524
- attach_function :LLVMBuildShl, [:pointer, :pointer, :pointer, :string], :pointer
525
- attach_function :LLVMBuildLShr, [:pointer, :pointer, :pointer, :string], :pointer
526
- attach_function :LLVMBuildAShr, [:pointer, :pointer, :pointer, :string], :pointer
527
- attach_function :LLVMBuildAnd, [:pointer, :pointer, :pointer, :string], :pointer
528
- attach_function :LLVMBuildOr, [:pointer, :pointer, :pointer, :string], :pointer
529
- attach_function :LLVMBuildXor, [:pointer, :pointer, :pointer, :string], :pointer
530
- attach_function :LLVMBuildNeg, [:pointer, :pointer, :string], :pointer
531
- attach_function :LLVMBuildNot, [:pointer, :pointer, :string], :pointer
532
-
533
- # Memory
534
- attach_function :LLVMBuildMalloc, [:pointer, :pointer, :string], :pointer
535
- attach_function :LLVMBuildArrayMalloc, [:pointer, :pointer, :pointer, :string], :string
536
- attach_function :LLVMBuildAlloca, [:pointer, :pointer, :string], :pointer
537
- attach_function :LLVMBuildArrayAlloca, [:pointer, :pointer, :pointer, :string], :pointer
538
- attach_function :LLVMBuildFree, [:pointer, :pointer], :pointer
539
- attach_function :LLVMBuildLoad, [:pointer, :pointer, :string], :pointer
540
- attach_function :LLVMBuildStore, [:pointer, :pointer, :pointer], :pointer
541
- attach_function :LLVMBuildGEP, [:pointer, :pointer, :pointer, :uint, :string], :pointer
542
- attach_function :LLVMBuildInBoundsGEP, [:pointer, :pointer, :pointer, :uint, :string], :pointer
543
- attach_function :LLVMBuildStructGEP, [:pointer, :pointer, :uint, :string], :pointer
544
- attach_function :LLVMBuildGlobalString, [:pointer, :string, :string], :pointer
545
- attach_function :LLVMBuildGlobalStringPtr, [:pointer, :string, :string], :pointer
546
-
547
- # Casts
548
- attach_function :LLVMBuildTrunc, [:pointer, :pointer, :pointer, :string], :pointer
549
- attach_function :LLVMBuildZExt, [:pointer, :pointer, :pointer, :string], :pointer
550
- attach_function :LLVMBuildSExt, [:pointer, :pointer, :pointer, :string], :pointer
551
- attach_function :LLVMBuildFPToUI, [:pointer, :pointer, :pointer, :string], :pointer
552
- attach_function :LLVMBuildFPToSI, [:pointer, :pointer, :pointer, :string], :pointer
553
- attach_function :LLVMBuildUIToFP, [:pointer, :pointer, :pointer, :string], :pointer
554
- attach_function :LLVMBuildSIToFP, [:pointer, :pointer, :pointer, :string], :pointer
555
- attach_function :LLVMBuildFPTrunc, [:pointer, :pointer, :pointer, :string], :pointer
556
- attach_function :LLVMBuildFPExt, [:pointer, :pointer, :pointer, :string], :pointer
557
- attach_function :LLVMBuildPtrToInt, [:pointer, :pointer, :pointer, :string], :pointer
558
- attach_function :LLVMBuildIntToPtr, [:pointer, :pointer, :pointer, :string], :pointer
559
- attach_function :LLVMBuildBitCast, [:pointer, :pointer, :pointer, :string], :pointer
560
- attach_function :LLVMBuildZExtOrBitCast, [:pointer, :pointer, :pointer, :string], :pointer
561
- attach_function :LLVMBuildSExtOrBitCast, [:pointer, :pointer, :pointer, :string], :pointer
562
- attach_function :LLVMBuildTruncOrBitCast, [:pointer, :pointer, :pointer, :string], :pointer
563
- attach_function :LLVMBuildPointerCast, [:pointer, :pointer, :pointer, :string], :pointer
564
- attach_function :LLVMBuildIntCast, [:pointer, :pointer, :pointer, :string], :pointer
565
- attach_function :LLVMBuildFPCast, [:pointer, :pointer, :pointer, :string], :pointer
566
-
567
- # Comparisons
568
- attach_function :LLVMBuildICmp, [:pointer, :int_predicate, :pointer, :pointer, :string], :pointer
569
- attach_function :LLVMBuildFCmp, [:pointer, :real_predicate, :pointer, :pointer, :string], :pointer
570
-
571
- # Misc
572
- attach_function :LLVMBuildPhi, [:pointer, :pointer, :string], :pointer
573
- attach_function :LLVMBuildCall, [:pointer, :pointer, :pointer, :uint, :string], :pointer
574
- attach_function :LLVMBuildSelect, [:pointer, :pointer, :pointer, :pointer, :string], :pointer
575
- attach_function :LLVMBuildVAArg, [:pointer, :pointer, :pointer, :string], :pointer
576
- attach_function :LLVMBuildExtractElement, [:pointer, :pointer, :pointer, :string], :pointer
577
- attach_function :LLVMBuildInsertElement, [:pointer, :pointer, :pointer, :pointer, :string], :pointer
578
- attach_function :LLVMBuildShuffleVector, [:pointer, :pointer, :pointer, :pointer, :string], :pointer
579
- attach_function :LLVMBuildExtractValue, [:pointer, :pointer, :uint, :string], :pointer
580
- attach_function :LLVMBuildInsertValue, [:pointer, :pointer, :pointer, :uint, :string], :pointer
581
-
582
- attach_function :LLVMBuildIsNull, [:pointer, :pointer, :string], :pointer
583
- attach_function :LLVMBuildIsNotNull, [:pointer, :pointer, :string], :pointer
584
- attach_function :LLVMBuildPtrDiff, [:pointer, :pointer, :pointer, :string], :pointer
585
-
586
- # Module providers
587
- attach_function :LLVMCreateModuleProviderForExistingModule, [:pointer], :pointer
588
- attach_function :LLVMDisposeModuleProvider, [:pointer], :void
589
-
590
- # Memory buffers
591
- attach_function :LLVMCreateMemoryBufferWithContentsOfFile, [:string, :pointer, :pointer], :int
592
- attach_function :LLVMCreateMemoryBufferWithSTDIN, [:pointer, :pointer], :int
593
- attach_function :LLVMDisposeMemoryBuffer, [:pointer], :void
594
-
595
- # Pass managers
596
- attach_function :LLVMCreatePassManager, [], :pointer
597
- attach_function :LLVMCreateFunctionPassManager, [:pointer], :pointer
598
- attach_function :LLVMCreateFunctionPassManagerForModule, [:pointer], :pointer
599
- attach_function :LLVMRunPassManager, [:pointer, :pointer], :int
600
- attach_function :LLVMInitializeFunctionPassManager, [:pointer], :int
601
- attach_function :LLVMRunFunctionPassManager, [:pointer, :pointer], :int
602
- attach_function :LLVMFinalizeFunctionPassManager, [:pointer], :int
603
- attach_function :LLVMDisposePassManager, [:pointer], :void
7
+ attach_function :dispose_message, :LLVMDisposeMessage, [:pointer], :void
604
8
  end
605
9
 
606
10
  require 'llvm/core/context'