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

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(execution_engine) ⇒ PassManager

Creates a new pass manager on the given ExecutionEngine.



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

def initialize(execution_engine)
  ptr = C.LLVMCreatePassManager()
  C.LLVMAddTargetData(
    C.LLVMGetExecutionEngineTargetData(execution_engine), ptr)
  @ptr = ptr

  do_initialization
end

Instance Method Details

#<<(name) ⇒ LLVM::PassManager

Append a pass to the pass queue.

Parameters:

  • (Symbol)

Returns:



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

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

#adce!Object



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

def adce!
  C.LLVMAddAggressiveDCEPass(self)
end

#constprop!Object



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

def constprop!
  C.LLVMAddConstantPropagationPass(self)
end

#disposeObject

Disposes the pass manager.



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

def dispose
  do_finalization
  C.LLVMDisposePassManager(self)
end

#dse!Object



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

def dse!
  C.LLVMAddDeadStoreEliminationPass(self)
end

#gdce!Object



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

def gdce!
  C.LLVMAddGlobalDCEPass(self)
end

#gvn!Object



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

def gvn!
  C.LLVMAddGVNPass(self)
end

#indvars!Object



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

def indvars!
  C.LLVMAddIndVarSimplifyPass(self)
end

#inline!Object



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

def inline!
  C.LLVMAddFunctionInliningPass(self)
end

#instcombine!Object



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

def instcombine!
  C.LLVMAddInstructionCombiningPass(self)
end

#jump_threading!Object



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

def jump_threading!
  C.LLVMAddJumpThreadingPass(self)
end

#licm!Object



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

def licm!
  C.LLVMAddLICMPass(self)
end

#loop_deletion!Object



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

def loop_deletion!
  C.LLVMAddLoopDeletionPass(self)
end

#loop_rotate!Object



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

def loop_rotate!
  C.LLVMAddLoopRotatePass(self)
end

#loop_unroll!Object



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

def loop_unroll!
  C.LLVMAddLoopUnrollPass(self)
end

#loop_unswitch!Object



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

def loop_unswitch!
  C.LLVMAddLoopUnswitchPass(self)
end

#mem2reg!Object



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

def mem2reg!
  C.LLVMAddPromoteMemoryToRegisterPass(self)
end

#memcpyopt!Object



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

def memcpyopt!
  C.LLVMAddMemCpyOptPass(self)
end

#reassociate!Object



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

def reassociate!
  C.LLVMAddReassociatePass(self)
end

#reg2mem!Object



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

def reg2mem!
  C.LLVMAddDemoteMemoryToRegisterPass(self)
end

#run(mod) ⇒ true, false

Run the pass queue on the given module.

Parameters:

Returns:

  • (true, false)

    Indicates whether the module was modified.



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

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

#scalarrepl!Object



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

def scalarrepl!
  C.LLVMAddScalarReplAggregatesPass(self)
end

#sccp!Object



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

def sccp!
  C.LLVMAddSCCPPass(self)
end

#simplify_libcalls!Object



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

def simplify_libcalls!
  C.LLVMAddSimplifyLibCallsPass(self)
end

#simplifycfg!Object



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

def simplifycfg!
  C.LLVMAddCFGSimplificationPass(self)
end

#tailcallelim!Object



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

def tailcallelim!
  C.LLVMAddTailCallEliminationPass(self)
end

#to_ptrObject



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

def to_ptr
  @ptr
end