ruby-llvm 14.0.0 → 15.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1d0074cad05a1c8a459d24ebc3fcba079751abee5eaeb8476866a0fe42e738f
4
- data.tar.gz: 8fb9c8dc932a1e7a17883f88b13850e06bb4c7dc967ee195477f95994f0411b8
3
+ metadata.gz: 1595f619407ef3dcb3bf455c4b14dc5843accc2f42854cf9b3bf46f378fcea40
4
+ data.tar.gz: 1cf2978bf457a6f45b19483570bef9ef1a0b6730bb90786895a6dd86950ab24b
5
5
  SHA512:
6
- metadata.gz: 5b89b7abb7d3ba845f6de9b45d689a5a228ad651f04d2cdc19d8aaa7e0ca9827fa6df4a7af839f3621fd97507148231dea560e4681cbc286d928238629bc55c4
7
- data.tar.gz: 74f2cd597179ce96cdf23cbf210d1c506f219a31048ef428b3ba036ad26dfda02f80ecf68a0031b36e6549fa6e010055b9340bc7c8dd8384385730a24761c7db
6
+ metadata.gz: 7a49ba3ff1bf07d0f529b54e82b696c1bb6c1dae57f126204f9fec56781e4a625a7d6f0b80d638598f63f009658f02e9a9dc4d7542bee10bae58501ab53220ec
7
+ data.tar.gz: f0b87e6e18742252858ace4e0e2366f98270feebfc4d948291abe8ba0306a957c17b1b59cc7ae081a6c4c30e294892d899148ce3ed8ad4d6f7abdaadf0c64424
data/README.md CHANGED
@@ -14,7 +14,7 @@ computationally intensive algorithms on the fly.
14
14
  Current version
15
15
  ---------------
16
16
 
17
- This library currently binds to LLVM-13 (specifically llvm-c 13).
17
+ This library currently binds to LLVM-15 (specifically llvm-c 15).
18
18
 
19
19
  About version numbers
20
20
  ---------------------
@@ -46,7 +46,7 @@ def find_llvm_config
46
46
  end
47
47
 
48
48
  def find_cxx
49
- check_for('C++ compiler', %W(g++ clang++), 'CXX') do |cxx|
49
+ check_for('C++ compiler', %W(clang++-#{LLVM_VERSION} clang++ g++), 'CXX') do |cxx|
50
50
  system(cxx, "--version", out: File::NULL, err: File::NULL)
51
51
  $?.success?
52
52
  end
@@ -56,7 +56,7 @@ LLVM_CONFIG = find_llvm_config
56
56
  CXX = find_cxx
57
57
 
58
58
  def invoke_llvm_config(options)
59
- `#{LLVM_CONFIG} #{options}`.tr("\n", " ")
59
+ `#{LLVM_CONFIG} #{options}`.tr("\n", " ").strip
60
60
  end
61
61
 
62
62
  def llvm_lib_name
@@ -77,8 +77,9 @@ desc "Build the shared library and config module"
77
77
  task :default => [SUPPORT_LIB, CONFIG_MOD]
78
78
 
79
79
  file SUPPORT_LIB => %w(support.cpp) do |task|
80
- sh "#{CXX} -shared #{task.prerequisites.join(' ')} -l#{llvm_lib_name} " \
81
- "#{invoke_llvm_config('--cxxflags --ldflags')} -fPIC -o #{SUPPORT_LIB}"
80
+ clang_stdlib = CXX =~ /^clang++/ ? "-stdlib=libc++" : ""
81
+ sh "#{CXX} -O3 -shared #{task.prerequisites.join(' ')} -l#{llvm_lib_name} " \
82
+ "#{invoke_llvm_config('--cxxflags --ldflags')} -fPIC #{clang_stdlib} -o #{SUPPORT_LIB}"
82
83
  end
83
84
 
84
85
  LLVM_CONFIG_OPTS = [
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib ["libLLVM-14.so.1", "libLLVM.so.14", "LLVM-14"]
7
+ ffi_lib ["libLLVM-15.so.1", "libLLVM.so.15", "LLVM-15"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
data/lib/llvm/config.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  # Generated by ruby-llvm. Please do not change this file by hand.
2
2
  module LLVM
3
3
  module CONFIG
4
- COMPONENTS = ["aarch64", "aarch64asmparser", "aarch64codegen", "aarch64desc", "aarch64disassembler", "aarch64info", "aarch64utils", "aggressiveinstcombine", "all", "all-targets", "amdgpu", "amdgpuasmparser", "amdgpucodegen", "amdgpudesc", "amdgpudisassembler", "amdgpuinfo", "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", "debuginfomsf", "debuginfopdb", "demangle", "dlltooldriver", "dwarflinker", "engine", "executionengine", "frontendopenmp", "fuzzmutate", "globalisel", "hexagon", "hexagonasmparser", "hexagoncodegen", "hexagondesc", "hexagondisassembler", "hexagoninfo", "instcombine", "instrumentation", "interpreter", "ipo", "irreader", "jitlink", "lanai", "lanaiasmparser", "lanaicodegen", "lanaidesc", "lanaidisassembler", "lanaiinfo", "libdriver", "lineeditor", "linker", "lto", "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", "object", "objectyaml", "option", "orcerror", "orcjit", "passes", "perfjitevents", "powerpc", "powerpcasmparser", "powerpccodegen", "powerpcdesc", "powerpcdisassembler", "powerpcinfo", "profiledata", "remarks", "riscv", "riscvasmparser", "riscvcodegen", "riscvdesc", "riscvdisassembler", "riscvinfo", "riscvutils", "runtimedyld", "scalaropts", "selectiondag", "sparc", "sparcasmparser", "sparccodegen", "sparcdesc", "sparcdisassembler", "sparcinfo", "support", "symbolize", "systemz", "systemzasmparser", "systemzcodegen", "systemzdesc", "systemzdisassembler", "systemzinfo", "tablegen", "target", "textapi", "transformutils", "vectorize", "webassembly", "webassemblyasmparser", "webassemblycodegen", "webassemblydesc", "webassemblydisassembler", "webassemblyinfo", "windowsmanifest", "x86", "x86asmparser", "x86codegen", "x86desc", "x86disassembler", "x86info", "x86utils", "xcore", "xcorecodegen", "xcoredesc", "xcoredisassembler", "xcoreinfo", "xray"]
5
- TARGETS_BUILT = ["AArch64", "AMDGPU", "ARM", "BPF", "Hexagon", "Lanai", "Mips", "MSP430", "NVPTX", "PowerPC", "RISCV", "Sparc", "SystemZ", "WebAssembly", "X86", "XCore", "AVR"]
6
- HOST_TARGET = "x86_64-pc-linux-gnu "
7
- BUILD_MODE = "RelWithDebInfo "
8
- CFLAGS = "-I/usr/lib/llvm-11/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS "
4
+ 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", "debuginfomsf", "debuginfopdb", "demangle", "dlltooldriver", "dwarflinker", "dwp", "engine", "executionengine", "extensions", "filecheck", "frontendopenacc", "frontendopenmp", "fuzzercli", "fuzzmutate", "globalisel", "hexagon", "hexagonasmparser", "hexagoncodegen", "hexagondesc", "hexagondisassembler", "hexagoninfo", "instcombine", "instrumentation", "interfacestub", "interpreter", "ipo", "irreader", "jitlink", "lanai", "lanaiasmparser", "lanaicodegen", "lanaidesc", "lanaidisassembler", "lanaiinfo", "libdriver", "lineeditor", "linker", "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", "runtimedyld", "scalaropts", "selectiondag", "sparc", "sparcasmparser", "sparccodegen", "sparcdesc", "sparcdisassembler", "sparcinfo", "support", "symbolize", "systemz", "systemzasmparser", "systemzcodegen", "systemzdesc", "systemzdisassembler", "systemzinfo", "tablegen", "target", "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"]
5
+ TARGETS_BUILT = ["AArch64", "AMDGPU", "ARM", "AVR", "BPF", "Hexagon", "Lanai", "Mips", "MSP430", "NVPTX", "PowerPC", "RISCV", "Sparc", "SystemZ", "VE", "WebAssembly", "X86", "XCore", "M68k"]
6
+ HOST_TARGET = "x86_64-pc-linux-gnu"
7
+ BUILD_MODE = "Release"
8
+ CFLAGS = "-I/usr/lib/llvm-15/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
9
9
  end
10
10
  end
@@ -9,8 +9,8 @@ module LLVM
9
9
  # @return [LLVM::Module]
10
10
  def self.parse_bitcode(path_or_memory_buffer)
11
11
  memory_buffer = case path_or_memory_buffer
12
- when MemoryBuffer then path_or_memory_buffer
13
- else MemoryBuffer.from_file(path_or_memory_buffer)
12
+ when MemoryBuffer then path_or_memory_buffer
13
+ else MemoryBuffer.from_file(path_or_memory_buffer)
14
14
  end
15
15
  FFI::MemoryPointer.new(:pointer) do |mod_ref|
16
16
  FFI::MemoryPointer.new(:pointer) do |msg_ref|
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib ["libLLVM-14.so.1", "libLLVM.so.14", "LLVM-14"]
7
+ ffi_lib ["libLLVM-15.so.1", "libLLVM.so.15", "LLVM-15"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -169,12 +169,20 @@ module LLVM
169
169
  # unwind instruction occurs
170
170
  # @LLVMinst invoke
171
171
  def invoke(fun, args, normal, exception, name = "")
172
+ invoke2(nil, fun, args, normal, exception, name)
173
+ end
174
+
175
+ def invoke2(type, fun, args, normal, exception, name = "")
176
+ raise ArgumentError, "Trying to build LLVM call with non-function: #{fun.inspect}" if !fun.is_a?(LLVM::Function)
177
+
178
+ type ||= fun.return_type
179
+ must_be_type!(type)
180
+
172
181
  s = args.size
173
182
  FFI::MemoryPointer.new(FFI.type_size(:pointer) * s) do |args_ptr|
174
183
  args_ptr.write_array_of_pointer(args)
175
- return Instruction.from_ptr(
176
- C.build_invoke(self,
177
- fun, args_ptr, s, normal, exception, name))
184
+ ins = C.build_invoke2(self, type, fun, args_ptr, s, normal, exception, name)
185
+ return Instruction.from_ptr(ins)
178
186
  end
179
187
  end
180
188
 
@@ -524,7 +532,17 @@ module LLVM
524
532
  # a value of the pointer's type.
525
533
  # @LLVMinst load
526
534
  def load(ptr, name = "")
527
- Instruction.from_ptr(C.build_load(self, ptr, name))
535
+ load2(nil, ptr, name)
536
+ end
537
+
538
+ def load2(type, ptr, name = "")
539
+ must_be_value!(ptr)
540
+
541
+ type ||= infer_type(ptr)
542
+ must_be_type!(type)
543
+
544
+ load = C.build_load2(self, type, ptr, name)
545
+ Instruction.from_ptr(load)
528
546
  end
529
547
 
530
548
  # Store a value at a given pointer
@@ -546,11 +564,29 @@ module LLVM
546
564
  # @LLVMinst gep
547
565
  # @see http://llvm.org/docs/GetElementPtr.html
548
566
  def gep(ptr, indices, name = "")
567
+ gep2(nil, ptr, indices, name)
568
+ end
569
+
570
+ # Obtain a pointer to the element at the given indices
571
+ # @param [LLVM::Type] type An LLVM::Type
572
+ # @param [LLVM::Value] ptr A pointer to an aggregate value
573
+ # @param [Array<LLVM::Value>] indices Ruby array of LLVM::Value representing
574
+ # indices into the aggregate
575
+ # @param [String] name The name of the result in LLVM IR
576
+ # @return [LLVM::Instruction] The resulting pointer
577
+ # @LLVMinst gep2
578
+ # @see http://llvm.org/docs/GetElementPtr.html
579
+ def gep2(type, ptr, indices, name)
580
+ must_be_value!(ptr)
581
+
582
+ type ||= must_infer_type!(ptr)
583
+ must_be_type!(type)
584
+
549
585
  indices = Array(indices)
550
586
  FFI::MemoryPointer.new(FFI.type_size(:pointer) * indices.size) do |indices_ptr|
551
587
  indices_ptr.write_array_of_pointer(indices)
552
- return Instruction.from_ptr(
553
- C.build_gep(self, ptr, indices_ptr, indices.size, name))
588
+ ins = C.build_gep2(self, type, ptr, indices_ptr, indices.size, name)
589
+ return Instruction.from_ptr(ins)
554
590
  end
555
591
  end
556
592
 
@@ -564,25 +600,44 @@ module LLVM
564
600
  # @LLVMinst gep
565
601
  # @see http://llvm.org/docs/GetElementPtr.html
566
602
  def inbounds_gep(ptr, indices, name = "")
603
+ inbounds_gep2(nil, ptr, indices, name)
604
+ end
605
+
606
+ def inbounds_gep2(type, ptr, indices, name = "")
607
+ must_be_value!(ptr)
608
+
609
+ type = must_infer_type!(ptr)
610
+ must_be_type!(type)
611
+
567
612
  indices = Array(indices)
568
613
  FFI::MemoryPointer.new(FFI.type_size(:pointer) * indices.size) do |indices_ptr|
569
614
  indices_ptr.write_array_of_pointer(indices)
570
- return Instruction.from_ptr(
571
- C.build_in_bounds_gep(self, ptr, indices_ptr, indices.size, name))
615
+ ins = C.build_inbounds_gep2(self, type, ptr, indices_ptr, indices.size, name)
616
+ return Instruction.from_ptr(ins)
572
617
  end
573
618
  end
574
619
 
575
620
  # Builds a struct getelementptr Instruction.
576
621
  #
577
- # @param [LLVM::Value] pointer A pointer to a structure
622
+ # @param [LLVM::Value] ptr A pointer to a structure
578
623
  # @param [LLVM::Value] idx Unsigned integer representing the index of a
579
624
  # structure member
580
625
  # @param [String] name The name of the result in LLVM IR
581
626
  # @return [LLVM::Instruction] The resulting pointer
582
627
  # @LLVMinst gep
583
628
  # @see http://llvm.org/docs/GetElementPtr.html
584
- def struct_gep(pointer, idx, name = "")
585
- Instruction.from_ptr(C.build_struct_gep(self, pointer, idx, name))
629
+ def struct_gep(ptr, idx, name = "")
630
+ struct_gep2(nil, ptr, idx, name)
631
+ end
632
+
633
+ def struct_gep2(type, ptr, idx, name)
634
+ must_be_value!(ptr)
635
+
636
+ type ||= must_infer_type!(ptr)
637
+ must_be_type!(type)
638
+
639
+ ins = C.build_struct_gep2(self, type, ptr, idx, name)
640
+ Instruction.from_ptr(ins)
586
641
  end
587
642
 
588
643
  # Creates a global string initialized to a given value.
@@ -868,8 +923,15 @@ module LLVM
868
923
  # @param [LLVM::Instruction]
869
924
  # @LLVMinst call
870
925
  def call(fun, *args)
926
+ call2(nil, fun, *args)
927
+ end
928
+
929
+ def call2(type, fun, *args)
871
930
  raise ArgumentError, "Trying to build LLVM call with non-function: #{fun.inspect}" if !fun.is_a?(LLVM::Function)
872
931
 
932
+ type ||= fun.function_type
933
+ must_be_type!(type)
934
+
873
935
  if args.last.kind_of? String
874
936
  name = args.pop
875
937
  else
@@ -878,7 +940,8 @@ module LLVM
878
940
 
879
941
  args_ptr = FFI::MemoryPointer.new(FFI.type_size(:pointer) * args.size)
880
942
  args_ptr.write_array_of_pointer(args)
881
- CallInst.from_ptr(C.build_call(self, fun, args_ptr, args.size, name))
943
+ ins = C.build_call2(self, type, fun, args_ptr, args.size, name)
944
+ CallInst.from_ptr(ins)
882
945
  end
883
946
 
884
947
  # Return a value based on a condition. This differs from 'cond' in that
@@ -908,7 +971,8 @@ module LLVM
908
971
 
909
972
  raise ArgumentError, "Error building extract_element with #{error}" if error
910
973
 
911
- Instruction.from_ptr(C.build_extract_element(self, vector, idx, name))
974
+ ins = C.build_extract_element(self, vector, idx, name)
975
+ Instruction.from_ptr(ins)
912
976
  end
913
977
 
914
978
  # Insert an element into a vector
@@ -927,17 +991,8 @@ module LLVM
927
991
 
928
992
  raise ArgumentError, "Error building insert_element with #{error}" if error
929
993
 
930
- Instruction.from_ptr(C.build_insert_element(self, vector, elem, idx, name))
931
- end
932
-
933
- private def element_error(vector, idx) # rubocop:disable Style/AccessModifierDeclarations
934
- if !vector.is_a?(LLVM::Value)
935
- "non-value: #{vector.inspect}"
936
- elsif vector.type.kind != :vector
937
- "non-vector: #{vector.type.kind}"
938
- elsif !idx.is_a?(LLVM::Value)
939
- "index: #{idx}"
940
- end
994
+ ins = C.build_insert_element(self, vector, elem, idx, name)
995
+ Instruction.from_ptr(ins)
941
996
  end
942
997
 
943
998
  # Shuffle two vectors according to a given mask
@@ -963,7 +1018,8 @@ module LLVM
963
1018
 
964
1019
  raise ArgumentError, "Error building extract_value with #{error}" if error
965
1020
 
966
- Instruction.from_ptr(C.build_extract_value(self, aggregate, idx, name))
1021
+ ins = C.build_extract_value(self, aggregate, idx, name)
1022
+ Instruction.from_ptr(ins)
967
1023
  end
968
1024
 
969
1025
  # Insert a value into an aggregate value's member field
@@ -982,17 +1038,8 @@ module LLVM
982
1038
 
983
1039
  raise ArgumentError, "Error building insert_value with #{error}" if error
984
1040
 
985
- Instruction.from_ptr(C.build_insert_value(self, aggregate, elem, idx, name))
986
- end
987
-
988
- private def value_error(aggregate, idx) # rubocop:disable Style/AccessModifierDeclarations
989
- if !aggregate.is_a?(LLVM::Value)
990
- "non-value: #{aggregate.inspect}"
991
- elsif !aggregate.type.aggregate?
992
- "non-aggregate: #{aggregate.type.kind}"
993
- elsif !idx.is_a?(Integer) || idx.negative?
994
- "index: #{idx}"
995
- end
1041
+ ins = C.build_insert_value(self, aggregate, elem, idx, name)
1042
+ Instruction.from_ptr(ins)
996
1043
  end
997
1044
 
998
1045
  # Check if a value is null
@@ -1020,5 +1067,79 @@ module LLVM
1020
1067
  def ptr_diff(lhs, rhs, name = "")
1021
1068
  Instruction.from_ptr(C.build_ptr_diff(lhs, rhs, name))
1022
1069
  end
1070
+
1071
+ private
1072
+
1073
+ private def must_be_value!(value)
1074
+ raise "must be a Value, got #{value.class.name}" unless Value === value
1075
+ end
1076
+
1077
+ private def must_be_type!(type)
1078
+ type2 = LLVM.Type(type)
1079
+ raise "must be a Type (LLVMTypeRef), got #{type2.class.name}" unless Type === type2
1080
+ end
1081
+
1082
+ private def must_infer_type!(value)
1083
+ infer_type(value)
1084
+ end
1085
+
1086
+ private def infer_type(ptr)
1087
+ case ptr
1088
+ when GlobalVariable
1089
+ Type.from_ptr(C.global_get_value_type(ptr))
1090
+ when Instruction
1091
+ must_infer_instruction_type!(ptr)
1092
+ else
1093
+ raise "#{ptr.class.name} #{ptr}"
1094
+ end
1095
+ end
1096
+
1097
+ private def must_infer_instruction_type!(ptr)
1098
+ case ptr.opcode
1099
+ when :get_element_ptr
1100
+ must_infer_gep!(ptr)
1101
+ when :alloca
1102
+ Type.from_ptr(C.get_allocated_type(ptr))
1103
+ when :load
1104
+ ptr.type
1105
+ else
1106
+ raise "Inferring type for instruction not currently supported: #{ptr.opcode} #{ptr}"
1107
+ end
1108
+ end
1109
+
1110
+ private def must_infer_gep!(ptr)
1111
+ source_type = Type.from_ptr(C.get_gep_source_element_type(ptr))
1112
+ case source_type.kind
1113
+ when :integer
1114
+ source_type
1115
+ when :struct
1116
+ raise "Cannot currently infer type from gep of struct"
1117
+ when :array, :vector
1118
+ source_type.element_type
1119
+ else
1120
+ debugger
1121
+ end
1122
+ end
1123
+
1124
+ private def element_error(vector, idx) # rubocop:disable Style/AccessModifierDeclarations
1125
+ if !vector.is_a?(LLVM::Value)
1126
+ "non-value: #{vector.inspect}"
1127
+ elsif vector.type.kind != :vector
1128
+ "non-vector: #{vector.type.kind}"
1129
+ elsif !idx.is_a?(LLVM::Value)
1130
+ "index: #{idx}"
1131
+ end
1132
+ end
1133
+
1134
+ private def value_error(aggregate, idx) # rubocop:disable Style/AccessModifierDeclarations
1135
+ if !aggregate.is_a?(LLVM::Value)
1136
+ "non-value: #{aggregate.inspect}"
1137
+ # TODO: fix this
1138
+ elsif !aggregate.type.aggregate?
1139
+ "non-aggregate: #{aggregate.type.kind}"
1140
+ elsif !idx.is_a?(Integer) || idx.negative?
1141
+ "index: #{idx}"
1142
+ end
1143
+ end
1023
1144
  end
1024
1145
  end
@@ -0,0 +1,25 @@
1
+ # unmodule LLVM
2
+ # module OpaquePointerBuilder
3
+ # # Builds a struct getelementptr Instruction.
4
+ # #
5
+ # # @param [LLVM::Value] pointer A pointer to a structure
6
+ # # @param [LLVM::Value] idx Unsigned integer representing the index of a
7
+ # # structure member
8
+ # # @param [String] name The name of the result in LLVM IR
9
+ # # @return [LLVM::Instruction] The resulting pointer
10
+ # # @LLVMinst gep
11
+ # # @see http://llvm.org/docs/GetElementPtr.html
12
+ # def struct_gep1(pointer, idx, name = "")
13
+ # Instruction.from_ptr(C.build_struct_gep(self, pointer, idx, name))
14
+ # end
15
+ #
16
+ # private def struct_gep2(type, pointer, idx, name)
17
+ # Instruction.from_ptr(C.build_struct_gep2(self, type, pointer, idx, name))
18
+ # end
19
+ #
20
+ # def struct_gep(pointer, idx, name = "", type = nil)
21
+ # type2 = type || must_infer_type(pointer)
22
+ # struct_gep2(types2, pointer, idx, name)
23
+ # end
24
+ # end
25
+ # end
@@ -5,14 +5,18 @@ module LLVM
5
5
  include PointerIdentity
6
6
 
7
7
  # @private
8
- def self.from_ptr(ptr, kind)
8
+ def self.from_ptr(ptr, kind = nil)
9
9
  return if ptr.null?
10
10
  kind ||= C.get_type_kind(ptr)
11
11
  ty = case kind
12
- when :integer then IntType.allocate
13
- when :function then FunctionType.allocate
14
- when :struct then StructType.allocate
15
- else allocate
12
+ when :integer
13
+ IntType.allocate
14
+ when :function
15
+ FunctionType.allocate
16
+ when :struct
17
+ StructType.allocate
18
+ else
19
+ allocate
16
20
  end
17
21
  ty.instance_variable_set(:@ptr, ptr)
18
22
  ty.instance_variable_set(:@kind, kind)
@@ -36,8 +40,13 @@ module LLVM
36
40
  # Returns the type of this types elements (works only for Pointer, Vector, and Array types.)
37
41
  def element_type
38
42
  case kind
39
- when :pointer, :vector, :array
40
- Type.from_ptr(C.get_element_type(self), nil)
43
+ when :vector, :array
44
+ element_type = C.get_element_type(self)
45
+ Type.from_ptr(element_type)
46
+ when :pointer
47
+ LLVM.Void
48
+ else
49
+ raise "element_type not supported for kind: #{kind}"
41
50
  end
42
51
  end
43
52
 
@@ -113,6 +122,21 @@ module LLVM
113
122
  from_ptr(C.void_type, :void)
114
123
  end
115
124
 
125
+ def self.label
126
+ from_ptr(C.label_type, :label)
127
+ end
128
+
129
+ def self.x86_mmx
130
+ from_ptr(C.x86mmx_type, :x86mmx)
131
+ end
132
+
133
+ def self.x86_amx
134
+ from_ptr(C.x86amx_type, :x86amx)
135
+ end
136
+ # def self.opaque_pointer
137
+ # from_ptr(C.opaque_type, :pointer)
138
+ # end
139
+
116
140
  def self.rec
117
141
  h = opaque
118
142
  ty = yield h
@@ -129,7 +153,11 @@ module LLVM
129
153
 
130
154
  class FunctionType < Type
131
155
  def return_type
132
- Type.from_ptr(C.get_return_type(self), nil)
156
+ Type.from_ptr(C.get_return_type(self))
157
+ end
158
+
159
+ def element_type
160
+ self
133
161
  end
134
162
 
135
163
  def argument_types
@@ -26,6 +26,10 @@ module LLVM
26
26
  Type.from_ptr(C.type_of(self), nil)
27
27
  end
28
28
 
29
+ def allocated_type
30
+ Type.from_ptr(C.get_allocated_type(self), nil)
31
+ end
32
+
29
33
  # Returns the value's name.
30
34
  def name
31
35
  C.get_value_name(self)
@@ -315,6 +319,10 @@ module LLVM
315
319
  def size
316
320
  C.get_array_length(type)
317
321
  end
322
+
323
+ def [](idx)
324
+ self.class.from_ptr(C.get_aggregate_element(self, idx))
325
+ end
318
326
  end
319
327
 
320
328
  class ConstantExpr < Constant
@@ -631,6 +639,10 @@ module LLVM
631
639
  vals = LLVM::Support.allocate_pointers(size_or_values, &block)
632
640
  from_ptr C.const_named_struct(type, vals, vals.size / vals.type_size)
633
641
  end
642
+
643
+ def [](idx)
644
+ self.class.from_ptr(C.get_aggregate_element(self, idx))
645
+ end
634
646
  end
635
647
 
636
648
  class ConstantVector < Constant
@@ -646,6 +658,10 @@ module LLVM
646
658
  def size
647
659
  C.get_vector_size(type)
648
660
  end
661
+
662
+ def [](idx)
663
+ self.class.from_ptr(C.get_aggregate_element(self, idx))
664
+ end
649
665
  end
650
666
 
651
667
  class GlobalValue < Constant
@@ -735,12 +751,17 @@ module LLVM
735
751
  @basic_block_collection ||= BasicBlockCollection.new(self)
736
752
  end
737
753
 
754
+ def function_type
755
+ Type.from_ptr(C.get_element_type(self), :function)
756
+ end
757
+
758
+ # In LLVM 15, not overriding this yields a pointer type instead of a function type
738
759
  def type
739
- Type.from_ptr(C.type_of(self), :pointer)
760
+ function_type
740
761
  end
741
762
 
742
- def function_type
743
- type.element_type
763
+ def return_type
764
+ type.return_type
744
765
  end
745
766
 
746
767
  # Adds attr to this value's attributes.
@@ -962,6 +983,10 @@ module LLVM
962
983
  ptr = C.get_previous_instruction(self)
963
984
  LLVM::Instruction.from_ptr(ptr) unless ptr.null?
964
985
  end
986
+
987
+ def opcode
988
+ C.get_instruction_opcode(self)
989
+ end
965
990
  end
966
991
 
967
992
  class CallInst < Instruction
data/lib/llvm/core.rb CHANGED
@@ -51,6 +51,57 @@ module LLVM
51
51
  # const char *LLVMGetStringAttributeValue
52
52
  # (LLVMAttributeRef A, unsigned *Length);
53
53
  attach_function :get_string_attribute_value, :LLVMGetStringAttributeValue, [:pointer, :pointer], :pointer
54
+
55
+ # LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name);
56
+ attach_function :build_load2, :LLVMBuildLoad2, [:pointer, :pointer, :pointer, :string], :pointer
57
+
58
+ # LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
59
+ # LLVMValueRef Pointer, LLVMValueRef *Indices,
60
+ # unsigned NumIndices, const char *Name);
61
+ attach_function :build_gep2, :LLVMBuildGEP2, [:pointer, :pointer, :pointer, :pointer, :uint, :string], :pointer
62
+
63
+ # LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
64
+ # LLVMValueRef Pointer, LLVMValueRef *Indices,
65
+ # unsigned NumIndices, const char *Name);
66
+ attach_function :build_inbounds_gep2, :LLVMBuildInBoundsGEP2, [:pointer, :pointer, :pointer, :pointer, :uint, :string], :pointer
67
+
68
+ # LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
69
+ # LLVMValueRef Pointer, unsigned Idx,
70
+ # const char *Name);
71
+ attach_function :build_struct_gep2, :LLVMBuildStructGEP2, [:pointer, :pointer, :pointer, :uint, :string], :pointer
72
+
73
+ # LLVMValueRef LLVMBuildCall2(LLVMBuilderRef, LLVMTypeRef, LLVMValueRef Fn,
74
+ # LLVMValueRef *Args, unsigned NumArgs,
75
+ # const char *Name);
76
+ attach_function :build_call2, :LLVMBuildCall2, [:pointer, :pointer, :pointer, :pointer, :uint, :string], :pointer
77
+
78
+ # LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Fn,
79
+ # LLVMValueRef *Args, unsigned NumArgs,
80
+ # LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
81
+ # const char *Name);
82
+ attach_function :build_invoke2, :LLVMBuildInvoke2, [:pointer, :pointer, :pointer, :pointer, :uint, :pointer, :pointer, :string], :pointer
83
+
84
+ # LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global);
85
+ attach_function :global_get_value_type, :LLVMGlobalGetValueType, [:pointer], :pointer
86
+
87
+ # LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP);
88
+ attach_function :get_gep_source_element_type, :LLVMGetGEPSourceElementType, [:pointer], :pointer
89
+
90
+ # (Not documented)
91
+ #
92
+ # @method x86amx_type()
93
+ # @return [FFI::Pointer(TypeRef)]
94
+ # @scope class
95
+ attach_function :x86amx_type, :LLVMX86AMXType, [], :pointer
96
+
97
+ # LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca);
98
+ attach_function :get_allocated_type, :LLVMGetAllocatedType, [:pointer], :pointer
99
+
100
+ # LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global);
101
+ attach_function :get_value_type, :LLVMGlobalGetValueType, [:pointer], :pointer
102
+
103
+ # LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx);
104
+ attach_function :get_aggregate_element, :LLVMGetAggregateElement, [:pointer, :int], :pointer
54
105
  end
55
106
 
56
107
  # Yields a pointer suitable for storing an LLVM output message.
data/lib/llvm/core_ffi.rb CHANGED
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib ["libLLVM-14.so.1", "libLLVM.so.14", "LLVM-14"]
7
+ ffi_lib ["libLLVM-15.so.1", "libLLVM.so.15", "LLVM-15"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -410,7 +410,10 @@ module LLVM::C
410
410
  :vector, 13,
411
411
  :metadata, 14,
412
412
  :x86_mmx, 15,
413
- :token, 16
413
+ :token, 16,
414
+ :scalable_vector, 17,
415
+ :bfloat, 18,
416
+ :x86_amx, 19,
414
417
  ]
415
418
 
416
419
  # (Not documented)
@@ -3012,15 +3015,6 @@ module LLVM::C
3012
3015
  # @scope class
3013
3016
  attach_function :const_nuw_add, :LLVMConstNUWAdd, [:pointer, :pointer], :pointer
3014
3017
 
3015
- # (Not documented)
3016
- #
3017
- # @method const_f_add(lhs_constant, rhs_constant)
3018
- # @param [FFI::Pointer(ValueRef)] lhs_constant
3019
- # @param [FFI::Pointer(ValueRef)] rhs_constant
3020
- # @return [FFI::Pointer(ValueRef)]
3021
- # @scope class
3022
- attach_function :const_f_add, :LLVMConstFAdd, [:pointer, :pointer], :pointer
3023
-
3024
3018
  # (Not documented)
3025
3019
  #
3026
3020
  # @method const_sub(lhs_constant, rhs_constant)
@@ -3048,15 +3042,6 @@ module LLVM::C
3048
3042
  # @scope class
3049
3043
  attach_function :const_nuw_sub, :LLVMConstNUWSub, [:pointer, :pointer], :pointer
3050
3044
 
3051
- # (Not documented)
3052
- #
3053
- # @method const_f_sub(lhs_constant, rhs_constant)
3054
- # @param [FFI::Pointer(ValueRef)] lhs_constant
3055
- # @param [FFI::Pointer(ValueRef)] rhs_constant
3056
- # @return [FFI::Pointer(ValueRef)]
3057
- # @scope class
3058
- attach_function :const_f_sub, :LLVMConstFSub, [:pointer, :pointer], :pointer
3059
-
3060
3045
  # (Not documented)
3061
3046
  #
3062
3047
  # @method const_mul(lhs_constant, rhs_constant)
@@ -3084,78 +3069,6 @@ module LLVM::C
3084
3069
  # @scope class
3085
3070
  attach_function :const_nuw_mul, :LLVMConstNUWMul, [:pointer, :pointer], :pointer
3086
3071
 
3087
- # (Not documented)
3088
- #
3089
- # @method const_f_mul(lhs_constant, rhs_constant)
3090
- # @param [FFI::Pointer(ValueRef)] lhs_constant
3091
- # @param [FFI::Pointer(ValueRef)] rhs_constant
3092
- # @return [FFI::Pointer(ValueRef)]
3093
- # @scope class
3094
- attach_function :const_f_mul, :LLVMConstFMul, [:pointer, :pointer], :pointer
3095
-
3096
- # (Not documented)
3097
- #
3098
- # @method const_u_div(lhs_constant, rhs_constant)
3099
- # @param [FFI::Pointer(ValueRef)] lhs_constant
3100
- # @param [FFI::Pointer(ValueRef)] rhs_constant
3101
- # @return [FFI::Pointer(ValueRef)]
3102
- # @scope class
3103
- attach_function :const_u_div, :LLVMConstUDiv, [:pointer, :pointer], :pointer
3104
-
3105
- # (Not documented)
3106
- #
3107
- # @method const_s_div(lhs_constant, rhs_constant)
3108
- # @param [FFI::Pointer(ValueRef)] lhs_constant
3109
- # @param [FFI::Pointer(ValueRef)] rhs_constant
3110
- # @return [FFI::Pointer(ValueRef)]
3111
- # @scope class
3112
- attach_function :const_s_div, :LLVMConstSDiv, [:pointer, :pointer], :pointer
3113
-
3114
- # (Not documented)
3115
- #
3116
- # @method const_exact_s_div(lhs_constant, rhs_constant)
3117
- # @param [FFI::Pointer(ValueRef)] lhs_constant
3118
- # @param [FFI::Pointer(ValueRef)] rhs_constant
3119
- # @return [FFI::Pointer(ValueRef)]
3120
- # @scope class
3121
- attach_function :const_exact_s_div, :LLVMConstExactSDiv, [:pointer, :pointer], :pointer
3122
-
3123
- # (Not documented)
3124
- #
3125
- # @method const_f_div(lhs_constant, rhs_constant)
3126
- # @param [FFI::Pointer(ValueRef)] lhs_constant
3127
- # @param [FFI::Pointer(ValueRef)] rhs_constant
3128
- # @return [FFI::Pointer(ValueRef)]
3129
- # @scope class
3130
- attach_function :const_f_div, :LLVMConstFDiv, [:pointer, :pointer], :pointer
3131
-
3132
- # (Not documented)
3133
- #
3134
- # @method const_u_rem(lhs_constant, rhs_constant)
3135
- # @param [FFI::Pointer(ValueRef)] lhs_constant
3136
- # @param [FFI::Pointer(ValueRef)] rhs_constant
3137
- # @return [FFI::Pointer(ValueRef)]
3138
- # @scope class
3139
- attach_function :const_u_rem, :LLVMConstURem, [:pointer, :pointer], :pointer
3140
-
3141
- # (Not documented)
3142
- #
3143
- # @method const_s_rem(lhs_constant, rhs_constant)
3144
- # @param [FFI::Pointer(ValueRef)] lhs_constant
3145
- # @param [FFI::Pointer(ValueRef)] rhs_constant
3146
- # @return [FFI::Pointer(ValueRef)]
3147
- # @scope class
3148
- attach_function :const_s_rem, :LLVMConstSRem, [:pointer, :pointer], :pointer
3149
-
3150
- # (Not documented)
3151
- #
3152
- # @method const_f_rem(lhs_constant, rhs_constant)
3153
- # @param [FFI::Pointer(ValueRef)] lhs_constant
3154
- # @param [FFI::Pointer(ValueRef)] rhs_constant
3155
- # @return [FFI::Pointer(ValueRef)]
3156
- # @scope class
3157
- attach_function :const_f_rem, :LLVMConstFRem, [:pointer, :pointer], :pointer
3158
-
3159
3072
  # (Not documented)
3160
3073
  #
3161
3074
  # @method const_and(lhs_constant, rhs_constant)
@@ -3461,27 +3374,6 @@ module LLVM::C
3461
3374
  # @scope class
3462
3375
  attach_function :const_shuffle_vector, :LLVMConstShuffleVector, [:pointer, :pointer, :pointer], :pointer
3463
3376
 
3464
- # (Not documented)
3465
- #
3466
- # @method const_extract_value(agg_constant, idx_list, num_idx)
3467
- # @param [FFI::Pointer(ValueRef)] agg_constant
3468
- # @param [FFI::Pointer(*UInt)] idx_list
3469
- # @param [Integer] num_idx
3470
- # @return [FFI::Pointer(ValueRef)]
3471
- # @scope class
3472
- attach_function :const_extract_value, :LLVMConstExtractValue, [:pointer, :pointer, :uint], :pointer
3473
-
3474
- # (Not documented)
3475
- #
3476
- # @method const_insert_value(agg_constant, element_value_constant, idx_list, num_idx)
3477
- # @param [FFI::Pointer(ValueRef)] agg_constant
3478
- # @param [FFI::Pointer(ValueRef)] element_value_constant
3479
- # @param [FFI::Pointer(*UInt)] idx_list
3480
- # @param [Integer] num_idx
3481
- # @return [FFI::Pointer(ValueRef)]
3482
- # @scope class
3483
- attach_function :const_insert_value, :LLVMConstInsertValue, [:pointer, :pointer, :pointer, :uint], :pointer
3484
-
3485
3377
  # (Not documented)
3486
3378
  #
3487
3379
  # @method const_inline_asm(ty, asm_string, constraints, has_side_effects, is_align_stack)
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib ["libLLVM-14.so.1", "libLLVM.so.14", "LLVM-14"]
7
+ ffi_lib ["libLLVM-15.so.1", "libLLVM.so.15", "LLVM-15"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib ["libLLVM-14.so.1", "libLLVM.so.14", "LLVM-14"]
7
+ ffi_lib ["libLLVM-15.so.1", "libLLVM.so.15", "LLVM-15"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib ["libLLVM-14.so.1", "libLLVM.so.14", "LLVM-14"]
7
+ ffi_lib ["libLLVM-15.so.1", "libLLVM.so.15", "LLVM-15"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -86,18 +86,7 @@ module LLVM
86
86
  # Populate an LTO pass manager.
87
87
  # @param [PassManager] pass_manager
88
88
  def build_with_lto(pass_manager, internalize = false, run_inliner = false)
89
- if pass_manager.is_a?(FunctionPassManager)
90
- raise ArgumentError, "FunctionPassManager does not support LTO"
91
- end
92
-
93
- if internalize.kind_of?(Integer) || run_inliner.kind_of?(Integer)
94
- warn 'Warning: Passing Integer value to LLVM::PassManagerBuilder#build_with_lto is deprecated.'
95
- internalize = !internalize.zero? if internalize.kind_of?(Integer)
96
- run_inliner = !run_inliner.zero? if run_inliner.kind_of?(Integer)
97
- end
98
-
99
- C.pass_manager_builder_populate_lto_pass_manager(self,
100
- pass_manager, flag(internalize), flag(run_inliner))
89
+ raise "build_with_lto is not currently supported"
101
90
  end
102
91
 
103
92
  private
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib ["libLLVM-14.so.1", "libLLVM.so.14", "LLVM-14"]
7
+ ffi_lib ["libLLVM-15.so.1", "libLLVM.so.15", "LLVM-15"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -103,15 +103,4 @@ module LLVM::C
103
103
  # @return [nil]
104
104
  # @scope class
105
105
  attach_function :pass_manager_builder_populate_module_pass_manager, :LLVMPassManagerBuilderPopulateModulePassManager, [OpaquePassManagerBuilder, :pointer], :void
106
-
107
- # See llvm::PassManagerBuilder::populateLTOPassManager.
108
- #
109
- # @method pass_manager_builder_populate_lto_pass_manager(pmb, pm, internalize, run_inliner)
110
- # @param [OpaquePassManagerBuilder] pmb
111
- # @param [FFI::Pointer(PassManagerRef)] pm
112
- # @param [Integer] internalize
113
- # @param [Integer] run_inliner
114
- # @return [nil]
115
- # @scope class
116
- attach_function :pass_manager_builder_populate_lto_pass_manager, :LLVMPassManagerBuilderPopulateLTOPassManager, [OpaquePassManagerBuilder, :pointer, :int, :int], :void
117
106
  end
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib ["libLLVM-14.so.1", "libLLVM.so.14", "LLVM-14"]
7
+ ffi_lib ["libLLVM-15.so.1", "libLLVM.so.15", "LLVM-15"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib ["libLLVM-14.so.1", "libLLVM.so.14", "LLVM-14"]
7
+ ffi_lib ["libLLVM-15.so.1", "libLLVM.so.15", "LLVM-15"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib ["libLLVM-14.so.1", "libLLVM.so.14", "LLVM-14"]
7
+ ffi_lib ["libLLVM-15.so.1", "libLLVM.so.15", "LLVM-15"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
data/lib/llvm/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LLVM
4
- LLVM_VERSION = "14"
5
- LLVM_REQUIRED_VERSION = "14.0"
6
- RUBY_LLVM_VERSION = "14.0.0"
4
+ LLVM_VERSION = "15"
5
+ LLVM_REQUIRED_VERSION = "15.0"
6
+ RUBY_LLVM_VERSION = "15.0.1"
7
7
  end
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: 14.0.0
4
+ version: 15.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: 2022-07-19 00:00:00.000000000 Z
12
+ date: 2022-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -45,6 +45,20 @@ dependencies:
45
45
  - - "<"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '14'
48
+ - !ruby/object:Gem::Dependency
49
+ name: debug
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
48
62
  - !ruby/object:Gem::Dependency
49
63
  name: ffi_gen
50
64
  requirement: !ruby/object:Gem::Requirement
@@ -183,6 +197,7 @@ files:
183
197
  - lib/llvm/core/builder.rb
184
198
  - lib/llvm/core/context.rb
185
199
  - lib/llvm/core/module.rb
200
+ - lib/llvm/core/opaque_pointer_builder.rb
186
201
  - lib/llvm/core/pass_manager.rb
187
202
  - lib/llvm/core/type.rb
188
203
  - lib/llvm/core/value.rb