Rename Cretonne to Cranelift!
This commit is contained in:
@@ -1 +1 @@
|
||||
"""Definitions for the base Cretonne language."""
|
||||
"""Definitions for the base Cranelift language."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
The `cretonne.entities` module predefines all the Cretonne entity reference
|
||||
operand types. There are corresponding definitions in the `cretonne.entities`
|
||||
The `cranelift.entities` module predefines all the Cranelift entity reference
|
||||
operand types. There are corresponding definitions in the `cranelift.entities`
|
||||
Rust module.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""
|
||||
The cretonne.formats defines all instruction formats.
|
||||
The cranelift.formats defines all instruction formats.
|
||||
|
||||
Every instruction format has a corresponding `InstructionData` variant in the
|
||||
Rust representation of Cretonne IR, so all instruction formats must be defined
|
||||
Rust representation of Cranelift IR, so all instruction formats must be defined
|
||||
in this module.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
The `cretonne.immediates` module predefines all the Cretonne immediate operand
|
||||
types.
|
||||
The `cranelift.immediates` module predefines all the Cranelift immediate
|
||||
operand types.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from cdsl.operands import ImmediateKind
|
||||
@@ -8,7 +8,7 @@ from cdsl.operands import ImmediateKind
|
||||
#: A 64-bit immediate integer operand.
|
||||
#:
|
||||
#: This type of immediate integer can interact with SSA values with any
|
||||
#: :py:class:`cretonne.IntType` type.
|
||||
#: :py:class:`cranelift.IntType` type.
|
||||
imm64 = ImmediateKind('imm64', 'A 64-bit immediate integer.')
|
||||
|
||||
#: An unsigned 8-bit immediate integer operand.
|
||||
@@ -42,13 +42,13 @@ ieee64 = ImmediateKind('ieee64', 'A 64-bit immediate floating point number.')
|
||||
#: An immediate boolean operand.
|
||||
#:
|
||||
#: This type of immediate boolean can interact with SSA values with any
|
||||
#: :py:class:`cretonne.BoolType` type.
|
||||
#: :py:class:`cranelift.BoolType` type.
|
||||
boolean = ImmediateKind('bool', 'An immediate boolean.',
|
||||
rust_type='bool')
|
||||
|
||||
#: A condition code for comparing integer values.
|
||||
#:
|
||||
#: This enumerated operand kind is used for the :cton:inst:`icmp` instruction
|
||||
#: This enumerated operand kind is used for the :clif:inst:`icmp` instruction
|
||||
#: and corresponds to the `condcodes::IntCC` Rust type.
|
||||
intcc = ImmediateKind(
|
||||
'intcc',
|
||||
@@ -70,7 +70,7 @@ intcc = ImmediateKind(
|
||||
|
||||
#: A condition code for comparing floating point values.
|
||||
#:
|
||||
#: This enumerated operand kind is used for the :cton:inst:`fcmp` instruction
|
||||
#: This enumerated operand kind is used for the :clif:inst:`fcmp` instruction
|
||||
#: and corresponds to the `condcodes::FloatCC` Rust type.
|
||||
floatcc = ImmediateKind(
|
||||
'floatcc',
|
||||
@@ -94,7 +94,7 @@ floatcc = ImmediateKind(
|
||||
'uge': 'UnorderedOrGreaterThanOrEqual',
|
||||
})
|
||||
|
||||
#: Flags for memory operations like :cton:inst:`load` and :cton:inst:`store`.
|
||||
#: Flags for memory operations like :clif:inst:`load` and :clif:inst:`store`.
|
||||
memflags = ImmediateKind(
|
||||
'memflags',
|
||||
'Memory operation flags',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Cretonne base instruction set.
|
||||
Cranelift base instruction set.
|
||||
|
||||
This module defines the basic Cretonne instruction set that all targets
|
||||
This module defines the basic Cranelift instruction set that all targets
|
||||
support.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
@@ -1524,8 +1524,8 @@ fdiv = Instruction(
|
||||
'fdiv', r"""
|
||||
Floating point division.
|
||||
|
||||
Unlike the integer division instructions :cton:inst:`sdiv` and
|
||||
:cton:inst:`udiv`, this can't trap. Division by zero is infinity or
|
||||
Unlike the integer division instructions :clif:inst:`sdiv` and
|
||||
:clif:inst:`udiv`, this can't trap. Division by zero is infinity or
|
||||
NaN, depending on the dividend.
|
||||
""",
|
||||
ins=(x, y), outs=a)
|
||||
@@ -1800,7 +1800,7 @@ fpromote = Instruction(
|
||||
Each lane in `x` is converted to the destination floating point format.
|
||||
This is an exact operation.
|
||||
|
||||
Cretonne currently only supports two floating point formats
|
||||
Cranelift currently only supports two floating point formats
|
||||
- :type:`f32` and :type:`f64`. This may change in the future.
|
||||
|
||||
The result type must have the same number of vector lanes as the input,
|
||||
@@ -1816,7 +1816,7 @@ fdemote = Instruction(
|
||||
Each lane in `x` is converted to the destination floating point format
|
||||
by rounding to nearest, ties to even.
|
||||
|
||||
Cretonne currently only supports two floating point formats
|
||||
Cranelift currently only supports two floating point formats
|
||||
- :type:`f32` and :type:`f64`. This may change in the future.
|
||||
|
||||
The result type must have the same number of vector lanes as the input,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Patterns for legalizing the `base` instruction set.
|
||||
|
||||
The base Cretonne instruction set is 'fat', and many instructions don't have
|
||||
The base Cranelift instruction set is 'fat', and many instructions don't have
|
||||
legal representations in a given target ISA. This module defines legalization
|
||||
patterns that describe how base instructions can be transformed to other base
|
||||
instructions that are legal.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Cretonne predicates that consider `Function` fields.
|
||||
Cranelift predicates that consider `Function` fields.
|
||||
"""
|
||||
from cdsl.predicates import FieldPredicate
|
||||
from .formats import UnaryGlobalValue, InstructionFormat
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Cretonne shared settings.
|
||||
Cranelift shared settings.
|
||||
|
||||
This module defines settings relevant for all code generators.
|
||||
"""
|
||||
@@ -20,10 +20,10 @@ opt_level = EnumSetting(
|
||||
|
||||
enable_verifier = BoolSetting(
|
||||
"""
|
||||
Run the Cretonne IR verifier at strategic times during compilation.
|
||||
Run the Cranelift IR verifier at strategic times during compilation.
|
||||
|
||||
This makes compilation slower but catches many bugs. The verifier is
|
||||
disabled by default, except when reading Cretonne IR from a text file.
|
||||
disabled by default, except when reading Cranelift IR from a text file.
|
||||
""",
|
||||
default=True)
|
||||
|
||||
@@ -51,8 +51,8 @@ call_conv = EnumSetting(
|
||||
'probestack'
|
||||
)
|
||||
|
||||
# Note that Cretonne doesn't currently need an is_pie flag, because PIE is just
|
||||
# PIC where symbols can't be pre-empted, which can be expressed with the
|
||||
# Note that Cranelift doesn't currently need an is_pie flag, because PIE is
|
||||
# just PIC where symbols can't be pre-empted, which can be expressed with the
|
||||
# `colocated` flag on external functions and global values.
|
||||
is_pic = BoolSetting("Enable Position-Independent Code generation")
|
||||
|
||||
@@ -126,7 +126,7 @@ baldrdash_prologue_words = NumSetting(
|
||||
in the epilogue.
|
||||
|
||||
This setting configures the number of pointer-sized words pushed on the
|
||||
stack when the Cretonne-generated code is entered. This includes the
|
||||
stack when the Cranelift-generated code is entered. This includes the
|
||||
pushed return address on x86.
|
||||
""")
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
The base.types module predefines all the Cretonne scalar types.
|
||||
The base.types module predefines all the Cranelift scalar types.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from cdsl.types import IntType, FloatType, BoolType, FlagsType
|
||||
|
||||
@@ -18,7 +18,7 @@ import gen_binemit
|
||||
def main():
|
||||
# type: () -> None
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Generate sources for Cretonne.')
|
||||
description='Generate sources for Cranelift.')
|
||||
parser.add_argument('--out-dir', help='set output directory')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Cretonne DSL classes.
|
||||
Cranelift DSL classes.
|
||||
|
||||
This module defines the classes that are used to define Cretonne instructions
|
||||
This module defines the classes that are used to define Cranelift instructions
|
||||
and other entitties.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Abstract syntax trees.
|
||||
|
||||
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 cranelift instructions.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from . import instructions
|
||||
|
||||
@@ -50,7 +50,7 @@ class InstructionFormat(object):
|
||||
of values.
|
||||
|
||||
All instruction formats must be predefined in the
|
||||
:py:mod:`cretonne.formats` module.
|
||||
:py:mod:`cranelift.formats` module.
|
||||
|
||||
:param kinds: List of `OperandKind` objects describing the operands.
|
||||
:param name: Instruction format name in CamelCase. This is used as a Rust
|
||||
|
||||
@@ -67,7 +67,7 @@ VARIABLE_ARGS = OperandKind(
|
||||
|
||||
|
||||
# Instances of immediate operand types are provided in the
|
||||
# `cretonne.immediates` module.
|
||||
# `cranelift.immediates` module.
|
||||
class ImmediateKind(OperandKind):
|
||||
"""
|
||||
The kind of an immediate instruction operand.
|
||||
@@ -152,7 +152,7 @@ class ImmediateKind(OperandKind):
|
||||
|
||||
|
||||
# Instances of entity reference operand types are provided in the
|
||||
# `cretonne.entities` module.
|
||||
# `cranelift.entities` module.
|
||||
class EntityRefKind(OperandKind):
|
||||
"""
|
||||
The kind of an entity reference instruction operand.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Cretonne predicates.
|
||||
Cranelift predicates.
|
||||
|
||||
A *predicate* is a function that computes a boolean result. The inputs to the
|
||||
function determine the kind of predicate:
|
||||
|
||||
@@ -14,7 +14,7 @@ except ImportError:
|
||||
|
||||
class Setting(object):
|
||||
"""
|
||||
A named setting variable that can be configured externally to Cretonne.
|
||||
A named setting variable that can be configured externally to Cranelift.
|
||||
|
||||
Settings are normally not named when they are created. They get their name
|
||||
from the `extract_names` method.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Cretonne ValueType hierarchy"""
|
||||
"""Cranelift ValueType hierarchy"""
|
||||
from __future__ import absolute_import
|
||||
import math
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Type variables for Parametric polymorphism.
|
||||
|
||||
Cretonne instructions and instruction transformations can be specified to be
|
||||
Cranelift instructions and instruction transformations can be specified to be
|
||||
polymorphic by using type variables.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Generate legalizer transformations.
|
||||
|
||||
The transformations defined in the `cretonne.legalize` module are all of the
|
||||
The transformations defined in the `cranelift.legalize` module are all of the
|
||||
macro-expansion form where the input pattern is a single instruction. We
|
||||
generate a Rust function for each `XFormGroup` which takes a `Cursor` pointing
|
||||
at the instruction to be legalized. The expanded destination pattern replaces
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"""
|
||||
Cretonne target ISA definitions
|
||||
-------------------------------
|
||||
Cranelift target ISA definitions
|
||||
--------------------------------
|
||||
|
||||
The :py:mod:`isa` package contains sub-packages for each target instruction set
|
||||
architecture supported by Cretonne.
|
||||
architecture supported by Cranelift.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from cdsl.isa import TargetISA # noqa
|
||||
@@ -19,6 +19,6 @@ def all_isas():
|
||||
# type: () -> List[TargetISA]
|
||||
"""
|
||||
Get a list of all the supported target ISAs. Each target ISA is represented
|
||||
as a :py:class:`cretonne.TargetISA` instance.
|
||||
as a :py:class:`cranelift.TargetISA` instance.
|
||||
"""
|
||||
return [riscv.ISA, x86.ISA, arm32.ISA, arm64.ISA]
|
||||
|
||||
@@ -61,7 +61,7 @@ RV32.enc(base.iconst.i32, Iz, OPIMM(0b000))
|
||||
RV64.enc(base.iconst.i32, Iz, OPIMM(0b000))
|
||||
RV64.enc(base.iconst.i64, Iz, OPIMM(0b000))
|
||||
|
||||
# Dynamic shifts have the same masking semantics as the cton base instructions.
|
||||
# Dynamic shifts have the same masking semantics as the clif base instructions.
|
||||
for inst, inst_imm, f3, f7 in [
|
||||
(base.ishl, base.ishl_imm, 0b001, 0b0000000),
|
||||
(base.ushr, base.ushr_imm, 0b101, 0b0000000),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"""
|
||||
x86 Target Architecture
|
||||
-------------------------
|
||||
-----------------------
|
||||
|
||||
This target ISA generates code for x86 CPUs with two separate CPU modes:
|
||||
|
||||
`I32`
|
||||
32-bit x86 architecture, also known as 'IA-32', also sometimes referred
|
||||
to as 'i386', however note that Cretonne depends on instructions not
|
||||
to as 'i386', however note that Cranelift depends on instructions not
|
||||
in the original `i386`, such as SSE2, CMOVcc, and UD2.
|
||||
|
||||
`I64`
|
||||
|
||||
@@ -34,7 +34,7 @@ except ImportError:
|
||||
|
||||
# Opcode representation.
|
||||
#
|
||||
# Cretonne requires each recipe to have a single encoding size in bytes, and
|
||||
# Cranelift requires each recipe to have a single encoding size in bytes, and
|
||||
# x86 opcodes are variable length, so we use separate recipes for different
|
||||
# styles of opcodes and prefixes. The opcode format is indicated by the recipe
|
||||
# name prefix:
|
||||
@@ -1600,7 +1600,7 @@ rcmp_sp = TailRecipe(
|
||||
#
|
||||
# 1. Guarantee that the test and branch get scheduled next to each other so
|
||||
# macro fusion is guaranteed to be possible.
|
||||
# 2. Hide the status flags from Cretonne which doesn't currently model flags.
|
||||
# 2. Hide the status flags from Cranelift which doesn't currently model flags.
|
||||
#
|
||||
# The encoding bits affect both the test and the branch instruction:
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Definitions for the semantics segment of the Cretonne language."""
|
||||
"""Definitions for the semantics segment of the Cranelift language."""
|
||||
from cdsl.ti import TypeEnv, ti_rtl, get_type_env
|
||||
from cdsl.operands import ImmediateKind
|
||||
from cdsl.ast import Var
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Tools to elaborate a given Rtl with concrete types into its semantically
|
||||
equivalent primitive version. Its elaborated primitive version contains only
|
||||
primitive cretonne instructions, which map well to SMTLIB functions.
|
||||
primitive cranelift instructions, which map well to SMTLIB functions.
|
||||
"""
|
||||
from .primitives import GROUP as PRIMITIVES, prim_to_bv, prim_from_bv
|
||||
from cdsl.xform import Rtl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Cretonne primitive instruction set.
|
||||
Cranelift primitive instruction set.
|
||||
|
||||
This module defines a primitive instruction set, in terms of which the base set
|
||||
is described. Most instructions in this set correspond 1-1 with an SMTLIB
|
||||
@@ -26,9 +26,9 @@ y = Operand('x', BV, doc="A semantic value Y (same width as X)")
|
||||
a = Operand('a', BV, doc="A semantic value A (same width as X)")
|
||||
cond = Operand('b', TypeVar.singleton(b1), doc='A b1 value')
|
||||
|
||||
real = Operand('real', Real, doc="A real cretonne value")
|
||||
real = Operand('real', Real, doc="A real cranelift value")
|
||||
fromReal = Operand('fromReal', Real.to_bitvec(),
|
||||
doc="A real cretonne value converted to a BV")
|
||||
doc="A real cranelift value converted to a BV")
|
||||
|
||||
#
|
||||
# BV Conversion/Materialization
|
||||
|
||||
@@ -186,14 +186,16 @@ def equivalent(r1, r2, inp_m, out_m):
|
||||
(q1, m1) = to_smt(r1)
|
||||
(q2, m2) = to_smt(r2)
|
||||
|
||||
# Build an expression for the equality of real Cretone inputs of r1 and r2
|
||||
# Build an expression for the equality of real Cranelift inputs of
|
||||
# r1 and r2
|
||||
args_eq_exp = [] # type: List[ExprRef]
|
||||
|
||||
for (v1, v2) in inp_m.items():
|
||||
assert isinstance(v2, Var)
|
||||
args_eq_exp.append(mk_eq(m1[v1], m2[v2]))
|
||||
|
||||
# Build an expression for the equality of real Cretone outputs of r1 and r2
|
||||
# Build an expression for the equality of real Cranelift outputs of
|
||||
# r1 and r2
|
||||
results_eq_exp = [] # type: List[ExprRef]
|
||||
for (v1, v2) in out_m.items():
|
||||
assert isinstance(v2, Var)
|
||||
|
||||
Reference in New Issue
Block a user