Beispiel #1
0
def gen_executor(mapir):
	from iegen.codegen import Function,gen_index_array
	from iegen.idg.visitor import ParamVisitor,DeclVisitor,OutputERVisitor

	#Create the executor function with the necessary parameters
	executor=Function(iegen.settings.executor_name,'void',ParamVisitor().visit(mapir.idg).get_params())

	#Add the necessary variable declarations
	executor.body.extend(DeclVisitor(mapir).visit(mapir.idg).get_decls())

	#Generate wrappers for the index arrays
	for index_array in mapir.get_index_arrays():
		executor.body.extend(gen_index_array(index_array))

	#Generate assignment statements for the output ERs
	executor.body.extend(OutputERVisitor(mapir).visit(mapir.idg).get_assigns())

	#Generate the loop statement definitions
	executor.body.extend(gen_executor_loop_stmts(mapir))
	executor.newline()

	#Generate the loop body using CLooG
	executor.body.extend(gen_executor_loop(mapir))
	executor.newline()

	#Generate the loop statement undefines
	executor.body.extend(gen_executor_undefs(mapir))
	executor.newline()

	return executor
Beispiel #2
0
	def atIDGIndexArray(self,node): self.stmts.extend(gen_index_array(node.data))

	def atIDGOutputERSpec(self,node): pass