Add OperandKind to the meta language.

We have a two-level type system: OperandKinds and ValueTypes. The value types
only apply to value operands, but there are many more kinds of operands:
immediate numbers, condition codes, basic block references, etc.
This commit is contained in:
Jakob Stoklund Olesen
2016-05-12 15:59:40 -07:00
parent ea46a17f56
commit 477fa01bfc
4 changed files with 120 additions and 62 deletions

View File

@@ -15,15 +15,15 @@ module :mod:`cretonne.base`.
.. module:: cretonne
Types
=====
Value Types
===========
Concrete value types are represented as instances of :class:`cretonne.Type`. There are
Concrete value types are represented as instances of :class:`cretonne.ValueType`. There are
subclasses to represent scalar and vector types.
.. inheritance-diagram:: Type ScalarType VectorType IntType FloatType
.. inheritance-diagram:: ValueType ScalarType VectorType IntType FloatType
:parts: 1
.. autoclass:: Type
.. autoclass:: ValueType
.. autoclass:: ScalarType
:members:
.. autoclass:: VectorType
@@ -48,33 +48,35 @@ types for their operands. This makes the instructions polymorphic.
.. autoclass:: TypeVar
Immediates
----------
Immediate instruction operands don't correspond to SSA values, but have values
that are encoded directly in the instruction. Immediate operands don't
have types from the :class:`cretonne.Type` type system; they often have
enumerated values of a specific type. The type of an immediate operand is
indicated with an instance of :class:`ImmediateType`.
.. autoclass:: ImmediateType
.. automodule:: cretonne.immediates
:members:
.. currentmodule:: cretonne
Instructions
============
New instructions are defined as instances of the :class:`cretonne.Instruction`
class.
.. autoclass:: Operand
.. autoclass:: Instruction
.. autoclass:: Operand
.. autoclass:: OperandKind
.. autoclass:: InstructionGroup
:members:
Immediates
----------
Immediate instruction operands don't correspond to SSA values, but have values
that are encoded directly in the instruction. Immediate operands don't
have types from the :class:`cretonne.ValueType` type system; they often have
enumerated values of a specific type. The type of an immediate operand is
indicated with an instance of :class:`ImmediateKind`.
.. autoclass:: ImmediateKind
.. automodule:: cretonne.immediates
:members:
.. currentmodule:: cretonne
Targets
=======