Update paths for the meta => meta-python rename.
This commit is contained in:
@@ -14,7 +14,7 @@ help:
|
|||||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
autohtml: html
|
autohtml: html
|
||||||
$(SPHINXABUILD) -z ../lib/codegen/meta --ignore '.*' -b html -E $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
$(SPHINXABUILD) -z ../lib/codegen/meta-python --ignore '.*' -b html -E $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||||
|
|
||||||
.PHONY: help Makefile
|
.PHONY: help Makefile
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
sys.path.insert(0, os.path.abspath('.'))
|
sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
# Also add the meta directory to sys.path so autodoc can find the Cranelift meta
|
# Also add the meta-python directory to sys.path so autodoc can find the Cranelift meta
|
||||||
# language definitions.
|
# language definitions.
|
||||||
sys.path.insert(0, os.path.abspath('../lib/codegen/meta'))
|
sys.path.insert(0, os.path.abspath('../lib/codegen/meta-python'))
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ domain specific language embedded in Python. This document describes the Python
|
|||||||
modules that form the embedded DSL.
|
modules that form the embedded DSL.
|
||||||
|
|
||||||
The meta language descriptions are Python modules under the
|
The meta language descriptions are Python modules under the
|
||||||
:file:`lib/codegen/meta` directory. The descriptions are processed in two
|
:file:`lib/codegen/meta-python` directory. The descriptions are processed in two
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
1. The Python modules are imported. This has the effect of building static data
|
1. The Python modules are imported. This has the effect of building static data
|
||||||
@@ -23,8 +23,8 @@ steps:
|
|||||||
constant tables.
|
constant tables.
|
||||||
|
|
||||||
The main driver for this source code generation process is the
|
The main driver for this source code generation process is the
|
||||||
:file:`lib/codegen/meta/build.py` script which is invoked as part of the build
|
:file:`lib/codegen/meta-python/build.py` script which is invoked as part of the build
|
||||||
process if anything in the :file:`lib/codegen/meta` directory has changed
|
process if anything in the :file:`lib/codegen/meta-python` directory has changed
|
||||||
since the last build.
|
since the last build.
|
||||||
|
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ of code generation. Each setting is defined in the meta language so a compact
|
|||||||
and consistent Rust representation can be generated. Shared settings are defined
|
and consistent Rust representation can be generated. Shared settings are defined
|
||||||
in the :mod:`base.settings` module. Some settings are specific to a target ISA,
|
in the :mod:`base.settings` module. Some settings are specific to a target ISA,
|
||||||
and defined in a :file:`settings.py` module under the appropriate
|
and defined in a :file:`settings.py` module under the appropriate
|
||||||
:file:`lib/codegen/meta/isa/*` directory.
|
:file:`lib/codegen/meta-python/isa/*` directory.
|
||||||
|
|
||||||
Settings can take boolean on/off values, small numbers, or explicitly enumerated
|
Settings can take boolean on/off values, small numbers, or explicitly enumerated
|
||||||
symbolic values. Each type is represented by a sub-class of :class:`Setting`:
|
symbolic values. Each type is represented by a sub-class of :class:`Setting`:
|
||||||
@@ -433,7 +433,7 @@ architectures. Each ISA is represented by a :py:class:`cdsl.isa.TargetISA` insta
|
|||||||
.. autoclass:: TargetISA
|
.. autoclass:: TargetISA
|
||||||
|
|
||||||
The definitions for each supported target live in a package under
|
The definitions for each supported target live in a package under
|
||||||
:file:`lib/codegen/meta/isa`.
|
:file:`lib/codegen/meta-python/isa`.
|
||||||
|
|
||||||
.. automodule:: isa
|
.. automodule:: isa
|
||||||
:members:
|
:members:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
****************
|
*****************
|
||||||
Testing Cranelift
|
Testing Cranelift
|
||||||
****************
|
*****************
|
||||||
|
|
||||||
Cranelift is tested at multiple levels of abstraction and integration. When
|
Cranelift is tested at multiple levels of abstraction and integration. When
|
||||||
possible, Rust unit tests are used to verify single functions and types. When
|
possible, Rust unit tests are used to verify single functions and types. When
|
||||||
@@ -109,7 +109,7 @@ header:
|
|||||||
isa_spec : "isa" isa_name { `option` } "\n"
|
isa_spec : "isa" isa_name { `option` } "\n"
|
||||||
|
|
||||||
The options given on the ``isa`` line modify the ISA-specific settings defined in
|
The options given on the ``isa`` line modify the ISA-specific settings defined in
|
||||||
:file:`lib/codegen/meta/isa/*/settings.py`.
|
:file:`lib/codegen/meta-python/isa/*/settings.py`.
|
||||||
|
|
||||||
All types of tests allow shared Cranelift settings to be modified:
|
All types of tests allow shared Cranelift settings to be modified:
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ All types of tests allow shared Cranelift settings to be modified:
|
|||||||
option : flag | setting "=" value
|
option : flag | setting "=" value
|
||||||
|
|
||||||
The shared settings available for all target ISAs are defined in
|
The shared settings available for all target ISAs are defined in
|
||||||
:file:`lib/codegen/meta/base/settings.py`.
|
:file:`lib/codegen/meta-python/base/settings.py`.
|
||||||
|
|
||||||
The ``set`` lines apply settings cumulatively::
|
The ``set`` lines apply settings cumulatively::
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ fi
|
|||||||
# Check if any Python files have changed since we last checked them.
|
# Check if any Python files have changed since we last checked them.
|
||||||
tsfile="$topdir/target/meta-checked"
|
tsfile="$topdir/target/meta-checked"
|
||||||
if [ -f "$tsfile" ]; then
|
if [ -f "$tsfile" ]; then
|
||||||
needcheck=$(find "$topdir/lib/codegen/meta" -name '*.py' -newer "$tsfile")
|
needcheck=$(find "$topdir/lib/codegen/meta-python" -name '*.py' -newer "$tsfile")
|
||||||
else
|
else
|
||||||
needcheck=yes
|
needcheck=yes
|
||||||
fi
|
fi
|
||||||
if [ -n "$needcheck" ]; then
|
if [ -n "$needcheck" ]; then
|
||||||
banner "Checking python source files"
|
banner "Checking python source files"
|
||||||
"$topdir/lib/codegen/meta/check.sh"
|
"$topdir/lib/codegen/meta-python/check.sh"
|
||||||
touch "$tsfile" || echo no target directory
|
touch "$tsfile" || echo no target directory
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Runtime support for precomputed constant hash tables.
|
//! Runtime support for precomputed constant hash tables.
|
||||||
//!
|
//!
|
||||||
//! The `lib/codegen/meta/constant_hash.py` Python module can generate constant hash tables using
|
//! The `lib/codegen/meta-python/constant_hash.py` Python module can generate constant hash tables using
|
||||||
//! open addressing and quadratic probing. The hash tables are arrays that are guaranteed to:
|
//! open addressing and quadratic probing. The hash tables are arrays that are guaranteed to:
|
||||||
//!
|
//!
|
||||||
//! - Have a power-of-two size.
|
//! - Have a power-of-two size.
|
||||||
@@ -56,7 +56,7 @@ pub fn probe<K: Copy + Eq, T: Table<K> + ?Sized>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A primitive hash function for matching opcodes.
|
/// A primitive hash function for matching opcodes.
|
||||||
/// Must match `lib/codegen/meta/constant_hash.py`.
|
/// Must match `lib/codegen/meta-python/constant_hash.py`.
|
||||||
pub fn simple_hash(s: &str) -> usize {
|
pub fn simple_hash(s: &str) -> usize {
|
||||||
let mut h: u32 = 5381;
|
let mut h: u32 = 5381;
|
||||||
for c in s.chars() {
|
for c in s.chars() {
|
||||||
@@ -71,7 +71,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic() {
|
fn basic() {
|
||||||
// c.f. `meta/constant_hash.py` tests.
|
// c.f. `meta-python/constant_hash.py` tests.
|
||||||
assert_eq!(simple_hash("Hello"), 0x2fa70c01);
|
assert_eq!(simple_hash("Hello"), 0x2fa70c01);
|
||||||
assert_eq!(simple_hash("world"), 0x5b0c31d5);
|
assert_eq!(simple_hash("world"), 0x5b0c31d5);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ pub trait InstBuilderBase<'f>: Sized {
|
|||||||
fn build(self, data: InstructionData, ctrl_typevar: Type) -> (Inst, &'f mut DataFlowGraph);
|
fn build(self, data: InstructionData, ctrl_typevar: Type) -> (Inst, &'f mut DataFlowGraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include trait code generated by `lib/codegen/meta/gen_instr.py`.
|
// Include trait code generated by `lib/codegen/meta-python/gen_instr.py`.
|
||||||
//
|
//
|
||||||
// This file defines the `InstBuilder` trait as an extension of `InstBuilderBase` with methods per
|
// This file defines the `InstBuilder` trait as an extension of `InstBuilderBase` with methods per
|
||||||
// instruction format and per opcode.
|
// instruction format and per opcode.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ pub type ValueList = entity::EntityList<Value>;
|
|||||||
/// Memory pool for holding value lists. See `ValueList`.
|
/// Memory pool for holding value lists. See `ValueList`.
|
||||||
pub type ValueListPool = entity::ListPool<Value>;
|
pub type ValueListPool = entity::ListPool<Value>;
|
||||||
|
|
||||||
// Include code generated by `lib/codegen/meta/gen_instr.py`. This file contains:
|
// Include code generated by `lib/codegen/meta-python/gen_instr.py`. This file contains:
|
||||||
//
|
//
|
||||||
// - The `pub enum InstructionFormat` enum with all the instruction formats.
|
// - The `pub enum InstructionFormat` enum with all the instruction formats.
|
||||||
// - The `pub enum InstructionData` enum with all the instruction data fields.
|
// - The `pub enum InstructionData` enum with all the instruction data fields.
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ pub struct Type(u8);
|
|||||||
/// a SIMD vector.
|
/// a SIMD vector.
|
||||||
pub const VOID: Type = Type(0);
|
pub const VOID: Type = Type(0);
|
||||||
|
|
||||||
/// Start of the lane types. See also `meta/cdsl.types.py`.
|
/// Start of the lane types. See also `meta-python/cdsl.types.py`.
|
||||||
const LANE_BASE: u8 = 0x70;
|
const LANE_BASE: u8 = 0x70;
|
||||||
|
|
||||||
/// Start of the 2-lane vector types.
|
/// Start of the 2-lane vector types.
|
||||||
const VECTOR_BASE: u8 = LANE_BASE + 16;
|
const VECTOR_BASE: u8 = LANE_BASE + 16;
|
||||||
|
|
||||||
// Include code generated by `lib/codegen/meta/gen_types.py`. This file contains constant
|
// Include code generated by `lib/codegen/meta-python/gen_types.py`. This file contains constant
|
||||||
// definitions for all the scalar types as well as common vector types for 64, 128, 256, and
|
// definitions for all the scalar types as well as common vector types for 64, 128, 256, and
|
||||||
// 512-bit SIMD vectors.
|
// 512-bit SIMD vectors.
|
||||||
include!(concat!(env!("OUT_DIR"), "/types.rs"));
|
include!(concat!(env!("OUT_DIR"), "/types.rs"));
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
use settings::{self, detail, Builder};
|
use settings::{self, detail, Builder};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
// Include code generated by `lib/codegen/meta/gen_settings.py`. This file contains a public
|
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
||||||
// `Flags` struct with an impl for all of the settings defined in
|
// `Flags` struct with an impl for all of the settings defined in
|
||||||
// `lib/codegen/meta/isa/arm32/settings.py`.
|
// `lib/codegen/meta-python/isa/arm32/settings.py`.
|
||||||
include!(concat!(env!("OUT_DIR"), "/settings-arm32.rs"));
|
include!(concat!(env!("OUT_DIR"), "/settings-arm32.rs"));
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
use settings::{self, detail, Builder};
|
use settings::{self, detail, Builder};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
// Include code generated by `lib/codegen/meta/gen_settings.py`. This file contains a public
|
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
||||||
// `Flags` struct with an impl for all of the settings defined in
|
// `Flags` struct with an impl for all of the settings defined in
|
||||||
// `lib/codegen/meta/isa/arm64/settings.py`.
|
// `lib/codegen/meta-python/isa/arm64/settings.py`.
|
||||||
include!(concat!(env!("OUT_DIR"), "/settings-arm64.rs"));
|
include!(concat!(env!("OUT_DIR"), "/settings-arm64.rs"));
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Support types for generated encoding tables.
|
//! Support types for generated encoding tables.
|
||||||
//!
|
//!
|
||||||
//! This module contains types and functions for working with the encoding tables generated by
|
//! This module contains types and functions for working with the encoding tables generated by
|
||||||
//! `lib/codegen/meta/gen_encoding.py`.
|
//! `lib/codegen/meta-python/gen_encoding.py`.
|
||||||
|
|
||||||
use constant_hash::{probe, Table};
|
use constant_hash::{probe, Table};
|
||||||
use ir::{Function, InstructionData, Opcode, Type};
|
use ir::{Function, InstructionData, Opcode, Type};
|
||||||
@@ -164,10 +164,10 @@ where
|
|||||||
/// Encoding lists are represented as sequences of u16 words.
|
/// Encoding lists are represented as sequences of u16 words.
|
||||||
pub type EncListEntry = u16;
|
pub type EncListEntry = u16;
|
||||||
|
|
||||||
/// Number of bits used to represent a predicate. c.f. `meta/gen_encoding.py`.
|
/// Number of bits used to represent a predicate. c.f. `meta-python/gen_encoding.py`.
|
||||||
const PRED_BITS: u8 = 12;
|
const PRED_BITS: u8 = 12;
|
||||||
const PRED_MASK: usize = (1 << PRED_BITS) - 1;
|
const PRED_MASK: usize = (1 << PRED_BITS) - 1;
|
||||||
/// First code word representing a predicate check. c.f. `meta/gen_encoding.py`.
|
/// First code word representing a predicate check. c.f. `meta-python/gen_encoding.py`.
|
||||||
const PRED_START: usize = 0x1000;
|
const PRED_START: usize = 0x1000;
|
||||||
|
|
||||||
/// An iterator over legal encodings for the instruction.
|
/// An iterator over legal encodings for the instruction.
|
||||||
|
|||||||
@@ -17,19 +17,19 @@ pub type RegUnit = u16;
|
|||||||
/// The size of this type is determined by the target ISA that has the most register units defined.
|
/// The size of this type is determined by the target ISA that has the most register units defined.
|
||||||
/// Currently that is arm32 which has 64+16 units.
|
/// Currently that is arm32 which has 64+16 units.
|
||||||
///
|
///
|
||||||
/// This type should be coordinated with meta/cdsl/registers.py.
|
/// This type should be coordinated with meta-python/cdsl/registers.py.
|
||||||
pub type RegUnitMask = [u32; 3];
|
pub type RegUnitMask = [u32; 3];
|
||||||
|
|
||||||
/// A bit mask indexed by register classes.
|
/// A bit mask indexed by register classes.
|
||||||
///
|
///
|
||||||
/// The size of this type is determined by the ISA with the most register classes.
|
/// The size of this type is determined by the ISA with the most register classes.
|
||||||
///
|
///
|
||||||
/// This type should be coordinated with meta/cdsl/isa.py.
|
/// This type should be coordinated with meta-python/cdsl/isa.py.
|
||||||
pub type RegClassMask = u32;
|
pub type RegClassMask = u32;
|
||||||
|
|
||||||
/// Guaranteed maximum number of top-level register classes with pressure tracking in any ISA.
|
/// Guaranteed maximum number of top-level register classes with pressure tracking in any ISA.
|
||||||
///
|
///
|
||||||
/// This can be increased, but should be coordinated with meta/cdsl/isa.py.
|
/// This can be increased, but should be coordinated with meta-python/cdsl/isa.py.
|
||||||
pub const MAX_TRACKED_TOPRCS: usize = 4;
|
pub const MAX_TRACKED_TOPRCS: usize = 4;
|
||||||
|
|
||||||
/// The register units in a target ISA are divided into disjoint register banks. Each bank covers a
|
/// The register units in a target ISA are divided into disjoint register banks. Each bank covers a
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
use settings::{self, detail, Builder};
|
use settings::{self, detail, Builder};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
// Include code generated by `lib/codegen/meta/gen_settings.py`. This file contains a public
|
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
||||||
// `Flags` struct with an impl for all of the settings defined in
|
// `Flags` struct with an impl for all of the settings defined in
|
||||||
// `lib/codegen/meta/isa/riscv/settings.py`.
|
// `lib/codegen/meta-python/isa/riscv/settings.py`.
|
||||||
include!(concat!(env!("OUT_DIR"), "/settings-riscv.rs"));
|
include!(concat!(env!("OUT_DIR"), "/settings-riscv.rs"));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
use settings::{self, detail, Builder};
|
use settings::{self, detail, Builder};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
// Include code generated by `lib/codegen/meta/gen_settings.py`. This file contains a public
|
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
||||||
// `Flags` struct with an impl for all of the settings defined in
|
// `Flags` struct with an impl for all of the settings defined in
|
||||||
// `lib/codegen/meta/isa/x86/settings.py`.
|
// `lib/codegen/meta-python/isa/x86/settings.py`.
|
||||||
include!(concat!(env!("OUT_DIR"), "/settings-x86.rs"));
|
include!(concat!(env!("OUT_DIR"), "/settings-x86.rs"));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ pub fn legalize_function(func: &mut ir::Function, cfg: &mut ControlFlowGraph, is
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Include legalization patterns that were generated by `gen_legalizer.py` from the `XForms` in
|
// Include legalization patterns that were generated by `gen_legalizer.py` from the `XForms` in
|
||||||
// `lib/codegen/meta/base/legalize.py`.
|
// `lib/codegen/meta-python/base/legalize.py`.
|
||||||
//
|
//
|
||||||
// Concretely, this defines private functions `narrow()`, and `expand()`.
|
// Concretely, this defines private functions `narrow()`, and `expand()`.
|
||||||
include!(concat!(env!("OUT_DIR"), "/legalizer.rs"));
|
include!(concat!(env!("OUT_DIR"), "/legalizer.rs"));
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Predicate functions for testing instruction fields.
|
//! Predicate functions for testing instruction fields.
|
||||||
//!
|
//!
|
||||||
//! This module defines functions that are used by the instruction predicates defined by
|
//! This module defines functions that are used by the instruction predicates defined by
|
||||||
//! `lib/codegen/meta/cdsl/predicates.py` classes.
|
//! `lib/codegen/meta-python/cdsl/predicates.py` classes.
|
||||||
//!
|
//!
|
||||||
//! The predicates the operate on integer fields use `Into<i64>` as a shared trait bound. This
|
//! The predicates the operate on integer fields use `Into<i64>` as a shared trait bound. This
|
||||||
//! bound is implemented by all the native integer types as well as `Imm64`.
|
//! bound is implemented by all the native integer types as well as `Imm64`.
|
||||||
|
|||||||
@@ -310,8 +310,9 @@ pub mod detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include code generated by `meta/gen_settings.py`. This file contains a public `Flags` struct
|
// Include code generated by `meta-python/gen_settings.py`. This file contains a public `Flags`
|
||||||
// with an impl for all of the settings defined in `lib/codegen/meta/base/settings.py`.
|
// struct with an impl for all of the settings defined in
|
||||||
|
// `lib/codegen/meta-python/base/settings.py`.
|
||||||
include!(concat!(env!("OUT_DIR"), "/settings.rs"));
|
include!(concat!(env!("OUT_DIR"), "/settings.rs"));
|
||||||
|
|
||||||
/// Wrapper containing flags and optionally a `TargetIsa` trait object.
|
/// Wrapper containing flags and optionally a `TargetIsa` trait object.
|
||||||
|
|||||||
Reference in New Issue
Block a user