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:
Jakob Stoklund Olesen
2016-11-08 09:40:19 -08:00
parent 6419ba12bc
commit ac59376c46
11 changed files with 210 additions and 202 deletions

View File

@@ -0,0 +1 @@
"""Definitions for the base Cretonne language."""

View File

@@ -0,0 +1,38 @@
"""
The base.types module predefines all the Cretonne scalar types.
"""
from __future__ import absolute_import
from cdsl.types import ScalarType, IntType, FloatType, BoolType
#: Boolean.
b1 = ScalarType(
'b1', 0,
"""
A boolean value that is either true or false.
""")
b8 = BoolType(8) #: 8-bit bool.
b16 = BoolType(16) #: 16-bit bool.
b32 = BoolType(32) #: 32-bit bool.
b64 = BoolType(64) #: 64-bit bool.
i8 = IntType(8) #: 8-bit int.
i16 = IntType(16) #: 16-bit int.
i32 = IntType(32) #: 32-bit int.
i64 = IntType(64) #: 64-bit int.
#: IEEE single precision.
f32 = FloatType(
32, """
A 32-bit floating point type represented in the IEEE 754-2008
*binary32* interchange format. This corresponds to the :c:type:`float`
type in most C implementations.
""")
#: IEEE double precision.
f64 = FloatType(
64, """
A 64-bit floating point type represented in the IEEE 754-2008
*binary64* interchange format. This corresponds to the :c:type:`double`
type in most C implementations.
""")