Move ValueType into a new cdsl top-level module.
We want to separate the Python classes that make up the DSL used to define the Cretonne language from the concrete definitions. - cdsl.types defines the ValueType class hierarchy. - base.types defines the concrete types.
This commit is contained in:
@@ -245,7 +245,7 @@ class TypeDocumenter(sphinx.ext.autodoc.Documenter):
|
||||
return False
|
||||
|
||||
def resolve_name(self, modname, parents, path, base):
|
||||
return 'cretonne.types', [base]
|
||||
return 'base.types', [base]
|
||||
|
||||
def add_content(self, more_content, no_docstring=False):
|
||||
super(TypeDocumenter, self).add_content(more_content, no_docstring)
|
||||
@@ -280,11 +280,11 @@ class InstDocumenter(sphinx.ext.autodoc.Documenter):
|
||||
op = inst.ins[0]
|
||||
sig += ' ' + op.name
|
||||
# If the first input is variable-args, this is 'return'. No parens.
|
||||
if op.typ.operand_kind().name == 'variable_args':
|
||||
if op.kind.name == 'variable_args':
|
||||
sig += '...'.format(op.name)
|
||||
for op in inst.ins[1:]:
|
||||
# This is a call or branch with args in (...).
|
||||
if op.typ.operand_kind().name == 'variable_args':
|
||||
if op.kind.name == 'variable_args':
|
||||
sig += '({}...)'.format(op.name)
|
||||
else:
|
||||
sig += ', ' + op.name
|
||||
|
||||
@@ -4,7 +4,7 @@ Cretonne Meta Language Reference
|
||||
|
||||
.. default-domain:: py
|
||||
.. highlight:: python
|
||||
.. module:: cretonne
|
||||
.. module:: cdsl
|
||||
|
||||
The Cretonne meta language is used to define instructions for Cretonne. It is a
|
||||
domain specific language embedded in Python. This document describes the Python
|
||||
@@ -16,8 +16,8 @@ steps:
|
||||
|
||||
1. The Python modules are imported. This has the effect of building static data
|
||||
structures in global variables in the modules. These static data structures
|
||||
use the classes in the :mod:`cretonne` module to describe instruction sets
|
||||
and other properties.
|
||||
in the :mod:`base` and :mod:`isa` packages use the classes in the
|
||||
:mod:`cdsl` module to describe instruction sets and other properties.
|
||||
|
||||
2. The static data structures are processed to produce Rust source code and
|
||||
constant tables.
|
||||
@@ -41,6 +41,7 @@ ISA, and defined in a `settings` module under the appropriate
|
||||
Settings can take boolean on/off values, small numbers, or explicitly enumerated
|
||||
symbolic values. Each type is represented by a sub-class of :class:`Setting`:
|
||||
|
||||
.. currentmodule:: cretonne
|
||||
.. inheritance-diagram:: Setting BoolSetting NumSetting EnumSetting
|
||||
:parts: 1
|
||||
|
||||
@@ -125,36 +126,36 @@ Immediate operands
|
||||
|
||||
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
|
||||
have types from the :class:`cdsl.types.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`.
|
||||
|
||||
.. currentmodule:: cretonne
|
||||
.. autoclass:: ImmediateKind
|
||||
|
||||
.. automodule:: cretonne.immediates
|
||||
:members:
|
||||
|
||||
.. currentmodule:: cretonne
|
||||
|
||||
Entity references
|
||||
-----------------
|
||||
|
||||
Instruction operands can also refer to other entities in the same function. This
|
||||
can be extended basic blocks, or entities declared in the function preamble.
|
||||
|
||||
.. currentmodule:: cretonne
|
||||
|
||||
.. autoclass:: EntityRefKind
|
||||
|
||||
.. automodule:: cretonne.entities
|
||||
:members:
|
||||
|
||||
.. currentmodule:: cretonne
|
||||
|
||||
Value types
|
||||
-----------
|
||||
|
||||
Concrete value types are represented as instances of :class:`cretonne.ValueType`. There are
|
||||
Concrete value types are represented as instances of :class:`cdsl.types.ValueType`. There are
|
||||
subclasses to represent scalar and vector types.
|
||||
|
||||
.. currentmodule:: cdsl.types
|
||||
.. autoclass:: ValueType
|
||||
.. inheritance-diagram:: ValueType ScalarType VectorType IntType FloatType BoolType
|
||||
:parts: 1
|
||||
@@ -169,11 +170,9 @@ subclasses to represent scalar and vector types.
|
||||
.. autoclass:: BoolType
|
||||
:members:
|
||||
|
||||
.. automodule:: cretonne.types
|
||||
.. automodule:: base.types
|
||||
:members:
|
||||
|
||||
.. currentmodule:: cretonne
|
||||
|
||||
There are no predefined vector types, but they can be created as needed with
|
||||
the :func:`ScalarType.by` function.
|
||||
|
||||
@@ -181,6 +180,8 @@ the :func:`ScalarType.by` function.
|
||||
Instruction representation
|
||||
==========================
|
||||
|
||||
.. currentmodule:: cretonne
|
||||
|
||||
The Rust in-memory representation of instructions is derived from the
|
||||
instruction descriptions. Part of the representation is generated, and part is
|
||||
written as Rust code in the `cretonne.instructions` module. The instruction
|
||||
|
||||
Reference in New Issue
Block a user