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:



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

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:



24
25
26
27
28
# File 'lib/llvm/core/pass_manager.rb', line 24

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

  self
end

#adce!Object



8
9
10
# File 'lib/llvm/transforms/scalar.rb', line 8

def adce!
  C.add_aggressive_dce_pass(self)
end

#always_inline!Object



34
35
36
# File 'lib/llvm/transforms/ipo.rb', line 34

def always_inline!
  C.add_always_inliner_pass(self)
end

#arg_promote!Object



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

def arg_promote!
  C.add_argument_promotion_pass(self)
end

#basicaa!Object



148
149
150
# File 'lib/llvm/transforms/scalar.rb', line 148

def basicaa!
  C.add_basic_alias_analysis_pass(self)
end

#bb_vectorize!Object



8
9
10
# File 'lib/llvm/transforms/vectorize.rb', line 8

def bb_vectorize!
  C.add_bb_vectorize_pass(self)
end

#const_merge!Object



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

def const_merge!
  C.add_constant_merge_pass(self)
end

#constprop!Object



118
119
120
# File 'lib/llvm/transforms/scalar.rb', line 118

def constprop!
  C.add_constant_propagation_pass(self)
end

#cvprop!Object



128
129
130
# File 'lib/llvm/transforms/scalar.rb', line 128

def cvprop!
  C.add_correlated_value_propagation_pass(self)
end

#dae!Object



19
20
21
# File 'lib/llvm/transforms/ipo.rb', line 19

def dae!
  C.add_dead_arg_elimination(self)
end

#disposeObject

Disposes the pass manager.



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

def dispose
  return if @ptr.nil?

  finalize

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

#dse!Object



18
19
20
# File 'lib/llvm/transforms/scalar.rb', line 18

def dse!
  C.add_dead_store_elimination_pass(self)
end

#early_cse!Object



133
134
135
# File 'lib/llvm/transforms/scalar.rb', line 133

def early_cse!
  C.add_early_cse_pass(self)
end

#fun_attrs!Object



24
25
26
# File 'lib/llvm/transforms/ipo.rb', line 24

def fun_attrs!
  C.add_function_attrs_pass(self)
end

#gdce!Object



39
40
41
# File 'lib/llvm/transforms/ipo.rb', line 39

def gdce!
  C.add_global_dce_pass(self)
end

#global_opt!Object



44
45
46
# File 'lib/llvm/transforms/ipo.rb', line 44

def global_opt!
  C.add_global_optimizer_pass(self)
end

#gvn!Object



23
24
25
# File 'lib/llvm/transforms/scalar.rb', line 23

def gvn!
  C.add_gvn_pass(self)
end

#indvars!Object



28
29
30
# File 'lib/llvm/transforms/scalar.rb', line 28

def indvars!
  C.add_ind_var_simplify_pass(self)
end

#inline!Object



29
30
31
# File 'lib/llvm/transforms/ipo.rb', line 29

def inline!
  C.add_function_inlining_pass(self)
end

#instcombine!Object



33
34
35
# File 'lib/llvm/transforms/scalar.rb', line 33

def instcombine!
  C.add_instruction_combining_pass(self)
end

#internalize!(all_but_main = true) ⇒ Object



64
65
66
# File 'lib/llvm/transforms/ipo.rb', line 64

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

#ipcp!Object



49
50
51
# File 'lib/llvm/transforms/ipo.rb', line 49

def ipcp!
  C.add_ip_constant_propagation_pass(self)
end

#ipsccp!Object



59
60
61
# File 'lib/llvm/transforms/ipo.rb', line 59

def ipsccp!
  C.add_ipsccp_pass(self)
end

#jump_threading!Object



38
39
40
# File 'lib/llvm/transforms/scalar.rb', line 38

def jump_threading!
  C.add_jump_threading_pass(self)
end

#licm!Object



43
44
45
# File 'lib/llvm/transforms/scalar.rb', line 43

def licm!
  C.add_licm_pass(self)
end

#loop_deletion!Object



48
49
50
# File 'lib/llvm/transforms/scalar.rb', line 48

def loop_deletion!
  C.add_loop_deletion_pass(self)
end

#loop_idiom!Object



53
54
55
# File 'lib/llvm/transforms/scalar.rb', line 53

def loop_idiom!
  C.add_loop_idiom_pass(self)
end

#loop_rotate!Object



58
59
60
# File 'lib/llvm/transforms/scalar.rb', line 58

def loop_rotate!
  C.add_loop_rotate_pass(self)
end

#loop_unroll!Object



63
64
65
# File 'lib/llvm/transforms/scalar.rb', line 63

def loop_unroll!
  C.add_loop_unroll_pass(self)
end

#loop_unswitch!Object



68
69
70
# File 'lib/llvm/transforms/scalar.rb', line 68

def loop_unswitch!
  C.add_loop_unswitch_pass(self)
end

#loop_vectorize!Object



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

def loop_vectorize!
  C.add_loop_vectorize_pass(self)
end

#lower_expect!Object



138
139
140
# File 'lib/llvm/transforms/scalar.rb', line 138

def lower_expect!
  C.add_lower_expect_intrinsic_pass(self)
end

#mem2reg!Object



78
79
80
# File 'lib/llvm/transforms/scalar.rb', line 78

def mem2reg!
  C.add_promote_memory_to_register_pass(self)
end

#memcpyopt!Object



73
74
75
# File 'lib/llvm/transforms/scalar.rb', line 73

def memcpyopt!
  C.add_mem_cpy_opt_pass(self)
end

#prune_eh!Object



54
55
56
# File 'lib/llvm/transforms/ipo.rb', line 54

def prune_eh!
  C.add_prune_eh_pass(self)
end

#reassociate!Object



83
84
85
# File 'lib/llvm/transforms/scalar.rb', line 83

def reassociate!
  C.add_reassociate_pass(self)
end

#reg2mem!Object



123
124
125
# File 'lib/llvm/transforms/scalar.rb', line 123

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.



34
35
36
# File 'lib/llvm/core/pass_manager.rb', line 34

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

#scalarrepl!Object



93
94
95
# File 'lib/llvm/transforms/scalar.rb', line 93

def scalarrepl!
  C.add_scalar_repl_aggregates_pass(self)
end

#scalarrepl_ssa!Object



98
99
100
# File 'lib/llvm/transforms/scalar.rb', line 98

def scalarrepl_ssa!
  C.add_scalar_repl_aggregates_pass_ssa(self)
end

#scalarrepl_threshold!(threshold) ⇒ Object



103
104
105
# File 'lib/llvm/transforms/scalar.rb', line 103

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

#sccp!Object



88
89
90
# File 'lib/llvm/transforms/scalar.rb', line 88

def sccp!
  C.add_sccp_pass(self)
end

#sdp!Object



69
70
71
# File 'lib/llvm/transforms/ipo.rb', line 69

def sdp!
  C.add_strip_dead_prototypes_pass(self)
end

#simplify_libcalls!Object



108
109
110
# File 'lib/llvm/transforms/scalar.rb', line 108

def simplify_libcalls!
  C.add_simplify_lib_calls_pass(self)
end

#simplifycfg!Object



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

def simplifycfg!
  C.add_cfg_simplification_pass(self)
end

#slp_vectorize!Object



18
19
20
# File 'lib/llvm/transforms/vectorize.rb', line 18

def slp_vectorize!
  C.add_slp_vectorize_pass(self)
end

#strip!Object



74
75
76
# File 'lib/llvm/transforms/ipo.rb', line 74

def strip!
  C.add_strip_symbols_pass(self)
end

#tailcallelim!Object



113
114
115
# File 'lib/llvm/transforms/scalar.rb', line 113

def tailcallelim!
  C.add_tail_call_elimination_pass(self)
end

#tbaa!Object



143
144
145
# File 'lib/llvm/transforms/scalar.rb', line 143

def tbaa!
  C.add_type_based_alias_analysis_pass(self)
end

#to_ptrObject



16
17
18
# File 'lib/llvm/core/pass_manager.rb', line 16

def to_ptr
  @ptr
end