ruby-llvm 18.1.8 → 18.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/llvm/core.rb CHANGED
@@ -2,207 +2,10 @@
2
2
 
3
3
  require 'llvm'
4
4
  require 'llvm/core_ffi'
5
+ require 'llvm/core_ffi_v2'
5
6
  require 'llvm/support'
6
7
 
7
8
  module LLVM
8
- # @private
9
- module C
10
- attach_function :dispose_message, :LLVMDisposeMessage, [:pointer], :void
11
-
12
- # typedef unsigned LLVMAttributeIndex;
13
- typedef(:uint, :llvmattributeindex)
14
-
15
- # void LLVMAddAttributeAtIndex
16
- # (LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A);
17
- attach_function :add_attribute_at_index, :LLVMAddAttributeAtIndex, [:pointer, :llvmattributeindex, :pointer], :void
18
-
19
- # void LLVMRemoveEnumAttributeAtIndex
20
- # (LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID);
21
- attach_function :remove_enum_attribute_at_index, :LLVMRemoveEnumAttributeAtIndex, [:pointer, :llvmattributeindex, :uint], :void
22
-
23
- # LLVMAttributeRef LLVMCreateEnumAttribute
24
- # (LLVMContextRef C, unsigned KindID, uint64_t Val);
25
- attach_function :create_enum_attribute, :LLVMCreateEnumAttribute, [:pointer, :uint, :uint64], :pointer
26
-
27
- # LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C,
28
- # const char *K, unsigned KLength,
29
- # const char *V, unsigned VLength);
30
- attach_function :create_string_attribute, :LLVMCreateStringAttribute, [:pointer, :string, :uint, :string, :uint], :pointer
31
-
32
- # unsigned LLVMGetEnumAttributeKindForName
33
- # (const char *Name, size_t SLen);
34
- attach_function :get_enum_attribute_kind_for_name, :LLVMGetEnumAttributeKindForName, [:pointer, :size_t], :uint
35
-
36
- attach_function :get_last_enum_attribute_kind, :LLVMGetLastEnumAttributeKind, [], :uint
37
-
38
- # unsigned LLVMGetAttributeCountAtIndex
39
- # (LLVMValueRef F, LLVMAttributeIndex Idx);
40
- attach_function :get_attribute_count_at_index, :LLVMGetAttributeCountAtIndex, [:pointer, :llvmattributeindex], :uint
41
-
42
- # void LLVMGetAttributesAtIndex
43
- # (LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs);
44
- attach_function :get_attributes_at_index, :LLVMGetAttributesAtIndex, [:pointer, :llvmattributeindex, :pointer], :void
45
-
46
- # unsigned LLVMGetEnumAttributeKind
47
- # (LLVMAttributeRef A);
48
- attach_function :get_enum_attribute_kind, :LLVMGetEnumAttributeKind, [:pointer], :uint
49
-
50
- # uint64_t LLVMGetEnumAttributeValue
51
- # (LLVMAttributeRef A);
52
- attach_function :get_enum_attribute_value, :LLVMGetEnumAttributeValue, [:pointer], :uint64
53
-
54
- # const char *LLVMGetStringAttributeKind
55
- # (LLVMAttributeRef A, unsigned *Length);
56
- attach_function :get_string_attribute_kind, :LLVMGetStringAttributeKind, [:pointer, :pointer], :string
57
-
58
- # const char *LLVMGetStringAttributeValue
59
- # (LLVMAttributeRef A, unsigned *Length);
60
- attach_function :get_string_attribute_value, :LLVMGetStringAttributeValue, [:pointer, :pointer], :string
61
-
62
- attach_function :is_enum_attribute, :LLVMIsEnumAttribute, [:pointer], :bool
63
- attach_function :is_string_attribute, :LLVMIsStringAttribute, [:pointer], :bool
64
- attach_function :is_type_attribute, :LLVMIsTypeAttribute, [:pointer], :bool
65
-
66
- # LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name);
67
- attach_function :build_load2, :LLVMBuildLoad2, [:pointer, :pointer, :pointer, :string], :pointer
68
-
69
- # LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
70
- # LLVMValueRef Pointer, LLVMValueRef *Indices,
71
- # unsigned NumIndices, const char *Name);
72
- attach_function :build_gep2, :LLVMBuildGEP2, [:pointer, :pointer, :pointer, :pointer, :uint, :string], :pointer
73
-
74
- # LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
75
- # LLVMValueRef Pointer, LLVMValueRef *Indices,
76
- # unsigned NumIndices, const char *Name);
77
- attach_function :build_inbounds_gep2, :LLVMBuildInBoundsGEP2, [:pointer, :pointer, :pointer, :pointer, :uint, :string], :pointer
78
-
79
- # LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
80
- # LLVMValueRef Pointer, unsigned Idx,
81
- # const char *Name);
82
- attach_function :build_struct_gep2, :LLVMBuildStructGEP2, [:pointer, :pointer, :pointer, :uint, :string], :pointer
83
-
84
- # LLVMValueRef LLVMBuildCall2(LLVMBuilderRef, LLVMTypeRef, LLVMValueRef Fn,
85
- # LLVMValueRef *Args, unsigned NumArgs,
86
- # const char *Name);
87
- attach_function :build_call2, :LLVMBuildCall2, [:pointer, :pointer, :pointer, :pointer, :uint, :string], :pointer
88
-
89
- # LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Fn,
90
- # LLVMValueRef *Args, unsigned NumArgs,
91
- # LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
92
- # const char *Name);
93
- attach_function :build_invoke2, :LLVMBuildInvoke2, [:pointer, :pointer, :pointer, :pointer, :uint, :pointer, :pointer, :string], :pointer
94
-
95
- # LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global);
96
- attach_function :global_get_value_type, :LLVMGlobalGetValueType, [:pointer], :pointer
97
-
98
- # LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP);
99
- attach_function :get_gep_source_element_type, :LLVMGetGEPSourceElementType, [:pointer], :pointer
100
-
101
- # (Not documented)
102
- #
103
- # @method x86amx_type()
104
- # @return [FFI::Pointer(TypeRef)]
105
- # @scope class
106
- attach_function :x86amx_type, :LLVMX86AMXType, [], :pointer
107
-
108
- # LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca);
109
- attach_function :get_allocated_type, :LLVMGetAllocatedType, [:pointer], :pointer
110
-
111
- # LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global);
112
- attach_function :get_value_type, :LLVMGlobalGetValueType, [:pointer], :pointer
113
-
114
- # LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx);
115
- attach_function :get_aggregate_element, :LLVMGetAggregateElement, [:pointer, :int], :pointer
116
-
117
- attach_function :get_type_by_name2, :LLVMGetTypeByName2, [:pointer, :string], :pointer
118
-
119
- # Determine whether a structure is packed.
120
- #
121
- # @see llvm::StructType::isPacked()
122
- #
123
- # @method is_packed_struct(struct_ty)
124
- # @param [FFI::Pointer(TypeRef)] struct_ty
125
- # @return [Bool]
126
- # @scope class
127
- attach_function :is_packed_struct, :LLVMIsPackedStruct, [:pointer], :bool
128
-
129
- # Determine whether a structure is opaque.
130
- #
131
- # @see llvm::StructType::isOpaque()
132
- #
133
- # @method is_opaque_struct(struct_ty)
134
- # @param [FFI::Pointer(TypeRef)] struct_ty
135
- # @return [Bool]
136
- # @scope class
137
- attach_function :is_opaque_struct, :LLVMIsOpaqueStruct, [:pointer], :bool
138
-
139
- # Determine whether a structure is literal.
140
- #
141
- # @see llvm::StructType::isLiteral()
142
- #
143
- # @method is_literal_struct(struct_ty)
144
- # @param [FFI::Pointer(TypeRef)] struct_ty
145
- # @return [Bool]
146
- # @scope class
147
- attach_function :is_literal_struct, :LLVMIsLiteralStruct, [:pointer], :bool
148
-
149
- # /**
150
- # * Read LLVM IR from a memory buffer and convert it into an in-memory Module
151
- # * object. Returns 0 on success.
152
- # * Optionally returns a human-readable description of any errors that
153
- # * occurred during parsing IR. OutMessage must be disposed with
154
- # * LLVMDisposeMessage.
155
- # *
156
- # * @see llvm::ParseIR()
157
- # */
158
- # LLVMBool LLVMParseIRInContext(LLVMContextRef ContextRef,
159
- # LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
160
- # char **OutMessage);
161
- attach_function :parse_ir_in_context, :LLVMParseIRInContext, [:pointer, :pointer, :pointer, :pointer], :bool
162
-
163
- enum :value_kind, [
164
- :argument, 0,
165
- :basic_block, 1,
166
- :memory_use, 2,
167
- :memory_def, 3,
168
- :memory_phi, 4,
169
- :function, 5,
170
- :global_alias, 6,
171
- :global_ifunc, 7,
172
- :global_variable, 8,
173
- :block_address, 9,
174
- :const_expr, 10,
175
- :const_array, 11,
176
- :const_struct, 12,
177
- :const_vector, 13,
178
- :undef, 14,
179
- :const_aggregregate_zero, 15,
180
- :const_data_array, 16,
181
- :const_data_vector, 17,
182
- :const_int, 18,
183
- :const_fp, 19,
184
- :const_null, 20,
185
- :const_none, 21,
186
- :metadata, 22,
187
- :inline_asm, 23,
188
- :instruction, 24,
189
- :poison, 25,
190
- ]
191
-
192
- # /**
193
- # * Obtain the enumerated type of a Value instance.
194
- # *
195
- # * @see llvm::Value::getValueID()
196
- # */
197
- attach_function :get_value_kind, :LLVMGetValueKind, [:pointer], :value_kind
198
-
199
- attach_function :get_poison, :LLVMGetPoison, [:pointer], :pointer
200
-
201
- attach_function :const_int_get_sext_value, :LLVMConstIntGetSExtValue, [:pointer], :long_long
202
-
203
- attach_function :const_int_get_zext_value, :LLVMConstIntGetZExtValue, [:pointer], :ulong_long
204
- end
205
-
206
9
  # Yields a pointer suitable for storing an LLVM output message.
207
10
  # If the message pointer is non-NULL (an error has happened), converts
208
11
  # the result to a string and returns it. Otherwise, returns +nil+.
@@ -245,7 +48,7 @@ module LLVM
245
48
  require 'llvm/core/value'
246
49
  require 'llvm/core/builder'
247
50
  require 'llvm/core/pass_manager'
248
- require 'llvm/transforms/pass_builder'
51
+ require 'llvm/pass_builder'
249
52
  require 'llvm/core/bitcode'
250
53
  require 'llvm/core/attribute'
251
54
  end
data/lib/llvm/core_ffi.rb CHANGED
@@ -1847,22 +1847,6 @@ module LLVM::C
1847
1847
  # @scope class
1848
1848
  attach_function :replace_all_uses_with, :LLVMReplaceAllUsesWith, [:pointer, :pointer], :void
1849
1849
 
1850
- # Determine whether the specified constant instance is constant.
1851
- #
1852
- # @method is_constant(val)
1853
- # @param [FFI::Pointer(ValueRef)] val
1854
- # @return [Integer]
1855
- # @scope class
1856
- attach_function :is_constant, :LLVMIsConstant, [:pointer], :int
1857
-
1858
- # Determine whether a value instance is undefined.
1859
- #
1860
- # @method is_undef(val)
1861
- # @param [FFI::Pointer(ValueRef)] val
1862
- # @return [Integer]
1863
- # @scope class
1864
- attach_function :is_undef, :LLVMIsUndef, [:pointer], :int
1865
-
1866
1850
  # (Not documented)
1867
1851
  #
1868
1852
  # @method is_a_argument(val)
@@ -2628,16 +2612,6 @@ module LLVM::C
2628
2612
  # @scope class
2629
2613
  attach_function :get_undef, :LLVMGetUndef, [:pointer], :pointer
2630
2614
 
2631
- # Determine whether a value instance is null.
2632
- #
2633
- # @see llvm::Constant::isNullValue()
2634
- #
2635
- # @method is_null(val)
2636
- # @param [FFI::Pointer(ValueRef)] val
2637
- # @return [Integer]
2638
- # @scope class
2639
- attach_function :is_null, :LLVMIsNull, [:pointer], :int
2640
-
2641
2615
  # Obtain a constant that is a constant pointer pointing to NULL for a
2642
2616
  # specified type.
2643
2617
  #
@@ -3452,14 +3426,6 @@ module LLVM::C
3452
3426
  # @scope class
3453
3427
  attach_function :set_initializer, :LLVMSetInitializer, [:pointer, :pointer], :void
3454
3428
 
3455
- # (Not documented)
3456
- #
3457
- # @method is_thread_local(global_var)
3458
- # @param [FFI::Pointer(ValueRef)] global_var
3459
- # @return [Integer]
3460
- # @scope class
3461
- attach_function :is_thread_local, :LLVMIsThreadLocal, [:pointer], :int
3462
-
3463
3429
  # (Not documented)
3464
3430
  #
3465
3431
  # @method set_thread_local(global_var, is_thread_local)
@@ -3469,14 +3435,6 @@ module LLVM::C
3469
3435
  # @scope class
3470
3436
  attach_function :set_thread_local, :LLVMSetThreadLocal, [:pointer, :int], :void
3471
3437
 
3472
- # (Not documented)
3473
- #
3474
- # @method is_global_constant(global_var)
3475
- # @param [FFI::Pointer(ValueRef)] global_var
3476
- # @return [Integer]
3477
- # @scope class
3478
- attach_function :is_global_constant, :LLVMIsGlobalConstant, [:pointer], :int
3479
-
3480
3438
  # (Not documented)
3481
3439
  #
3482
3440
  # @method set_global_constant(global_var, is_constant)
@@ -0,0 +1,353 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LLVM
4
+ # @private
5
+ module C
6
+ attach_function :dispose_message, :LLVMDisposeMessage, [:pointer], :void
7
+
8
+ # typedef unsigned LLVMAttributeIndex;
9
+ typedef(:uint, :llvmattributeindex)
10
+
11
+ # void LLVMAddAttributeAtIndex
12
+ # (LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A);
13
+ attach_function :add_attribute_at_index, :LLVMAddAttributeAtIndex, [:pointer, :llvmattributeindex, :pointer], :void
14
+
15
+ # void LLVMRemoveEnumAttributeAtIndex
16
+ # (LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID);
17
+ attach_function :remove_enum_attribute_at_index, :LLVMRemoveEnumAttributeAtIndex, [:pointer, :llvmattributeindex, :uint], :void
18
+
19
+ # LLVMAttributeRef LLVMCreateEnumAttribute
20
+ # (LLVMContextRef C, unsigned KindID, uint64_t Val);
21
+ attach_function :create_enum_attribute, :LLVMCreateEnumAttribute, [:pointer, :uint, :uint64], :pointer
22
+
23
+ # LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C,
24
+ # const char *K, unsigned KLength,
25
+ # const char *V, unsigned VLength);
26
+ attach_function :create_string_attribute, :LLVMCreateStringAttribute, [:pointer, :string, :uint, :string, :uint], :pointer
27
+
28
+ # unsigned LLVMGetEnumAttributeKindForName
29
+ # (const char *Name, size_t SLen);
30
+ attach_function :get_enum_attribute_kind_for_name, :LLVMGetEnumAttributeKindForName, [:pointer, :size_t], :uint
31
+
32
+ attach_function :get_last_enum_attribute_kind, :LLVMGetLastEnumAttributeKind, [], :uint
33
+
34
+ # unsigned LLVMGetAttributeCountAtIndex
35
+ # (LLVMValueRef F, LLVMAttributeIndex Idx);
36
+ attach_function :get_attribute_count_at_index, :LLVMGetAttributeCountAtIndex, [:pointer, :llvmattributeindex], :uint
37
+
38
+ # void LLVMGetAttributesAtIndex
39
+ # (LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs);
40
+ attach_function :get_attributes_at_index, :LLVMGetAttributesAtIndex, [:pointer, :llvmattributeindex, :pointer], :void
41
+
42
+ # unsigned LLVMGetEnumAttributeKind
43
+ # (LLVMAttributeRef A);
44
+ attach_function :get_enum_attribute_kind, :LLVMGetEnumAttributeKind, [:pointer], :uint
45
+
46
+ # uint64_t LLVMGetEnumAttributeValue
47
+ # (LLVMAttributeRef A);
48
+ attach_function :get_enum_attribute_value, :LLVMGetEnumAttributeValue, [:pointer], :uint64
49
+
50
+ # const char *LLVMGetStringAttributeKind
51
+ # (LLVMAttributeRef A, unsigned *Length);
52
+ attach_function :get_string_attribute_kind, :LLVMGetStringAttributeKind, [:pointer, :pointer], :string
53
+
54
+ # const char *LLVMGetStringAttributeValue
55
+ # (LLVMAttributeRef A, unsigned *Length);
56
+ attach_function :get_string_attribute_value, :LLVMGetStringAttributeValue, [:pointer, :pointer], :string
57
+
58
+ attach_function :is_enum_attribute, :LLVMIsEnumAttribute, [:pointer], :bool
59
+ attach_function :is_string_attribute, :LLVMIsStringAttribute, [:pointer], :bool
60
+ attach_function :is_type_attribute, :LLVMIsTypeAttribute, [:pointer], :bool
61
+
62
+ # LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name);
63
+ attach_function :build_load2, :LLVMBuildLoad2, [:pointer, :pointer, :pointer, :string], :pointer
64
+
65
+ # LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
66
+ # LLVMValueRef Pointer, LLVMValueRef *Indices,
67
+ # unsigned NumIndices, const char *Name);
68
+ attach_function :build_gep2, :LLVMBuildGEP2, [:pointer, :pointer, :pointer, :pointer, :uint, :string], :pointer
69
+
70
+ # LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
71
+ # LLVMValueRef Pointer, LLVMValueRef *Indices,
72
+ # unsigned NumIndices, const char *Name);
73
+ attach_function :build_inbounds_gep2, :LLVMBuildInBoundsGEP2, [:pointer, :pointer, :pointer, :pointer, :uint, :string], :pointer
74
+
75
+ # LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
76
+ # LLVMValueRef Pointer, unsigned Idx,
77
+ # const char *Name);
78
+ attach_function :build_struct_gep2, :LLVMBuildStructGEP2, [:pointer, :pointer, :pointer, :uint, :string], :pointer
79
+
80
+ # LLVMValueRef LLVMBuildCall2(LLVMBuilderRef, LLVMTypeRef, LLVMValueRef Fn,
81
+ # LLVMValueRef *Args, unsigned NumArgs,
82
+ # const char *Name);
83
+ attach_function :build_call2, :LLVMBuildCall2, [:pointer, :pointer, :pointer, :pointer, :uint, :string], :pointer
84
+
85
+ # LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Fn,
86
+ # LLVMValueRef *Args, unsigned NumArgs,
87
+ # LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
88
+ # const char *Name);
89
+ attach_function :build_invoke2, :LLVMBuildInvoke2, [:pointer, :pointer, :pointer, :pointer, :uint, :pointer, :pointer, :string], :pointer
90
+
91
+ # LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef, LLVMTypeRef ElemTy,
92
+ # LLVMValueRef LHS, LLVMValueRef RHS,
93
+ # const char *Name);
94
+ attach_function :build_ptr_diff2, :LLVMBuildPtrDiff2, [:pointer, :pointer, :pointer, :pointer, :string], :pointer
95
+
96
+ # LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global);
97
+ attach_function :global_get_value_type, :LLVMGlobalGetValueType, [:pointer], :pointer
98
+
99
+ # LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP);
100
+ attach_function :get_gep_source_element_type, :LLVMGetGEPSourceElementType, [:pointer], :pointer
101
+
102
+ # (Not documented)
103
+ #
104
+ # @method x86amx_type()
105
+ # @return [FFI::Pointer(TypeRef)]
106
+ # @scope class
107
+ attach_function :x86amx_type, :LLVMX86AMXType, [], :pointer
108
+
109
+ # LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca);
110
+ attach_function :get_allocated_type, :LLVMGetAllocatedType, [:pointer], :pointer
111
+
112
+ # LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global);
113
+ attach_function :get_value_type, :LLVMGlobalGetValueType, [:pointer], :pointer
114
+
115
+ # LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx);
116
+ attach_function :get_aggregate_element, :LLVMGetAggregateElement, [:pointer, :int], :pointer
117
+
118
+ attach_function :get_type_by_name2, :LLVMGetTypeByName2, [:pointer, :string], :pointer
119
+
120
+ # Determine whether a structure is packed.
121
+ #
122
+ # @see llvm::StructType::isPacked()
123
+ #
124
+ # @method is_packed_struct(struct_ty)
125
+ # @param [FFI::Pointer(TypeRef)] struct_ty
126
+ # @return [Bool]
127
+ # @scope class
128
+ attach_function :is_packed_struct, :LLVMIsPackedStruct, [:pointer], :bool
129
+
130
+ # Determine whether a structure is opaque.
131
+ #
132
+ # @see llvm::StructType::isOpaque()
133
+ #
134
+ # @method is_opaque_struct(struct_ty)
135
+ # @param [FFI::Pointer(TypeRef)] struct_ty
136
+ # @return [Bool]
137
+ # @scope class
138
+ attach_function :is_opaque_struct, :LLVMIsOpaqueStruct, [:pointer], :bool
139
+
140
+ # Determine whether a structure is literal.
141
+ #
142
+ # @see llvm::StructType::isLiteral()
143
+ #
144
+ # @method is_literal_struct(struct_ty)
145
+ # @param [FFI::Pointer(TypeRef)] struct_ty
146
+ # @return [Bool]
147
+ # @scope class
148
+ attach_function :is_literal_struct, :LLVMIsLiteralStruct, [:pointer], :bool
149
+
150
+ # /**
151
+ # * Read LLVM IR from a memory buffer and convert it into an in-memory Module
152
+ # * object. Returns 0 on success.
153
+ # * Optionally returns a human-readable description of any errors that
154
+ # * occurred during parsing IR. OutMessage must be disposed with
155
+ # * LLVMDisposeMessage.
156
+ # *
157
+ # * @see llvm::ParseIR()
158
+ # */
159
+ # LLVMBool LLVMParseIRInContext(LLVMContextRef ContextRef,
160
+ # LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
161
+ # char **OutMessage);
162
+ attach_function :parse_ir_in_context, :LLVMParseIRInContext, [:pointer, :pointer, :pointer, :pointer], :bool
163
+
164
+ enum :value_kind, [
165
+ :argument, 0,
166
+ :basic_block, 1,
167
+ :memory_use, 2,
168
+ :memory_def, 3,
169
+ :memory_phi, 4,
170
+ :function, 5,
171
+ :global_alias, 6,
172
+ :global_ifunc, 7,
173
+ :global_variable, 8,
174
+ :block_address, 9,
175
+ :const_expr, 10,
176
+ :const_array, 11,
177
+ :const_struct, 12,
178
+ :const_vector, 13,
179
+ :undef, 14,
180
+ :const_aggregregate_zero, 15,
181
+ :const_data_array, 16,
182
+ :const_data_vector, 17,
183
+ :const_int, 18,
184
+ :const_fp, 19,
185
+ :const_null, 20,
186
+ :const_none, 21,
187
+ :metadata, 22,
188
+ :inline_asm, 23,
189
+ :instruction, 24,
190
+ :poison, 25,
191
+ ]
192
+
193
+ # /**
194
+ # * Obtain the enumerated type of a Value instance.
195
+ # *
196
+ # * @see llvm::Value::getValueID()
197
+ # */
198
+ attach_function :get_value_kind, :LLVMGetValueKind, [:pointer], :value_kind
199
+
200
+ attach_function :get_poison, :LLVMGetPoison, [:pointer], :pointer
201
+
202
+ attach_function :const_int_get_sext_value, :LLVMConstIntGetSExtValue, [:pointer], :long_long
203
+
204
+ attach_function :const_int_get_zext_value, :LLVMConstIntGetZExtValue, [:pointer], :ulong_long
205
+
206
+ # (Not documented)
207
+ #
208
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:atomic_rmw_bin_op).</em>
209
+ #
210
+ # === Options:
211
+ # :xchg ::
212
+ #
213
+ # :add ::
214
+ # < Set the new value and return the one old
215
+ # :sub ::
216
+ # < Add a value and return the old one
217
+ # :and_ ::
218
+ # < Subtract a value and return the old one
219
+ # :nand ::
220
+ # < And a value and return the old one
221
+ # :or_ ::
222
+ # < Not-And a value and return the old one
223
+ # :xor ::
224
+ # < OR a value and return the old one
225
+ # :max ::
226
+ # < Xor a value and return the old one
227
+ # :min ::
228
+ # < Sets the value if it's greater than the
229
+ # original using a signed comparison and return
230
+ # the old one
231
+ # :u_max ::
232
+ # < Sets the value if it's Smaller than the
233
+ # original using a signed comparison and return
234
+ # the old one
235
+ # :u_min ::
236
+ # < Sets the value if it's greater than the
237
+ # original using an unsigned comparison and return
238
+ # the old one
239
+ #
240
+ # @method _enum_atomic_rmw_bin_op_
241
+ # @return [Symbol]
242
+ # @scope class
243
+ enum :atomic_rmw_bin_op, [
244
+ :xchg,
245
+ :add,
246
+ :sub,
247
+ :and,
248
+ :nand,
249
+ :or,
250
+ :xor,
251
+ :max,
252
+ :min,
253
+ :umax,
254
+ :umin,
255
+ :fadd,
256
+ :fsub,
257
+ :fmax,
258
+ :fmin,
259
+ :uincwrap,
260
+ :udecwrap,
261
+ ]
262
+
263
+ # (Not documented)
264
+ #
265
+ # @method build_atomic_rmw(b, op, ptr, val, ordering, single_thread)
266
+ # @param [FFI::Pointer(BuilderRef)] b
267
+ # @param [Symbol from _enum_atomic_rmw_bin_op_] op
268
+ # @param [FFI::Pointer(ValueRef)] ptr
269
+ # @param [FFI::Pointer(ValueRef)] val
270
+ # @param [Symbol from _enum_atomic_ordering_] ordering
271
+ # @param [Integer] single_thread
272
+ # @return [FFI::Pointer(ValueRef)]
273
+ # @scope class
274
+ attach_function :build_atomic_rmw, :LLVMBuildAtomicRMW, [:pointer, :atomic_rmw_bin_op, :pointer, :pointer, :atomic_ordering, :int], :pointer
275
+
276
+ # Create a ConstantDataSequential and initialize it with a string.
277
+ #
278
+ # @see llvm::ConstantDataArray::getString()
279
+ #
280
+ # @method const_string_in_context(c, str, length, dont_null_terminate)
281
+ # @param [FFI::Pointer(ContextRef)] c
282
+ # @param [String] str
283
+ # @param [Integer] length
284
+ # @param [Integer] dont_null_terminate
285
+ # @return [FFI::Pointer(ValueRef)]
286
+ # @scope class
287
+ attach_function :const_string_in_context, :LLVMConstStringInContext, [:pointer, :string, :size_t, :int], :pointer
288
+
289
+ # Determine whether the specified constant instance is constant.
290
+ #
291
+ # @method is_constant(val)
292
+ # @param [FFI::Pointer(ValueRef)] val
293
+ # @return [Integer]
294
+ # @scope class
295
+ attach_function :is_constant, :LLVMIsConstant, [:pointer], :bool
296
+
297
+ # Determine whether a value instance is undefined.
298
+ #
299
+ # @method is_undef(val)
300
+ # @param [FFI::Pointer(ValueRef)] val
301
+ # @return [Integer]
302
+ # @scope class
303
+ attach_function :is_undef, :LLVMIsUndef, [:pointer], :bool
304
+
305
+ # Determine whether a value instance is null.
306
+ #
307
+ # @see llvm::Constant::isNullValue()
308
+ #
309
+ # @method is_null(val)
310
+ # @param [FFI::Pointer(ValueRef)] val
311
+ # @return [Integer]
312
+ # @scope class
313
+ attach_function :is_null, :LLVMIsNull, [:pointer], :bool
314
+
315
+ attach_function :is_poison, :LLVMIsPoison, [:pointer], :bool
316
+
317
+ # (Not documented)
318
+ #
319
+ # @method is_thread_local(global_var)
320
+ # @param [FFI::Pointer(ValueRef)] global_var
321
+ # @return [Integer]
322
+ # @scope class
323
+ attach_function :is_thread_local, :LLVMIsThreadLocal, [:pointer], :bool
324
+
325
+ # (Not documented)
326
+ #
327
+ # @method is_global_constant(global_var)
328
+ # @param [FFI::Pointer(ValueRef)] global_var
329
+ # @return [Integer]
330
+ # @scope class
331
+ attach_function :is_global_constant, :LLVMIsGlobalConstant, [:pointer], :bool
332
+
333
+ attach_function :build_int_cast2, :LLVMBuildIntCast2, [:pointer, :pointer, :pointer, :bool, :string], :pointer
334
+
335
+ # LLVMBool LLVMGetNUW(LLVMValueRef ArithInst);
336
+ attach_function :get_nuw, :LLVMGetNUW, [:pointer], :bool
337
+
338
+ # void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW);
339
+ attach_function :set_nuw, :LLVMSetNUW, [:pointer, :bool], :void
340
+
341
+ # LLVMBool LLVMGetNSW(LLVMValueRef ArithInst);
342
+ attach_function :get_nsw, :LLVMGetNSW, [:pointer], :bool
343
+
344
+ # void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW);
345
+ attach_function :set_nsw, :LLVMSetNSW, [:pointer, :bool], :void
346
+
347
+ # LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst);
348
+ attach_function :get_exact, :LLVMGetExact, [:pointer], :bool
349
+
350
+ # void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact);
351
+ attach_function :set_exact, :LLVMSetExact, [:pointer, :bool], :void
352
+ end
353
+ end
@@ -192,7 +192,7 @@ module LLVM
192
192
  :no_frame_pointer_elim => false,
193
193
  :enable_fast_i_sel => false,
194
194
  # TODO
195
- #:mcjmm => nil,
195
+ # :mcjmm => nil,
196
196
  }.merge(options)
197
197
 
198
198
  super
data/lib/llvm/lljit.rb CHANGED
@@ -5,7 +5,6 @@ require 'llvm/core'
5
5
  module LLVM
6
6
  # wrapper around LLVMOrcLLJITRef
7
7
  class LLJit
8
-
9
8
  # create lljit
10
9
  # does not automatically dispose of lljit
11
10
  # if lljit was disposed, that would dispose of builder