loki.backend.fgencon

Classes

FortranCodegenConservative(style[, depth])

Strictly conservative version of FortranCodegen visitor that will attempt to use existing Source information from the frontends where possible.

class FortranCodegenConservative(style, depth=0)

Bases: FortranCodegen

Strictly conservative version of FortranCodegen visitor that will attempt to use existing Source information from the frontends where possible.

visit_Node(o, *args, **kwargs)
Format non-supported nodes as

! <repr(Node)>

visit_Assignment(o, *args, **kwargs)
Format statement as

<lhs> = <rhs>

or

<pointer> => <rhs>

visit_CallStatement(o, *args, **kwargs)
Format call statement as

CALL <name>(<args>)

visit_Comment(o, *args, **kwargs)

Format comments.

visit_Conditional(o, *args, **kwargs)
Format conditional as

IF (<condition>) <single-statement body>

or
[name:] IF (<condition>) THEN

…body…

[ELSE IF (<condition>) THEN [name]]

[…body…]

[ELSE [name]]

[…body…]

END IF [name]

visit_VariableDeclaration(o, *args, **kwargs)
Format declaration as

[<type>] [, DIMENSION(…)] :: var [= initial] [, var [= initial] ] …

visit_Import(o, *args, **kwargs)
Format imports according to their type as

#include “…”

or

include “…”

or

USE [, <nature> ::] <module> [, ONLY: <symbols>]

or

USE [, <nature> ::] <module> [, <rename-list>]

or

IMPORT <symbols>

visit_Loop(o, *args, **kwargs)
Format loop with explicit range as
[name:] DO [label] <var>=<loop range>

…body…

END DO [name]

visit_Section(o, *args, **kwargs)

Format the section’s body.

visit_Subroutine(o, *args, **kwargs)
Format as
<ftype> [<prefix>] <name> ([<args>]) [RESULT(<name>)] [BIND(c, name=<name>)]

…docstring… …spec… …body…

[CONTAINS]

[…member…]

END <ftype> <name>

visit_Module(o, *args, **kwargs)
Format as
MODULE <name>

…spec…

CONTAINS

…routines…

END MODULE