[meta] Remove mentions to Python in comments of the non-meta crate;
This commit is contained in:
@@ -50,8 +50,7 @@ fn main() {
|
|||||||
let crate_dir = cur_dir.as_path();
|
let crate_dir = cur_dir.as_path();
|
||||||
|
|
||||||
// Make sure we rebuild if this build script changes (will not happen with
|
// Make sure we rebuild if this build script changes (will not happen with
|
||||||
// if the path to this file contains non-UTF8 bytes). The `build.py` script
|
// if the path to this file contains non-UTF-8 bytes).
|
||||||
// prints out its own dependencies.
|
|
||||||
println!(
|
println!(
|
||||||
"cargo:rerun-if-changed={}",
|
"cargo:rerun-if-changed={}",
|
||||||
crate_dir.join("build.rs").to_str().unwrap()
|
crate_dir.join("build.rs").to_str().unwrap()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Runtime support for precomputed constant hash tables.
|
//! Runtime support for precomputed constant hash tables.
|
||||||
//!
|
//!
|
||||||
//! The `cranelift-codegen/meta-python/constant_hash.py` Python module can generate constant hash tables
|
//! The `cranelift-codegen/meta/src/constant_hash.rs` Rust crate can generate constant hash tables
|
||||||
//! using open addressing and quadratic probing. The hash tables are arrays that are guaranteed to:
|
//! using 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 `cranelift-codegen/meta-python/constant_hash.py` and `cranelift-codegen/meta/constant_hash.rs`.
|
/// Must match `cranelift-codegen/meta/src/constant_hash.rs`.
|
||||||
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-python/constant_hash.py` tests.
|
// c.f. `meta/src/constant_hash.rs` 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 `cranelift-codegen/meta-python/gen_instr.py`.
|
// Include trait code generated by `cranelift-codegen/meta/src/gen_inst.rs`.
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
//! Immediate operands for Cranelift instructions
|
//! Immediate operands for Cranelift instructions
|
||||||
//!
|
//!
|
||||||
//! This module defines the types of immediate operands that can appear on Cranelift instructions.
|
//! This module defines the types of immediate operands that can appear on Cranelift instructions.
|
||||||
//! Each type here should have a corresponding definition in the `cranelift.immediates` Python
|
//! Each type here should have a corresponding definition in the
|
||||||
//! module in the meta language.
|
//! `cranelift-codegen/meta/src/shared/immediates` crate in the meta language.
|
||||||
|
|
||||||
use core::fmt::{self, Display, Formatter};
|
use core::fmt::{self, Display, Formatter};
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
|||||||
@@ -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 `cranelift-codegen/meta-python/gen_instr.py`. This file contains:
|
// Include code generated by `cranelift-codegen/meta/src/gen_inst.rs`. 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.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ pub struct Type(u8);
|
|||||||
/// Not a valid type. Can't be loaded or stored. Can't be part of a SIMD vector.
|
/// Not a valid type. Can't be loaded or stored. Can't be part of a SIMD vector.
|
||||||
pub const INVALID: Type = Type(0);
|
pub const INVALID: Type = Type(0);
|
||||||
|
|
||||||
/// Start of the lane types. See also `meta-python/cdsl/types.py`.
|
/// Start of the lane types. See also `meta/src/cdsl/types.rs`.
|
||||||
const LANE_BASE: u8 = 0x70;
|
const LANE_BASE: u8 = 0x70;
|
||||||
|
|
||||||
/// Start of the 2-lane vector types.
|
/// Start of the 2-lane vector types.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
use crate::settings::{self, detail, Builder};
|
use crate::settings::{self, detail, Builder};
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
// Include code generated by `cranelift-codegen/meta-python/gen_settings.py`. This file contains a public
|
// Include code generated by `cranelift-codegen/meta/src/gen_settings.rs`. This file contains a
|
||||||
// `Flags` struct with an impl for all of the settings defined in
|
// public `Flags` struct with an impl for all of the settings defined in
|
||||||
// `cranelift-codegen/meta-python/isa/arm32/settings.py`.
|
// `cranelift-codegen/meta/src/isa/arm32/mod.rs`.
|
||||||
include!(concat!(env!("OUT_DIR"), "/settings-arm32.rs"));
|
include!(concat!(env!("OUT_DIR"), "/settings-arm32.rs"));
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
use crate::settings::{self, detail, Builder};
|
use crate::settings::{self, detail, Builder};
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
// Include code generated by `cranelift-codegen/meta-python/gen_settings.py`. This file contains a public
|
// Include code generated by `cranelift-codegen/meta/src/gen_settings.rs`. This file contains a
|
||||||
// `Flags` struct with an impl for all of the settings defined in
|
// public `Flags` struct with an impl for all of the settings defined in
|
||||||
// `cranelift-codegen/meta-python/isa/arm64/settings.py`.
|
// `cranelift-codegen/meta/src/isa/arm64/mod.rs`.
|
||||||
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
|
||||||
//! `cranelift-codegen/meta-python/gen_encoding.py`.
|
//! `cranelift-codegen/meta/src/gen_encodings.rs`.
|
||||||
|
|
||||||
use crate::constant_hash::{probe, Table};
|
use crate::constant_hash::{probe, Table};
|
||||||
use crate::ir::{Function, InstructionData, Opcode, Type};
|
use crate::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-python/gen_encoding.py`.
|
/// Number of bits used to represent a predicate. c.f. `meta/src/gen_encodings.rs`.
|
||||||
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-python/gen_encoding.py`.
|
/// First code word representing a predicate check. c.f. `meta/src/gen_encodings.rs`.
|
||||||
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-python/cdsl/registers.py.
|
/// This type should be coordinated with meta/src/cdsl/regs.rs.
|
||||||
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-python/cdsl/isa.py.
|
/// This type should be coordinated with meta/src/cdsl/regs.rs.
|
||||||
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-python/cdsl/isa.py.
|
/// This can be increased, but should be coordinated with meta/src/cdsl/regs.rs.
|
||||||
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
|
||||||
@@ -37,7 +37,7 @@ pub const MAX_TRACKED_TOPRCS: usize = 4;
|
|||||||
///
|
///
|
||||||
/// The `RegBank` struct provides a static description of a register bank.
|
/// The `RegBank` struct provides a static description of a register bank.
|
||||||
pub struct RegBank {
|
pub struct RegBank {
|
||||||
/// The name of this register bank as defined in the ISA's `registers.py` file.
|
/// The name of this register bank as defined in the ISA's DSL definition.
|
||||||
pub name: &'static str,
|
pub name: &'static str,
|
||||||
|
|
||||||
/// The first register unit in this bank.
|
/// The first register unit in this bank.
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
use crate::settings::{self, detail, Builder};
|
use crate::settings::{self, detail, Builder};
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
// Include code generated by `cranelift-codegen/meta-python/gen_settings.py`. This file contains a public
|
// Include code generated by `cranelift-codegen/meta/src/gen_settings.rs`. This file contains a
|
||||||
// `Flags` struct with an impl for all of the settings defined in
|
// public `Flags` struct with an impl for all of the settings defined in
|
||||||
// `cranelift-codegen/meta-python/isa/riscv/settings.py`.
|
// `cranelift-codegen/meta/src/isa/riscv/mod.rs`.
|
||||||
include!(concat!(env!("OUT_DIR"), "/settings-riscv.rs"));
|
include!(concat!(env!("OUT_DIR"), "/settings-riscv.rs"));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ pub enum StackBase {
|
|||||||
/// This behaves like a set of `StackBase` variants.
|
/// This behaves like a set of `StackBase` variants.
|
||||||
///
|
///
|
||||||
/// The internal representation as a `u8` is public because stack base masks are used in constant
|
/// The internal representation as a `u8` is public because stack base masks are used in constant
|
||||||
/// tables generated from the Python encoding definitions.
|
/// tables generated from the meta-language encoding definitions.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub struct StackBaseMask(pub u8);
|
pub struct StackBaseMask(pub u8);
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
use crate::settings::{self, detail, Builder};
|
use crate::settings::{self, detail, Builder};
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
// Include code generated by `cranelift-codegen/meta-python/gen_settings.py`. This file contains a public
|
// Include code generated by `cranelift-codegen/meta/src/gen_settings.rs:`. This file contains a
|
||||||
// `Flags` struct with an impl for all of the settings defined in
|
// public `Flags` struct with an impl for all of the settings defined in
|
||||||
// `cranelift-codegen/meta-python/isa/x86/settings.py`.
|
// `cranelift-codegen/meta/src/isa/x86/settings.rs`.
|
||||||
include!(concat!(env!("OUT_DIR"), "/settings-x86.rs"));
|
include!(concat!(env!("OUT_DIR"), "/settings-x86.rs"));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -117,14 +117,14 @@ 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.rs` from the
|
||||||
// `cranelift-codegen/meta-python/base/legalize.py`.
|
// `TransformGroup` in `cranelift-codegen/meta/shared/legalize.rs`.
|
||||||
//
|
//
|
||||||
// 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"));
|
||||||
|
|
||||||
/// Custom expansion for conditional trap instructions.
|
/// Custom expansion for conditional trap instructions.
|
||||||
/// TODO: Add CFG support to the Python patterns so we won't have to do this.
|
/// TODO: Add CFG support to the Rust DSL patterns so we won't have to do this.
|
||||||
fn expand_cond_trap(
|
fn expand_cond_trap(
|
||||||
inst: ir::Inst,
|
inst: ir::Inst,
|
||||||
func: &mut ir::Function,
|
func: &mut ir::Function,
|
||||||
|
|||||||
@@ -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
|
||||||
//! `cranelift-codegen/meta-python/cdsl/predicates.py` classes.
|
//! `cranelift-codegen/meta/src/cdsl/instructions.rs` 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`.
|
||||||
|
|||||||
@@ -89,9 +89,9 @@ impl RegisterSet {
|
|||||||
|
|
||||||
// Mask out the unavailable units.
|
// Mask out the unavailable units.
|
||||||
for idx in 0..self.avail.len() {
|
for idx in 0..self.avail.len() {
|
||||||
// If a single unit in a register is unavailable, the whole register can't be used.
|
// If a single unit in a register is unavailable, the whole register can't be used. If
|
||||||
// If a register straddles a word boundary, it will be marked as unavailable.
|
// a register straddles a word boundary, it will be marked as unavailable. There's an
|
||||||
// There's an assertion in `cdsl/registers.py` to check for that.
|
// assertion in `cranelift-codegen/meta/src/cdsl/regs.rs` to check for that.
|
||||||
for i in 0..rc.width {
|
for i in 0..rc.width {
|
||||||
rsi.regs[idx] &= self.avail[idx] >> i;
|
rsi.regs[idx] &= self.avail[idx] >> i;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,9 +331,9 @@ pub mod detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include code generated by `meta-python/gen_settings.py`. This file contains a public `Flags`
|
// Include code generated by `meta/gen_settings.rs`. This file contains a public `Flags` struct
|
||||||
// struct with an impl for all of the settings defined in
|
// with an implementation for all of the settings defined in
|
||||||
// `cranelift-codegen/meta-python/base/settings.py`.
|
// `cranelift-codegen/meta/src/shared/settings.rs`.
|
||||||
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