Say "IR" instead of "IL".

While the specifics of these terms are debatable, "IR" generally
isn't incorrect in this context, and is the more widely recognized
term at this time.

See also the discussion in #267.

Fixes #267.
This commit is contained in:
Dan Gohman
2018-03-28 14:15:01 -07:00
parent a297465c25
commit 57cd69d8b4
45 changed files with 106 additions and 119 deletions

View File

@@ -1,2 +1,2 @@
This crate contains the core Cretonne code generator. It translates code from an
intermediate language into executable machine code.
intermediate representation into executable machine code.

View File

@@ -2,7 +2,7 @@
The cretonne.formats defines all instruction formats.
Every instruction format has a corresponding `InstructionData` variant in the
Rust representation of cretonne IL, so all instruction formats must be defined
Rust representation of Cretonne IR, so all instruction formats must be defined
in this module.
"""
from __future__ import absolute_import

View File

@@ -20,10 +20,10 @@ opt_level = EnumSetting(
enable_verifier = BoolSetting(
"""
Run the Cretonne IL verifier at strategic times during compilation.
Run the Cretonne IR verifier at strategic times during compilation.
This makes compilation slower but catches many bugs. The verifier is
disabled by default, except when reading Cretonne IL from a text file.
disabled by default, except when reading Cretonne IR from a text file.
""",
default=True)

View File

@@ -559,7 +559,7 @@ class Enumerator(Literal):
is an AST leaf node representing one of the values.
:param kind: The enumerated `ImmediateKind` containing the value.
:param value: The textual IL representation of the value.
:param value: The textual IR representation of the value.
`Enumerator` nodes are not usually created directly. They are created by
using the dot syntax on immediate kinds: `intcc.ult`.

View File

@@ -20,7 +20,7 @@ use std::ptr::write_unaligned;
/// A `CodeSink` that writes binary machine code directly into memory.
///
/// A `MemoryCodeSink` object should be used when emitting a Cretonne IL function into executable
/// A `MemoryCodeSink` object should be used when emitting a Cretonne IR function into executable
/// memory. It writes machine code directly to a raw pointer without any bounds checking, so make
/// sure to allocate enough memory for the whole function. The number of bytes required is returned
/// by the `Context::compile()` function.

View File

@@ -1,6 +1,6 @@
//! IL entity references.
//! Cretonne IR entity references.
//!
//! Instructions in Cretonne IL need to reference other entities in the function. This can be other
//! Instructions in Cretonne IR need to reference other entities in the function. This can be other
//! parts of the function like extended basic blocks or stack slots, or it can be external entities
//! that are declared in the function preamble in the text format.
//!
@@ -16,7 +16,7 @@
//! data structures use the `PackedOption<EntityRef>` representation, while function arguments and
//! return values prefer the more Rust-like `Option<EntityRef>` variant.
//!
//! The entity references all implement the `Display` trait in a way that matches the textual IL
//! The entity references all implement the `Display` trait in a way that matches the textual IR
//! format.
use std::fmt;

View File

@@ -55,7 +55,7 @@ pub struct Function {
///
/// This information is only transiently available after the `binemit::relax_branches` function
/// computes it, and it can easily be recomputed by calling that function. It is not included
/// in the textual IL format.
/// in the textual IR format.
pub offsets: EbbOffsets,
/// Source locations.

View File

@@ -1,7 +1,7 @@
//! Instruction formats and opcodes.
//!
//! The `instructions` module contains definitions for instruction formats, opcodes, and the
//! in-memory representation of IL instructions.
//! in-memory representation of IR instructions.
//!
//! A large part of this module is auto-generated from the instruction descriptions in the meta
//! directory.

View File

@@ -71,8 +71,7 @@ impl Layout {
// within an EBB. The instruction sequence numbers are all between the sequence number of their
// containing EBB and the following EBB.
//
// The result is that sequence numbers work like BASIC line numbers for the textual representation
// of the IL.
// The result is that sequence numbers work like BASIC line numbers for the textual form of the IR.
type SequenceNumber = u32;
// Initial stride assigned to new sequence numbers.

View File

@@ -6,7 +6,7 @@ use std::str::FromStr;
/// The name of a runtime library routine.
///
/// Runtime library calls are generated for Cretonne IL instructions that don't have an equivalent
/// Runtime library calls are generated for Cretonne IR instructions that don't have an equivalent
/// ISA instruction or an easy macro expansion. A `LibCall` is used as a well-known name to refer to
/// the runtime library routine. This way, Cretonne doesn't have to know about the naming
/// convention in the embedding VM's runtime library.

View File

@@ -1,4 +1,4 @@
//! Representation of Cretonne IL functions.
//! Representation of Cretonne IR functions.
pub mod types;
pub mod entities;

View File

@@ -12,7 +12,7 @@ use std::cmp;
/// 1. An instruction or
/// 2. An EBB header.
///
/// This corresponds more or less to the lines in the textual representation of Cretonne IL.
/// This corresponds more or less to the lines in the textual form of Cretonne IR.
#[derive(PartialEq, Eq, Clone, Copy)]
pub struct ProgramPoint(u32);

View File

@@ -7,7 +7,7 @@ use std::fmt;
/// A source location.
///
/// This is an opaque 32-bit number attached to each Cretonne IL instruction. Cretonne does not
/// This is an opaque 32-bit number attached to each Cretonne IR instruction. Cretonne does not
/// interpret source locations in any way, they are simply preserved from the input to the output.
///
/// The default source location uses the all-ones bit pattern `!0`. It is used for instructions

View File

@@ -45,7 +45,7 @@ fn vmctx_addr(inst: ir::Inst, func: &mut ir::Function, offset: i64) {
/// Expand a `global_addr` instruction for a deref global.
fn deref_addr(inst: ir::Inst, func: &mut ir::Function, base: ir::GlobalVar, offset: i64) {
// We need to load a pointer from the `base` global variable, so insert a new `global_addr`
// instruction. This depends on the iterative legalization loop. Note that the IL verifier
// instruction. This depends on the iterative legalization loop. Note that the IR verifier
// detects any cycles in the `deref` globals.
let ptr_ty = func.dfg.value_type(func.dfg.first_result(inst));
let mut pos = FuncCursor::new(func).at_inst(inst);

View File

@@ -15,7 +15,7 @@ use std::vec::Vec;
/// A diversion of a value from its original location to a new register or stack location.
///
/// In IL, a diversion is represented by a `regmove` instruction, possibly a chain of them for the
/// In IR, a diversion is represented by a `regmove` instruction, possibly a chain of them for the
/// same value.
///
/// When tracking diversions, the `from` field is the original assigned value location, and `to` is

View File

@@ -15,9 +15,9 @@ pub enum CtonError {
/// code. This should never happen for validated WebAssembly code.
InvalidInput,
/// An IL verifier error.
/// An IR verifier error.
///
/// This always represents a bug, either in the code that generated IL for Cretonne, or a bug
/// This always represents a bug, either in the code that generated IR for Cretonne, or a bug
/// in Cretonne itself.
Verifier(verifier::Error),

View File

@@ -41,11 +41,11 @@ define_passes!{
Pass, NUM_PASSES, DESCRIPTIONS;
process_file: "Processing test file",
parse_text: "Parsing textual Cretonne IL",
parse_text: "Parsing textual Cretonne IR",
wasm_translate_module: "Translate WASM module",
wasm_translate_function: "Translate WASM function",
verifier: "Verify Cretonne IL",
verifier: "Verify Cretonne IR",
verify_cssa: "Verify CSSA",
verify_liveness: "Verify live ranges",
verify_locations: "Verify value locations",

View File

@@ -1,8 +1,7 @@
//! Converting Cretonne IL to text.
//! Converting Cretonne IR to text.
//!
//! The `write` module provides the `write_function` function which converts an IL `Function` to an
//! equivalent textual representation. This textual representation can be read back by the
//! `cretonne-reader` crate.
//! The `write` module provides the `write_function` function which converts an IR `Function` to an
//! equivalent textual form. This textual form can be read back by the `cretonne-reader` crate.
use ir::{Function, DataFlowGraph, Ebb, Inst, Value, ValueDef, Type, SigRef};
use isa::{TargetIsa, RegInfo};

View File

@@ -1,4 +1,4 @@
//! Test command for checking the IL legalizer.
//! Test command for checking the IR legalizer.
//!
//! The `test legalizer` test command runs each function through `legalize_function()` and sends
//! the result to filecheck.

View File

@@ -1,6 +1,6 @@
//! The `print-cfg` sub-command.
//!
//! Read a series of Cretonne IL files and print their control flow graphs
//! Read a series of Cretonne IR files and print their control flow graphs
//! in graphviz format.
use std::borrow::Cow;

View File

@@ -1,4 +1,4 @@
//! Test command for checking the IL verifier.
//! Test command for checking the IR verifier.
//!
//! The `test verifier` test command looks for annotations on instructions like this:
//!

View File

@@ -2,7 +2,7 @@
authors = ["The Cretonne Project Developers"]
name = "cretonne-frontend"
version = "0.4.1"
description = "Cretonne IL builder helper"
description = "Cretonne IR builder helper"
license = "Apache-2.0"
documentation = "https://cretonne.readthedocs.io/"
repository = "https://github.com/Cretonne/cretonne"

View File

@@ -1,5 +1,5 @@
This crate provides a straightforward way to create a
[Cretonne](https://crates.io/crates/cretonne) IL function and fill it with
[Cretonne](https://crates.io/crates/cretonne) IR function and fill it with
instructions translated from another language. It contains an SSA construction
module that provides convenient methods for translating non-SSA variables into
SSA Cretonne IL values via `use_var` and `def_var` calls.
SSA Cretonne IR values via `use_var` and `def_var` calls.

View File

@@ -1,4 +1,4 @@
//! A frontend for building Cretonne IL from other languages.
//! A frontend for building Cretonne IR from other languages.
use cretonne::cursor::{Cursor, FuncCursor};
use cretonne::ir;
use cretonne::ir::{Ebb, Type, Value, Function, Inst, JumpTable, StackSlot, JumpTableData,
@@ -10,7 +10,7 @@ use ssa::{SSABuilder, SideEffects, Block};
use cretonne::entity::{EntityRef, EntityMap, EntitySet};
use cretonne::packed_option::PackedOption;
/// Structure used for translating a series of functions into Cretonne IL.
/// Structure used for translating a series of functions into Cretonne IR.
///
/// In order to reduce memory reallocations when compiling multiple functions,
/// `FunctionBuilderContext` holds various data structures which are cleared between
@@ -29,7 +29,7 @@ where
}
/// Temporary object used to build a single Cretonne IL `Function`.
/// Temporary object used to build a single Cretonne IR `Function`.
pub struct FunctionBuilder<'a, Variable: 'a>
where
Variable: EntityRef,
@@ -103,7 +103,7 @@ where
}
/// Implementation of the [`InstBuilder`](../cretonne/ir/builder/trait.InstBuilder.html) that has
/// one convenience method per Cretonne IL instruction.
/// one convenience method per Cretonne IR instruction.
pub struct FuncInstBuilder<'short, 'long: 'short, Variable: 'long>
where
Variable: EntityRef,
@@ -191,7 +191,7 @@ impl<'short, 'long, Variable> InstBuilderBase<'short> for FuncInstBuilder<'short
}
}
/// This module allows you to create a function in Cretonne IL in a straightforward way, hiding
/// This module allows you to create a function in Cretonne IR in a straightforward way, hiding
/// all the complexity of its internal representation.
///
/// The module is parametrized by one type which is the representation of variables in your
@@ -203,10 +203,10 @@ impl<'short, 'long, Variable> InstBuilderBase<'short> for FuncInstBuilder<'short
/// - the last instruction of each block is a terminator instruction which has no natural successor,
/// and those instructions can only appear at the end of extended blocks.
///
/// The parameters of Cretonne IL instructions are Cretonne IL values, which can only be created
/// as results of other Cretonne IL instructions. To be able to create variables redefined multiple
/// The parameters of Cretonne IR instructions are Cretonne IR values, which can only be created
/// as results of other Cretonne IR instructions. To be able to create variables redefined multiple
/// times in your program, use the `def_var` and `use_var` command, that will maintain the
/// correspondence between your variables and Cretonne IL SSA values.
/// correspondence between your variables and Cretonne IR SSA values.
///
/// The first block for which you call `switch_to_block` will be assumed to be the beginning of
/// the function.
@@ -220,7 +220,7 @@ impl<'short, 'long, Variable> InstBuilderBase<'short> for FuncInstBuilder<'short
///
/// # Errors
///
/// The functions below will panic in debug mode whenever you try to modify the Cretonne IL
/// The functions below will panic in debug mode whenever you try to modify the Cretonne IR
/// function in a way that violate the coherence of the code. For instance: switching to a new
/// `Ebb` when you haven't filled the current one with a terminator instruction, inserting a
/// return instruction with arguments that don't match the function's signature.
@@ -311,7 +311,7 @@ where
self.func_ctx.types[var] = ty;
}
/// Returns the Cretonne IL value corresponding to the utilization at the current program
/// Returns the Cretonne IR value corresponding to the utilization at the current program
/// position of a previously defined user variable.
pub fn use_var(&mut self, var: Variable) -> Value {
let ty = *self.func_ctx.types.get(var).expect(
@@ -462,8 +462,8 @@ where
}
/// All the functions documented in the previous block are write-only and help you build a valid
/// Cretonne IL functions via multiple debug asserts. However, you might need to improve the
/// performance of your translation perform more complex transformations to your Cretonne IL
/// Cretonne IR functions via multiple debug asserts. However, you might need to improve the
/// performance of your translation perform more complex transformations to your Cretonne IR
/// function. The functions below help you inspect the function you're creating and modify it
/// in ways that can be unsafe if used incorrectly.
impl<'a, Variable> FunctionBuilder<'a, Variable>

View File

@@ -1,15 +1,15 @@
//! Cretonne IL builder library.
//! Cretonne IR builder library.
//!
//! Provides a straightforward way to create a Cretonne IL function and fill it with instructions
//! Provides a straightforward way to create a Cretonne IR function and fill it with instructions
//! translated from another language. Contains an SSA construction module that lets you translate
//! your non-SSA variables into SSA Cretonne IL values via `use_var` and `def_var` calls.
//! your non-SSA variables into SSA Cretonne IR values via `use_var` and `def_var` calls.
//!
//! To get started, create an [`FunctionBuilderContext`](struct.FunctionBuilderContext.html) and
//! pass it as an argument to a [`FunctionBuilder`](struct.FunctionBuilder.html).
//!
//! # Example
//!
//! Here is a pseudo-program we want to transform into Cretonne IL:
//! Here is a pseudo-program we want to transform into Cretonne IR:
//!
//! ```cton
//! function(x) {
@@ -29,7 +29,7 @@
//! }
//! ```
//!
//! Here is how you build the corresponding Cretonne IL function using `FunctionBuilderContext`:
//! Here is how you build the corresponding Cretonne IR function using `FunctionBuilderContext`:
//!
//! ```rust
//! extern crate cretonne;

View File

@@ -231,7 +231,7 @@ fn emit_zero(ty: Type, mut cur: FuncCursor) -> Value {
}
}
/// The following methods are the API of the SSA builder. Here is how it should be used when
/// translating to Cretonne IL:
/// translating to Cretonne IR:
///
/// - for each sequence of contiguous instructions (with no branches), create a corresponding
/// basic block with `declare_ebb_body_block` or `declare_ebb_header_block` depending on the

View File

@@ -2,7 +2,7 @@
authors = ["The Cretonne Project Developers"]
name = "cretonne-reader"
version = "0.4.1"
description = "Cretonne textual IL reader"
description = "Cretonne textual IR reader"
license = "Apache-2.0"
documentation = "https://cretonne.readthedocs.io/"
repository = "https://github.com/Cretonne/cretonne"

View File

@@ -1782,7 +1782,7 @@ impl<'a> Parser<'a> {
// explicit type specified. Look up `ctrl_value` to see if it was defined
// already.
// TBD: If it is defined in another block, the type should have been
// specified explicitly. It is unfortunate that the correctness of IL
// specified explicitly. It is unfortunate that the correctness of IR
// depends on the layout of the blocks.
let ctrl_src_value = inst_data
.typevar_operand(&ctx.function.dfg.value_lists)

View File

@@ -2,7 +2,7 @@
name = "cretonne-wasm"
version = "0.4.1"
authors = ["The Cretonne Project Developers"]
description = "Translator from WebAssembly to Cretonne IL"
description = "Translator from WebAssembly to Cretonne IR"
repository = "https://github.com/Cretonne/cretonne"
license = "Apache-2.0"
readme = "README.md"

View File

@@ -1,3 +1,2 @@
This crate performs the translation from a wasm module in binary format to the
in-memory representation of the [Cretonne](https://crates.io/crates/cretonne)
IL.
in-memory form of the [Cretonne](https://crates.io/crates/cretonne) IR.

View File

@@ -1,5 +1,5 @@
//! This module contains the bulk of the interesting code performing the translation between
//! WebAssembly and Cretonne IL.
//! WebAssembly and Cretonne IR.
//!
//! The translation is done in one pass, opcode by opcode. Two main data structures are used during
//! code translations: the value stack and the control stack. The value stack mimics the execution
@@ -38,7 +38,7 @@ use std::vec::Vec;
// Clippy warns about "flags: _" but its important to document that the flags field is ignored
#[cfg_attr(feature = "cargo-clippy", allow(unneeded_field_pattern))]
/// Translates wasm operators into Cretonne IL instructions. Returns `true` if it inserted
/// Translates wasm operators into Cretonne IR instructions. Returns `true` if it inserted
/// a return.
pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
op: Operator,

View File

@@ -26,7 +26,7 @@ pub enum GlobalValue {
/// Environment affecting the translation of a single WebAssembly function.
///
/// A `FuncEnvironment` trait object is required to translate a WebAssembly function to Cretonne
/// IL. The function environment provides information about the WebAssembly module as well as the
/// IR. The function environment provides information about the WebAssembly module as well as the
/// runtime environment.
pub trait FuncEnvironment {
/// Get the flags for the current compilation.

View File

@@ -1,7 +1,7 @@
//! Stand-alone WebAssembly to Cretonne IL translator.
//! Stand-alone WebAssembly to Cretonne IR translator.
//!
//! This module defines the `FuncTranslator` type which can translate a single WebAssembly
//! function to Cretonne IL guided by a `FuncEnvironment` which provides information about the
//! function to Cretonne IR guided by a `FuncEnvironment` which provides information about the
//! WebAssembly module and the runtime environment.
use code_translator::translate_operator;
@@ -14,9 +14,9 @@ use environ::FuncEnvironment;
use state::TranslationState;
use wasmparser::{self, BinaryReader};
/// WebAssembly to Cretonne IL function translator.
/// WebAssembly to Cretonne IR function translator.
///
/// A `FuncTranslator` is used to translate a binary WebAssembly function into Cretonne IL guided
/// A `FuncTranslator` is used to translate a binary WebAssembly function into Cretonne IR guided
/// by a `FuncEnvironment` object. A single translator instance can be reused to translate multiple
/// functions which will reduce heap allocation traffic.
pub struct FuncTranslator {

View File

@@ -1,5 +1,5 @@
//! Performs the translation from a wasm module in binary format to the in-memory representation
//! of the Cretonne IL. More particularly, it translates the code of all the functions bodies and
//! Performs translation from a wasm module in binary format to the in-memory form
//! of Cretonne IR. More particularly, it translates the code of all the functions bodies and
//! interacts with an environment implementing the
//! [`ModuleEnvironment`](trait.ModuleEnvironment.html)
//! trait to deal with tables, globals and linear memory.

View File

@@ -10,7 +10,7 @@ use environ::ModuleEnvironment;
use std::string::String;
/// Translate a sequence of bytes forming a valid Wasm binary into a list of valid Cretonne IL
/// Translate a sequence of bytes forming a valid Wasm binary into a list of valid Cretonne IR
/// [`Function`](../cretonne/ir/function/struct.Function.html).
/// Returns the functions and also the mappings for imported functions and signature between the
/// indexes in the wasm module and the indexes inside each functions.