Class: LLVM::PassManager

Inherits:
Object
  • Object
show all
Defined in:
lib/llvm/core/pass_manager.rb,
lib/llvm/transforms/ipo.rb,
lib/llvm/transforms/scalar.rb,
lib/llvm/transforms/vectorize.rb

Overview

The PassManager runs a queue of passes on a module. See llvm.org/docs/Passes.html for the list of available passes.

Direct Known Subclasses

FunctionPassManager

Instance Method Summary collapse

Constructor Details

#initialize(machine = nil) ⇒ PassManager

Creates a new pass manager.

Parameters:



10
11
12
13
14
15
# File 'lib/llvm/core/pass_manager.rb', line 10

def initialize(machine = nil)
  if machine
    warn("[DEPRECATION] PassManager.new should be called without parameters")
  end
  @ptr = C.create_pass_manager()
end

Instance Method Details

#<<(name) ⇒ LLVM::PassManager

Append a pass to the pass queue.

Parameters:

  • name (Symbol)

Returns:



26
27
28
29
30
# File 'lib/llvm/core/pass_manager.rb', line 26

def <<(name)
  send(:"#{name}!")

  self
end

#adce!Object



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

def adce!
  C.add_aggressive_dce_pass(self)
end

#always_inline!Object



36
37
38
# File 'lib/llvm/transforms/ipo.rb', line 36

def always_inline!
  C.add_always_inliner_pass(self)
end

#arg_promote!Object



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

def arg_promote!
  C.add_argument_promotion_pass(self)
end

#basicaa!Object



150
151
152
# File 'lib/llvm/transforms/scalar.rb', line 150

def basicaa!
  C.add_basic_alias_analysis_pass(self)
end

#bb_vectorize!Object



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

def bb_vectorize!
  C.add_bb_vectorize_pass(self)
end

#const_merge!Object



16
17
18
# File 'lib/llvm/transforms/ipo.rb', line 16

def const_merge!
  C.add_constant_merge_pass(self)
end

#constprop!Object



120
121
122
# File 'lib/llvm/transforms/scalar.rb', line 120

def constprop!
  C.add_constant_propagation_pass(self)
end

#cvprop!Object



130
131
132
# File 'lib/llvm/transforms/scalar.rb', line 130

def cvprop!
  C.add_correlated_value_propagation_pass(self)
end

#dae!Object



21
22
23
# File 'lib/llvm/transforms/ipo.rb', line 21

def dae!
  C.add_dead_arg_elimination(self)
end

#disposeObject

Disposes the pass manager.



41
42
43
44
45
46
47
48
# File 'lib/llvm/core/pass_manager.rb', line 41

def dispose
  return if @ptr.nil?

  finalize

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

#dse!Object



20
21
22
# File 'lib/llvm/transforms/scalar.rb', line 20

def dse!
  C.add_dead_store_elimination_pass(self)
end

#early_cse!Object



135
136
137
# File 'lib/llvm/transforms/scalar.rb', line 135

def early_cse!
  C.add_early_cse_pass(self)
end

#fun_attrs!Object



26
27
28
# File 'lib/llvm/transforms/ipo.rb', line 26

def fun_attrs!
  C.add_function_attrs_pass(self)
end

#gdce!Object



41
42
43
# File 'lib/llvm/transforms/ipo.rb', line 41

def gdce!
  C.add_global_dce_pass(self)
end

#global_opt!Object



46
47
48
# File 'lib/llvm/transforms/ipo.rb', line 46

def global_opt!
  C.add_global_optimizer_pass(self)
end

#gvn!Object



25
26
27
# File 'lib/llvm/transforms/scalar.rb', line 25

def gvn!
  C.add_gvn_pass(self)
end

#indvars!Object



30
31
32
# File 'lib/llvm/transforms/scalar.rb', line 30

def indvars!
  C.add_ind_var_simplify_pass(self)
end

#inline!Object



31
32
33
# File 'lib/llvm/transforms/ipo.rb', line 31

def inline!
  C.add_function_inlining_pass(self)
end

#instcombine!Object



35
36
37
# File 'lib/llvm/transforms/scalar.rb', line 35

def instcombine!
  C.add_instruction_combining_pass(self)
end

#internalize!(all_but_main = true) ⇒ Object



66
67
68
# File 'lib/llvm/transforms/ipo.rb', line 66

def internalize!(all_but_main = true)
  C.add_internalize_pass(self, all_but_main)
end

#ipcp!Object



51
52
53
# File 'lib/llvm/transforms/ipo.rb', line 51

def ipcp!
  C.add_ip_constant_propagation_pass(self)
end

#ipsccp!Object



61
62
63
# File 'lib/llvm/transforms/ipo.rb', line 61

def ipsccp!
  C.add_ipsccp_pass(self)
end

#jump_threading!Object



40
41
42
# File 'lib/llvm/transforms/scalar.rb', line 40

def jump_threading!
  C.add_jump_threading_pass(self)
end

#licm!Object



45
46
47
# File 'lib/llvm/transforms/scalar.rb', line 45

def licm!
  C.add_licm_pass(self)
end

#loop_deletion!Object



50
51
52
# File 'lib/llvm/transforms/scalar.rb', line 50

def loop_deletion!
  C.add_loop_deletion_pass(self)
end

#loop_idiom!Object



55
56
57
# File 'lib/llvm/transforms/scalar.rb', line 55

def loop_idiom!
  C.add_loop_idiom_pass(self)
end

#loop_rotate!Object



60
61
62
# File 'lib/llvm/transforms/scalar.rb', line 60

def loop_rotate!
  C.add_loop_rotate_pass(self)
end

#loop_unroll!Object



65
66
67
# File 'lib/llvm/transforms/scalar.rb', line 65

def loop_unroll!
  C.add_loop_unroll_pass(self)
end

#loop_unswitch!Object



70
71
72
# File 'lib/llvm/transforms/scalar.rb', line 70

def loop_unswitch!
  C.add_loop_unswitch_pass(self)
end

#loop_vectorize!Object



15
16
17
# File 'lib/llvm/transforms/vectorize.rb', line 15

def loop_vectorize!
  C.add_loop_vectorize_pass(self)
end

#lower_expect!Object



140
141
142
# File 'lib/llvm/transforms/scalar.rb', line 140

def lower_expect!
  C.add_lower_expect_intrinsic_pass(self)
end

#mem2reg!Object



80
81
82
# File 'lib/llvm/transforms/scalar.rb', line 80

def mem2reg!
  C.add_promote_memory_to_register_pass(self)
end

#memcpyopt!Object



75
76
77
# File 'lib/llvm/transforms/scalar.rb', line 75

def memcpyopt!
  C.add_mem_cpy_opt_pass(self)
end

#mergefunc!Object



155
156
157
# File 'lib/llvm/transforms/scalar.rb', line 155

def mergefunc!
  C.add_merge_functions_pass(self)
end

#prune_eh!Object



56
57
58
# File 'lib/llvm/transforms/ipo.rb', line 56

def prune_eh!
  C.add_prune_eh_pass(self)
end

#reassociate!Object



85
86
87
# File 'lib/llvm/transforms/scalar.rb', line 85

def reassociate!
  C.add_reassociate_pass(self)
end

#reg2mem!Object



125
126
127
# File 'lib/llvm/transforms/scalar.rb', line 125

def reg2mem!
  C.add_demote_memory_to_register_pass(self)
end

#run(mod) ⇒ true, false

Run the pass queue on the given module.

Parameters:

Returns:

  • (true, false)

    Indicates whether the module was modified.



36
37
38
# File 'lib/llvm/core/pass_manager.rb', line 36

def run(mod)
  C.run_pass_manager(self, mod) != 0
end

#scalarrepl!Object



95
96
97
# File 'lib/llvm/transforms/scalar.rb', line 95

def scalarrepl!
  C.add_scalar_repl_aggregates_pass(self)
end

#scalarrepl_ssa!Object



100
101
102
# File 'lib/llvm/transforms/scalar.rb', line 100

def scalarrepl_ssa!
  C.add_scalar_repl_aggregates_pass_ssa(self)
end

#scalarrepl_threshold!(threshold) ⇒ Object



105
106
107
# File 'lib/llvm/transforms/scalar.rb', line 105

def scalarrepl_threshold!(threshold)
  C.add_scalar_repl_aggregates_pass(self, threshold)
end

#sccp!Object



90
91
92
# File 'lib/llvm/transforms/scalar.rb', line 90

def sccp!
  C.add_sccp_pass(self)
end

#sdp!Object



71
72
73
# File 'lib/llvm/transforms/ipo.rb', line 71

def sdp!
  C.add_strip_dead_prototypes_pass(self)
end

#simplify_libcalls!Object



110
111
112
# File 'lib/llvm/transforms/scalar.rb', line 110

def simplify_libcalls!
  C.add_simplify_lib_calls_pass(self)
end

#simplifycfg!Object



15
16
17
# File 'lib/llvm/transforms/scalar.rb', line 15

def simplifycfg!
  C.add_cfg_simplification_pass(self)
end

#slp_vectorize!Object



20
21
22
# File 'lib/llvm/transforms/vectorize.rb', line 20

def slp_vectorize!
  C.add_slp_vectorize_pass(self)
end

#strip!Object



76
77
78
# File 'lib/llvm/transforms/ipo.rb', line 76

def strip!
  C.add_strip_symbols_pass(self)
end

#tailcallelim!Object



115
116
117
# File 'lib/llvm/transforms/scalar.rb', line 115

def tailcallelim!
  C.add_tail_call_elimination_pass(self)
end

#tbaa!Object



145
146
147
# File 'lib/llvm/transforms/scalar.rb', line 145

def tbaa!
  C.add_type_based_alias_analysis_pass(self)
end

#to_ptrObject



18
19
20
# File 'lib/llvm/core/pass_manager.rb', line 18

def to_ptr
  @ptr
end