ruby-llvm 16.0.0 → 16.0.1
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/config.rb +6 -6
- data/lib/llvm/core/builder.rb +36 -7
- data/lib/llvm/core/value.rb +10 -0
- data/lib/llvm/execution_engine.rb +2 -2
- data/lib/llvm/target.rb +9 -13
- data/lib/llvm/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6e1b8f07e635723694d6a987397f074c5433bcfad6867cb1832e71333c7a13e
|
|
4
|
+
data.tar.gz: 730e751e566373dc30950c08b12eafa665403ac635ffa6d33bb5324b56cd906d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1bbf9522c2c6a9782d46760138ff35ad5ed41b571bdd93425b3bc4d0d89992ec04cf904ec59fda21793a9edfa14ecb749128ccb4d03fa2a4b0801c5a22a61f9
|
|
7
|
+
data.tar.gz: 917666ebfceda78a79299df2849bf653dfdd2d723615ba6e105bf56f54ab95f3580158903a8b9b4702ffd32e0764b79d246bd1aecac35faac12eabd049f2d54d
|
|
@@ -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/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
|
+
fun = insert_block.parent.global_parent.functions[fun.to_s] unless fun.is_a?(LLVM::Value)
|
|
943
|
+
|
|
944
|
+
msg = "Function provided to call instruction was neither a value nor a function name: #{fun.inspect}"
|
|
945
|
+
raise ArgumentError, msg if fun.nil?
|
|
946
|
+
|
|
947
|
+
msg = "Type must be provided to call2 when function argument is not a function type: #{fun.inspect}"
|
|
948
|
+
raise ArgumentError, msg if !fun.is_a?(Function) && type.nil?
|
|
933
949
|
|
|
934
950
|
type ||= fun.function_type
|
|
935
951
|
must_be_type!(type)
|
|
936
952
|
|
|
937
|
-
|
|
938
|
-
|
|
953
|
+
[type, fun]
|
|
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
|
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)
|
|
@@ -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/target.rb
CHANGED
|
@@ -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/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-llvm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 16.0.
|
|
4
|
+
version: 16.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jesse Johnson
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2023-
|
|
12
|
+
date: 2023-12-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: ffi
|
|
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
238
238
|
- !ruby/object:Gem::Version
|
|
239
239
|
version: '0'
|
|
240
240
|
requirements: []
|
|
241
|
-
rubygems_version: 3.
|
|
241
|
+
rubygems_version: 3.4.21
|
|
242
242
|
signing_key:
|
|
243
243
|
specification_version: 4
|
|
244
244
|
summary: LLVM bindings for Ruby
|