‘pyMem’ Dialect#

A dialect representing python programs TODO

Operations#

pyMem.gcAllocFunction (::pylir::Mem::GCAllocFunctionOp)#

Syntax:

operation ::= `pyMem.gcAllocFunction` $closure_args_types attr-dict

Allocates a function object with enough space for closure_args_types as closure arguments. This operation must be used over gcAllocObject if space must be allocated for closure_args_types. It is otherwise identical to gcAllocObject.

The function object allocated is tracked by the garbage collector and guaranteed to be life as long as it is reachable.

Interfaces: InferTypeOpInterface

Attributes:#

AttributeMLIR TypeDescription
closure_args_types::mlir::ArrayAttrtype array attribute

Results:#

Result

Description

result

python memory type

pyMem.gcAllocObject (::pylir::Mem::GCAllocObjectOp)#

Syntax:

operation ::= `pyMem.gcAllocObject` $type_object`[` $trailing_items `]` attr-dict

Allocates an object with the layout type and type given by the $type_object with $trailing_items. These trailing items correspond to the amount of elements in a tuple for tuple objects, for all other objects they correspond to the amount of slots allocated.

Items allocated by the operation are tracked by the garbage collector and guaranteed to be life as long as they are reachable.

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

type_object

dynamic type

trailing_items

index

Results:#

Result

Description

result

python memory type

pyMem.initDict (::pylir::Mem::InitDictOp)#

Syntax:

operation ::= `pyMem.initDict` $memory attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

Results:#

Result

Description

result

dynamic type

pyMem.initFloat (::pylir::Mem::InitFloatOp)#

Syntax:

operation ::= `pyMem.initFloat` $memory `to` $initializer attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

initializer

64-bit float

Results:#

Result

Description

result

dynamic type

pyMem.initFunc (::pylir::Mem::InitFuncOp)#

Syntax:

operation ::= `pyMem.initFunc` $memory `to` $initializer
              (`[` $closure_args^ `:` type($closure_args) `]`)? attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Attributes:#

AttributeMLIR TypeDescription
initializer::mlir::FlatSymbolRefAttrflat symbol reference attribute

Operands:#

Operand

Description

memory

python memory type

closure_args

variadic of any type

Results:#

Result

Description

result

dynamic type

pyMem.initIntAdd (::pylir::Mem::InitIntAddOp)#

Syntax:

operation ::= `pyMem.initIntAdd` $memory `to` $lhs `+` $rhs attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

lhs

dynamic type

rhs

dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.initIntSigned (::pylir::Mem::InitIntSignedOp)#

Syntax:

operation ::= `pyMem.initIntSigned` $memory `to` $initializer attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

initializer

index

Results:#

Result

Description

result

dynamic type

pyMem.initIntUnsigned (::pylir::Mem::InitIntUnsignedOp)#

Syntax:

operation ::= `pyMem.initIntUnsigned` $memory `to` $initializer attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

initializer

index

Results:#

Result

Description

result

dynamic type

pyMem.initList (::pylir::Mem::InitListOp)#

Syntax:

operation ::= `pyMem.initList` $memory `to` ` ` `[` $initializer `]` attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

initializer

variadic of dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.initObject (::pylir::Mem::InitObjectOp)#

Syntax:

operation ::= `pyMem.initObject` $memory attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

Results:#

Result

Description

result

dynamic type

pyMem.initSet (::pylir::Mem::InitSetOp)#

Syntax:

operation ::= `pyMem.initSet` $memory `to` ` ` `{` $initializer `}` attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

initializer

variadic of dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.initStr (::pylir::Mem::InitStrOp)#

Syntax:

operation ::= `pyMem.initStr` $memory (`to` $strings^)? attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

strings

variadic of dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.initStrFromInt (::pylir::Mem::InitStrFromIntOp)#

Syntax:

operation ::= `pyMem.initStrFromInt` $memory `to` $integer attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

integer

dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.initTuple (::pylir::Mem::InitTupleOp)#

Syntax:

operation ::= `pyMem.initTuple` $memory `to` ` ` `(` (`)`) : (`` $initializer^ `)`)?  attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

initializer

variadic of dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.initTupleCopy (::pylir::Mem::InitTupleCopyOp)#

Syntax:

operation ::= `pyMem.initTupleCopy` $memory `to` ` ` `(` `*` $initializer `)` attr-dict

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

initializer

dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.initTupleDropFront (::pylir::Mem::InitTupleDropFrontOp)#

Syntax:

operation ::= `pyMem.initTupleDropFront` $memory `to` ` ` $count `(` $tuple `)` attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

count

index

tuple

dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.initTupleFromList (::pylir::Mem::InitTupleFromListOp)#

Syntax:

operation ::= `pyMem.initTupleFromList` $memory `to` ` ` `(` `*` $initializer `)` attr-dict

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

initializer

dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.initTuplePrepend (::pylir::Mem::InitTuplePrependOp)#

Syntax:

operation ::= `pyMem.initTuplePrepend` $memory `to` ` ` `(` $element `,` $tuple `)` attr-dict

Traits: AlwaysBound

Interfaces: CaptureInterface, InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

element

dynamic type

tuple

dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.initType (::pylir::Mem::InitTypeOp)#

Syntax:

operation ::= `pyMem.initType` $memory `(` `name` `=` $name `,`
              `mro` `=` $mro_tuple_memory `to` $mro_tuple `,`
              `slots` `=` $slots_tuple `)` attr-dict

Traits: AlwaysBound

Interfaces: InferTypeOpInterface

Operands:#

Operand

Description

memory

python memory type

name

dynamic type

mro_tuple_memory

python memory type

mro_tuple

dynamic type

slots_tuple

dynamic type

Results:#

Result

Description

result

dynamic type

pyMem.stackAllocObject (::pylir::Mem::StackAllocObjectOp)#

Syntax:

operation ::= `pyMem.stackAllocObject` $layout $type_object`[`$trailing_items`]` attr-dict

Allocates an object with the layout given by $layout with $trailing_items and the type $type_object. These trailing items correspond to the amount of elements in a tuple for tuple objects, for all other objects they correspond to the amount of slots allocated.

Due to the use of attributes for the layout and amount of trailing items, the amount of memory allocated by this operation is known ahead of time and statically allocated within a functions frame. The lifetime of this object is therefore also equal to the frame of the function call. If any references to a destroyed object still exist it is undefined behaviour.

Interfaces: CaptureInterface, InferTypeOpInterface

Attributes:#

AttributeMLIR TypeDescription
layoutpylir::Mem::LayoutTypeAttrEnum of types with known object layouts
trailing_items::mlir::IntegerAttrindex attribute

Operands:#

Operand

Description

type_object

dynamic type

Results:#

Result

Description

result

python memory type

Types#

MemoryType#

python memory type

Syntax: !pyMem.memory