Python 3 compat.

Try to keep our Python sources compatible with both Python 2.7 and 3.

Check with 'pylint --py3k' and 'python -3'.
This commit is contained in:
Jakob Stoklund Olesen
2016-08-23 15:16:40 -07:00
parent c0a9a4fe46
commit 9da6847805
20 changed files with 40 additions and 34 deletions

View File

@@ -5,7 +5,7 @@ Cretonne target ISA definitions
The :py:mod:`isa` package contains sub-packages for each target instruction set
architecture supported by Cretonne.
"""
from __future__ import absolute_import
from . import riscv

View File

@@ -24,10 +24,10 @@ RV32G / RV64G
F, and D instruction sets listed above.
"""
import defs
import encodings
import settings
from __future__ import absolute_import
from . import defs
from . import encodings
from . import settings
# Re-export the primary target ISA definition.
isa = defs.isa

View File

@@ -3,7 +3,7 @@ RISC-V definitions.
Commonly used definitions.
"""
from __future__ import absolute_import
from cretonne import TargetISA, CPUMode
import cretonne.base

View File

@@ -1,9 +1,10 @@
"""
RISC-V Encodings.
"""
from __future__ import absolute_import
from cretonne import base
from defs import RV32, RV64
from recipes import OPIMM, OPIMM32, OP, OP32, R, Rshamt
from .defs import RV32, RV64
from .recipes import OPIMM, OPIMM32, OP, OP32, R, Rshamt
# Basic arithmetic binary instructions are encoded in an R-type instruction.
for inst, f3, f7 in [

View File

@@ -8,6 +8,7 @@ instruction formats described in the reference:
Volume I: User-Level ISA
Version 2.1
"""
from __future__ import absolute_import
from cretonne import EncRecipe
from cretonne.formats import Binary, BinaryImm

View File

@@ -1,11 +1,11 @@
"""
RISC-V settings.
"""
from __future__ import absolute_import
from cretonne import SettingGroup, BoolSetting
from cretonne.predicates import And
import cretonne.settings as shared
from defs import isa
from .defs import isa
isa.settings = SettingGroup('riscv', parent=shared.group)