ruby-llvm 19.1.0 → 19.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e10c7862bad0824d39c4267e4f57a0938c692797152c367f19e89c45349cfdc1
4
- data.tar.gz: 9ff941e455b59e7f710213da4b0b0bd0cb074d47ee217b4aa5603f78b267acaa
3
+ metadata.gz: e79f189aca81c294be8c7e03f22bd723e546ebcf1abf2ec3d65247cf94a89601
4
+ data.tar.gz: dd35f61c2cb3764f3736ddb587f1df9079fecb23ff3e3dd6a0b62cd20ce6b764
5
5
  SHA512:
6
- metadata.gz: a0cde4581200138358072feb19b55bfac4f53aa59b98c24c49d5a37a90dc973be394982397cc46045c7515403abe4ff3ec7f0115598310dc2c09af4a7b797453
7
- data.tar.gz: 11972368435dc06407593cbb500208a61a152c7d57a8bd7952023862fa8c78a766cd5bdffd18bf78c711e0afd2cb1ead03ff8a4c9fbd6423bbd229ae2f31baf2
6
+ metadata.gz: 4d27cce47be66097018b3caa11afd3356e7be1305ece76e1511f214cb7a313b678d224951d74460a9ec7fb517b74b2d0f30aa759af949ca77115b6839e22d503
7
+ data.tar.gz: 3898e49f6284f524ce117eb830ce2be6d423f474439012d793d7690051c006d2183b0cbefcad242c31ee5765216633035a79d972e50da1977075565c78e44a31
data/lib/llvm/config.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # Generated by ruby-llvm. Please do not change this file by hand.
2
2
  module LLVM
3
3
  module CONFIG
4
- VERSION = "19.1.0"
4
+ VERSION = "19.1.3"
5
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", "codegendata", "codegentypes", "core", "coroutines", "coverage", "debuginfobtf", "debuginfocodeview", "debuginfodwarf", "debuginfogsym", "debuginfologicalview", "debuginfomsf", "debuginfopdb", "demangle", "dlltooldriver", "dwarflinker", "dwarflinkerclassic", "dwarflinkerparallel", "dwp", "engine", "executionengine", "extensions", "filecheck", "frontenddriver", "frontendhlsl", "frontendoffloading", "frontendopenacc", "frontendopenmp", "fuzzercli", "fuzzmutate", "globalisel", "hexagon", "hexagonasmparser", "hexagoncodegen", "hexagondesc", "hexagondisassembler", "hexagoninfo", "hipstdpar", "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", "orcdebugging", "orcjit", "orcshared", "orctargetprocess", "passes", "perfjitevents", "powerpc", "powerpcasmparser", "powerpccodegen", "powerpcdesc", "powerpcdisassembler", "powerpcinfo", "profiledata", "remarks", "riscv", "riscvasmparser", "riscvcodegen", "riscvdesc", "riscvdisassembler", "riscvinfo", "riscvtargetmca", "runtimedyld", "sandboxir", "scalaropts", "selectiondag", "sparc", "sparcasmparser", "sparccodegen", "sparcdesc", "sparcdisassembler", "sparcinfo", "support", "symbolize", "systemz", "systemzasmparser", "systemzcodegen", "systemzdesc", "systemzdisassembler", "systemzinfo", "tablegen", "target", "targetparser", "textapi", "textapibinaryreader", "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
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"
@@ -149,15 +149,15 @@ module LLVM
149
149
  private
150
150
 
151
151
  def enum_value_mem_none?
152
- (enum_value & 63).zero?
152
+ enum_value.nobits?(63)
153
153
  end
154
154
 
155
155
  def enum_value_mem_read?
156
- (enum_value & 21) != 0
156
+ enum_value.anybits?(21)
157
157
  end
158
158
 
159
159
  def enum_value_mem_write?
160
- (enum_value & 42) != 0
160
+ enum_value.anybits?(42)
161
161
  end
162
162
 
163
163
  def enum_kind_id
@@ -228,8 +228,8 @@ module LLVM
228
228
  C.get_int_type_width(self)
229
229
  end
230
230
 
231
- def from_i(int, options = {})
232
- signed = case options
231
+ private def get_sign_option(options)
232
+ case options
233
233
  when true, false
234
234
  options
235
235
  when Hash
@@ -237,11 +237,16 @@ module LLVM
237
237
  else
238
238
  raise ArgumentError
239
239
  end
240
- # return poison if !fits_width?(int, width, signed)
240
+ end
241
+
242
+ def from_i(int, options = {})
243
+ signed = get_sign_option(options)
241
244
 
242
- ptr = C.const_int(self, int, signed ? 1 : 0)
243
- val = from_ptr(ptr)
244
- val.to_i(signed) == int ? val : poison
245
+ return parse(int.to_s, 0) if width > 64 || int.is_a?(String)
246
+
247
+ val = from_ptr(C.const_int(self, int, signed ? 1 : 0))
248
+ unpoisoned = val.to_i(signed) == int
249
+ unpoisoned ? val : poison
245
250
  end
246
251
 
247
252
  # unused
@@ -259,9 +264,21 @@ module LLVM
259
264
  ConstantInt.from_ptr(ptr)
260
265
  end
261
266
 
267
+ # parse string using const_int_of_string_and_size
268
+ # normalize the string to base 10 (used in llvm ir), and handle prefixes like 0x
269
+ private def const_int_of_string_and_size(str, radix)
270
+ normalized_string = radix == 10 ? str : str.to_i(radix).to_s
271
+ val = from_ptr(C.const_int_of_string_and_size(self, normalized_string, normalized_string.size, 10))
272
+
273
+ unpoisoned = normalized_string == val.to_s.split.last
274
+ unpoisoned ? val : poison
275
+ end
276
+
277
+ # parse string using const_int_of_string_and_size
278
+ # alternative implementation parsing with ruby:
279
+ # from_i(str.to_i(radix))
262
280
  def parse(str, radix = 10)
263
- # from_ptr(C.const_int_of_string(self, str, radix))
264
- from_i(str.to_i(radix))
281
+ const_int_of_string_and_size(str, radix)
265
282
  end
266
283
 
267
284
  def type
@@ -12,7 +12,7 @@ module LLVM
12
12
  val
13
13
  end
14
14
 
15
- def self.from_ptr_kind(ptr)
15
+ def self.from_ptr_kind(ptr) # rubocop:disable Metrics/CyclomaticComplexity
16
16
  return if ptr.null?
17
17
 
18
18
  kind = C.get_value_kind(ptr)
@@ -27,6 +27,8 @@ module LLVM
27
27
  Poison.from_ptr(ptr)
28
28
  when :global_variable
29
29
  GlobalVariable.from_ptr(ptr)
30
+ when :const_expr
31
+ ConstantExpr.from_ptr(ptr)
30
32
  else
31
33
  raise "from_ptr_kind cannot handle: #{kind}"
32
34
  end
@@ -627,13 +629,24 @@ module LLVM
627
629
  type.from_f(to_i.to_f)
628
630
  end
629
631
 
630
- def to_i(signed = true)
632
+ private def to_i_i64(signed)
631
633
  if signed
632
634
  C.const_int_get_sext_value(self)
633
635
  else
634
636
  C.const_int_get_zext_value(self)
635
637
  end
636
638
  end
639
+
640
+ # const_int_get_sext_value const_int_get_zext_value only return long long, 64-bits
641
+ # beyond 64-bits parse the string value into a ruby integer
642
+ # TODO: overflow behavior is not the same on these arms, signed is ignored above 64-bits
643
+ def to_i(signed = true)
644
+ if type.width <= 64
645
+ to_i_i64(signed)
646
+ else
647
+ to_s.split.last.to_i
648
+ end
649
+ end
637
650
  end
638
651
 
639
652
  # creates LLVM::Int1, LLVM::Int64, etc
data/lib/llvm/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module LLVM
4
4
  LLVM_VERSION = "19"
5
- LLVM_REQUIRED_VERSION = "19.1.0"
6
- RUBY_LLVM_VERSION = "19.1.0"
5
+ LLVM_REQUIRED_VERSION = "19.1.3"
6
+ RUBY_LLVM_VERSION = "19.1.3"
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: 19.1.0
4
+ version: 19.1.3
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: 2024-09-25 00:00:00.000000000 Z
12
+ date: 2024-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi