ruby-llvm 3.4.2 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib 'LLVM-3.4'
7
+ ffi_lib ["libLLVM-3.5.so.1", "LLVM-3.5"]
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 'LLVM-3.4'
7
+ ffi_lib ["libLLVM-3.5.so.1", "LLVM-3.5"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -12,7 +12,7 @@ module LLVM::C
12
12
  end
13
13
  end
14
14
 
15
- # (Not documented)
15
+ # See llvm::createArgumentPromotionPass function.
16
16
  #
17
17
  # @method add_argument_promotion_pass(pm)
18
18
  # @param [FFI::Pointer(PassManagerRef)] pm
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib 'LLVM-3.4'
7
+ ffi_lib ["libLLVM-3.5.so.1", "LLVM-3.5"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -12,7 +12,7 @@ module LLVM::C
12
12
  end
13
13
  end
14
14
 
15
- # (Not documented)
15
+ # See llvm::createAggressiveDCEPass function.
16
16
  #
17
17
  # @method add_aggressive_dce_pass(pm)
18
18
  # @param [FFI::Pointer(PassManagerRef)] pm
@@ -36,6 +36,22 @@ module LLVM::C
36
36
  # @scope class
37
37
  attach_function :add_dead_store_elimination_pass, :LLVMAddDeadStoreEliminationPass, [:pointer], :void
38
38
 
39
+ # See llvm::createScalarizerPass function.
40
+ #
41
+ # @method add_scalarizer_pass(pm)
42
+ # @param [FFI::Pointer(PassManagerRef)] pm
43
+ # @return [nil]
44
+ # @scope class
45
+ attach_function :add_scalarizer_pass, :LLVMAddScalarizerPass, [:pointer], :void
46
+
47
+ # See llvm::createMergedLoadStoreMotionPass function.
48
+ #
49
+ # @method add_merged_load_store_motion_pass(pm)
50
+ # @param [FFI::Pointer(PassManagerRef)] pm
51
+ # @return [nil]
52
+ # @scope class
53
+ attach_function :add_merged_load_store_motion_pass, :LLVMAddMergedLoadStoreMotionPass, [:pointer], :void
54
+
39
55
  # See llvm::createGVNPass function.
40
56
  #
41
57
  # @method add_gvn_pass(pm)
@@ -4,7 +4,7 @@ require 'ffi'
4
4
 
5
5
  module LLVM::C
6
6
  extend FFI::Library
7
- ffi_lib 'LLVM-3.4'
7
+ ffi_lib ["libLLVM-3.5.so.1", "LLVM-3.5"]
8
8
 
9
9
  def self.attach_function(name, *_)
10
10
  begin; super; rescue FFI::NotFoundError => e
@@ -12,7 +12,7 @@ module LLVM::C
12
12
  end
13
13
  end
14
14
 
15
- # (Not documented)
15
+ # See llvm::createBBVectorizePass function.
16
16
  #
17
17
  # @method add_bb_vectorize_pass(pm)
18
18
  # @param [FFI::Pointer(PassManagerRef)] pm
@@ -1,4 +1,4 @@
1
1
  module LLVM
2
- LLVM_VERSION = "3.4"
3
- RUBY_LLVM_VERSION = "3.4.2"
2
+ LLVM_VERSION = "3.5"
3
+ RUBY_LLVM_VERSION = "3.5.0"
4
4
  end
@@ -84,4 +84,11 @@ class MCJITTestCase < Minitest::Test
84
84
  end
85
85
  assert_nil engine.functions[:bar]
86
86
  end
87
+
88
+ def test_accessors
89
+ main_mod = LLVM::Module.new('main')
90
+ engine = LLVM::MCJITCompiler.new(main_mod, :opt_level => 0)
91
+ assert_match /^e-/, engine.data_layout.to_s
92
+ assert_match /gnu/, engine.target_machine.triple
93
+ end
87
94
  end
@@ -33,6 +33,10 @@ class ModuleTestCase < Minitest::Test
33
33
  var.unnamed_addr = true
34
34
  assert var.unnamed_addr?
35
35
 
36
+ assert (var.dll_storage_class == :default)
37
+ var.dll_storage_class = :dll_import
38
+ assert (var.dll_storage_class == :dll_import)
39
+
36
40
  # global_constant
37
41
  assert !var.global_constant?
38
42
  var.global_constant = true
@@ -58,7 +58,7 @@ class TargetTestCase < Minitest::Test
58
58
  assert_equal '', mach.features
59
59
 
60
60
  layout = mach.data_layout
61
- assert_equal 'e-p:32:32:32-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f16:16:16-f32:32:32-f64:32:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32', layout.to_s
61
+ assert_equal 'e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128', layout.to_s
62
62
  end
63
63
 
64
64
  def test_emit
@@ -79,7 +79,7 @@ class TargetTestCase < Minitest::Test
79
79
 
80
80
  Tempfile.open('emit') do |tmp|
81
81
  mach.emit(mod, tmp.path, :object)
82
- assert_match %r{\x31\xc0\xc3}, File.read(tmp.path, mode: 'rb')
82
+ assert_match %r{\x66\x31\xc0}, File.read(tmp.path, mode: 'rb')
83
83
  end
84
84
  end
85
85
 
@@ -93,23 +93,23 @@ class TargetTestCase < Minitest::Test
93
93
 
94
94
  assert_equal '', mod.data_layout
95
95
 
96
- mod.data_layout = 'e-p:64:64:64'
97
- assert_equal 'e-p:64:64:64', mod.data_layout
96
+ mod.data_layout = 'e-p:32:32'
97
+ assert_equal 'e-p:32:32', mod.data_layout
98
98
  end
99
99
 
100
100
  def test_data_layout
101
101
  layout_be = LLVM::TargetDataLayout.new('E')
102
102
  assert_equal :big_endian, layout_be.byte_order
103
103
 
104
- desc = "e-p:64:64:64-S0-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64"
104
+ desc = "e-p:32:32:32-S0-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64"
105
105
  layout = LLVM::TargetDataLayout.new(desc)
106
106
 
107
- assert_equal desc, layout.to_s
107
+ assert_equal "e-p:32:32", layout.to_s
108
108
  assert_equal :little_endian, layout.byte_order
109
- assert_equal 8, layout.pointer_size
110
- assert_equal 8, layout.pointer_size(0)
111
- assert_equal LLVM::Int64.type, layout.int_ptr_type
112
- assert_equal LLVM::Int64.type, layout.int_ptr_type(0)
109
+ assert_equal 4, layout.pointer_size
110
+ assert_equal 4, layout.pointer_size(0)
111
+ assert_equal LLVM::Int32.type, layout.int_ptr_type
112
+ assert_equal LLVM::Int32.type, layout.int_ptr_type(0)
113
113
 
114
114
  assert_equal 19, layout.bit_size_of(LLVM::Int19.type)
115
115
  assert_equal 3, layout.storage_size_of(LLVM::Int19.type)
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: 3.4.2
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Voorhis
@@ -127,7 +127,6 @@ files:
127
127
  - lib/llvm/linker.rb
128
128
  - lib/llvm/linker_ffi.rb
129
129
  - lib/llvm/support.rb
130
- - lib/llvm/support_ffi.rb
131
130
  - lib/llvm/target.rb
132
131
  - lib/llvm/target_ffi.rb
133
132
  - lib/llvm/transforms/builder.rb
@@ -1,23 +0,0 @@
1
- # Generated by ffi_gen. Please do not change this file by hand.
2
-
3
- require 'ffi'
4
-
5
- module LLVM::C
6
- extend FFI::Library
7
- ffi_lib 'LLVM-3.4'
8
-
9
- def self.attach_function(name, *_)
10
- begin; super; rescue FFI::NotFoundError => e
11
- (class << self; self; end).class_eval { define_method(name) { |*_| raise e } }
12
- end
13
- end
14
-
15
- # (Not documented)
16
- #
17
- # @method load_library_permanently(filename)
18
- # @param [String] filename
19
- # @return [Integer]
20
- # @scope class
21
- attach_function :load_library_permanently, :LLVMLoadLibraryPermanently, [:string], :int
22
-
23
- end