Rename Cretonne to Cranelift!
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//! This module contains the bulk of the interesting code performing the translation between
|
||||
//! WebAssembly and Cretonne IR.
|
||||
//! WebAssembly and Cranelift 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
|
||||
@@ -22,11 +22,11 @@
|
||||
//!
|
||||
//! That is why `translate_function_body` takes an object having the `WasmRuntime` trait as
|
||||
//! argument.
|
||||
use cretonne_codegen::ir::condcodes::{FloatCC, IntCC};
|
||||
use cretonne_codegen::ir::types::*;
|
||||
use cretonne_codegen::ir::{self, InstBuilder, JumpTableData, MemFlags};
|
||||
use cretonne_codegen::packed_option::ReservedValue;
|
||||
use cretonne_frontend::{FunctionBuilder, Variable};
|
||||
use cranelift_codegen::ir::condcodes::{FloatCC, IntCC};
|
||||
use cranelift_codegen::ir::types::*;
|
||||
use cranelift_codegen::ir::{self, InstBuilder, JumpTableData, MemFlags};
|
||||
use cranelift_codegen::packed_option::ReservedValue;
|
||||
use cranelift_frontend::{FunctionBuilder, Variable};
|
||||
use environ::{FuncEnvironment, GlobalVariable, WasmError, WasmResult};
|
||||
use state::{ControlStackFrame, TranslationState};
|
||||
use std::collections::{hash_map, HashMap};
|
||||
@@ -38,7 +38,7 @@ use wasmparser::{MemoryImmediate, Operator};
|
||||
|
||||
// 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 IR instructions. Returns `true` if it inserted
|
||||
/// Translates wasm operators into Cranelift IR instructions. Returns `true` if it inserted
|
||||
/// a return.
|
||||
pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
||||
op: Operator,
|
||||
@@ -55,7 +55,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
||||
match op {
|
||||
/********************************** Locals ****************************************
|
||||
* `get_local` and `set_local` are treated as non-SSA variables and will completely
|
||||
* disappear in the Cretonne Code
|
||||
* disappear in the Cranelift Code
|
||||
***********************************************************************************/
|
||||
Operator::GetLocal { local_index } => {
|
||||
state.push1(builder.use_var(Variable::with_u32(local_index)))
|
||||
@@ -218,7 +218,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
||||
* Once the destination `Ebb` is found, we sometimes have to declare a certain depth
|
||||
* of the stack unreachable, because some branch instructions are terminator.
|
||||
*
|
||||
* The `br_table` case is much more complicated because Cretonne's `br_table` instruction
|
||||
* The `br_table` case is much more complicated because Cranelift's `br_table` instruction
|
||||
* does not support jump arguments like all the other branch instructions. That is why, in
|
||||
* the case where we would use jump arguments for every other branch instructions, we
|
||||
* need to split the critical edges leaving the `br_tables` by creating one `Ebb` per
|
||||
@@ -226,7 +226,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
||||
* `Ebb`s contain only a jump instruction pointing to the final destination, this time with
|
||||
* jump arguments.
|
||||
*
|
||||
* This system is also implemented in Cretonne's SSA construction algorithm, because
|
||||
* This system is also implemented in Cranelift's SSA construction algorithm, because
|
||||
* `use_var` located in a destination `Ebb` of a `br_table` might trigger the addition
|
||||
* of jump arguments in each predecessor branch instruction, one of which might be a
|
||||
* `br_table`.
|
||||
@@ -291,7 +291,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
||||
};
|
||||
builder.ins().jump(ebb, &[]);
|
||||
} else {
|
||||
// Here we have jump arguments, but Cretonne's br_table doesn't support them
|
||||
// Here we have jump arguments, but Cranelift's br_table doesn't support them
|
||||
// We then proceed to split the edges going out of the br_table
|
||||
let return_count = jump_args_count;
|
||||
let mut dest_ebb_sequence = Vec::new();
|
||||
@@ -413,7 +413,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
||||
state.push1(environ.translate_memory_size(builder.cursor(), heap_index, heap)?);
|
||||
}
|
||||
/******************************* Load instructions ***********************************
|
||||
* Wasm specifies an integer alignment flag but we drop it in Cretonne.
|
||||
* Wasm specifies an integer alignment flag but we drop it in Cranelift.
|
||||
* The memory base address is provided by the environment.
|
||||
* TODO: differentiate between 32 bit and 64 bit architecture, to put the uextend or not
|
||||
************************************************************************************/
|
||||
@@ -488,7 +488,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
||||
translate_load(offset, ir::Opcode::Load, F64, builder, state, environ);
|
||||
}
|
||||
/****************************** Store instructions ***********************************
|
||||
* Wasm specifies an integer alignment flag but we drop it in Cretonne.
|
||||
* Wasm specifies an integer alignment flag but we drop it in Cranelift.
|
||||
* The memory base address is provided by the environment.
|
||||
* TODO: differentiate between 32 bit and 64 bit architecture, to put the uextend or not
|
||||
************************************************************************************/
|
||||
@@ -1027,7 +1027,7 @@ fn translate_load<FE: FuncEnvironment + ?Sized>(
|
||||
let (base, offset) = get_heap_addr(heap, addr32, offset, environ.native_pointer(), builder);
|
||||
// Note that we don't set `is_aligned` here, even if the load instruction's
|
||||
// alignment immediate says it's aligned, because WebAssembly's immediate
|
||||
// field is just a hint, while Cretonne's aligned flag needs a guarantee.
|
||||
// field is just a hint, while Cranelift's aligned flag needs a guarantee.
|
||||
let flags = MemFlags::new();
|
||||
let (load, dfg) = builder
|
||||
.ins()
|
||||
|
||||
Reference in New Issue
Block a user