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:
Jakob Stoklund Olesen
2016-11-08 12:29:17 -08:00
parent 0b9b956695
commit cc86964ab3
7 changed files with 14 additions and 13 deletions

View File

@@ -7,12 +7,12 @@ patterns that describe how base instructions can be transformed to other base
instructions that are legal.
"""
from __future__ import absolute_import
from base.instructions import iadd, iadd_cout, iadd_cin, iadd_carry
from base.instructions import isub, isub_bin, isub_bout, isub_borrow
from base.instructions import band, bor, bxor, isplit_lohi, iconcat_lohi
from base.instructions import icmp
from .ast import Var
from .xform import Rtl, XFormGroup
from .instructions import iadd, iadd_cout, iadd_cin, iadd_carry
from .instructions import isub, isub_bin, isub_bout, isub_borrow
from .instructions import band, bor, bxor, isplit_lohi, iconcat_lohi
from .instructions import icmp
from cdsl.ast import Var
from cdsl.xform import Rtl, XFormGroup
narrow = XFormGroup('narrow', """

View File

@@ -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.
"""
from __future__ import absolute_import
from cdsl import instructions
from . import instructions
try:
from typing import Union, Tuple # noqa

View File

@@ -259,7 +259,7 @@ class Instruction(object):
Create an `ast.Apply` AST node representing the application of this
instruction to the arguments.
"""
from cretonne.ast import Apply
from .ast import Apply
return Apply(self, args)
@@ -312,5 +312,5 @@ class BoundInstruction(object):
Create an `ast.Apply` AST node representing the application of this
instruction to the arguments.
"""
from cretonne.ast import Apply
from .ast import Apply
return Apply(self, args)

View File

@@ -2,10 +2,11 @@
Instruction transformations.
"""
from __future__ import absolute_import
from .ast import Def, Var, Apply, Expr # noqa
from .ast import Def, Var, Apply
try:
from typing import Union, Iterator, Sequence, Iterable # noqa
from .ast import Expr # noqa
DefApply = Union[Def, Apply]
except ImportError:
pass

View File

@@ -9,12 +9,12 @@ the input instruction.
"""
from __future__ import absolute_import
from srcgen import Formatter
import cretonne.legalize as legalize
from cretonne.ast import Def # noqa
from cretonne.xform import XForm, XFormGroup # noqa
from base import legalize
try:
from typing import Sequence # noqa
from cdsl.ast import Def # noqa
from cdsl.xform import XForm, XFormGroup # noqa
except ImportError:
pass