class RCGTK::FunctionPassManager

A FunctionPassManager is responsible for scheduling and running optimization passes on individual functions inside the context of a module.

Public Class Methods

new(mod) click to toggle source

Create a new function pass manager. You should never have to do this as {Module Modules} should create FunctionPassManagers for you whenever they are requested.

@see Module#function_pass_manager

@param [Module] mod Module this pass manager belongs to.

# File lib/rcgtk/pass_manager.rb, line 183
def initialize(mod)
        # LLVM Initialization
        @ptr = Bindings.create_function_pass_manager_for_module(mod)

        # Set the target data if the module is associated with a execution engine.
        self.target_data = mod.engine.target_data if mod.engine

        Bindings.initialize_function_pass_manager(@ptr)

        # RLTK Initialization
        @enabled = Array.new
end

Public Instance Methods

run(fun) click to toggle source

Run the enabled passes on the given function inside the execution engine’s module.

@param [Function] fun Function to optimize.

@return [void]

# File lib/rcgtk/pass_manager.rb, line 202
def run(fun)
        Bindings.run_function_pass_manager(@ptr, fun).to_bool
end

Protected Instance Methods

finalize() click to toggle source

Called by {#dispose} to finalize any operations of the function pass manager.

@return [void]

# File lib/rcgtk/pass_manager.rb, line 211
def finalize
        Bindings.finalize_function_pass_manager(@ptr).to_bool
end