Class: LLVM::PassManager

Inherits:
Object
  • Object
show all
Defined in:
lib/llvm/core/pass_manager.rb,
lib/llvm/transforms/ipo.rb,
lib/llvm/transforms/utils.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:



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

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:



31
32
33
34
35
# File 'lib/llvm/core/pass_manager.rb', line 31

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

  self
end

#adce!Object

/** See llvm::createAggressiveDCEPass function. */ void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM);



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

def adce!
  C.add_aggressive_dce_pass(self)
end

#add_discriminators!Object

/** See llvm::createAddDiscriminatorsPass function. */ void LLVMAddAddDiscriminatorsPass(LLVMPassManagerRef PM);



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

def add_discriminators!
  C.add_add_discriminators_pass(self)
end

#alignment_from_assumptions!Object

/** See llvm::createAlignmentFromAssumptionsPass function. */ void LLVMAddAlignmentFromAssumptionsPass(LLVMPassManagerRef PM);



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

def alignment_from_assumptions!
  C.add_alignment_from_assumptions_pass(self)
end

#always_inline!Object

/** See llvm::createAlwaysInlinerPass function. */ void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM);



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

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!
  warn('arg_promote! / LLVMAddArgumentPromotionPass was removed from LLVM')
end

#basicaa!Object

/** See llvm::createBasicAliasAnalysisPass function */ void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM);



305
306
307
# File 'lib/llvm/transforms/scalar.rb', line 305

def basicaa!
  C.add_basic_alias_analysis_pass(self)
end

#bb_vectorize!Object



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

def bb_vectorize!
  warn('bb_vectorize! / LLVMAddBBVectorizePass was removed from LLVM - replace with slp_vectorize!')
  slp_vectorize!
end

#bdce!Object

/** See llvm::createBitTrackingDCEPass function. */ void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM);



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

def bdce!
  C.add_bit_tracking_dce_pass(self)
end

#called_value_propagation!Object

/** See llvm::createCalledValuePropagationPass function. */ void LLVMAddCalledValuePropagationPass(LLVMPassManagerRef PM);



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

def called_value_propagation!
  C.add_called_value_propagation_pass(self)
end

#const_merge!Object

/** See llvm::createConstantMergePass function. */ void LLVMAddConstantMergePass(LLVMPassManagerRef PM);



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

def const_merge!
  C.add_constant_merge_pass(self)
end

#constprop!Object



235
236
237
# File 'lib/llvm/transforms/scalar.rb', line 235

def constprop!
  warn('constprop! / LLVMAddConstantPropagationPass was removed from LLVM')
end

#cvprop!Object

/** See llvm::createCorrelatedValuePropagationPass function */ void LLVMAddCorrelatedValuePropagationPass(LLVMPassManagerRef PM);



256
257
258
# File 'lib/llvm/transforms/scalar.rb', line 256

def cvprop!
  C.add_correlated_value_propagation_pass(self)
end

#dae!Object

/** See llvm::createDeadArgEliminationPass function. */ void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM);



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

def dae!
  C.add_dead_arg_elimination_pass(self)
end

#dce!Object

/** See llvm::createDeadCodeEliminationPass function. */ void LLVMAddDCEPass(LLVMPassManagerRef PM);



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

def dce!
  C.add_dce_pass(self)
end

#disposeObject

Disposes the pass manager.



46
47
48
49
50
51
52
53
# File 'lib/llvm/core/pass_manager.rb', line 46

def dispose
  return if @ptr.nil?

  finalize

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

#dse!Object

/** See llvm::createDeadStoreEliminationPass function. */ void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM);



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

def dse!
  C.add_dead_store_elimination_pass(self)
end

#early_cse!Object

/** See llvm::createEarlyCSEPass function */ void LLVMAddEarlyCSEPass(LLVMPassManagerRef PM);



263
264
265
# File 'lib/llvm/transforms/scalar.rb', line 263

def early_cse!
  C.add_early_cse_pass(self)
end

#early_cse_memssa!Object

/** See llvm::createEarlyCSEPass function */ void LLVMAddEarlyCSEMemSSAPass(LLVMPassManagerRef PM);



270
271
272
# File 'lib/llvm/transforms/scalar.rb', line 270

def early_cse_memssa!
  C.add_early_cse_mem_ssa_pass(self)
end

#fun_attrs!Object

/** See llvm::createFunctionAttrsPass function. */ void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM);



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

def fun_attrs!
  C.add_function_attrs_pass(self)
end

#gdce!Object

/** See llvm::createGlobalDCEPass function. */ void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM);



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

def gdce!
  C.add_global_dce_pass(self)
end

#global_opt!Object

/** See llvm::createGlobalOptimizerPass function. */ void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM);



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

def global_opt!
  C.add_global_optimizer_pass(self)
end

#gvn!Object

/** See llvm::createGVNPass function. */ void LLVMAddGVNPass(LLVMPassManagerRef PM);



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

def gvn!
  C.add_gvn_pass(self)
end

#indvars!Object

/** See llvm::createIndVarSimplifyPass function. */ void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM);



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

def indvars!
  C.add_ind_var_simplify_pass(self)
end

#inline!Object

/** See llvm::createFunctionInliningPass function. */ void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM);



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

def inline!
  C.add_function_inlining_pass(self)
end

#instcombine!Object

/** See llvm::createInstructionCombiningPass function. */ void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM);



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

def instcombine!
  C.add_instruction_combining_pass(self)
end

#instsimplify!Object

/** See llvm::createInstSimplifyLegacyPass function. */ void LLVMAddInstructionSimplifyPass(LLVMPassManagerRef PM);



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

def instsimplify!
  C.add_instruction_simplify_pass(self)
end

#internalize!(all_but_main = true) ⇒ Object

/** See llvm::createInternalizePass function. */ void LLVMAddInternalizePass(LLVMPassManagerRef, unsigned AllButMain);



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

def internalize!(all_but_main = true)
  C.add_internalize_pass(self, all_but_main ? 1 : 0)
end

#ipcp!Object



79
80
81
# File 'lib/llvm/transforms/ipo.rb', line 79

def ipcp!
  warn('ipcp! / LLVMAddIPConstantPropagationPass was removed from LLVM')
end

#ipsccp!Object

/** See llvm::createIPSCCPPass function. */ void LLVMAddIPSCCPPass(LLVMPassManagerRef PM);



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

def ipsccp!
  C.add_ipsccp_pass(self)
end

#jump_threading!Object

/** See llvm::createJumpThreadingPass function. */ void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM);



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

def jump_threading!
  C.add_jump_threading_pass(self)
end

#licm!Object

/** See llvm::createLICMPass function. */ void LLVMAddLICMPass(LLVMPassManagerRef PM);



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

def licm!
  C.add_licm_pass(self)
end

#loop_deletion!Object

/** See llvm::createLoopDeletionPass function. */ void LLVMAddLoopDeletionPass(LLVMPassManagerRef PM);



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

def loop_deletion!
  C.add_loop_deletion_pass(self)
end

#loop_idiom!Object

/** See llvm::createLoopIdiomPass function */ void LLVMAddLoopIdiomPass(LLVMPassManagerRef PM);



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

def loop_idiom!
  C.add_loop_idiom_pass(self)
end

#loop_reroll!Object

/** See llvm::createLoopRerollPass function. */ void LLVMAddLoopRerollPass(LLVMPassManagerRef PM);



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

def loop_reroll!
  C.add_loop_reroll_pass(self)
end

#loop_rotate!Object

/** See llvm::createLoopRotatePass function. */ void LLVMAddLoopRotatePass(LLVMPassManagerRef PM);



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

def loop_rotate!
  C.add_loop_rotate_pass(self)
end

#loop_unroll!Object



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

def loop_unroll!
  C.add_loop_unroll_pass(self)
end

#loop_unroll_and_jam!Object

/** See llvm::createLoopUnrollAndJamPass function. */ void LLVMAddLoopUnrollAndJamPass(LLVMPassManagerRef PM);



152
153
154
# File 'lib/llvm/transforms/scalar.rb', line 152

def loop_unroll_and_jam!
  C.add_loop_unroll_and_jam_pass(self)
end

#loop_unswitch!Object



157
158
159
# File 'lib/llvm/transforms/scalar.rb', line 157

def loop_unswitch!
  warn('loop_unswitch! / LLVMAddLoopUnswitchPass was removed in LLVM 15')
end

#loop_vectorize!Object

/** See llvm::createLoopVectorizePass function. */ void LLVMAddLoopVectorizePass(LLVMPassManagerRef PM);



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

def loop_vectorize!
  C.add_loop_vectorize_pass(self)
end

#lower_constant_intrinsics!Object

/** See llvm::createLowerConstantIntrinsicsPass function */ void LLVMAddLowerConstantIntrinsicsPass(LLVMPassManagerRef PM);



284
285
286
# File 'lib/llvm/transforms/scalar.rb', line 284

def lower_constant_intrinsics!
  C.add_lower_constant_intrinsics_pass(self)
end

#lower_expect!Object

/** See llvm::createLowerExpectIntrinsicPass function */ void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM);



277
278
279
# File 'lib/llvm/transforms/scalar.rb', line 277

def lower_expect!
  C.add_lower_expect_intrinsic_pass(self)
end

#loweratomic!Object

/** See llvm::createLowerAtomicPass function. */ void LLVMAddLowerAtomicPass(LLVMPassManagerRef PM);



164
165
166
# File 'lib/llvm/transforms/scalar.rb', line 164

def loweratomic!
  C.add_lower_atomic_pass(self)
end

#lowerswitch!Object

/** See llvm::createLowerSwitchPass function. */ void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM);



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

def lowerswitch!
  C.add_lower_switch_pass(self)
end

#mem2reg!Object

/** See llvm::createPromoteMemoryToRegisterPass function. */ void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM);



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

def mem2reg!
  C.add_promote_memory_to_register_pass(self)
end

#memcpyopt!Object

/** See llvm::createMemCpyOptPass function. */ void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM);



171
172
173
# File 'lib/llvm/transforms/scalar.rb', line 171

def memcpyopt!
  C.add_mem_cpy_opt_pass(self)
end

#mergefunc!Object

/** See llvm::createMergeFunctionsPass function. */ void LLVMAddMergeFunctionsPass(LLVMPassManagerRef PM);



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

def mergefunc!
  C.add_merge_functions_pass(self)
end

#mergereturn!Object

/** See llvm::createUnifyFunctionExitNodesPass function */ void LLVMAddUnifyFunctionExitNodesPass(LLVMPassManagerRef PM);



312
313
314
# File 'lib/llvm/transforms/scalar.rb', line 312

def mergereturn!
  C.add_unify_function_exit_nodes_pass(self)
end

#mldst_motion!Object

/** See llvm::createMergedLoadStoreMotionPass function. */ void LLVMAddMergedLoadStoreMotionPass(LLVMPassManagerRef PM);



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

def mldst_motion!
  C.add_merged_load_store_motion_pass(self)
end

#newgvn!Object

/** See llvm::createGVNPass function. */ void LLVMAddNewGVNPass(LLVMPassManagerRef PM);



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

def newgvn!
  C.add_new_gvn_pass(self)
end

#partially_inline_libcalls!Object

/** See llvm::createPartiallyInlineLibCallsPass function. */ void LLVMAddPartiallyInlineLibCallsPass(LLVMPassManagerRef PM);



178
179
180
# File 'lib/llvm/transforms/scalar.rb', line 178

def partially_inline_libcalls!
  C.add_partially_inline_lib_calls_pass(self)
end

#prune_eh!Object

/** See llvm::createPruneEHPass function. */ void LLVMAddPruneEHPass(LLVMPassManagerRef PM);



86
87
88
# File 'lib/llvm/transforms/ipo.rb', line 86

def prune_eh!
  C.add_prune_eh_pass(self)
end

#reassociate!Object

/** See llvm::createReassociatePass function. */ void LLVMAddReassociatePass(LLVMPassManagerRef PM);



185
186
187
# File 'lib/llvm/transforms/scalar.rb', line 185

def reassociate!
  C.add_reassociate_pass(self)
end

#reg2mem!Object

/** See llvm::demotePromoteMemoryToRegisterPass function. */ void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM);



242
243
244
# File 'lib/llvm/transforms/scalar.rb', line 242

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.



41
42
43
# File 'lib/llvm/core/pass_manager.rb', line 41

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

#scalarizer!Object

/** See llvm::createScalarizerPass function. */ void LLVMAddScalarizerPass(LLVMPassManagerRef PM);



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

def scalarizer!
  C.add_scalarizer_pass(self)
end

#scalarrepl!Object

/** See llvm::createSROAPass function. */ void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM);



199
200
201
# File 'lib/llvm/transforms/scalar.rb', line 199

def scalarrepl!
  C.add_scalar_repl_aggregates_pass(self)
end

#scalarrepl_ssa!Object

/** See llvm::createSROAPass function. */ void LLVMAddScalarReplAggregatesPassSSA(LLVMPassManagerRef PM);



206
207
208
# File 'lib/llvm/transforms/scalar.rb', line 206

def scalarrepl_ssa!
  C.add_scalar_repl_aggregates_pass_ssa(self)
end

#scalarrepl_threshold!(threshold = 0) ⇒ Object

/** See llvm::createSROAPass function. */ void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM,

int Threshold);

threshold appears unused: llvm.org/doxygen/Scalar_8cpp_source.html#l00211



215
216
217
# File 'lib/llvm/transforms/scalar.rb', line 215

def scalarrepl_threshold!(threshold = 0)
  C.add_scalar_repl_aggregates_pass_with_threshold(self, threshold)
end

#sccp!Object

/** See llvm::createSCCPPass function. */ void LLVMAddSCCPPass(LLVMPassManagerRef PM);



192
193
194
# File 'lib/llvm/transforms/scalar.rb', line 192

def sccp!
  C.add_sccp_pass(self)
end

#scoped_noalias_aa!Object

@ LLVMPass scoped-noalias-aa /** See llvm::createScopedNoAliasAAPass function */ void LLVMAddScopedNoAliasAAPass(LLVMPassManagerRef PM);



298
299
300
# File 'lib/llvm/transforms/scalar.rb', line 298

def scoped_noalias_aa!
  C.add_scoped_no_alias_aa_pass(self)
end

#sdp!Object

/** See llvm::createStripDeadPrototypesPass function. */ void LLVMAddStripDeadPrototypesPass(LLVMPassManagerRef PM);



107
108
109
# File 'lib/llvm/transforms/ipo.rb', line 107

def sdp!
  C.add_strip_dead_prototypes_pass(self)
end

#simplify_libcalls!Object

/** See llvm::createSimplifyLibCallsPass function. */ void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM); removed: llvm.org/doxygen/Scalar_8cpp_source.html#l00211



223
224
225
# File 'lib/llvm/transforms/scalar.rb', line 223

def simplify_libcalls!
  warn('simplify_libcalls! / LLVMAddSimplifyLibCallsPass was removed from LLVM')
end

#simplifycfg!Object

/** See llvm::createCFGSimplificationPass function. */ void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM);



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

def simplifycfg!
  C.add_cfg_simplification_pass(self)
end

#slp_vectorize!Object

/** See llvm::createSLPVectorizerPass function. */ void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM);



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

def slp_vectorize!
  C.add_slp_vectorize_pass(self)
end

#strip!Object

/** See llvm::createStripSymbolsPass function. */ void LLVMAddStripSymbolsPass(LLVMPassManagerRef PM);



114
115
116
# File 'lib/llvm/transforms/ipo.rb', line 114

def strip!
  C.add_strip_symbols_pass(self)
end

#tailcallelim!Object

/** See llvm::createTailCallEliminationPass function. */ void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM);



230
231
232
# File 'lib/llvm/transforms/scalar.rb', line 230

def tailcallelim!
  C.add_tail_call_elimination_pass(self)
end

#tbaa!Object

/** See llvm::createTypeBasedAliasAnalysisPass function */ void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM);



291
292
293
# File 'lib/llvm/transforms/scalar.rb', line 291

def tbaa!
  C.add_type_based_alias_analysis_pass(self)
end

#to_ptrObject



23
24
25
# File 'lib/llvm/core/pass_manager.rb', line 23

def to_ptr
  @ptr
end

#verify!Object

/** See llvm::createVerifierPass function. */ void LLVMAddVerifierPass(LLVMPassManagerRef PM);



249
250
251
# File 'lib/llvm/transforms/scalar.rb', line 249

def verify!
  C.add_verifier_pass(self)
end