Move ast, xform, and legalize modules.
- cdsl.ast defines classes representing abstract syntax trees. - cdsl.xform defines classes for instruction transformations. - base.legalize defines legalization patterns.
This commit is contained in:
@@ -7,12 +7,12 @@ patterns that describe how base instructions can be transformed to other base
|
|||||||
instructions that are legal.
|
instructions that are legal.
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from base.instructions import iadd, iadd_cout, iadd_cin, iadd_carry
|
from .instructions import iadd, iadd_cout, iadd_cin, iadd_carry
|
||||||
from base.instructions import isub, isub_bin, isub_bout, isub_borrow
|
from .instructions import isub, isub_bin, isub_bout, isub_borrow
|
||||||
from base.instructions import band, bor, bxor, isplit_lohi, iconcat_lohi
|
from .instructions import band, bor, bxor, isplit_lohi, iconcat_lohi
|
||||||
from base.instructions import icmp
|
from .instructions import icmp
|
||||||
from .ast import Var
|
from cdsl.ast import Var
|
||||||
from .xform import Rtl, XFormGroup
|
from cdsl.xform import Rtl, XFormGroup
|
||||||
|
|
||||||
|
|
||||||
narrow = XFormGroup('narrow', """
|
narrow = XFormGroup('narrow', """
|
||||||
@@ -5,7 +5,7 @@ This module defines classes that can be used to create abstract syntax trees
|
|||||||
for patern matching an rewriting of cretonne instructions.
|
for patern matching an rewriting of cretonne instructions.
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from cdsl import instructions
|
from . import instructions
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from typing import Union, Tuple # noqa
|
from typing import Union, Tuple # noqa
|
||||||
@@ -259,7 +259,7 @@ class Instruction(object):
|
|||||||
Create an `ast.Apply` AST node representing the application of this
|
Create an `ast.Apply` AST node representing the application of this
|
||||||
instruction to the arguments.
|
instruction to the arguments.
|
||||||
"""
|
"""
|
||||||
from cretonne.ast import Apply
|
from .ast import Apply
|
||||||
return Apply(self, args)
|
return Apply(self, args)
|
||||||
|
|
||||||
|
|
||||||
@@ -312,5 +312,5 @@ class BoundInstruction(object):
|
|||||||
Create an `ast.Apply` AST node representing the application of this
|
Create an `ast.Apply` AST node representing the application of this
|
||||||
instruction to the arguments.
|
instruction to the arguments.
|
||||||
"""
|
"""
|
||||||
from cretonne.ast import Apply
|
from .ast import Apply
|
||||||
return Apply(self, args)
|
return Apply(self, args)
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
Instruction transformations.
|
Instruction transformations.
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from .ast import Def, Var, Apply, Expr # noqa
|
from .ast import Def, Var, Apply
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from typing import Union, Iterator, Sequence, Iterable # noqa
|
from typing import Union, Iterator, Sequence, Iterable # noqa
|
||||||
|
from .ast import Expr # noqa
|
||||||
DefApply = Union[Def, Apply]
|
DefApply = Union[Def, Apply]
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
@@ -9,12 +9,12 @@ the input instruction.
|
|||||||
"""
|
"""
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from srcgen import Formatter
|
from srcgen import Formatter
|
||||||
import cretonne.legalize as legalize
|
from base import legalize
|
||||||
from cretonne.ast import Def # noqa
|
|
||||||
from cretonne.xform import XForm, XFormGroup # noqa
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from typing import Sequence # noqa
|
from typing import Sequence # noqa
|
||||||
|
from cdsl.ast import Def # noqa
|
||||||
|
from cdsl.xform import XForm, XFormGroup # noqa
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user