ruby-llvm 18.1.7 → 18.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -12,10 +12,6 @@ module LLVM::C
12
12
  end
13
13
  end
14
14
 
15
- def for_each_value_subclass(macro)
16
- macroARGUMENTmacroBASIC_BLOCKmacroINLINE_ASMmacroUSERmacroCONSTANTmacroBLOCK_ADDRESSmacroCONSTANT_AGGREGATE_ZEROmacroCONSTANT_ARRAYmacroCONSTANT_DATA_SEQUENTIALmacroCONSTANT_DATA_ARRAYmacroCONSTANT_DATA_VECTORmacroCONSTANT_EXPRmacroCONSTANT_FPmacroCONSTANT_INTmacroCONSTANT_POINTER_NULLmacroCONSTANT_STRUCTmacroCONSTANT_TOKEN_NONEmacroCONSTANT_VECTORmacroGLOBAL_VALUEmacroGLOBAL_ALIASmacroGLOBAL_OBJECTmacroFUNCTIONmacroGLOBAL_VARIABLEmacroUNDEF_VALUEmacroINSTRUCTIONmacroBINARY_OPERATORmacroCALL_INSTmacroINTRINSIC_INSTmacroDBG_INFO_INTRINSICmacroDBG_DECLARE_INSTmacroMEM_INTRINSICmacroMEM_CPY_INSTmacroMEM_MOVE_INSTmacroMEM_SET_INSTmacroCMP_INSTmacroF_CMP_INSTmacroI_CMP_INSTmacroEXTRACT_ELEMENT_INSTmacroGET_ELEMENT_PTR_INSTmacroINSERT_ELEMENT_INSTmacroINSERT_VALUE_INSTmacroLANDING_PAD_INSTmacroPHI_NODEmacroSELECT_INSTmacroSHUFFLE_VECTOR_INSTmacroSTORE_INSTmacroTERMINATOR_INSTmacroBRANCH_INSTmacroINDIRECT_BR_INSTmacroINVOKE_INSTmacroRETURN_INSTmacroSWITCH_INSTmacroUNREACHABLE_INSTmacroRESUME_INSTmacroCLEANUP_RETURN_INSTmacroCATCH_RETURN_INSTmacroFUNCLET_PAD_INSTmacroCATCH_PAD_INSTmacroCLEANUP_PAD_INSTmacroUNARY_INSTRUCTIONmacroALLOCA_INSTmacroCAST_INSTmacroADDR_SPACE_CAST_INSTmacroBIT_CAST_INSTmacroFP_EXT_INSTmacroFP_TO_SI_INSTmacroFP_TO_UI_INSTmacroFP_TRUNC_INSTmacroINT_TO_PTR_INSTmacroPTR_TO_INT_INSTmacroS_EXT_INSTmacroSI_TO_FP_INSTmacroTRUNC_INSTmacroUI_TO_FP_INSTmacroZ_EXT_INSTmacroEXTRACT_VALUE_INSTmacroLOAD_INSTmacroVA_ARG_INST
17
- end
18
-
19
15
  # (Not documented)
20
16
  #
21
17
  # @method load_library_permanently(filename)
@@ -1851,22 +1847,6 @@ module LLVM::C
1851
1847
  # @scope class
1852
1848
  attach_function :replace_all_uses_with, :LLVMReplaceAllUsesWith, [:pointer, :pointer], :void
1853
1849
 
1854
- # Determine whether the specified constant instance is constant.
1855
- #
1856
- # @method is_constant(val)
1857
- # @param [FFI::Pointer(ValueRef)] val
1858
- # @return [Integer]
1859
- # @scope class
1860
- attach_function :is_constant, :LLVMIsConstant, [:pointer], :int
1861
-
1862
- # Determine whether a value instance is undefined.
1863
- #
1864
- # @method is_undef(val)
1865
- # @param [FFI::Pointer(ValueRef)] val
1866
- # @return [Integer]
1867
- # @scope class
1868
- attach_function :is_undef, :LLVMIsUndef, [:pointer], :int
1869
-
1870
1850
  # (Not documented)
1871
1851
  #
1872
1852
  # @method is_a_argument(val)
@@ -2632,16 +2612,6 @@ module LLVM::C
2632
2612
  # @scope class
2633
2613
  attach_function :get_undef, :LLVMGetUndef, [:pointer], :pointer
2634
2614
 
2635
- # Determine whether a value instance is null.
2636
- #
2637
- # @see llvm::Constant::isNullValue()
2638
- #
2639
- # @method is_null(val)
2640
- # @param [FFI::Pointer(ValueRef)] val
2641
- # @return [Integer]
2642
- # @scope class
2643
- attach_function :is_null, :LLVMIsNull, [:pointer], :int
2644
-
2645
2615
  # Obtain a constant that is a constant pointer pointing to NULL for a
2646
2616
  # specified type.
2647
2617
  #
@@ -3456,14 +3426,6 @@ module LLVM::C
3456
3426
  # @scope class
3457
3427
  attach_function :set_initializer, :LLVMSetInitializer, [:pointer, :pointer], :void
3458
3428
 
3459
- # (Not documented)
3460
- #
3461
- # @method is_thread_local(global_var)
3462
- # @param [FFI::Pointer(ValueRef)] global_var
3463
- # @return [Integer]
3464
- # @scope class
3465
- attach_function :is_thread_local, :LLVMIsThreadLocal, [:pointer], :int
3466
-
3467
3429
  # (Not documented)
3468
3430
  #
3469
3431
  # @method set_thread_local(global_var, is_thread_local)
@@ -3473,14 +3435,6 @@ module LLVM::C
3473
3435
  # @scope class
3474
3436
  attach_function :set_thread_local, :LLVMSetThreadLocal, [:pointer, :int], :void
3475
3437
 
3476
- # (Not documented)
3477
- #
3478
- # @method is_global_constant(global_var)
3479
- # @param [FFI::Pointer(ValueRef)] global_var
3480
- # @return [Integer]
3481
- # @scope class
3482
- attach_function :is_global_constant, :LLVMIsGlobalConstant, [:pointer], :int
3483
-
3484
3438
  # (Not documented)
3485
3439
  #
3486
3440
  # @method set_global_constant(global_var, is_constant)
@@ -4568,20 +4522,6 @@ module LLVM::C
4568
4522
  # @scope class
4569
4523
  attach_function :build_indirect_br, :LLVMBuildIndirectBr, [:pointer, :pointer, :uint], :pointer
4570
4524
 
4571
- # (Not documented)
4572
- #
4573
- # @method build_invoke(builder_ref, fn, args, num_args, then_, catch, name)
4574
- # @param [FFI::Pointer(BuilderRef)] builder_ref
4575
- # @param [FFI::Pointer(ValueRef)] fn
4576
- # @param [FFI::Pointer(*ValueRef)] args
4577
- # @param [Integer] num_args
4578
- # @param [FFI::Pointer(BasicBlockRef)] then_
4579
- # @param [FFI::Pointer(BasicBlockRef)] catch
4580
- # @param [String] name
4581
- # @return [FFI::Pointer(ValueRef)]
4582
- # @scope class
4583
- attach_function :build_invoke, :LLVMBuildInvoke, [:pointer, :pointer, :pointer, :uint, :pointer, :pointer, :string], :pointer
4584
-
4585
4525
  # (Not documented)
4586
4526
  #
4587
4527
  # @method build_landing_pad(b, ty, pers_fn, num_clauses, name)
@@ -5036,16 +4976,6 @@ module LLVM::C
5036
4976
  # @scope class
5037
4977
  attach_function :build_free, :LLVMBuildFree, [:pointer, :pointer], :pointer
5038
4978
 
5039
- # (Not documented)
5040
- #
5041
- # @method build_load(builder_ref, pointer_val, name)
5042
- # @param [FFI::Pointer(BuilderRef)] builder_ref
5043
- # @param [FFI::Pointer(ValueRef)] pointer_val
5044
- # @param [String] name
5045
- # @return [FFI::Pointer(ValueRef)]
5046
- # @scope class
5047
- attach_function :build_load, :LLVMBuildLoad, [:pointer, :pointer, :string], :pointer
5048
-
5049
4979
  # (Not documented)
5050
4980
  #
5051
4981
  # @method build_store(builder_ref, val, ptr)
@@ -5056,41 +4986,6 @@ module LLVM::C
5056
4986
  # @scope class
5057
4987
  attach_function :build_store, :LLVMBuildStore, [:pointer, :pointer, :pointer], :pointer
5058
4988
 
5059
- # (Not documented)
5060
- #
5061
- # @method build_gep(b, pointer, indices, num_indices, name)
5062
- # @param [FFI::Pointer(BuilderRef)] b
5063
- # @param [FFI::Pointer(ValueRef)] pointer
5064
- # @param [FFI::Pointer(*ValueRef)] indices
5065
- # @param [Integer] num_indices
5066
- # @param [String] name
5067
- # @return [FFI::Pointer(ValueRef)]
5068
- # @scope class
5069
- attach_function :build_gep, :LLVMBuildGEP, [:pointer, :pointer, :pointer, :uint, :string], :pointer
5070
-
5071
- # (Not documented)
5072
- #
5073
- # @method build_in_bounds_gep(b, pointer, indices, num_indices, name)
5074
- # @param [FFI::Pointer(BuilderRef)] b
5075
- # @param [FFI::Pointer(ValueRef)] pointer
5076
- # @param [FFI::Pointer(*ValueRef)] indices
5077
- # @param [Integer] num_indices
5078
- # @param [String] name
5079
- # @return [FFI::Pointer(ValueRef)]
5080
- # @scope class
5081
- attach_function :build_in_bounds_gep, :LLVMBuildInBoundsGEP, [:pointer, :pointer, :pointer, :uint, :string], :pointer
5082
-
5083
- # (Not documented)
5084
- #
5085
- # @method build_struct_gep(b, pointer, idx, name)
5086
- # @param [FFI::Pointer(BuilderRef)] b
5087
- # @param [FFI::Pointer(ValueRef)] pointer
5088
- # @param [Integer] idx
5089
- # @param [String] name
5090
- # @return [FFI::Pointer(ValueRef)]
5091
- # @scope class
5092
- attach_function :build_struct_gep, :LLVMBuildStructGEP, [:pointer, :pointer, :uint, :string], :pointer
5093
-
5094
4989
  # (Not documented)
5095
4990
  #
5096
4991
  # @method build_global_string(b, str, name)
@@ -5400,18 +5295,6 @@ module LLVM::C
5400
5295
  # @scope class
5401
5296
  attach_function :build_phi, :LLVMBuildPhi, [:pointer, :pointer, :string], :pointer
5402
5297
 
5403
- # (Not documented)
5404
- #
5405
- # @method build_call(builder_ref, fn, args, num_args, name)
5406
- # @param [FFI::Pointer(BuilderRef)] builder_ref
5407
- # @param [FFI::Pointer(ValueRef)] fn
5408
- # @param [FFI::Pointer(*ValueRef)] args
5409
- # @param [Integer] num_args
5410
- # @param [String] name
5411
- # @return [FFI::Pointer(ValueRef)]
5412
- # @scope class
5413
- attach_function :build_call, :LLVMBuildCall, [:pointer, :pointer, :pointer, :uint, :string], :pointer
5414
-
5415
5298
  # (Not documented)
5416
5299
  #
5417
5300
  # @method build_select(builder_ref, if_, then_, else_, name)