Class: RLTK::CG::FunctionPassManager

Inherits:
PassManager show all
Defined in:
lib/rltk/cg/pass_manager.rb

Overview

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

Constant Summary

Constants inherited from PassManager

PassManager::CLASS_FINALIZER, PassManager::PASSES

Instance Attribute Summary

Attributes included from BindingClass

#ptr

Instance Method Summary collapse

Methods inherited from PassManager

#add, #enabled, #enabled?, #target_data=

Methods included from BindingClass

#==

Constructor Details

#initialize(mod) ⇒ FunctionPassManager

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

Parameters:

  • mod (Module)

    Module this pass manager belongs to.

See Also:



176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/rltk/cg/pass_manager.rb', line 176

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

Instance Method Details

#run(fun) ⇒ void

This method returns an undefined value.

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

Parameters:

  • fun (Function)

    Function to optimize.



195
196
197
# File 'lib/rltk/cg/pass_manager.rb', line 195

def run(fun)
	Bindings.run_function_pass_manager(@ptr, fun).to_bool
end