Add ImmediateType for declaring immediate operands.

This commit is contained in:
Jakob Stoklund Olesen
2016-03-30 11:36:23 -07:00
parent 29481a5851
commit 10903503c4
4 changed files with 60 additions and 1 deletions

View File

@@ -110,3 +110,23 @@ class TypeVar(object):
def __init__(self, name):
self.name = name
#
# Immediate operands.
#
# Instances of immediate operand types are provided in the cretonne.immediates
# module.
class ImmediateType(object):
"""
The type of an immediate instruction operand.
"""
def __init__(self, name, doc):
self.name = name
self.__doc__ = doc
def __str__(self):
return self.name
def __repr__(self):
return 'ImmediateType({})'.format(self.name)

View File

@@ -0,0 +1,12 @@
"""
The cretonne.immdiates module predefines all the Cretonne immediate operand
types.
"""
from . import ImmediateType
#: A 64-bit immediate integer operand.
#:
#: This type of immediate integer can interact with SSA values with any
#: :py:class:`cretonne.IntType` type.
imm64 = ImmediateType('imm64', 'A 64-bit immediate integer.')