diff --git a/cranelift/codegen/build.rs b/cranelift/codegen/build.rs index d9d6f13fc5..ef89d48ffe 100644 --- a/cranelift/codegen/build.rs +++ b/cranelift/codegen/build.rs @@ -50,8 +50,7 @@ fn main() { let crate_dir = cur_dir.as_path(); // 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 - // prints out its own dependencies. + // if the path to this file contains non-UTF-8 bytes). println!( "cargo:rerun-if-changed={}", crate_dir.join("build.rs").to_str().unwrap() diff --git a/cranelift/codegen/src/constant_hash.rs b/cranelift/codegen/src/constant_hash.rs index d6afc5eed0..5785a89825 100644 --- a/cranelift/codegen/src/constant_hash.rs +++ b/cranelift/codegen/src/constant_hash.rs @@ -1,6 +1,6 @@ //! 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: //! //! - Have a power-of-two size. @@ -56,7 +56,7 @@ pub fn probe + ?Sized>( } /// 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 { let mut h: u32 = 5381; for c in s.chars() { @@ -71,7 +71,7 @@ mod tests { #[test] 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("world"), 0x5b0c31d5); } diff --git a/cranelift/codegen/src/ir/builder.rs b/cranelift/codegen/src/ir/builder.rs index 43578d5378..13202870f3 100644 --- a/cranelift/codegen/src/ir/builder.rs +++ b/cranelift/codegen/src/ir/builder.rs @@ -32,7 +32,7 @@ pub trait InstBuilderBase<'f>: Sized { 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 // instruction format and per opcode. diff --git a/cranelift/codegen/src/ir/immediates.rs b/cranelift/codegen/src/ir/immediates.rs index 36cc470aef..73d1d8cc21 100644 --- a/cranelift/codegen/src/ir/immediates.rs +++ b/cranelift/codegen/src/ir/immediates.rs @@ -1,8 +1,8 @@ //! Immediate operands for 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 -//! module in the meta language. +//! Each type here should have a corresponding definition in the +//! `cranelift-codegen/meta/src/shared/immediates` crate in the meta language. use core::fmt::{self, Display, Formatter}; use core::mem; diff --git a/cranelift/codegen/src/ir/instructions.rs b/cranelift/codegen/src/ir/instructions.rs index ae227dc5f7..8278888d7e 100644 --- a/cranelift/codegen/src/ir/instructions.rs +++ b/cranelift/codegen/src/ir/instructions.rs @@ -28,7 +28,7 @@ pub type ValueList = entity::EntityList; /// Memory pool for holding value lists. See `ValueList`. pub type ValueListPool = entity::ListPool; -// 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 InstructionData` enum with all the instruction data fields. diff --git a/cranelift/codegen/src/ir/types.rs b/cranelift/codegen/src/ir/types.rs index eee39c83e4..20bed0c4ce 100644 --- a/cranelift/codegen/src/ir/types.rs +++ b/cranelift/codegen/src/ir/types.rs @@ -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. 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; /// Start of the 2-lane vector types. diff --git a/cranelift/codegen/src/isa/arm32/settings.rs b/cranelift/codegen/src/isa/arm32/settings.rs index 084c142399..bef631b2bb 100644 --- a/cranelift/codegen/src/isa/arm32/settings.rs +++ b/cranelift/codegen/src/isa/arm32/settings.rs @@ -3,7 +3,7 @@ use crate::settings::{self, detail, Builder}; use core::fmt; -// Include code generated by `cranelift-codegen/meta-python/gen_settings.py`. This file contains a public -// `Flags` struct with an impl for all of the settings defined in -// `cranelift-codegen/meta-python/isa/arm32/settings.py`. +// Include code generated by `cranelift-codegen/meta/src/gen_settings.rs`. This file contains a +// public `Flags` struct with an impl for all of the settings defined in +// `cranelift-codegen/meta/src/isa/arm32/mod.rs`. include!(concat!(env!("OUT_DIR"), "/settings-arm32.rs")); diff --git a/cranelift/codegen/src/isa/arm64/settings.rs b/cranelift/codegen/src/isa/arm64/settings.rs index b7be97e368..56d0f4ee0b 100644 --- a/cranelift/codegen/src/isa/arm64/settings.rs +++ b/cranelift/codegen/src/isa/arm64/settings.rs @@ -3,7 +3,7 @@ use crate::settings::{self, detail, Builder}; use core::fmt; -// Include code generated by `cranelift-codegen/meta-python/gen_settings.py`. This file contains a public -// `Flags` struct with an impl for all of the settings defined in -// `cranelift-codegen/meta-python/isa/arm64/settings.py`. +// Include code generated by `cranelift-codegen/meta/src/gen_settings.rs`. This file contains a +// public `Flags` struct with an impl for all of the settings defined in +// `cranelift-codegen/meta/src/isa/arm64/mod.rs`. include!(concat!(env!("OUT_DIR"), "/settings-arm64.rs")); diff --git a/cranelift/codegen/src/isa/enc_tables.rs b/cranelift/codegen/src/isa/enc_tables.rs index 45ad86441b..e21557497e 100644 --- a/cranelift/codegen/src/isa/enc_tables.rs +++ b/cranelift/codegen/src/isa/enc_tables.rs @@ -1,7 +1,7 @@ //! Support types for generated encoding tables. //! //! 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::ir::{Function, InstructionData, Opcode, Type}; @@ -164,10 +164,10 @@ where /// Encoding lists are represented as sequences of u16 words. 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_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; /// An iterator over legal encodings for the instruction. diff --git a/cranelift/codegen/src/isa/registers.rs b/cranelift/codegen/src/isa/registers.rs index 6baebd7237..3c1b4262c1 100644 --- a/cranelift/codegen/src/isa/registers.rs +++ b/cranelift/codegen/src/isa/registers.rs @@ -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. /// 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]; /// A bit mask indexed by 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; /// 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; /// 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. 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, /// The first register unit in this bank. diff --git a/cranelift/codegen/src/isa/riscv/settings.rs b/cranelift/codegen/src/isa/riscv/settings.rs index 26999b87ee..3599a93495 100644 --- a/cranelift/codegen/src/isa/riscv/settings.rs +++ b/cranelift/codegen/src/isa/riscv/settings.rs @@ -3,9 +3,9 @@ use crate::settings::{self, detail, Builder}; use core::fmt; -// Include code generated by `cranelift-codegen/meta-python/gen_settings.py`. This file contains a public -// `Flags` struct with an impl for all of the settings defined in -// `cranelift-codegen/meta-python/isa/riscv/settings.py`. +// Include code generated by `cranelift-codegen/meta/src/gen_settings.rs`. This file contains a +// public `Flags` struct with an impl for all of the settings defined in +// `cranelift-codegen/meta/src/isa/riscv/mod.rs`. include!(concat!(env!("OUT_DIR"), "/settings-riscv.rs")); #[cfg(test)] diff --git a/cranelift/codegen/src/isa/stack.rs b/cranelift/codegen/src/isa/stack.rs index cc7b578039..852aedddd8 100644 --- a/cranelift/codegen/src/isa/stack.rs +++ b/cranelift/codegen/src/isa/stack.rs @@ -82,7 +82,7 @@ pub enum StackBase { /// This behaves like a set of `StackBase` variants. /// /// 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)] pub struct StackBaseMask(pub u8); diff --git a/cranelift/codegen/src/isa/x86/settings.rs b/cranelift/codegen/src/isa/x86/settings.rs index ab5e080662..2d3a3f6698 100644 --- a/cranelift/codegen/src/isa/x86/settings.rs +++ b/cranelift/codegen/src/isa/x86/settings.rs @@ -3,9 +3,9 @@ use crate::settings::{self, detail, Builder}; use core::fmt; -// Include code generated by `cranelift-codegen/meta-python/gen_settings.py`. This file contains a public -// `Flags` struct with an impl for all of the settings defined in -// `cranelift-codegen/meta-python/isa/x86/settings.py`. +// Include code generated by `cranelift-codegen/meta/src/gen_settings.rs:`. This file contains a +// public `Flags` struct with an impl for all of the settings defined in +// `cranelift-codegen/meta/src/isa/x86/settings.rs`. include!(concat!(env!("OUT_DIR"), "/settings-x86.rs")); #[cfg(test)] diff --git a/cranelift/codegen/src/legalizer/mod.rs b/cranelift/codegen/src/legalizer/mod.rs index 0a59f0d1b5..b7aa287835 100644 --- a/cranelift/codegen/src/legalizer/mod.rs +++ b/cranelift/codegen/src/legalizer/mod.rs @@ -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 -// `cranelift-codegen/meta-python/base/legalize.py`. +// Include legalization patterns that were generated by `gen_legalizer.rs` from the +// `TransformGroup` in `cranelift-codegen/meta/shared/legalize.rs`. // // Concretely, this defines private functions `narrow()`, and `expand()`. include!(concat!(env!("OUT_DIR"), "/legalizer.rs")); /// 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( inst: ir::Inst, func: &mut ir::Function, diff --git a/cranelift/codegen/src/predicates.rs b/cranelift/codegen/src/predicates.rs index da01ad6b2b..978e733c66 100644 --- a/cranelift/codegen/src/predicates.rs +++ b/cranelift/codegen/src/predicates.rs @@ -1,7 +1,7 @@ //! Predicate functions for testing instruction fields. //! //! 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` as a shared trait bound. This //! bound is implemented by all the native integer types as well as `Imm64`. diff --git a/cranelift/codegen/src/regalloc/register_set.rs b/cranelift/codegen/src/regalloc/register_set.rs index 29b6df7625..c9b419a517 100644 --- a/cranelift/codegen/src/regalloc/register_set.rs +++ b/cranelift/codegen/src/regalloc/register_set.rs @@ -89,9 +89,9 @@ impl RegisterSet { // Mask out the unavailable units. 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 register straddles a word boundary, it will be marked as unavailable. - // There's an assertion in `cdsl/registers.py` to check for that. + // If a single unit in a register is unavailable, the whole register can't be used. If + // a register straddles a word boundary, it will be marked as unavailable. There's an + // assertion in `cranelift-codegen/meta/src/cdsl/regs.rs` to check for that. for i in 0..rc.width { rsi.regs[idx] &= self.avail[idx] >> i; } diff --git a/cranelift/codegen/src/settings.rs b/cranelift/codegen/src/settings.rs index 748484b10c..836b47a5f6 100644 --- a/cranelift/codegen/src/settings.rs +++ b/cranelift/codegen/src/settings.rs @@ -331,9 +331,9 @@ pub mod detail { } } -// Include code generated by `meta-python/gen_settings.py`. This file contains a public `Flags` -// struct with an impl for all of the settings defined in -// `cranelift-codegen/meta-python/base/settings.py`. +// Include code generated by `meta/gen_settings.rs`. This file contains a public `Flags` struct +// with an implementation for all of the settings defined in +// `cranelift-codegen/meta/src/shared/settings.rs`. include!(concat!(env!("OUT_DIR"), "/settings.rs")); /// Wrapper containing flags and optionally a `TargetIsa` trait object.