waj-ruby-llvm 2.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/README.rdoc +31 -0
  2. data/ext/ruby-llvm-support/Makefile.am +1 -0
  3. data/ext/ruby-llvm-support/Makefile.in +612 -0
  4. data/ext/ruby-llvm-support/config.guess +1500 -0
  5. data/ext/ruby-llvm-support/config.sub +1616 -0
  6. data/ext/ruby-llvm-support/configure +17190 -0
  7. data/ext/ruby-llvm-support/configure.ac +16 -0
  8. data/ext/ruby-llvm-support/depcomp +584 -0
  9. data/ext/ruby-llvm-support/install-sh +507 -0
  10. data/ext/ruby-llvm-support/libtool +9403 -0
  11. data/ext/ruby-llvm-support/ltmain.sh +8745 -0
  12. data/ext/ruby-llvm-support/missing +367 -0
  13. data/ext/ruby-llvm-support/src/Makefile.am +5 -0
  14. data/ext/ruby-llvm-support/src/Makefile.in +472 -0
  15. data/ext/ruby-llvm-support/src/support.cpp +12 -0
  16. data/lib/llvm.rb +12 -0
  17. data/lib/llvm/analysis.rb +62 -0
  18. data/lib/llvm/core.rb +598 -0
  19. data/lib/llvm/core/bitcode.rb +88 -0
  20. data/lib/llvm/core/builder.rb +851 -0
  21. data/lib/llvm/core/context.rb +22 -0
  22. data/lib/llvm/core/module.rb +232 -0
  23. data/lib/llvm/core/pass_manager.rb +76 -0
  24. data/lib/llvm/core/type.rb +173 -0
  25. data/lib/llvm/core/value.rb +782 -0
  26. data/lib/llvm/execution_engine.rb +169 -0
  27. data/lib/llvm/support.rb +22 -0
  28. data/lib/llvm/target.rb +9 -0
  29. data/lib/llvm/transforms/ipo.rb +23 -0
  30. data/lib/llvm/transforms/scalar.rb +136 -0
  31. data/test/array_test.rb +38 -0
  32. data/test/basic_block_test.rb +88 -0
  33. data/test/basic_test.rb +11 -0
  34. data/test/binary_operations_test.rb +58 -0
  35. data/test/bitcode_test.rb +25 -0
  36. data/test/branch_test.rb +57 -0
  37. data/test/call_test.rb +82 -0
  38. data/test/comparisons_test.rb +66 -0
  39. data/test/conversions_test.rb +86 -0
  40. data/test/double_test.rb +33 -0
  41. data/test/equality_test.rb +91 -0
  42. data/test/generic_value_test.rb +22 -0
  43. data/test/instruction_test.rb +32 -0
  44. data/test/ipo_test.rb +53 -0
  45. data/test/memory_access_test.rb +38 -0
  46. data/test/module_test.rb +21 -0
  47. data/test/parameter_collection_test.rb +28 -0
  48. data/test/phi_test.rb +33 -0
  49. data/test/select_test.rb +22 -0
  50. data/test/struct_test.rb +75 -0
  51. data/test/test_helper.rb +50 -0
  52. data/test/type_test.rb +15 -0
  53. data/test/vector_test.rb +64 -0
  54. metadata +133 -0
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Extended bindings for LLVM.
3
+ */
4
+
5
+ #include <llvm/Support/DynamicLibrary.h>
6
+
7
+ extern "C" {
8
+ int LLVMLoadLibraryPermanently(const char* filename) {
9
+ return llvm::sys::DynamicLibrary::LoadLibraryPermanently(filename);
10
+ }
11
+ }
12
+
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'ffi'
3
+
4
+ require 'llvm/support'
5
+
6
+ module LLVM
7
+ # @private
8
+ module C
9
+ extend ::FFI::Library
10
+ ffi_lib ['LLVM-2.9']
11
+ end
12
+ end
@@ -0,0 +1,62 @@
1
+ require 'llvm'
2
+ require 'llvm/core'
3
+ require 'llvm/target'
4
+
5
+ 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
+ class Module
19
+ # Verify that the module is valid.
20
+ # @return [nil, String] human-readable description of any invalid
21
+ # constructs if invalid.
22
+ def verify
23
+ do_verification(:return_status)
24
+ end
25
+
26
+ # Verify that a module is valid, and abort the process if not.
27
+ # @return [nil]
28
+ def verify!
29
+ do_verification(:abort_process)
30
+ end
31
+
32
+ private
33
+ 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
39
+ end
40
+ end
41
+ end
42
+
43
+ class Function
44
+ # Verify that a function is valid.
45
+ # @return [true, false]
46
+ def verify
47
+ do_verification(:return_status)
48
+ end
49
+
50
+ # Verify that a function is valid, and abort the process if not.
51
+ # @return [true, false]
52
+ def verify!
53
+ do_verification(:abort_process)
54
+ end
55
+
56
+ private
57
+
58
+ def do_verification(action)
59
+ C.LLVMVerifyFunction(self, action) != 0
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,598 @@
1
+ require 'llvm'
2
+
3
+ module LLVM
4
+ # @private
5
+ 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
+ :no_capture, 1 << 21,
24
+ :no_red_zone, 1 << 22,
25
+ :no_implicit_float, 1 << 23,
26
+ :naked, 1 << 24
27
+ ]
28
+
29
+ enum :opcode, [
30
+ # Terminator Instructions
31
+ :ret, 1,
32
+ :br, 2,
33
+ :switch, 3,
34
+ :indirectbr, 4,
35
+ :invoke, 5,
36
+ :unwind, 6,
37
+ :unreachable, 7,
38
+
39
+ # Standard Binary Operators
40
+ :add, 8,
41
+ :fadd, 9,
42
+ :sub, 10,
43
+ :fsub, 11,
44
+ :mul, 12,
45
+ :fmul, 13,
46
+ :udiv, 14,
47
+ :sdiv, 15,
48
+ :fdiv, 16,
49
+ :urem, 17,
50
+ :srem, 18,
51
+ :frem, 19,
52
+
53
+ # Logical Operators
54
+ :shl, 20,
55
+ :lshr, 21,
56
+ :ashr, 22,
57
+ :and, 23,
58
+ :or, 24,
59
+ :xor, 25,
60
+
61
+ # Memory Operators
62
+ :alloca, 26,
63
+ :load, 27,
64
+ :store, 28,
65
+ :getelementptr, 29,
66
+
67
+ # Cast Operators
68
+ :trunc, 30,
69
+ :zext, 31,
70
+ :sext, 32,
71
+ :fptoui, 33,
72
+ :fptosi, 34,
73
+ :uitofp, 35,
74
+ :sitofp, 36,
75
+ :fptrunc, 37,
76
+ :fpext, 38,
77
+ :ptrtoint, 39,
78
+ :inttoptr, 40,
79
+ :bitcast, 41,
80
+
81
+ # Other Operators
82
+ :icmp, 42,
83
+ :fcmp, 43,
84
+ :phi, 44,
85
+ :call, 45,
86
+ :select, 46,
87
+
88
+ # UserOp1
89
+ # UserOp2
90
+ :vaarg, 49,
91
+ :extractelement, 50,
92
+ :insertelement, 51,
93
+ :shufflevector, 52,
94
+ :extractvalue, 53,
95
+ :insertvalue, 54,
96
+ ]
97
+
98
+ enum :type_kind, [
99
+ :void,
100
+ :float,
101
+ :double,
102
+ :x86_fp80,
103
+ :fp128,
104
+ :ppc_fp128,
105
+ :label,
106
+ :integer,
107
+ :function,
108
+ :struct,
109
+ :array,
110
+ :pointer,
111
+ :opaque,
112
+ :vector,
113
+ :metadata
114
+ ]
115
+
116
+ enum :linkage, [
117
+ :external,
118
+ :available_externally,
119
+ :link_once_any,
120
+ :link_once_odr,
121
+ :weak_any,
122
+ :weak_odr,
123
+ :appending,
124
+ :internal,
125
+ :private,
126
+ :dll_import,
127
+ :dll_export,
128
+ :external_weak,
129
+ :ghost,
130
+ :common,
131
+ :linker_private
132
+ ]
133
+
134
+ enum :visibility, [
135
+ :default,
136
+ :hidden,
137
+ :protected
138
+ ]
139
+
140
+ enum :call_conv, [
141
+ :ccall, 0,
142
+ :fastcall, 8,
143
+ :coldcall, 9,
144
+ :x86_stdcall, 64,
145
+ :x86_fastcall, 65
146
+ ]
147
+
148
+ enum :int_predicate, [
149
+ :eq, 32,
150
+ :ne, 33,
151
+ :ugt, 34,
152
+ :uge, 35,
153
+ :ult, 36,
154
+ :ule, 37,
155
+ :sgt, 38,
156
+ :sge, 39,
157
+ :slt, 40,
158
+ :sle, 41
159
+ ]
160
+
161
+ enum :real_predicate, [
162
+ :false,
163
+ :oeq,
164
+ :ogt,
165
+ :oge,
166
+ :olt,
167
+ :ole,
168
+ :one,
169
+ :ord,
170
+ :uno,
171
+ :ueq,
172
+ :ugt,
173
+ :uge,
174
+ :ult,
175
+ :ule,
176
+ :une,
177
+ :true
178
+ ]
179
+
180
+ # Error handling
181
+ attach_function :LLVMDisposeMessage, [:pointer], :void
182
+
183
+ # Contexts
184
+ attach_function :LLVMContextCreate, [], :pointer
185
+ attach_function :LLVMGetGlobalContext, [], :pointer
186
+ attach_function :LLVMContextDispose, [:pointer], :void
187
+
188
+ # Modules
189
+ attach_function :LLVMModuleCreateWithName, [:string], :pointer
190
+ attach_function :LLVMModuleCreateWithNameInContext, [:string, :pointer], :pointer
191
+ attach_function :LLVMDisposeModule, [:pointer], :void
192
+ attach_function :LLVMGetDataLayout, [:pointer], :string
193
+ attach_function :LLVMSetDataLayout, [:pointer, :string], :void
194
+ attach_function :LLVMGetTarget, [:pointer], :string
195
+ attach_function :LLVMSetTarget, [:pointer, :string], :void
196
+ attach_function :LLVMAddTypeName, [:pointer, :string, :pointer], :int
197
+ attach_function :LLVMDeleteTypeName, [:pointer, :string], :void
198
+ attach_function :LLVMGetTypeByName, [:pointer, :string], :pointer
199
+ attach_function :LLVMDumpModule, [:pointer], :void
200
+
201
+ # Types
202
+ attach_function :LLVMGetTypeKind, [:pointer], :type_kind
203
+ attach_function :LLVMGetTypeContext, [:pointer], :pointer
204
+
205
+ # Integer types
206
+ attach_function :LLVMInt1TypeInContext, [:pointer], :pointer
207
+ attach_function :LLVMInt8TypeInContext, [:pointer], :pointer
208
+ attach_function :LLVMInt16TypeInContext, [:pointer], :pointer
209
+ attach_function :LLVMInt32TypeInContext, [:pointer], :pointer
210
+ attach_function :LLVMInt64TypeInContext, [:pointer], :pointer
211
+ attach_function :LLVMIntTypeInContext, [:pointer, :uint], :pointer
212
+
213
+ attach_function :LLVMInt1Type, [], :pointer
214
+ attach_function :LLVMInt8Type, [], :pointer
215
+ attach_function :LLVMInt16Type, [], :pointer
216
+ attach_function :LLVMInt32Type, [], :pointer
217
+ attach_function :LLVMInt64Type, [], :pointer
218
+ attach_function :LLVMIntType, [:uint], :pointer
219
+ attach_function :LLVMGetIntTypeWidth, [:pointer], :uint
220
+
221
+ # Real types
222
+ attach_function :LLVMFloatTypeInContext, [:pointer], :pointer
223
+ attach_function :LLVMDoubleTypeInContext, [:pointer], :pointer
224
+ attach_function :LLVMX86FP80TypeInContext, [:pointer], :pointer
225
+ attach_function :LLVMFP128TypeInContext, [:pointer], :pointer
226
+ attach_function :LLVMPPCFP128TypeInContext, [:pointer], :pointer
227
+
228
+ attach_function :LLVMFloatType, [], :pointer
229
+ attach_function :LLVMDoubleType, [], :pointer
230
+ attach_function :LLVMX86FP80Type, [], :pointer
231
+ attach_function :LLVMFP128Type, [], :pointer
232
+ attach_function :LLVMPPCFP128Type, [], :pointer
233
+
234
+ # Function types
235
+ attach_function :LLVMFunctionType, [:pointer, :pointer, :uint, :int], :pointer
236
+ attach_function :LLVMIsFunctionVarArg, [:pointer], :int
237
+ attach_function :LLVMGetReturnType, [:pointer], :pointer
238
+ attach_function :LLVMCountParamTypes, [:pointer], :uint
239
+ attach_function :LLVMGetParamTypes, [:pointer, :pointer], :void
240
+
241
+ # Struct types
242
+ attach_function :LLVMStructTypeInContext, [:pointer, :pointer, :uint, :int], :pointer
243
+ attach_function :LLVMStructType, [:pointer, :uint, :int], :pointer
244
+ attach_function :LLVMCountStructElementTypes, [:pointer], :uint
245
+ attach_function :LLVMGetStructElementTypes, [:pointer, :pointer], :void
246
+ attach_function :LLVMIsPackedStruct, [:pointer], :int
247
+
248
+ # Array, pointer and vector types (sequence types)
249
+ attach_function :LLVMArrayType, [:pointer, :uint], :pointer
250
+ attach_function :LLVMPointerType, [:pointer, :uint], :pointer
251
+ attach_function :LLVMVectorType, [:pointer, :uint], :pointer
252
+
253
+ attach_function :LLVMGetElementType, [:pointer], :pointer
254
+ attach_function :LLVMGetArrayLength, [:pointer], :uint
255
+ attach_function :LLVMGetPointerAddressSpace, [:pointer], :uint
256
+ attach_function :LLVMGetVectorSize, [:pointer], :uint
257
+
258
+ # All other types
259
+ attach_function :LLVMVoidTypeInContext, [:pointer], :pointer
260
+ attach_function :LLVMLabelTypeInContext, [:pointer], :pointer
261
+ attach_function :LLVMOpaqueTypeInContext, [:pointer], :pointer
262
+
263
+ attach_function :LLVMVoidType, [], :pointer
264
+ attach_function :LLVMLabelType, [], :pointer
265
+ attach_function :LLVMOpaqueType, [], :pointer
266
+
267
+ # Type handles
268
+ attach_function :LLVMCreateTypeHandle, [:pointer], :pointer
269
+ attach_function :LLVMRefineType, [:pointer, :pointer], :void
270
+ attach_function :LLVMResolveTypeHandle, [:pointer], :pointer
271
+ attach_function :LLVMDisposeTypeHandle, [:pointer], :void
272
+
273
+ # All values
274
+ attach_function :LLVMTypeOf, [:pointer], :pointer
275
+ attach_function :LLVMGetValueName, [:pointer], :string
276
+ attach_function :LLVMSetValueName, [:pointer, :string], :void
277
+ attach_function :LLVMDumpValue, [:pointer], :void
278
+
279
+ # Operations on Users
280
+ attach_function :LLVMGetOperand, [:pointer, :int], :pointer
281
+ attach_function :LLVMSetOperand, [:pointer, :int, :pointer], :void
282
+ attach_function :LLVMGetNumOperands, [:pointer], :int
283
+
284
+ # Constants of any type
285
+ attach_function :LLVMConstNull, [:pointer], :pointer
286
+ attach_function :LLVMConstAllOnes, [:pointer], :pointer
287
+ attach_function :LLVMGetUndef, [:pointer], :pointer
288
+ attach_function :LLVMIsConstant, [:pointer], :int
289
+ attach_function :LLVMIsNull, [:pointer], :int
290
+ attach_function :LLVMIsUndef, [:pointer], :int
291
+ attach_function :LLVMConstPointerNull, [:pointer], :pointer
292
+
293
+ # Scalar constants
294
+ attach_function :LLVMConstInt, [:pointer, :ulong_long, :int], :pointer
295
+ attach_function :LLVMConstIntOfString, [:pointer, :string, :uint8], :pointer
296
+ attach_function :LLVMConstIntOfStringAndSize, [:pointer, :string, :uint, :uint8], :pointer
297
+ attach_function :LLVMConstReal, [:pointer, :double], :pointer
298
+ attach_function :LLVMConstRealOfString, [:pointer, :string], :pointer
299
+ attach_function :LLVMConstRealOfStringAndSize, [:pointer, :string, :uint], :pointer
300
+
301
+ # Composite constants
302
+ attach_function :LLVMConstStringInContext, [:pointer, :string, :uint, :int], :pointer
303
+ attach_function :LLVMConstStructInContext, [:pointer, :pointer, :uint, :int], :pointer
304
+
305
+ attach_function :LLVMConstString, [:string, :uint, :int], :pointer
306
+ attach_function :LLVMConstArray, [:pointer, :pointer, :uint], :pointer
307
+ attach_function :LLVMConstStruct, [:pointer, :uint, :int], :pointer
308
+ attach_function :LLVMConstVector, [:pointer, :uint], :pointer
309
+
310
+ # Constant expressions
311
+ attach_function :LLVMGetConstOpcode, [:pointer], :opcode
312
+ attach_function :LLVMAlignOf, [:pointer], :pointer
313
+ attach_function :LLVMSizeOf, [:pointer], :pointer
314
+ attach_function :LLVMConstNeg, [:pointer], :pointer
315
+ attach_function :LLVMConstFNeg, [:pointer], :pointer
316
+ attach_function :LLVMConstNot, [:pointer], :pointer
317
+ attach_function :LLVMConstAdd, [:pointer, :pointer], :pointer
318
+ attach_function :LLVMConstNSWAdd, [:pointer, :pointer], :pointer
319
+ attach_function :LLVMConstFAdd, [:pointer, :pointer], :pointer
320
+ attach_function :LLVMConstSub, [:pointer, :pointer], :pointer
321
+ attach_function :LLVMConstFSub, [:pointer, :pointer], :pointer
322
+ attach_function :LLVMConstMul, [:pointer, :pointer], :pointer
323
+ attach_function :LLVMConstFMul, [:pointer, :pointer], :pointer
324
+ attach_function :LLVMConstUDiv, [:pointer, :pointer], :pointer
325
+ attach_function :LLVMConstSDiv, [:pointer, :pointer], :pointer
326
+ attach_function :LLVMConstExactSDiv, [:pointer, :pointer], :pointer
327
+ attach_function :LLVMConstFDiv, [:pointer, :pointer], :pointer
328
+ attach_function :LLVMConstURem, [:pointer, :pointer], :pointer
329
+ attach_function :LLVMConstSRem, [:pointer, :pointer], :pointer
330
+ attach_function :LLVMConstFRem, [:pointer, :pointer], :pointer
331
+ attach_function :LLVMConstAnd, [:pointer, :pointer], :pointer
332
+ attach_function :LLVMConstOr, [:pointer, :pointer], :pointer
333
+ attach_function :LLVMConstXor, [:pointer, :pointer], :pointer
334
+ attach_function :LLVMConstICmp, [:int, :pointer, :pointer], :pointer
335
+ attach_function :LLVMConstFCmp, [:int, :pointer, :pointer], :pointer
336
+ attach_function :LLVMConstShl, [:pointer, :pointer], :pointer
337
+ attach_function :LLVMConstLShr, [:pointer, :pointer], :pointer
338
+ attach_function :LLVMConstAShr, [:pointer, :pointer], :pointer
339
+ attach_function :LLVMConstGEP, [:pointer, :pointer, :uint], :pointer
340
+ attach_function :LLVMConstInBoundsGEP, [:pointer, :pointer, :uint], :pointer
341
+ attach_function :LLVMConstTrunc, [:pointer, :pointer], :pointer
342
+ attach_function :LLVMConstSExt, [:pointer, :pointer], :pointer
343
+ attach_function :LLVMConstZExt, [:pointer, :pointer], :pointer
344
+ attach_function :LLVMConstFPTrunc, [:pointer, :pointer], :pointer
345
+ attach_function :LLVMConstFPExt, [:pointer, :pointer], :pointer
346
+ attach_function :LLVMConstUIToFP, [:pointer, :pointer], :pointer
347
+ attach_function :LLVMConstSIToFP, [:pointer, :pointer], :pointer
348
+ attach_function :LLVMConstFPToUI, [:pointer, :pointer], :pointer
349
+ attach_function :LLVMConstFPToSI, [:pointer, :pointer], :pointer
350
+ attach_function :LLVMConstPtrToInt, [:pointer, :pointer], :pointer
351
+ attach_function :LLVMConstIntToPtr, [:pointer, :pointer], :pointer
352
+ attach_function :LLVMConstBitCast, [:pointer, :pointer], :pointer
353
+ attach_function :LLVMConstZExtOrBitCast, [:pointer, :pointer], :pointer
354
+ attach_function :LLVMConstSExtOrBitCast, [:pointer, :pointer], :pointer
355
+ attach_function :LLVMConstTruncOrBitCast, [:pointer, :pointer], :pointer
356
+ attach_function :LLVMConstPointerCast, [:pointer, :pointer], :pointer
357
+ attach_function :LLVMConstIntCast, [:pointer, :pointer, :uint], :pointer
358
+ attach_function :LLVMConstFPCast, [:pointer, :pointer], :pointer
359
+ attach_function :LLVMConstSelect, [:pointer, :pointer, :pointer], :pointer
360
+ attach_function :LLVMConstExtractElement, [:pointer, :pointer], :pointer
361
+ attach_function :LLVMConstInsertElement, [:pointer, :pointer], :pointer
362
+ attach_function :LLVMConstShuffleVector, [:pointer, :pointer, :pointer], :pointer
363
+ attach_function :LLVMConstExtractValue, [:pointer, :pointer, :uint], :pointer
364
+ attach_function :LLVMConstInsertValue, [:pointer, :pointer, :pointer, :uint], :pointer
365
+ attach_function :LLVMConstInlineAsm, [:pointer, :string, :string, :int], :pointer
366
+
367
+ # Global variables, functions and aliases (globals)
368
+ attach_function :LLVMGetGlobalParent, [:pointer], :pointer
369
+ attach_function :LLVMIsDeclaration, [:pointer], :int
370
+ attach_function :LLVMGetLinkage, [:pointer], :linkage
371
+ attach_function :LLVMSetLinkage, [:pointer, :linkage], :void
372
+ attach_function :LLVMGetSection, [:pointer], :string
373
+ attach_function :LLVMSetSection, [:pointer, :string], :void
374
+ attach_function :LLVMGetVisibility, [:pointer], :visibility
375
+ attach_function :LLVMSetVisibility, [:pointer, :visibility], :void
376
+ attach_function :LLVMGetAlignment, [:pointer], :uint
377
+ attach_function :LLVMSetAlignment, [:pointer, :uint], :void
378
+
379
+ attach_function :LLVMAddGlobal, [:pointer, :pointer, :string], :pointer
380
+ attach_function :LLVMGetNamedGlobal, [:pointer, :string], :pointer
381
+ attach_function :LLVMGetFirstGlobal, [:pointer], :pointer
382
+ attach_function :LLVMGetLastGlobal, [:pointer], :pointer
383
+ attach_function :LLVMGetNextGlobal, [:pointer], :pointer
384
+ attach_function :LLVMGetPreviousGlobal, [:pointer], :pointer
385
+ attach_function :LLVMDeleteGlobal, [:pointer], :void
386
+ attach_function :LLVMGetInitializer, [:pointer], :pointer
387
+ attach_function :LLVMSetInitializer, [:pointer, :pointer], :void
388
+ attach_function :LLVMIsThreadLocal, [:pointer], :bool
389
+ attach_function :LLVMSetThreadLocal, [:pointer, :int], :void
390
+ attach_function :LLVMIsGlobalConstant, [:pointer], :bool
391
+ attach_function :LLVMSetGlobalConstant, [:pointer, :bool], :void
392
+
393
+ # Aliases
394
+ attach_function :LLVMAddAlias, [:pointer, :pointer, :pointer, :string], :pointer
395
+
396
+ # Function operations
397
+ attach_function :LLVMAddFunction, [:pointer, :string, :pointer], :pointer
398
+ attach_function :LLVMGetNamedFunction, [:pointer, :string], :pointer
399
+ attach_function :LLVMGetFirstFunction, [:pointer], :pointer
400
+ attach_function :LLVMGetLastFunction, [:pointer], :pointer
401
+ attach_function :LLVMGetNextFunction, [:pointer], :pointer
402
+ attach_function :LLVMGetPreviousFunction, [:pointer], :pointer
403
+ attach_function :LLVMDeleteFunction, [:pointer], :void
404
+ attach_function :LLVMGetIntrinsicID, [:pointer], :uint
405
+ attach_function :LLVMGetFunctionCallConv, [:pointer], :call_conv
406
+ attach_function :LLVMSetFunctionCallConv, [:pointer, :call_conv], :void
407
+ attach_function :LLVMGetGC, [:pointer], :string
408
+ attach_function :LLVMSetGC, [:pointer, :string], :void
409
+ attach_function :LLVMAddFunctionAttr, [:pointer, :attribute], :void
410
+ attach_function :LLVMRemoveFunctionAttr, [:pointer, :attribute], :void
411
+
412
+ # Parameters
413
+ attach_function :LLVMCountParams, [:pointer], :uint
414
+ attach_function :LLVMGetParams, [:pointer, :pointer], :void
415
+ attach_function :LLVMGetParam, [:pointer, :uint], :pointer
416
+ attach_function :LLVMGetParamParent, [:pointer], :pointer
417
+ attach_function :LLVMGetFirstParam, [:pointer], :pointer
418
+ attach_function :LLVMGetLastParam, [:pointer], :pointer
419
+ attach_function :LLVMGetNextParam, [:pointer], :pointer
420
+ attach_function :LLVMGetPreviousParam, [:pointer], :pointer
421
+ attach_function :LLVMAddAttribute, [:pointer, :attribute], :void
422
+ attach_function :LLVMRemoveAttribute, [:pointer, :attribute], :void
423
+ attach_function :LLVMSetParamAlignment, [:pointer, :uint], :void
424
+
425
+ # Basic blocks
426
+ attach_function :LLVMBasicBlockAsValue, [:pointer], :pointer
427
+ attach_function :LLVMValueIsBasicBlock, [:pointer], :int
428
+ attach_function :LLVMValueAsBasicBlock, [:pointer], :pointer
429
+ attach_function :LLVMGetBasicBlockParent, [:pointer], :pointer
430
+ attach_function :LLVMCountBasicBlocks, [:pointer], :uint
431
+ attach_function :LLVMGetBasicBlocks, [:pointer, :pointer], :void
432
+ attach_function :LLVMGetFirstBasicBlock, [:pointer], :pointer
433
+ attach_function :LLVMGetLastBasicBlock, [:pointer], :pointer
434
+ attach_function :LLVMGetNextBasicBlock, [:pointer], :pointer
435
+ attach_function :LLVMGetPreviousBasicBlock, [:pointer], :pointer
436
+ attach_function :LLVMGetEntryBasicBlock, [:pointer], :pointer
437
+
438
+ attach_function :LLVMAppendBasicBlockInContext, [:pointer, :pointer, :string], :pointer
439
+ attach_function :LLVMInsertBasicBlockInContext, [:pointer, :pointer, :string], :pointer
440
+
441
+ attach_function :LLVMAppendBasicBlock, [:pointer, :string], :pointer
442
+ attach_function :LLVMDeleteBasicBlock, [:pointer], :void
443
+
444
+ # Instructions
445
+ attach_function :LLVMGetInstructionParent, [:pointer], :pointer
446
+ attach_function :LLVMGetFirstInstruction, [:pointer], :pointer
447
+ attach_function :LLVMGetLastInstruction, [:pointer], :pointer
448
+ attach_function :LLVMGetNextInstruction, [:pointer], :pointer
449
+ attach_function :LLVMGetPreviousInstruction, [:pointer], :pointer
450
+
451
+ # Call sites
452
+ attach_function :LLVMSetInstructionCallConv, [:pointer, :call_conv], :void
453
+ attach_function :LLVMGetInstructionCallConv, [:pointer], :call_conv
454
+ attach_function :LLVMAddInstrAttribute, [:pointer, :uint, :attribute], :void
455
+ attach_function :LLVMRemoveInstrAttribute, [:pointer, :uint, :attribute], :void
456
+ attach_function :LLVMSetInstrParamAlignment, [:pointer, :uint, :uint], :void
457
+
458
+ # Call instructions
459
+ attach_function :LLVMIsTailCall, [:pointer], :int
460
+ attach_function :LLVMSetTailCall, [:pointer, :int], :void
461
+
462
+ # Phi nodes
463
+ attach_function :LLVMAddIncoming, [:pointer, :pointer, :pointer, :uint], :void
464
+ attach_function :LLVMCountIncoming, [:pointer], :uint
465
+ attach_function :LLVMGetIncomingValue, [:pointer, :uint], :pointer
466
+ attach_function :LLVMGetIncomingBlock, [:pointer, :uint], :pointer
467
+
468
+ # Instruction builders
469
+ attach_function :LLVMCreateBuilderInContext, [:pointer], :pointer
470
+ attach_function :LLVMCreateBuilder, [], :pointer
471
+ attach_function :LLVMPositionBuilder, [:pointer, :pointer, :pointer], :void
472
+ attach_function :LLVMPositionBuilderBefore, [:pointer, :pointer], :void
473
+ attach_function :LLVMPositionBuilderAtEnd, [:pointer, :pointer], :void
474
+ attach_function :LLVMGetInsertBlock, [:pointer], :pointer
475
+ attach_function :LLVMClearInsertionPosition, [:pointer], :void
476
+ attach_function :LLVMInsertIntoBuilder, [:pointer, :pointer], :void
477
+ attach_function :LLVMInsertIntoBuilderWithName, [:pointer, :pointer, :string], :void
478
+ attach_function :LLVMDisposeBuilder, [:pointer], :void
479
+
480
+ # Terminators
481
+ attach_function :LLVMBuildRetVoid, [:pointer], :pointer
482
+ attach_function :LLVMBuildRet, [:pointer, :pointer], :pointer
483
+ attach_function :LLVMBuildAggregateRet, [:pointer, :pointer, :uint], :pointer
484
+ attach_function :LLVMBuildBr, [:pointer, :pointer], :pointer
485
+ attach_function :LLVMBuildCondBr, [:pointer, :pointer, :pointer, :pointer], :pointer
486
+ attach_function :LLVMBuildSwitch, [:pointer, :pointer, :pointer, :uint], :pointer
487
+ attach_function :LLVMBuildInvoke, [:pointer, :pointer, :pointer, :uint, :pointer, :pointer, :string], :pointer
488
+ attach_function :LLVMBuildUnwind, [:pointer], :pointer
489
+ attach_function :LLVMBuildUnreachable, [:pointer], :pointer
490
+
491
+ # Switch instruction
492
+ attach_function :LLVMAddCase, [:pointer, :pointer, :pointer], :void
493
+
494
+ # Arithmetic
495
+ attach_function :LLVMBuildAdd, [:pointer, :pointer, :pointer, :string], :pointer
496
+ attach_function :LLVMBuildNSWAdd, [:pointer, :pointer, :pointer, :string], :pointer
497
+ attach_function :LLVMBuildFAdd, [:pointer, :pointer, :pointer, :string], :pointer
498
+ attach_function :LLVMBuildSub, [:pointer, :pointer, :pointer, :string], :pointer
499
+ attach_function :LLVMBuildFSub, [:pointer, :pointer, :pointer, :string], :pointer
500
+ attach_function :LLVMBuildMul, [:pointer, :pointer, :pointer, :string], :pointer
501
+ attach_function :LLVMBuildFMul, [:pointer, :pointer, :pointer, :string], :pointer
502
+ attach_function :LLVMBuildUDiv, [:pointer, :pointer, :pointer, :string], :pointer
503
+ attach_function :LLVMBuildSDiv, [:pointer, :pointer, :pointer, :string], :pointer
504
+ attach_function :LLVMBuildExactSDiv, [:pointer, :pointer, :pointer, :string], :pointer
505
+ attach_function :LLVMBuildFDiv, [:pointer, :pointer, :pointer, :string], :pointer
506
+ attach_function :LLVMBuildURem, [:pointer, :pointer, :pointer, :string], :pointer
507
+ attach_function :LLVMBuildSRem, [:pointer, :pointer, :pointer, :string], :pointer
508
+ attach_function :LLVMBuildFRem, [:pointer, :pointer, :pointer, :string], :pointer
509
+ attach_function :LLVMBuildShl, [:pointer, :pointer, :pointer, :string], :pointer
510
+ attach_function :LLVMBuildLShr, [:pointer, :pointer, :pointer, :string], :pointer
511
+ attach_function :LLVMBuildAShr, [:pointer, :pointer, :pointer, :string], :pointer
512
+ attach_function :LLVMBuildAnd, [:pointer, :pointer, :pointer, :string], :pointer
513
+ attach_function :LLVMBuildOr, [:pointer, :pointer, :pointer, :string], :pointer
514
+ attach_function :LLVMBuildXor, [:pointer, :pointer, :pointer, :string], :pointer
515
+ attach_function :LLVMBuildNeg, [:pointer, :pointer, :string], :pointer
516
+ attach_function :LLVMBuildNot, [:pointer, :pointer, :string], :pointer
517
+
518
+ # Memory
519
+ attach_function :LLVMBuildMalloc, [:pointer, :pointer, :string], :pointer
520
+ attach_function :LLVMBuildArrayMalloc, [:pointer, :pointer, :pointer, :string], :string
521
+ attach_function :LLVMBuildAlloca, [:pointer, :pointer, :string], :pointer
522
+ attach_function :LLVMBuildArrayAlloca, [:pointer, :pointer, :pointer, :string], :pointer
523
+ attach_function :LLVMBuildFree, [:pointer, :pointer], :pointer
524
+ attach_function :LLVMBuildLoad, [:pointer, :pointer, :string], :pointer
525
+ attach_function :LLVMBuildStore, [:pointer, :pointer, :pointer], :pointer
526
+ attach_function :LLVMBuildGEP, [:pointer, :pointer, :pointer, :uint, :string], :pointer
527
+ attach_function :LLVMBuildInBoundsGEP, [:pointer, :pointer, :pointer, :uint, :string], :pointer
528
+ attach_function :LLVMBuildStructGEP, [:pointer, :pointer, :uint, :string], :pointer
529
+ attach_function :LLVMBuildGlobalString, [:pointer, :string, :string], :pointer
530
+ attach_function :LLVMBuildGlobalStringPtr, [:pointer, :string, :string], :pointer
531
+
532
+ # Casts
533
+ attach_function :LLVMBuildTrunc, [:pointer, :pointer, :pointer, :string], :pointer
534
+ attach_function :LLVMBuildZExt, [:pointer, :pointer, :pointer, :string], :pointer
535
+ attach_function :LLVMBuildSExt, [:pointer, :pointer, :pointer, :string], :pointer
536
+ attach_function :LLVMBuildFPToUI, [:pointer, :pointer, :pointer, :string], :pointer
537
+ attach_function :LLVMBuildFPToSI, [:pointer, :pointer, :pointer, :string], :pointer
538
+ attach_function :LLVMBuildUIToFP, [:pointer, :pointer, :pointer, :string], :pointer
539
+ attach_function :LLVMBuildSIToFP, [:pointer, :pointer, :pointer, :string], :pointer
540
+ attach_function :LLVMBuildFPTrunc, [:pointer, :pointer, :pointer, :string], :pointer
541
+ attach_function :LLVMBuildFPExt, [:pointer, :pointer, :pointer, :string], :pointer
542
+ attach_function :LLVMBuildPtrToInt, [:pointer, :pointer, :pointer, :string], :pointer
543
+ attach_function :LLVMBuildIntToPtr, [:pointer, :pointer, :pointer, :string], :pointer
544
+ attach_function :LLVMBuildBitCast, [:pointer, :pointer, :pointer, :string], :pointer
545
+ attach_function :LLVMBuildZExtOrBitCast, [:pointer, :pointer, :pointer, :string], :pointer
546
+ attach_function :LLVMBuildSExtOrBitCast, [:pointer, :pointer, :pointer, :string], :pointer
547
+ attach_function :LLVMBuildTruncOrBitCast, [:pointer, :pointer, :pointer, :string], :pointer
548
+ attach_function :LLVMBuildPointerCast, [:pointer, :pointer, :pointer, :string], :pointer
549
+ attach_function :LLVMBuildIntCast, [:pointer, :pointer, :pointer, :string], :pointer
550
+ attach_function :LLVMBuildFPCast, [:pointer, :pointer, :pointer, :string], :pointer
551
+
552
+ # Comparisons
553
+ attach_function :LLVMBuildICmp, [:pointer, :int_predicate, :pointer, :pointer, :string], :pointer
554
+ attach_function :LLVMBuildFCmp, [:pointer, :real_predicate, :pointer, :pointer, :string], :pointer
555
+
556
+ # Misc
557
+ attach_function :LLVMBuildPhi, [:pointer, :pointer, :string], :pointer
558
+ attach_function :LLVMBuildCall, [:pointer, :pointer, :pointer, :uint, :string], :pointer
559
+ attach_function :LLVMBuildSelect, [:pointer, :pointer, :pointer, :pointer, :string], :pointer
560
+ attach_function :LLVMBuildVAArg, [:pointer, :pointer, :pointer, :string], :pointer
561
+ attach_function :LLVMBuildExtractElement, [:pointer, :pointer, :pointer, :string], :pointer
562
+ attach_function :LLVMBuildInsertElement, [:pointer, :pointer, :pointer, :pointer, :string], :pointer
563
+ attach_function :LLVMBuildShuffleVector, [:pointer, :pointer, :pointer, :pointer, :string], :pointer
564
+ attach_function :LLVMBuildExtractValue, [:pointer, :pointer, :uint, :string], :pointer
565
+ attach_function :LLVMBuildInsertValue, [:pointer, :pointer, :pointer, :uint, :string], :pointer
566
+
567
+ attach_function :LLVMBuildIsNull, [:pointer, :pointer, :string], :pointer
568
+ attach_function :LLVMBuildIsNotNull, [:pointer, :pointer, :string], :pointer
569
+ attach_function :LLVMBuildPtrDiff, [:pointer, :pointer, :pointer, :string], :pointer
570
+
571
+ # Module providers
572
+ attach_function :LLVMCreateModuleProviderForExistingModule, [:pointer], :pointer
573
+ attach_function :LLVMDisposeModuleProvider, [:pointer], :void
574
+
575
+ # Memory buffers
576
+ attach_function :LLVMCreateMemoryBufferWithContentsOfFile, [:string, :pointer, :pointer], :int
577
+ attach_function :LLVMCreateMemoryBufferWithSTDIN, [:pointer, :pointer], :int
578
+ attach_function :LLVMDisposeMemoryBuffer, [:pointer], :void
579
+
580
+ # Pass managers
581
+ attach_function :LLVMCreatePassManager, [], :pointer
582
+ attach_function :LLVMCreateFunctionPassManager, [:pointer], :pointer
583
+ attach_function :LLVMCreateFunctionPassManagerForModule, [:pointer], :pointer
584
+ attach_function :LLVMRunPassManager, [:pointer, :pointer], :int
585
+ attach_function :LLVMInitializeFunctionPassManager, [:pointer], :int
586
+ attach_function :LLVMRunFunctionPassManager, [:pointer, :pointer], :int
587
+ attach_function :LLVMFinalizeFunctionPassManager, [:pointer], :int
588
+ attach_function :LLVMDisposePassManager, [:pointer], :void
589
+ end
590
+
591
+ require 'llvm/core/context'
592
+ require 'llvm/core/module'
593
+ require 'llvm/core/type'
594
+ require 'llvm/core/value'
595
+ require 'llvm/core/builder'
596
+ require 'llvm/core/pass_manager'
597
+ require 'llvm/core/bitcode'
598
+ end