c

scalan.compilation

FileCodegen

abstract class FileCodegen[+ScalanCake <: ScalanEx] extends AnyRef

Base class for code generators

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FileCodegen
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FileCodegen(scalan: ScalanCake, config: CodegenConfig)

Type Members

  1. sealed trait BaseNumericType extends AnyRef
  2. sealed trait SpecialNumericValue extends AnyRef
  3. trait SrcStringHelper extends AnyRef
  4. class SrcStringHelperBase extends SrcStringHelper

Abstract Value Members

  1. abstract def emitFooter(graph: ScalanCake.PGraph, functionName: String)(implicit stream: PrintWriter): Unit

    Emits the final part of the file (after the kernel)

  2. abstract def emitHeader(graph: ScalanCake.PGraph, functionName: String)(implicit stream: PrintWriter): Unit

    Emits the initial part of the file (before the kernel)

  3. abstract def functionFooter(): Option[String]
  4. abstract def functionHeader(sym: ScalanCake.Sym, args: List[ScalanCake.Sym]): String
  5. abstract def functionReturn(y: ScalanCake.Sym): String
  6. abstract def languageName: String

    Name of language generated (used in error messages)

  7. abstract def simpleNode(sym: ScalanCake.Sym, d: ScalanCake.Def[_]): String

    Translation of a simple (non-complex) node.

    Translation of a simple (non-complex) node. Normally calls tpe(sym.elem) (in typed languages), id(sym) and rhs(d). Example for C: src"${sym.elem} $sym = $d;.

    Attributes
    protected
  8. abstract def specialNumericLiteral(x: SpecialNumericValue, t: BaseNumericType): String
  9. implicit abstract def srcStringHelper(sc: StringContext): SrcStringHelper

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def applyFunction(f: ScalanCake.Sym, args: Seq[ScalanCake.Sym]): String
  5. def argList(f: ScalanCake.Sym, x: ScalanCake.Sym): List[ScalanCake.Sym]

    Assume x is right-nested tuple like (a_1, (a_2, (a_3, ...

    Assume x is right-nested tuple like (a_1, (a_2, (a_3, ... (a_{N-1}, a_N)...)

    returns

    a list of a_i

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def binOp(op: ScalanCake.BinOp[_, _], x: ScalanCake.Sym, y: ScalanCake.Sym): String
  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  9. lazy val codegenName: String

    Codegen name (used in error messages)

  10. val config: CodegenConfig
  11. def emit(string: String)(implicit stream: PrintWriter, indentLevel: IndentLevel): Unit
  12. def emit(lines: Seq[String])(implicit stream: PrintWriter, indentLevel: IndentLevel): Unit
  13. def emitFunction(sym: ScalanCake.Sym, args: List[ScalanCake.Sym], returnValue: Option[ScalanCake.Ref[Any]], lambdaOrThunk: ScalanCake.AstGraph, f: (ScalanCake.Schedule) ⇒ ScalanCake.Schedule = identity)(implicit stream: PrintWriter, indentLevel: IndentLevel): Unit
  14. def emitKernel(graph: ScalanCake.PGraph, functionName: String)(implicit stream: PrintWriter): Unit

    Emits the kernel

  15. def emitNode(sym: ScalanCake.Sym, d: ScalanCake.Def[_], graph: ScalanCake.AstGraph)(implicit stream: PrintWriter, indentLevel: IndentLevel): Unit

    Emits a node in the schedule.

    Emits a node in the schedule. Override this for nodes which need more than one line, and rhs for the simple cases.

  16. def emitSchedule(graph: ScalanCake.AstGraph, f: (ScalanCake.Schedule) ⇒ ScalanCake.Schedule = identity)(implicit stream: PrintWriter, indentLevel: IndentLevel): Unit
  17. def emitSourceFile(graph: ScalanCake.PGraph, functionName: String, sourcesDir: File): File

    Emits the complete source file

  18. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  20. def fileExtension: String

    File extension for generated code

  21. def fileName(baseName: String): String

    File name (with extension) for generated code

  22. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  24. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def id(s: ScalanCake.Sym): String

    Translation of a Sym to variable name

  26. val importBuilder: ImportBuilder
  27. def indent: String

    Standard indentation for one level is 4 spaces, can be according to defaults of the specific language

    Standard indentation for one level is 4 spaces, can be according to defaults of the specific language

    Attributes
    protected
  28. def indented(f: (IndentLevel) ⇒ Unit)(implicit indentLevel: IndentLevel): Unit

    Executes given function f with incremented identation.

    Executes given function f with incremented identation. Current identation at call site is passed as implicit parameter.

  29. def init(functionName: String, graph: ScalanCake.PGraph): Unit

    Prepares to work with a kernel

  30. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  31. def literal(value: Any): String

    Translation of a literal.

    Translation of a literal. The default is C/Java literals for primitives and null.

  32. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  33. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  34. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  35. def reset(): Unit

    Finishes working with a kernel

  36. def rhs(d: ScalanCake.Def[_]): String

    Translation of a Def

  37. val scalan: ScalanCake
  38. def sourceFile(sourcesDir: File, functionName: String): File
  39. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  40. def toString(): String
    Definition Classes
    FileCodegen → AnyRef → Any
  41. def tpe(elem: ScalanCake.Elem[_]): String

    Translation of the type represented by an Elem to the generated language (no need to implement for weakly typed or fully type-inferred languages).

  42. def translateToSrc(arg: Any): String
    Attributes
    protected
  43. def unOp(op: ScalanCake.UnOp[_, _], x: ScalanCake.Sym): String
  44. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  47. object DOUBLE extends BaseNumericType with Product with Serializable
  48. object FLOAT extends BaseNumericType with Product with Serializable
  49. object NaN extends SpecialNumericValue with Product with Serializable
  50. object NegInf extends SpecialNumericValue with Product with Serializable
  51. object PosInf extends SpecialNumericValue with Product with Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped