diff --git a/cranelift/module/README.md b/cranelift/module/README.md index a357aa637d..1727975f96 100644 --- a/cranelift/module/README.md +++ b/cranelift/module/README.md @@ -6,14 +6,13 @@ This crate is structured as an optional layer on top of cranelift-codegen. It provides additional functionality, such as linking, however users that require greater flexibility don't need to use it. -A `Module` is a collection of functions and data objects that are linked -together. `Backend` is a trait that defines an interface for backends -that compile modules into various forms. Most users will use one of the -following `Backend` implementations: +A module is a collection of functions and data objects that are linked +together. The `Module` trait that defines a common interface for various kinds +of modules. Most users will use one of the following `Module` implementations: - - `SimpleJITBackend`, provided by [cranelift-simplejit], which JITs + - `SimpleJITModule`, provided by [cranelift-simplejit], which JITs code to memory for direct execution. - - `ObjectBackend`, provided by [cranelift-object], which emits native + - `ObjectModule`, provided by [cranelift-object], which emits native object files. [cranelift-simplejit]: https://crates.io/crates/cranelift-simplejit diff --git a/cranelift/module/src/data_context.rs b/cranelift/module/src/data_context.rs index b7b3e6c18f..ca490a09e9 100644 --- a/cranelift/module/src/data_context.rs +++ b/cranelift/module/src/data_context.rs @@ -50,7 +50,8 @@ pub struct DataDescription { pub data_relocs: Vec<(CodeOffset, ir::GlobalValue, Addend)>, /// Object file section pub custom_segment_section: Option<(String, String)>, - /// Alignment + /// Alignment in bytes. `None` means that the default alignment of the respective module should + /// be used. pub align: Option, } diff --git a/cranelift/module/src/module.rs b/cranelift/module/src/module.rs index 84fc19c96f..26704ae5e5 100644 --- a/cranelift/module/src/module.rs +++ b/cranelift/module/src/module.rs @@ -142,7 +142,7 @@ impl FunctionDeclaration { } } -/// Error messages for all `Module` and `Backend` methods +/// Error messages for all `Module` methods #[derive(Error, Debug)] pub enum ModuleError { /// Indicates an identifier was used before it was declared diff --git a/cranelift/object/src/backend.rs b/cranelift/object/src/backend.rs index a0c964cd09..56008a1cf9 100644 --- a/cranelift/object/src/backend.rs +++ b/cranelift/object/src/backend.rs @@ -1,4 +1,4 @@ -//! Defines `ObjectBackend`. +//! Defines `ObjectModule`. use anyhow::anyhow; use cranelift_codegen::binemit::{ @@ -23,7 +23,7 @@ use std::convert::TryInto; use std::mem; use target_lexicon::PointerWidth; -/// A builder for `ObjectBackend`. +/// A builder for `ObjectModule`. pub struct ObjectBuilder { isa: Box, binary_format: object::BinaryFormat, @@ -37,7 +37,7 @@ pub struct ObjectBuilder { impl ObjectBuilder { /// Create a new `ObjectBuilder` using the given Cranelift target, that - /// can be passed to [`Module::new`](cranelift_module::Module::new). + /// can be passed to [`ObjectModule::new`]. /// /// The `libcall_names` function provides a way to translate `cranelift_codegen`'s `ir::LibCall` /// enum to symbols. LibCalls are inserted in the IR as part of the legalization for certain diff --git a/cranelift/object/src/lib.rs b/cranelift/object/src/lib.rs index 12ca1d7aca..1b9b677e89 100644 --- a/cranelift/object/src/lib.rs +++ b/cranelift/object/src/lib.rs @@ -27,7 +27,7 @@ mod backend; -pub use crate::backend::{ObjectModule, ObjectBuilder, ObjectProduct}; +pub use crate::backend::{ObjectBuilder, ObjectModule, ObjectProduct}; /// Version number of this crate. pub const VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/cranelift/simplejit/src/backend.rs b/cranelift/simplejit/src/backend.rs index 5d42be75fe..369561f06b 100644 --- a/cranelift/simplejit/src/backend.rs +++ b/cranelift/simplejit/src/backend.rs @@ -164,7 +164,7 @@ pub struct SimpleJITCompiledData { relocs: Vec, } -/// A handle to allow freeing memory allocated by the `Backend`. +/// A handle to allow freeing memory allocated by the `Module`. struct SimpleJITMemoryHandle { code: Memory, readonly: Memory, @@ -360,7 +360,7 @@ impl SimpleJITModule { } } - /// Create a new `SimpleJITBackend`. + /// Create a new `SimpleJITModule`. pub fn new(builder: SimpleJITBuilder) -> Self { let memory = SimpleJITMemoryHandle { code: Memory::new(), diff --git a/cranelift/simplejit/src/lib.rs b/cranelift/simplejit/src/lib.rs index 831dc751b2..682dcaecb6 100644 --- a/cranelift/simplejit/src/lib.rs +++ b/cranelift/simplejit/src/lib.rs @@ -26,7 +26,7 @@ mod backend; mod memory; -pub use crate::backend::{SimpleJITModule, SimpleJITBuilder, SimpleJITProduct}; +pub use crate::backend::{SimpleJITBuilder, SimpleJITModule, SimpleJITProduct}; /// Version number of this crate. pub const VERSION: &str = env!("CARGO_PKG_VERSION");