scair.clair.macros

Members list

Type members

Classlikes

case class Anchor(directive: Directive)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait AssemblyFormat[format <: String]

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Return
class Load
class Dealloc
case class AssemblyFormatDirective(directives: Seq[Directive])

Declarative assembly format representation. Contains a sequence of directives that define the format.

Declarative assembly format representation. Contains a sequence of directives that define the format.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class AttrDictDirective() extends Directive

Directive for an operation's attribute dictionnary. Its presence is mandatory in every declarative assembly format, as this ensures the operation's unknown added attributes are carried by its syntax.

Directive for an operation's attribute dictionnary. Its presence is mandatory in every declarative assembly format, as this ensures the operation's unknown added attributes are carried by its syntax.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Directive
class Object
trait Matchable
class Any
Show all
trait DerivedAttribute[name <: String, T] extends ParametrizedAttribute

Attributes

Supertypes
trait Attribute
class Object
trait Matchable
class Any
Known subtypes
class Complex
class Ptr
Self type
T

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait DerivedOperation[name <: String, T] extends Operation

Attributes

Supertypes
trait Operation
trait IRNode
class Object
trait Matchable
class Any
Known subtypes
class Apply
class For
class If
class Load
class Min
class Parallel
class Store
class Yield
class AddF
class AddI
class AndI
class BitCast
class CeilDivSi
class CeilDivUi
class CmpF
class CmpI
class Constant
class DivF
class DivSI
class DivUI
class ExtF
class ExtSI
class ExtUI
class FPToSI
class FPToUI
class FloorDivSI
class IndexCast
class IndexCastUI
class MaxNumF
class MaxSI
class MaxUI
class MaximumF
class MinNumF
class MinSI
class MinUI
class MinimumF
class MulF
class MulI
class NegF
class Ori
class RemF
class RemSI
class RemUI
class SIToFP
class ScalingExtF
class SelectOp
class ShLI
class ShRSI
class ShRUI
class SubF
class SubI
class TruncF
class TruncI
class UIToFP
class XOrI
class Mul
class Norm
class Call
class Func
class Return
class Load
class Alloc
class Dealloc
class Dim
class Load
class Store
class Condition
class ForOp
class ForallOp
class IfOp
class InParallelOp
class ParallelOp
class ReduceOp
class WhileOp
class YieldOp
Show all
Self type
T

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait Directive

Base trait for assembly format directives. Directives represent a unit of the assembly format, and can generate printing and parsing implementations for their constructs.

Base trait for assembly format directives. Directives represent a unit of the assembly format, and can generate printing and parsing implementations for their constructs.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
case class LiteralDirective(literal: String) extends Directive

Directive for literal text in the assembly format. Examples include keywords, punctuation, and other fixed strings. Typically used to clarify semantic or solve ambiguity.

Directive for literal text in the assembly format. Examples include keywords, punctuation, and other fixed strings. Typically used to clarify semantic or solve ambiguity.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Directive
class Object
trait Matchable
class Any
Show all
case class OptionalGroupDirective(anchor: Directive, directives: Seq[Directive]) extends Directive

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Directive
class Object
trait Matchable
class Any
Show all
case class PrintingState(var shouldEmitSpace: Boolean, var lastWasPunctuation: Boolean)

Holds state during printer generation to manage spacing and punctuation.

Holds state during printer generation to manage spacing and punctuation.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class TypeDirective(construct: OperandDef | ResultDef) extends Directive

Directive for types of individual operands or results.

Directive for types of individual operands or results.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Directive
class Object
trait Matchable
class Any
Show all
case class VariableDirective(construct: OpInputDef) extends Directive

Directive for variables, handling operations' individual constructs (operands, results, regions, successors or properties).

Directive for variables, handling operations' individual constructs (operands, results, regions, successors or properties).

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Directive
class Object
trait Matchable
class Any
Show all

Types

Type helper to get the defined input type of a construct definition.

Type helper to get the defined input type of a construct definition.

Attributes

type DefinedInputOf[T <: OpInputDef, A <: Attribute] = T match { case OperandDef => Value[A] case ResultDef => Result[A] case RegionDef => Region case SuccessorDef => Successor case OpPropertyDef => A }

Type helper to get the defined input type of a construct definition.

Type helper to get the defined input type of a construct definition.

Attributes

Value members

Concrete methods

def ADTFlatAttrInputMacro[Def <: AttributeDef : Type](attrInputDefs: Seq[AttributeParamDef], adtAttrExpr: Expr[_])(using evidence$1: Type[Def], Quotes): Expr[Seq[Attribute]]
def ADTFlatInputMacro[Def <: OpInputDef : Type](opInputDefs: Seq[Def], adtOpExpr: Expr[_])(using evidence$1: Type[Def], Quotes): Expr[Seq[DefinedInput[Def]]]

Get all constructs of the specified type flattened from the ADT expression.

Get all constructs of the specified type flattened from the ADT expression.

Type parameters

Def

The construct definition type.

Value parameters

adtOpExpr

The ADT expression.

opInputDefs

The construct definitions.

Attributes

transparent inline def assemblyFormat[$ : ParsingRun](using evidence$1: ParsingRun[$], opDef: OperationDef): ParsingRun[AssemblyFormatDirective]

Parser for the complete assembly format. Parses one or more directives into an AssemblyFormatDirective.

Parser for the complete assembly format. Parses one or more directives into an AssemblyFormatDirective.

Attributes

transparent inline def assemblyId[$ : ParsingRun]: ParsingRun[String]

Parses an assembly format identifier. Those should match Scala's identifier rules, for maximum compatibility with the ADT fields; this is an approximation.

Parses an assembly format identifier. Those should match Scala's identifier rules, for maximum compatibility with the ADT fields; this is an approximation.

Attributes

transparent inline def attrDictDirective[$ : ParsingRun]: ParsingRun[AttrDictDirective]

Parser for attribute dictionary directives. Parses the keyword "attr-dict" into an AttrDictDirective.

Parser for attribute dictionary directives. Parses the keyword "attr-dict" into an AttrDictDirective.

Attributes

transparent inline def chainParsers(run: Expr[ParsingRun[Any]], next: Expr[ParsingRun[Any]])(using quotes: Quotes, ctx: Expr[ParsingRun[Any]]): Expr[ParsingRun[Any]]

Helper function to chain parsers together using fastparse's sequencing operator. Handles different return types by matching on the specific parser types.

Helper function to chain parsers together using fastparse's sequencing operator. Handles different return types by matching on the specific parser types.

Attributes

def constructExtractor[Def <: OpInputDef : Type](d: Def)(using evidence$1: Type[Def], Quotes): Expr[((DefinedInput[Def] | Seq[DefinedInput[Def]]) => Def match { case OperandDef => Value[_ <: Attribute] case ResultDef => Result[_ <: Attribute] case RegionDef => Region case SuccessorDef => Successor case OpPropertyDef => <: Attribute }) | ((DefinedInput[Def] | Seq[DefinedInput[Def]]) => Seq[Def match { case OperandDef => Value[_ <: Attribute] case ResultDef => Result[_ <: Attribute] case RegionDef => Region case SuccessorDef => Successor case OpPropertyDef => <: Attribute }]) | ((DefinedInput[Def] | Seq[DefinedInput[Def]]) => Option[Def match { case OperandDef => Value[_ <: Attribute] case ResultDef => Result[_ <: Attribute] case RegionDef => Region case SuccessorDef => Successor case OpPropertyDef => <: Attribute }])]

Returns an extractor expression for the passed construct definition.

Returns an extractor expression for the passed construct definition.

Value parameters

defs

The constructs definitions.

Attributes

def constructPartitioner[Def <: OpInputDef : Type](defs: Seq[Def])(using evidence$1: Type[Def], Quotes): Seq[Expr[((DerivedOperationCompanion[_]#UnstructuredOp, Seq[DefinedInput[Def]]) => DefinedInput[Def]) | ((DerivedOperationCompanion[_]#UnstructuredOp, Seq[DefinedInput[Def]]) => Seq[DefinedInput[Def]])]]

Partion constructs of a specified type. That is, check that they are in a coherent quantity, and partition them into the provided definitions.

Partion constructs of a specified type. That is, check that they are in a coherent quantity, and partition them into the provided definitions.

Type parameters

Def

The construct definition type.

Value parameters

defs

The construct definitions.

Attributes

Returns

A function of an operation and its flat sequence of constructs, returning the sequence of partitions according to the definitions.

def constructorArgs(opDef: OperationDef, op: Expr[DerivedOperationCompanion[_]#UnstructuredOp])(using Quotes): Seq[x$3.reflect.NamedArg]

Return all named arguments for the primary constructor of an ADT. Those are checked, in the sense that they are checked to be of the correct types and numbers.

Return all named arguments for the primary constructor of an ADT. Those are checked, in the sense that they are checked to be of the correct types and numbers.

Value parameters

op

The UnstructuredOp instance.

opDef

The OperationDef derived from the ADT.

Attributes

Returns

The checked named arguments for the primary constructor of the ADT.

def customPrintMacro(opDef: OperationDef, adtOpExpr: Expr[_], p: Expr[Printer], indentLevel: Expr[Int])(using Quotes): Expr[Unit]
def deriveOperationCompanion[T <: Operation : Type](using evidence$1: Type[T], Quotes): Expr[DerivedOperationCompanion[T]]
def derivedAttributeCompanion[T : Type](using evidence$1: Type[T], Quotes): Expr[DerivedAttributeCompanion[T]]
transparent inline def directive[$ : ParsingRun](using evidence$1: ParsingRun[$], opDef: OperationDef): ParsingRun[Directive]

Parser for any directive.

Parser for any directive.

Attributes

def expectSegmentSizes[Def <: OpInputDef : Type](using evidence$1: Type[Def], Quotes): Expr[DerivedOperationCompanion[_]#UnstructuredOp => Seq[Int]]

Expect a segmentSizes property of DenseArrayAttr type, and return it as a list of integers.

Expect a segmentSizes property of DenseArrayAttr type, and return it as a list of integers.

Type parameters

Def

The construct definition type.

Value parameters

op

The UnstructuredOp expression.

Attributes

def extractedConstructs[Def <: OpInputDef : Type](defs: Seq[Def], op: Expr[DerivedOperationCompanion[_]#UnstructuredOp])(using evidence$1: Type[Def], Quotes): Seq[Expr[Def match { case OperandDef => Value[_ <: Attribute] case ResultDef => Result[_ <: Attribute] case RegionDef => Region case SuccessorDef => Successor case OpPropertyDef => <: Attribute } | Seq[Def match { case OperandDef => Value[_ <: Attribute] case ResultDef => Result[_ <: Attribute] case RegionDef => Region case SuccessorDef => Successor case OpPropertyDef => <: Attribute }] | Option[Def match { case OperandDef => Value[_ <: Attribute] case ResultDef => Result[_ <: Attribute] case RegionDef => Region case SuccessorDef => Successor case OpPropertyDef => <: Attribute }]]]
def fromUnstructuredOperationMacro[T : Type](opDef: OperationDef, genExpr: Expr[DerivedOperationCompanion[T]#UnstructuredOp])(using evidence$1: Type[T], Quotes): Expr[T]

Attempt to create an ADT from an UnstructuredOp[ADT]

Attempt to create an ADT from an UnstructuredOp[ADT]

Type parameters

T

The ADT Type.

Value parameters

genExpr

The expression of the UnstructuredOp[ADT].

opDef

The OperationDef derived from the ADT.

Attributes

Returns

The ADT instance.

def generateCheckedPropertyArgument[A <: Attribute : Type](list: Expr[Map[String, Attribute]], propName: String)(using evidence$1: Type[A], Quotes): Expr[A]

Helper to check a property argument.

Helper to check a property argument.

Attributes

def generateOptionalCheckedPropertyArgument[A <: Attribute : Type](list: Expr[Map[String, Attribute]], propName: String)(using evidence$1: Type[A], Quotes): Expr[Option[A]]
def getAttrConstructor[T : Type](attrDef: AttributeDef, attributes: Expr[Seq[Attribute]])(using evidence$1: Type[T], Quotes): Expr[T]
def getConstructConstraint(_def: OpInputDef)(using Quotes): Type[_ <: AnyKind]

Helper to get the expected type of a construct definition's construct.

Helper to get the expected type of a construct definition's construct.

Attributes

def getConstructName[Def <: OpInputDef](using d: Type[Def], Quotes): String

Helper to get the name of a construct definition type.

Helper to get the name of a construct definition type.

Attributes

def getConstructSeq[Def <: OpInputDef](op: Expr[DerivedOperationCompanion[_]#UnstructuredOp])(using d: Type[Def], Quotes): Expr[Seq[DefinedInput[Def]]]

Helper to access the right sequence of constructs from an UnstructuredOp, given a construct definition type.

Helper to access the right sequence of constructs from an UnstructuredOp, given a construct definition type.

Attributes

def getConstructVariadicity(_def: OpInputDef)(using Quotes): Variadicity

Helper to get the variadicity of a construct definition's construct.

Helper to get the variadicity of a construct definition's construct.

Attributes

transparent inline def literalDirective[$ : ParsingRun]: ParsingRun[LiteralDirective]

Parser for literal directives. Parses text enclosed in backticks as a literal directive.

Parser for literal directives. Parses text enclosed in backticks as a literal directive.

Attributes

def makeSegmentSizes[T <: MayVariadicOpInputDef : Type](hasMultiVariadic: Boolean, defs: Seq[T], adtOpExpr: Expr[_])(using evidence$1: Type[T], Quotes): Expr[Map[String, Attribute]]
def multivariadicConstructPartitioner[Def <: OpInputDef : Type](defs: Seq[Def])(using evidence$1: Type[Def], Quotes): Seq[Expr[((DerivedOperationCompanion[_]#UnstructuredOp, Seq[DefinedInput[Def]]) => DefinedInput[Def]) | ((DerivedOperationCompanion[_]#UnstructuredOp, Seq[DefinedInput[Def]]) => Seq[DefinedInput[Def]])]]

Partition a construct sequence, in the case of multiple variadic definitions

Partition a construct sequence, in the case of multiple variadic definitions

Attributes

See also
def operandsMacro(opDef: OperationDef, adtOpExpr: Expr[_])(using Quotes): Expr[Seq[Value[Attribute]]]
def optionalConstructExtractor[Def <: OpInputDef : Type, t <: Attribute : Type](d: Def)(using evidence$1: Type[Def], evidence$2: Type[t], Quotes): Expr[(DefinedInput[Def] | Seq[DefinedInput[Def]]) => Option[DefinedInputOf[Def, t]]]
def optionalGroupDirective[$ : ParsingRun](using evidence$1: ParsingRun[$], opDef: OperationDef): ParsingRun[Directive]
def parametersMacro(attrDef: AttributeDef, adtAttrExpr: Expr[_])(using Quotes): Expr[Seq[Attribute]]

Parse a declarative assembly format string into an AssemblyFormatDirective, its internal representation for implementation generation.

Parse a declarative assembly format string into an AssemblyFormatDirective, its internal representation for implementation generation.

Attributes

def parseMacro(opDef: OperationDef, p: Expr[Parser])(using ctx: Expr[ParsingRun[Any]])(using Quotes): Expr[ParsingRun[Operation]]
transparent inline def possiblyAnchoredDirective[$ : ParsingRun](using evidence$1: ParsingRun[$], opDef: OperationDef): ParsingRun[Anchor | Directive]
def propertiesMacro(opDef: OperationDef, adtOpExpr: Expr[_])(using Quotes): Expr[Map[String, Attribute]]
def regionsMacro(opDef: OperationDef, adtOpExpr: Expr[_])(using Quotes): Expr[Seq[Region]]
def resultsMacro(opDef: OperationDef, adtOpExpr: Expr[_])(using Quotes): Expr[Seq[Result[Attribute]]]
def selectMember[T : Type](obj: Expr[_], name: String)(using evidence$1: Type[T], Quotes): Expr[T]

Small helper to select a member of an expression.

Small helper to select a member of an expression.

Value parameters

name

The name of the member to select.

obj

The object to select the member from.

Attributes

def singleConstructExtractor[Def <: OpInputDef : Type, t <: Attribute : Type](d: Def)(using evidence$1: Type[Def], evidence$2: Type[t], Quotes): Expr[(DefinedInput[Def] | Seq[DefinedInput[Def]]) => DefinedInputOf[Def, t]]
def successorsMacro(opDef: OperationDef, adtOpExpr: Expr[_])(using Quotes): Expr[Seq[Successor]]
inline def summonAttributeTraits[T <: Tuple]: Seq[DerivedAttributeCompanion[_]]
def summonAttributeTraitsMacro[T <: Tuple : Type](using evidence$1: Type[T], Quotes): Expr[Seq[DerivedAttributeCompanion[_]]]
def summonAttributeTraitsMacroRec[T <: Tuple : Type](using evidence$1: Type[T], Quotes): Seq[Expr[DerivedAttributeCompanion[_]]]
inline def summonDialect[Attributes <: Tuple, Operations <: Tuple](attributes: Seq[AttributeCompanion]): Dialect
inline def summonMLIRTraits[T <: Tuple]: Seq[DerivedOperationCompanion[_]]
def summonMLIRTraitsMacro[T <: Tuple : Type](using evidence$1: Type[T], Quotes): Expr[Seq[DerivedOperationCompanion[_]]]
def summonMLIRTraitsMacroRec[T <: Tuple : Type](using evidence$1: Type[T], Quotes): Seq[Expr[DerivedOperationCompanion[_]]]
transparent inline def typeDirective[$ : ParsingRun](using evidence$1: ParsingRun[$], opDef: OperationDef): ParsingRun[TypeDirective]

Parser for type directives. Parses "type($var)" where $var is a variable directive.

Parser for type directives. Parses "type($var)" where $var is a variable directive.

Attributes

def uniadicConstructPartitioner[Def <: OpInputDef : Type](defs: Seq[Def])(using evidence$1: Type[Def], Quotes): Seq[Expr[(DerivedOperationCompanion[_]#UnstructuredOp, Seq[DefinedInput[Def]]) => DefinedInput[Def]]]

Partition a construct sequence, in the case of no variadic defintion.

Partition a construct sequence, in the case of no variadic defintion.

Attributes

See also
def univariadicConstructPartitioner[Def <: OpInputDef : Type](defs: Seq[Def])(using evidence$1: Type[Def], Quotes): Seq[Expr[((DerivedOperationCompanion[_]#UnstructuredOp, Seq[DefinedInput[Def]]) => DefinedInput[Def]) | ((DerivedOperationCompanion[_]#UnstructuredOp, Seq[DefinedInput[Def]]) => Seq[DefinedInput[Def]])]]

Partition a construct sequence, in the case of a single variadic defintion.

Partition a construct sequence, in the case of a single variadic defintion.

Attributes

See also
transparent inline def variableDirective[$ : ParsingRun](using evidence$1: ParsingRun[$], opDef: OperationDef): ParsingRun[VariableDirective]

Parser for variable directives. Parses a dollar sign followed by an identifier, which references a construct of the Operation.

Parser for variable directives. Parses a dollar sign followed by an identifier, which references a construct of the Operation.

Attributes

def variadicConstructExtractor[Def <: OpInputDef : Type, t <: Attribute : Type](d: Def)(using evidence$1: Type[Def], evidence$2: Type[t], Quotes): Expr[(DefinedInput[Def] | Seq[DefinedInput[Def]]) => Seq[DefinedInputOf[Def, t]]]