loki.backend.maxgen

Functions

maxj_dfevar_type(_type)

maxj_local_type(_type)

maxjgen(ir)

Generate Maxeler maxj kernel code from one or many IR objects/trees.

Classes

MaxjCodeMapper(*args, **kwargs)

MaxjCodegen([depth, indent, linewidth])

Tree visitor to generate Maxeler maxj kernel code from IR.

maxjgen(ir)

Generate Maxeler maxj kernel code from one or many IR objects/trees.

class MaxjCodegen(depth=0, indent='  ', linewidth=90)

Bases: Stringifier

Tree visitor to generate Maxeler maxj kernel code from IR.

visit_Sourcefile(o, **kwargs)

Format as

...modules...
...subroutines...
visit_Module(o, **kwargs)

Format modules for a kernel as:

package <name without Kernel>;
...imports...
class <name> extends Kernel {
    ...spec without imports...
    ...routines...
}

Format modules for the manager as:

package <name without Manager>;
...imports...
public interface <name> extends ManagerPCIe, ManagerKernel {
    ...spec without imports...
    ...routines...
}

or for the platform-specific instantiation:

package <name without ManagerMAX5C>;
...imports...
public class <name> extends MAX5CManager implements <name without MAX5C> {
    ...spec without imports...
    ...routines...
}
visit_Subroutine(o, **kwargs)

Format as:

<name>(<args>) {
    ...spec without arg declarations...
    ...body...
}
visit_Node(o, **kwargs)

Format non-supported nodes as

// <repr(Node)>
visit_Intrinsic(o, **kwargs)

Format intrinsic nodes.

visit_Comment(o, **kwargs)

Format comments.

visit_CommentBlock(o, **kwargs)

Format comment blocks.

visit_VariableDeclaration(o, **kwargs)

Format declaration as

<type> <name> = <initial>
visit_Loop(o, **kwargs)

Format loop with explicit range as

for (<var> = <start>; <var> <= <end>; <var> += <incr>) {
    ...body...
}
visit_Assignment(o, **kwargs)

Format statement as

<target> = <expr>

or

<dfe_target> <== <expr>
visit_ConditionalAssignment(o, **kwargs)

Format conditional statement as

<target> = <condition> ? <expr> : <else_expr>
visit_Section(o, **kwargs)

Format the section’s body.

visit_CallStatement(o, **kwargs)

Format call statement as

<name>(<args>)
visit_Import(o, **kwargs)

Format imports as

import <name>;
visit_SymbolAttributes(o, **kwargs)
visit_TypeDef(o)
class MaxjCodeMapper(*args, **kwargs)

Bases: LokiStringifyMapper

map_logic_literal(expr, enclosing_prec, *args, **kwargs)
map_string_literal(expr, enclosing_prec, *args, **kwargs)
map_variable_symbol(expr, enclosing_prec, *args, **kwargs)
map_meta_symbol(expr, enclosing_prec, *args, **kwargs)
map_scalar(expr, enclosing_prec, *args, **kwargs)
map_array(expr, enclosing_prec, *args, **kwargs)
map_array_subscript(expr, enclosing_prec, *args, **kwargs)
map_string_subscript(expr, enclosing_prec, *args, **kwargs)
map_range_index(expr, enclosing_prec, *args, **kwargs)
map_cast(expr, enclosing_prec, *args, **kwargs)
map_comparison(expr, enclosing_prec, *args, **kwargs)