Add documentation for top-level items in cranelift-codegen/meta

This commit is contained in:
Andrew Brown
2019-10-30 17:54:04 -07:00
parent e45c283194
commit f19456640c
10 changed files with 12 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ macro_rules! predicate {
}; };
} }
/// A macro that joins boolean settings into a list (e.g. `preset!(feature_a && feature_b)`).
#[macro_export] #[macro_export]
macro_rules! preset { macro_rules! preset {
() => { () => {

View File

@@ -1,3 +1,4 @@
//! Trait for extending `HashMap` with `get_or_default`.
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::Hash; use std::hash::Hash;

View File

@@ -1,3 +1,4 @@
//! Error returned during meta code-generation.
use std::fmt; use std::fmt;
use std::io; use std::io;

View File

@@ -1,3 +1,4 @@
//! Generate instruction data (including opcodes, formats, builders, etc.).
use std::fmt; use std::fmt;
use cranelift_codegen_shared::constant_hash; use cranelift_codegen_shared::constant_hash;

View File

@@ -1,3 +1,4 @@
//! Generate transformations to legalize instructions without encodings.
use crate::cdsl::ast::{Def, DefPool, Expr, VarPool}; use crate::cdsl::ast::{Def, DefPool, Expr, VarPool};
use crate::cdsl::isa::TargetIsa; use crate::cdsl::isa::TargetIsa;
use crate::cdsl::operands::Operand; use crate::cdsl::operands::Operand;

View File

@@ -1,3 +1,4 @@
//! Generate the ISA-specific registers.
use crate::cdsl::isa::TargetIsa; use crate::cdsl::isa::TargetIsa;
use crate::cdsl::regs::{RegBank, RegClass}; use crate::cdsl::regs::{RegBank, RegClass};
use crate::error; use crate::error;

View File

@@ -1,3 +1,4 @@
//! Generate the ISA-specific settings.
use std::collections::HashMap; use std::collections::HashMap;
use cranelift_codegen_shared::constant_hash::{generate_table, simple_hash}; use cranelift_codegen_shared::constant_hash::{generate_table, simple_hash};

View File

@@ -1,3 +1,4 @@
//! Define supported ISAs; includes ISA-specific instructions, encodings, registers, settings, etc.
use crate::cdsl::isa::TargetIsa; use crate::cdsl::isa::TargetIsa;
use crate::shared::Definitions as SharedDefinitions; use crate::shared::Definitions as SharedDefinitions;
use std::fmt; use std::fmt;

View File

@@ -1,3 +1,5 @@
//! This crate generates Rust sources for use by
//! [`cranelift_codegen`](../cranelift_codegen/index.html).
#[macro_use] #[macro_use]
mod cdsl; mod cdsl;
mod srcgen; mod srcgen;
@@ -17,6 +19,7 @@ mod default_map;
mod shared; mod shared;
mod unique_table; mod unique_table;
/// Generate an ISA from an architecture string (e.g. "x86_64").
pub fn isa_from_arch(arch: &str) -> Result<isa::Isa, String> { pub fn isa_from_arch(arch: &str) -> Result<isa::Isa, String> {
isa::Isa::from_arch(arch).ok_or_else(|| format!("no supported isa found for arch `{}`", arch)) isa::Isa::from_arch(arch).ok_or_else(|| format!("no supported isa found for arch `{}`", arch))
} }

View File

@@ -1,3 +1,4 @@
//! An index-accessed table implementation that avoids duplicate entries.
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::Hash; use std::hash::Hash;
use std::slice; use std::slice;