ruby-llvm 16.0.0 → 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/ext/ruby-llvm-support/Rakefile +1 -3
- data/lib/llvm/analysis_ffi.rb +1 -1
- data/lib/llvm/config.rb +6 -6
- data/lib/llvm/core/bitcode_ffi.rb +1 -1
- data/lib/llvm/core/builder.rb +37 -8
- data/lib/llvm/core/pass_manager.rb +2 -3
- data/lib/llvm/core/value.rb +37 -4
- data/lib/llvm/core.rb +1 -0
- data/lib/llvm/core_ffi.rb +1 -1
- data/lib/llvm/execution_engine.rb +2 -2
- data/lib/llvm/execution_engine_ffi.rb +1 -1
- data/lib/llvm/linker_ffi.rb +1 -1
- data/lib/llvm/target.rb +10 -14
- 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 +5 -8
- 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
|
|
@@ -76,11 +76,9 @@ CLEAN.include(SUPPORT_LIB, CONFIG_MOD)
|
|
|
76
76
|
desc "Build the shared library and config module"
|
|
77
77
|
task :default => [SUPPORT_LIB, CONFIG_MOD]
|
|
78
78
|
|
|
79
|
-
# -I/usr/lib/llvm-14/include/c++/v1/ is needed for CI
|
|
80
79
|
file SUPPORT_LIB => %w(support.cpp) do |task|
|
|
81
|
-
clang_stdlib = CXX.match?(/^clang++/) ? "-stdlib=libc++" : ""
|
|
82
80
|
sh "#{CXX} -O3 -shared #{task.prerequisites.join(' ')} -l#{llvm_lib_name} " \
|
|
83
|
-
"#{invoke_llvm_config('--cxxflags --ldflags')} -
|
|
81
|
+
"#{invoke_llvm_config('--cxxflags --ldflags')} -fPIC -o #{SUPPORT_LIB}"
|
|
84
82
|
end
|
|
85
83
|
|
|
86
84
|
LLVM_CONFIG_OPTS = [
|
data/lib/llvm/analysis_ffi.rb
CHANGED
data/lib/llvm/config.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Generated by ruby-llvm. Please do not change this file by hand.
|
|
2
2
|
module LLVM
|
|
3
3
|
module CONFIG
|
|
4
|
-
VERSION = "
|
|
5
|
-
COMPONENTS = ["aarch64", "aarch64asmparser", "aarch64codegen", "aarch64desc", "aarch64disassembler", "aarch64info", "aarch64utils", "aggressiveinstcombine", "all", "all-targets", "amdgpu", "amdgpuasmparser", "amdgpucodegen", "amdgpudesc", "amdgpudisassembler", "amdgpuinfo", "amdgputargetmca", "amdgpuutils", "analysis", "arm", "armasmparser", "armcodegen", "armdesc", "armdisassembler", "arminfo", "armutils", "asmparser", "asmprinter", "avr", "avrasmparser", "avrcodegen", "avrdesc", "avrdisassembler", "avrinfo", "binaryformat", "bitreader", "bitstreamreader", "bitwriter", "bpf", "bpfasmparser", "bpfcodegen", "bpfdesc", "bpfdisassembler", "bpfinfo", "cfguard", "codegen", "core", "coroutines", "coverage", "debuginfocodeview", "debuginfodwarf", "debuginfogsym", "debuginfologicalview", "debuginfomsf", "debuginfopdb", "demangle", "dlltooldriver", "dwarflinker", "dwarflinkerparallel", "dwp", "engine", "executionengine", "extensions", "filecheck", "frontendhlsl", "frontendopenacc", "frontendopenmp", "fuzzercli", "fuzzmutate", "globalisel", "hexagon", "hexagonasmparser", "hexagoncodegen", "hexagondesc", "hexagondisassembler", "hexagoninfo", "instcombine", "instrumentation", "interfacestub", "interpreter", "ipo", "irprinter", "irreader", "jitlink", "lanai", "lanaiasmparser", "lanaicodegen", "lanaidesc", "lanaidisassembler", "lanaiinfo", "libdriver", "lineeditor", "linker", "loongarch", "loongarchasmparser", "loongarchcodegen", "loongarchdesc", "loongarchdisassembler", "loongarchinfo", "lto", "m68k", "m68kasmparser", "m68kcodegen", "m68kdesc", "m68kdisassembler", "m68kinfo", "mc", "mca", "mcdisassembler", "mcjit", "mcparser", "mips", "mipsasmparser", "mipscodegen", "mipsdesc", "mipsdisassembler", "mipsinfo", "mirparser", "msp430", "msp430asmparser", "msp430codegen", "msp430desc", "msp430disassembler", "msp430info", "native", "nativecodegen", "nvptx", "nvptxcodegen", "nvptxdesc", "nvptxinfo", "objcarcopts", "objcopy", "object", "objectyaml", "option", "orcjit", "orcshared", "orctargetprocess", "passes", "perfjitevents", "powerpc", "powerpcasmparser", "powerpccodegen", "powerpcdesc", "powerpcdisassembler", "powerpcinfo", "profiledata", "remarks", "riscv", "riscvasmparser", "riscvcodegen", "riscvdesc", "riscvdisassembler", "riscvinfo", "riscvtargetmca", "runtimedyld", "scalaropts", "selectiondag", "sparc", "sparcasmparser", "sparccodegen", "sparcdesc", "sparcdisassembler", "sparcinfo", "support", "symbolize", "systemz", "systemzasmparser", "systemzcodegen", "systemzdesc", "systemzdisassembler", "systemzinfo", "tablegen", "target", "targetparser", "textapi", "transformutils", "ve", "veasmparser", "vecodegen", "vectorize", "vedesc", "vedisassembler", "veinfo", "webassembly", "webassemblyasmparser", "webassemblycodegen", "webassemblydesc", "webassemblydisassembler", "webassemblyinfo", "webassemblyutils", "windowsdriver", "windowsmanifest", "x86", "x86asmparser", "x86codegen", "x86desc", "x86disassembler", "x86info", "x86targetmca", "xcore", "xcorecodegen", "xcoredesc", "xcoredisassembler", "xcoreinfo", "xray"]
|
|
6
|
-
TARGETS_BUILT = ["AArch64", "AMDGPU", "ARM", "AVR", "BPF", "Hexagon", "Lanai", "LoongArch", "Mips", "MSP430", "NVPTX", "PowerPC", "RISCV", "Sparc", "SystemZ", "VE", "WebAssembly", "X86", "XCore", "M68k"]
|
|
4
|
+
VERSION = "17.0.6"
|
|
5
|
+
COMPONENTS = ["aarch64", "aarch64asmparser", "aarch64codegen", "aarch64desc", "aarch64disassembler", "aarch64info", "aarch64utils", "aggressiveinstcombine", "all", "all-targets", "amdgpu", "amdgpuasmparser", "amdgpucodegen", "amdgpudesc", "amdgpudisassembler", "amdgpuinfo", "amdgputargetmca", "amdgpuutils", "analysis", "arm", "armasmparser", "armcodegen", "armdesc", "armdisassembler", "arminfo", "armutils", "asmparser", "asmprinter", "avr", "avrasmparser", "avrcodegen", "avrdesc", "avrdisassembler", "avrinfo", "binaryformat", "bitreader", "bitstreamreader", "bitwriter", "bpf", "bpfasmparser", "bpfcodegen", "bpfdesc", "bpfdisassembler", "bpfinfo", "cfguard", "codegen", "codegentypes", "core", "coroutines", "coverage", "debuginfobtf", "debuginfocodeview", "debuginfodwarf", "debuginfogsym", "debuginfologicalview", "debuginfomsf", "debuginfopdb", "demangle", "dlltooldriver", "dwarflinker", "dwarflinkerparallel", "dwp", "engine", "executionengine", "extensions", "filecheck", "frontendhlsl", "frontendopenacc", "frontendopenmp", "fuzzercli", "fuzzmutate", "globalisel", "hexagon", "hexagonasmparser", "hexagoncodegen", "hexagondesc", "hexagondisassembler", "hexagoninfo", "instcombine", "instrumentation", "interfacestub", "interpreter", "ipo", "irprinter", "irreader", "jitlink", "lanai", "lanaiasmparser", "lanaicodegen", "lanaidesc", "lanaidisassembler", "lanaiinfo", "libdriver", "lineeditor", "linker", "loongarch", "loongarchasmparser", "loongarchcodegen", "loongarchdesc", "loongarchdisassembler", "loongarchinfo", "lto", "m68k", "m68kasmparser", "m68kcodegen", "m68kdesc", "m68kdisassembler", "m68kinfo", "mc", "mca", "mcdisassembler", "mcjit", "mcparser", "mips", "mipsasmparser", "mipscodegen", "mipsdesc", "mipsdisassembler", "mipsinfo", "mirparser", "msp430", "msp430asmparser", "msp430codegen", "msp430desc", "msp430disassembler", "msp430info", "native", "nativecodegen", "nvptx", "nvptxcodegen", "nvptxdesc", "nvptxinfo", "objcarcopts", "objcopy", "object", "objectyaml", "option", "orcjit", "orcshared", "orctargetprocess", "passes", "perfjitevents", "powerpc", "powerpcasmparser", "powerpccodegen", "powerpcdesc", "powerpcdisassembler", "powerpcinfo", "profiledata", "remarks", "riscv", "riscvasmparser", "riscvcodegen", "riscvdesc", "riscvdisassembler", "riscvinfo", "riscvtargetmca", "runtimedyld", "scalaropts", "selectiondag", "sparc", "sparcasmparser", "sparccodegen", "sparcdesc", "sparcdisassembler", "sparcinfo", "support", "symbolize", "systemz", "systemzasmparser", "systemzcodegen", "systemzdesc", "systemzdisassembler", "systemzinfo", "tablegen", "target", "targetparser", "textapi", "transformutils", "ve", "veasmparser", "vecodegen", "vectorize", "vedesc", "vedisassembler", "veinfo", "webassembly", "webassemblyasmparser", "webassemblycodegen", "webassemblydesc", "webassemblydisassembler", "webassemblyinfo", "webassemblyutils", "windowsdriver", "windowsmanifest", "x86", "x86asmparser", "x86codegen", "x86desc", "x86disassembler", "x86info", "x86targetmca", "xcore", "xcorecodegen", "xcoredesc", "xcoredisassembler", "xcoreinfo", "xray", "xtensa", "xtensaasmparser", "xtensacodegen", "xtensadesc", "xtensadisassembler", "xtensainfo"]
|
|
6
|
+
TARGETS_BUILT = ["AArch64", "AMDGPU", "ARM", "AVR", "BPF", "Hexagon", "Lanai", "LoongArch", "Mips", "MSP430", "NVPTX", "PowerPC", "RISCV", "Sparc", "SystemZ", "VE", "WebAssembly", "X86", "XCore", "M68k", "Xtensa"]
|
|
7
7
|
HOST_TARGET = "x86_64-pc-linux-gnu"
|
|
8
8
|
BUILD_MODE = "RelWithDebInfo"
|
|
9
|
-
CFLAGS = "-I/usr/lib/llvm-
|
|
10
|
-
CXXFLAGS = "-I/usr/lib/llvm-
|
|
11
|
-
LDFLAGS = "-L/usr/lib/llvm-
|
|
9
|
+
CFLAGS = "-I/usr/lib/llvm-17/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
|
|
10
|
+
CXXFLAGS = "-I/usr/lib/llvm-17/include -std=c++17 -fno-exceptions -funwind-tables -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
|
|
11
|
+
LDFLAGS = "-L/usr/lib/llvm-17/lib"
|
|
12
12
|
end
|
|
13
13
|
end
|
data/lib/llvm/core/builder.rb
CHANGED
|
@@ -127,7 +127,7 @@ module LLVM
|
|
|
127
127
|
C.build_cond_br(self, cond2, iftrue, iffalse))
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
-
private def cond_condition(cond)
|
|
130
|
+
private def cond_condition(cond)
|
|
131
131
|
case cond
|
|
132
132
|
when LLVM::Value
|
|
133
133
|
cond_type = cond.type
|
|
@@ -389,6 +389,16 @@ module LLVM
|
|
|
389
389
|
Instruction.from_ptr(C.build_f_rem(self, lhs, rhs, name))
|
|
390
390
|
end
|
|
391
391
|
|
|
392
|
+
# The ‘fneg’ instruction returns the negation of its operand.
|
|
393
|
+
# @param [LLVM::Value] lhs Floating point or vector of floating points
|
|
394
|
+
# @param [String] name Name of the result in LLVM IR
|
|
395
|
+
# @return [LLVM::Instruction] The floating point negation
|
|
396
|
+
# @LLVMinst fneg
|
|
397
|
+
# https://llvm.org/docs/LangRef.html#fneg-instruction
|
|
398
|
+
def fneg(lhs, name = "")
|
|
399
|
+
Instruction.from_ptr(C.build_f_neg(self, lhs, name))
|
|
400
|
+
end
|
|
401
|
+
|
|
392
402
|
# @param [LLVM::Value] lhs Integer or vector of integers
|
|
393
403
|
# @param [LLVM::Value] rhs Integer or vector of integers
|
|
394
404
|
# @param [String] name Name of the result in LLVM IR
|
|
@@ -928,22 +938,41 @@ module LLVM
|
|
|
928
938
|
call2(nil, fun, *args)
|
|
929
939
|
end
|
|
930
940
|
|
|
931
|
-
def
|
|
932
|
-
|
|
941
|
+
private def call2_infer_function_and_type(type, fun)
|
|
942
|
+
fun2 = fun.is_a?(LLVM::Value) ? fun : insert_block.parent.global_parent.functions[fun.to_s]
|
|
943
|
+
|
|
944
|
+
msg = "Function provided to call instruction was neither a value nor a function name:"
|
|
945
|
+
raise ArgumentError, "#{msg} #{fun}" if fun2.nil?
|
|
946
|
+
|
|
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?
|
|
933
949
|
|
|
934
|
-
type ||=
|
|
950
|
+
type ||= fun2.function_type
|
|
935
951
|
must_be_type!(type)
|
|
936
952
|
|
|
937
|
-
|
|
938
|
-
|
|
953
|
+
[type, fun2]
|
|
954
|
+
end
|
|
955
|
+
|
|
956
|
+
def call2(type, fun, *args)
|
|
957
|
+
type, fun = call2_infer_function_and_type(type, fun)
|
|
958
|
+
|
|
959
|
+
name = if args.last.kind_of? String
|
|
960
|
+
args.pop
|
|
939
961
|
else
|
|
940
|
-
|
|
962
|
+
""
|
|
941
963
|
end
|
|
942
964
|
|
|
943
965
|
args_ptr = FFI::MemoryPointer.new(FFI.type_size(:pointer) * args.size)
|
|
944
966
|
args_ptr.write_array_of_pointer(args)
|
|
945
967
|
ins = C.build_call2(self, type, fun, args_ptr, args.size, name)
|
|
946
|
-
|
|
968
|
+
|
|
969
|
+
call_inst = CallInst.from_ptr(ins)
|
|
970
|
+
|
|
971
|
+
if fun.is_a?(Function)
|
|
972
|
+
call_inst.call_conv = fun.call_conv
|
|
973
|
+
end
|
|
974
|
+
|
|
975
|
+
call_inst
|
|
947
976
|
end
|
|
948
977
|
|
|
949
978
|
# Return a value based on a condition. This differs from 'cond' in that
|
|
@@ -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
|
@@ -121,6 +121,11 @@ module LLVM
|
|
|
121
121
|
fun.remove_attribute(attr, index)
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
+
# Get the parent module of a global variable, including functions
|
|
125
|
+
def global_parent
|
|
126
|
+
LLVM::Module.from_ptr(C.get_global_parent(self))
|
|
127
|
+
end
|
|
128
|
+
|
|
124
129
|
private
|
|
125
130
|
|
|
126
131
|
# get function this param belongs to
|
|
@@ -800,6 +805,11 @@ module LLVM
|
|
|
800
805
|
conv
|
|
801
806
|
end
|
|
802
807
|
|
|
808
|
+
# gets the calling convention of the function
|
|
809
|
+
def call_conv
|
|
810
|
+
C.get_function_call_conv(self)
|
|
811
|
+
end
|
|
812
|
+
|
|
803
813
|
# Returns an Enumerable of the BasicBlocks in this function.
|
|
804
814
|
def basic_blocks
|
|
805
815
|
@basic_block_collection ||= BasicBlockCollection.new(self)
|
|
@@ -859,12 +869,16 @@ module LLVM
|
|
|
859
869
|
attr_ref = case attr
|
|
860
870
|
when Attribute
|
|
861
871
|
attr
|
|
862
|
-
when Symbol
|
|
872
|
+
when Symbol, String
|
|
863
873
|
attr_kind_id = attribute_id(attr)
|
|
864
|
-
|
|
865
|
-
|
|
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
|
|
866
880
|
else
|
|
867
|
-
raise "Adding unknown attribute type"
|
|
881
|
+
raise "Adding unknown attribute type: #{attr.inspect}"
|
|
868
882
|
end
|
|
869
883
|
C.add_attribute_at_index(@fun, @index, attr_ref)
|
|
870
884
|
end
|
|
@@ -901,12 +915,31 @@ module LLVM
|
|
|
901
915
|
end
|
|
902
916
|
|
|
903
917
|
def attribute_id(attr_name)
|
|
918
|
+
upgrade = upgrade_attr(attr_name)
|
|
919
|
+
return upgrade if upgrade
|
|
920
|
+
|
|
904
921
|
attr_mem = FFI::MemoryPointer.from_string(attribute_name(attr_name))
|
|
905
922
|
attr_kind_id = C.get_enum_attribute_kind_for_name(attr_mem, attr_mem.size - 1)
|
|
906
923
|
|
|
907
924
|
raise "No attribute named: #{attr_name}" if attr_kind_id.zero?
|
|
908
925
|
attr_kind_id
|
|
909
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
|
+
|
|
910
943
|
end
|
|
911
944
|
|
|
912
945
|
# @private
|
data/lib/llvm/core.rb
CHANGED
data/lib/llvm/core_ffi.rb
CHANGED
|
@@ -204,7 +204,7 @@ module LLVM
|
|
|
204
204
|
if type.width <= 8
|
|
205
205
|
:int8
|
|
206
206
|
else
|
|
207
|
-
"int#{type.width}"
|
|
207
|
+
:"int#{type.width}"
|
|
208
208
|
end
|
|
209
209
|
else
|
|
210
210
|
type.kind
|
|
@@ -280,7 +280,7 @@ module LLVM
|
|
|
280
280
|
|
|
281
281
|
# Creates a GenericValue from a Ruby boolean.
|
|
282
282
|
def self.from_b(b)
|
|
283
|
-
from_i(b ? 1 : 0, LLVM::Int1, false)
|
|
283
|
+
from_i(b ? 1 : 0, type: LLVM::Int1, signed: false)
|
|
284
284
|
end
|
|
285
285
|
|
|
286
286
|
# Creates a GenericValue from an FFI::Pointer pointing to some arbitrary value.
|
data/lib/llvm/linker_ffi.rb
CHANGED
data/lib/llvm/target.rb
CHANGED
|
@@ -25,7 +25,7 @@ module LLVM
|
|
|
25
25
|
|
|
26
26
|
module TargetModule
|
|
27
27
|
extend FFI::Library
|
|
28
|
-
ffi_lib ["libLLVM-
|
|
28
|
+
ffi_lib ["libLLVM-17.so.1", "libLLVM.so.17", "LLVM-17"]
|
|
29
29
|
|
|
30
30
|
def self.safe_attach_function(*args)
|
|
31
31
|
attach_function(*args)
|
|
@@ -37,19 +37,15 @@ module LLVM
|
|
|
37
37
|
def self.init(target, asm_printer = false)
|
|
38
38
|
target_module = TargetModule.dup
|
|
39
39
|
target_module.module_eval do
|
|
40
|
-
attach_function :"initialize_target_info_#{target}",
|
|
41
|
-
|
|
42
|
-
attach_function :"initialize_target_#{target}",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
safe_attach_function :"initialize_#{target}_asm_parser",
|
|
50
|
-
:"LLVMInitialize#{target}AsmParser", [], :void
|
|
51
|
-
safe_attach_function :"initialize_#{target}_disassembler",
|
|
52
|
-
:"LLVMInitialize#{target}Disassembler", [], :void
|
|
40
|
+
attach_function :"initialize_target_info_#{target}", :"LLVMInitialize#{target}TargetInfo", [], :void
|
|
41
|
+
attach_function :"initialize_target_#{target}", :"LLVMInitialize#{target}Target", [], :void
|
|
42
|
+
attach_function :"initialize_target_#{target}_mc", :"LLVMInitialize#{target}TargetMC", [], :void
|
|
43
|
+
|
|
44
|
+
if asm_printer
|
|
45
|
+
attach_function(:"initialize_#{target}_asm_printer", :"LLVMInitialize#{target}AsmPrinter", [], :void)
|
|
46
|
+
end
|
|
47
|
+
safe_attach_function :"initialize_#{target}_asm_parser", :"LLVMInitialize#{target}AsmParser", [], :void
|
|
48
|
+
safe_attach_function :"initialize_#{target}_disassembler", :"LLVMInitialize#{target}Disassembler", [], :void
|
|
53
49
|
end
|
|
54
50
|
|
|
55
51
|
C.extend(target_module)
|
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
|