ruby-llvm 16.0.1 → 17.0.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.
- checksums.yaml +4 -4
- data/lib/llvm/analysis_ffi.rb +1 -1
- data/lib/llvm/core/bitcode_ffi.rb +1 -1
- data/lib/llvm/core/builder.rb +7 -7
- data/lib/llvm/core/pass_manager.rb +2 -3
- data/lib/llvm/core/value.rb +27 -4
- data/lib/llvm/core.rb +1 -0
- data/lib/llvm/core_ffi.rb +1 -1
- data/lib/llvm/execution_engine_ffi.rb +1 -1
- data/lib/llvm/linker_ffi.rb +1 -1
- data/lib/llvm/target.rb +1 -1
- data/lib/llvm/target_ffi.rb +1 -1
- data/lib/llvm/transforms/ipo.rb +17 -23
- data/lib/llvm/transforms/pass_builder.rb +688 -0
- data/lib/llvm/transforms/{builder.rb → pass_manager_builder.rb} +10 -29
- data/lib/llvm/transforms/scalar.rb +45 -55
- data/lib/llvm/transforms/utils.rb +3 -7
- data/lib/llvm/transforms/vectorize.rb +3 -5
- data/lib/llvm/version.rb +3 -3
- data/lib/llvm.rb +2 -0
- metadata +4 -7
- data/lib/llvm/transforms/builder_ffi.rb +0 -106
- data/lib/llvm/transforms/ipo_ffi.rb +0 -111
- data/lib/llvm/transforms/scalar_ffi.rb +0 -320
- data/lib/llvm/transforms/vectorize_ffi.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48dcc8621dc724981ca68f91f7daa86461fbe5a80c278d58d89645d3730f34cc
|
4
|
+
data.tar.gz: a196abfcc5891316857476db99e8b734207d5dab498715ad8cd69bc8a1b69810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 735a272ae85c2a2a2a1d9cf1f13211a5404dfe7a0e118870f2335395f3e610f45b95c1212ffc3eceabc71e9e68aeb4d8140a416b42bb5918bd73319be723479d
|
7
|
+
data.tar.gz: 11b93cfed8118fd90d0c885190c323dc2d61a404050385c62acb23fa900d8b7a39f8d5c61f78dd39be98979c9b7062f45b069c4185c8fec6a82337e8083a2d54
|
data/lib/llvm/analysis_ffi.rb
CHANGED
data/lib/llvm/core/builder.rb
CHANGED
@@ -939,18 +939,18 @@ module LLVM
|
|
939
939
|
end
|
940
940
|
|
941
941
|
private def call2_infer_function_and_type(type, fun)
|
942
|
-
|
942
|
+
fun2 = fun.is_a?(LLVM::Value) ? fun : insert_block.parent.global_parent.functions[fun.to_s]
|
943
943
|
|
944
|
-
msg = "Function provided to call instruction was neither a value nor a function name:
|
945
|
-
raise ArgumentError, msg if
|
944
|
+
msg = "Function provided to call instruction was neither a value nor a function name:"
|
945
|
+
raise ArgumentError, "#{msg} #{fun}" if fun2.nil?
|
946
946
|
|
947
|
-
msg = "Type must be provided to call2 when function argument is not a function type:
|
948
|
-
raise ArgumentError, msg if !
|
947
|
+
msg = "Type must be provided to call2 when function argument is not a function type:"
|
948
|
+
raise ArgumentError, "#{msg} #{fun}" if !fun2.is_a?(Function) && type.nil?
|
949
949
|
|
950
|
-
type ||=
|
950
|
+
type ||= fun2.function_type
|
951
951
|
must_be_type!(type)
|
952
952
|
|
953
|
-
[type,
|
953
|
+
[type, fun2]
|
954
954
|
end
|
955
955
|
|
956
956
|
def call2(type, fun, *args)
|
@@ -13,9 +13,8 @@ module LLVM
|
|
13
13
|
#
|
14
14
|
# @param [LLVM::ExecutionEngine, LLVM::TargetMachine] machine
|
15
15
|
def initialize(machine = nil)
|
16
|
-
if machine
|
17
|
-
|
18
|
-
end
|
16
|
+
warn("[DEPRECATION] PassManager.new should be called without parameters") if machine
|
17
|
+
|
19
18
|
@ptr = C.create_pass_manager()
|
20
19
|
end
|
21
20
|
|
data/lib/llvm/core/value.rb
CHANGED
@@ -869,12 +869,16 @@ module LLVM
|
|
869
869
|
attr_ref = case attr
|
870
870
|
when Attribute
|
871
871
|
attr
|
872
|
-
when Symbol
|
872
|
+
when Symbol, String
|
873
873
|
attr_kind_id = attribute_id(attr)
|
874
|
-
|
875
|
-
|
874
|
+
if attr_kind_id.is_a?(Integer)
|
875
|
+
ctx = Context.global
|
876
|
+
C.create_enum_attribute(ctx, attr_kind_id, 0)
|
877
|
+
else
|
878
|
+
attr_kind_id
|
879
|
+
end
|
876
880
|
else
|
877
|
-
raise "Adding unknown attribute type"
|
881
|
+
raise "Adding unknown attribute type: #{attr.inspect}"
|
878
882
|
end
|
879
883
|
C.add_attribute_at_index(@fun, @index, attr_ref)
|
880
884
|
end
|
@@ -911,12 +915,31 @@ module LLVM
|
|
911
915
|
end
|
912
916
|
|
913
917
|
def attribute_id(attr_name)
|
918
|
+
upgrade = upgrade_attr(attr_name)
|
919
|
+
return upgrade if upgrade
|
920
|
+
|
914
921
|
attr_mem = FFI::MemoryPointer.from_string(attribute_name(attr_name))
|
915
922
|
attr_kind_id = C.get_enum_attribute_kind_for_name(attr_mem, attr_mem.size - 1)
|
916
923
|
|
917
924
|
raise "No attribute named: #{attr_name}" if attr_kind_id.zero?
|
918
925
|
attr_kind_id
|
919
926
|
end
|
927
|
+
|
928
|
+
# Upgrade attributes from before LLVM 16
|
929
|
+
# readnone, readonly, writeonly
|
930
|
+
def upgrade_attr(attr)
|
931
|
+
case attr.to_sym
|
932
|
+
when :readnone
|
933
|
+
LLVM::Attribute.memory
|
934
|
+
when :readonly
|
935
|
+
LLVM::Attribute.memory(memory: :read)
|
936
|
+
when :writeonly
|
937
|
+
LLVM::Attribute.memory(memory: :write)
|
938
|
+
when :inaccessiblememonly
|
939
|
+
LLVM::Attribute.memory(inaccessiblemem: :readwrite)
|
940
|
+
end
|
941
|
+
end
|
942
|
+
|
920
943
|
end
|
921
944
|
|
922
945
|
# @private
|
data/lib/llvm/core.rb
CHANGED
data/lib/llvm/core_ffi.rb
CHANGED
data/lib/llvm/linker_ffi.rb
CHANGED
data/lib/llvm/target.rb
CHANGED
data/lib/llvm/target_ffi.rb
CHANGED
data/lib/llvm/transforms/ipo.rb
CHANGED
@@ -3,122 +3,116 @@
|
|
3
3
|
# Interprocedural optimization (IPO)
|
4
4
|
require 'llvm'
|
5
5
|
require 'llvm/core'
|
6
|
-
require 'llvm/transforms/ipo_ffi'
|
7
6
|
|
8
7
|
module LLVM
|
9
8
|
class PassManager
|
10
9
|
# @LLVMpass arg_promotion
|
11
10
|
def arg_promote!
|
12
|
-
|
11
|
+
raise DeprecationError
|
13
12
|
end
|
14
13
|
|
15
14
|
# @LLVMpass const_merge
|
16
15
|
# /** See llvm::createConstantMergePass function. */
|
17
16
|
# void LLVMAddConstantMergePass(LLVMPassManagerRef PM);
|
18
17
|
def const_merge!
|
19
|
-
|
18
|
+
raise DeprecationError
|
20
19
|
end
|
21
20
|
|
22
21
|
# @LLVMpass mergefunc
|
23
22
|
# /** See llvm::createMergeFunctionsPass function. */
|
24
23
|
# void LLVMAddMergeFunctionsPass(LLVMPassManagerRef PM);
|
25
24
|
def mergefunc!
|
26
|
-
|
25
|
+
raise DeprecationError
|
27
26
|
end
|
28
27
|
|
29
28
|
# @LLVMpass called-value-propagation
|
30
29
|
# /** See llvm::createCalledValuePropagationPass function. */
|
31
30
|
# void LLVMAddCalledValuePropagationPass(LLVMPassManagerRef PM);
|
32
31
|
def called_value_propagation!
|
33
|
-
|
32
|
+
raise DeprecationError
|
34
33
|
end
|
35
34
|
|
36
35
|
# @LLVMpass dae
|
37
36
|
# /** See llvm::createDeadArgEliminationPass function. */
|
38
37
|
# void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM);
|
39
38
|
def dae!
|
40
|
-
|
39
|
+
raise DeprecationError
|
41
40
|
end
|
42
41
|
|
43
42
|
# @LLVMpass function_attrs
|
44
43
|
# /** See llvm::createFunctionAttrsPass function. */
|
45
44
|
# void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM);
|
46
45
|
def fun_attrs!
|
47
|
-
|
46
|
+
raise DeprecationError
|
48
47
|
end
|
49
48
|
|
50
49
|
# @LLVMpass inline
|
51
50
|
# /** See llvm::createFunctionInliningPass function. */
|
52
51
|
# void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM);
|
53
52
|
def inline!
|
54
|
-
|
53
|
+
raise DeprecationError
|
55
54
|
end
|
56
55
|
|
57
56
|
# @LLVMpass always_inline
|
58
57
|
# /** See llvm::createAlwaysInlinerPass function. */
|
59
58
|
# void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM);
|
60
59
|
def always_inline!
|
61
|
-
|
60
|
+
raise DeprecationError
|
62
61
|
end
|
63
62
|
|
64
63
|
# @LLVMpass gdce
|
65
64
|
# /** See llvm::createGlobalDCEPass function. */
|
66
65
|
# void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM);
|
67
66
|
def gdce!
|
68
|
-
|
67
|
+
raise DeprecationError
|
69
68
|
end
|
70
69
|
|
71
70
|
# @LLVMpass global_opt
|
72
71
|
# /** See llvm::createGlobalOptimizerPass function. */
|
73
72
|
# void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM);
|
74
73
|
def global_opt!
|
75
|
-
|
74
|
+
raise DeprecationError
|
76
75
|
end
|
77
76
|
|
78
77
|
# @LLVMpass ipcp
|
79
78
|
def ipcp!
|
80
|
-
|
79
|
+
raise DeprecationError
|
81
80
|
end
|
82
81
|
|
83
82
|
# @LLVMpass prune_eh
|
84
83
|
# /** See llvm::createPruneEHPass function. */
|
85
84
|
# void LLVMAddPruneEHPass(LLVMPassManagerRef PM);
|
86
85
|
def prune_eh!
|
87
|
-
|
86
|
+
raise DeprecationError
|
88
87
|
end
|
89
88
|
|
90
89
|
# @LLVMpass ipsccp
|
91
90
|
# /** See llvm::createIPSCCPPass function. */
|
92
91
|
# void LLVMAddIPSCCPPass(LLVMPassManagerRef PM);
|
93
92
|
def ipsccp!
|
94
|
-
|
93
|
+
raise DeprecationError
|
95
94
|
end
|
96
95
|
|
97
96
|
# @LLVMpass internalize
|
98
97
|
# /** See llvm::createInternalizePass function. */
|
99
98
|
# void LLVMAddInternalizePass(LLVMPassManagerRef, unsigned AllButMain);
|
100
|
-
def internalize!(
|
101
|
-
|
99
|
+
def internalize!(_all_but_main = true)
|
100
|
+
raise DeprecationError
|
102
101
|
end
|
103
102
|
|
104
103
|
# @LLVMpass sdp
|
105
104
|
# /** See llvm::createStripDeadPrototypesPass function. */
|
106
105
|
# void LLVMAddStripDeadPrototypesPass(LLVMPassManagerRef PM);
|
107
106
|
def sdp!
|
108
|
-
|
107
|
+
raise DeprecationError
|
109
108
|
end
|
110
109
|
|
111
110
|
# @LLVMpass strip
|
112
111
|
# /** See llvm::createStripSymbolsPass function. */
|
113
112
|
# void LLVMAddStripSymbolsPass(LLVMPassManagerRef PM);
|
114
113
|
def strip!
|
115
|
-
|
114
|
+
raise DeprecationError
|
116
115
|
end
|
117
116
|
|
118
117
|
end
|
119
|
-
|
120
|
-
module C
|
121
|
-
attach_function :add_merge_functions_pass, :LLVMAddMergeFunctionsPass, [:pointer], :void
|
122
|
-
attach_function :add_called_value_propagation_pass, :LLVMAddCalledValuePropagationPass, [:pointer], :void
|
123
|
-
end
|
124
118
|
end
|