Class: LLVM::PassManagerBuilder

Inherits:
Object
  • Object
show all
Includes:
PointerIdentity
Defined in:
lib/llvm/transforms/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PointerIdentity

#==, #eql?, #hash, #to_ptr

Constructor Details

#initializePassManagerBuilder

Returns a new instance of PassManagerBuilder.



16
17
18
19
20
21
22
23
24
25
# File 'lib/llvm/transforms/builder.rb', line 16

def initialize
  @ptr = C.pass_manager_builder_create

  @size_level         = 0
  @opt_level          = 0
  @unit_at_a_time     = false
  @unroll_loops       = false
  @simplify_lib_calls = false
  @inliner_threshold  = 0
end

Instance Attribute Details

#inliner_thresholdObject

Returns the value of attribute inliner_threshold.



14
15
16
# File 'lib/llvm/transforms/builder.rb', line 14

def inliner_threshold
  @inliner_threshold
end

#opt_levelObject

Returns the value of attribute opt_level.



10
11
12
# File 'lib/llvm/transforms/builder.rb', line 10

def opt_level
  @opt_level
end

#simplify_lib_callsObject

Returns the value of attribute simplify_lib_calls.



13
14
15
# File 'lib/llvm/transforms/builder.rb', line 13

def simplify_lib_calls
  @simplify_lib_calls
end

#size_levelObject

Returns the value of attribute size_level.



9
10
11
# File 'lib/llvm/transforms/builder.rb', line 9

def size_level
  @size_level
end

#unit_at_a_timeObject

Returns the value of attribute unit_at_a_time.



11
12
13
# File 'lib/llvm/transforms/builder.rb', line 11

def unit_at_a_time
  @unit_at_a_time
end

#unroll_loopsObject

Returns the value of attribute unroll_loops.



12
13
14
# File 'lib/llvm/transforms/builder.rb', line 12

def unroll_loops
  @unroll_loops
end

Instance Method Details

#build(pass_manager) ⇒ Object

Populate a pass manager.

Parameters:



74
75
76
77
78
79
80
81
82
# File 'lib/llvm/transforms/builder.rb', line 74

def build(pass_manager)
  case pass_manager
  when FunctionPassManager
    C.pass_manager_builder_populate_function_pass_manager(self, pass_manager)

  when PassManager
    C.pass_manager_builder_populate_module_pass_manager(self, pass_manager)
  end
end

#build_with_lto(pass_manager, internalize = false, run_inliner = false) ⇒ Object

Populate an LTO pass manager.

Parameters:



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/llvm/transforms/builder.rb', line 86

def build_with_lto(pass_manager, internalize=false, run_inliner=false)
  if pass_manager.is_a?(FunctionPassManager)
    raise ArgumentError, "FunctionPassManager does not support LTO"
  end

  if internalize.kind_of?(Integer) || run_inliner.kind_of?(Integer)
    warn 'Warning: Passing Integer value to LLVM::PassManagerBuilder#build_with_lto is deprecated.'
    internalize = !internalize.zero? if internalize.kind_of?(Integer)
    run_inliner = !run_inliner.zero? if run_inliner.kind_of?(Integer)
  end

  C.pass_manager_builder_populate_lto_pass_manager(self,
        pass_manager, flag(internalize), flag(run_inliner))
end

#disposeObject



27
28
29
30
31
32
# File 'lib/llvm/transforms/builder.rb', line 27

def dispose
  return if @ptr.nil?

  C.pass_manager_builder_dispose(@ptr)
  @ptr = nil
end