Rename the 'cretonne' crate to 'cretonne-codegen'.
This fixes the next part of #287.
This commit is contained in:
@@ -22,10 +22,10 @@
|
||||
//!
|
||||
//! That is why `translate_function_body` takes an object having the `WasmRuntime` trait as
|
||||
//! argument.
|
||||
use cretonne::ir::condcodes::{FloatCC, IntCC};
|
||||
use cretonne::ir::types::*;
|
||||
use cretonne::ir::{self, InstBuilder, JumpTableData, MemFlags};
|
||||
use cretonne::packed_option::ReservedValue;
|
||||
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 environ::{FuncEnvironment, GlobalValue};
|
||||
use state::{ControlStackFrame, TranslationState};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! "Dummy" environment for testing wasm translation.
|
||||
|
||||
use cretonne::cursor::FuncCursor;
|
||||
use cretonne::ir::types::*;
|
||||
use cretonne::ir::{self, InstBuilder};
|
||||
use cretonne::settings;
|
||||
use cretonne_codegen::cursor::FuncCursor;
|
||||
use cretonne_codegen::ir::types::*;
|
||||
use cretonne_codegen::ir::{self, InstBuilder};
|
||||
use cretonne_codegen::settings;
|
||||
use environ::{FuncEnvironment, GlobalValue, ModuleEnvironment};
|
||||
use func_translator::FuncTranslator;
|
||||
use std::error::Error;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! All the runtime support necessary for the wasm to cretonne translation is formalized by the
|
||||
//! traits `FunctionEnvironment` and `ModuleEnvironment`.
|
||||
use cretonne::cursor::FuncCursor;
|
||||
use cretonne::ir::{self, InstBuilder};
|
||||
use cretonne::settings::Flags;
|
||||
use cretonne_codegen::cursor::FuncCursor;
|
||||
use cretonne_codegen::ir::{self, InstBuilder};
|
||||
use cretonne_codegen::settings::Flags;
|
||||
use std::string::String;
|
||||
use std::vec::Vec;
|
||||
use translation_utils::{FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex,
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
//! WebAssembly module and the runtime environment.
|
||||
|
||||
use code_translator::translate_operator;
|
||||
use cretonne::entity::EntityRef;
|
||||
use cretonne::ir::{self, Ebb, InstBuilder};
|
||||
use cretonne::result::{CtonError, CtonResult};
|
||||
use cretonne::timing;
|
||||
use cretonne_codegen::entity::EntityRef;
|
||||
use cretonne_codegen::ir::{self, Ebb, InstBuilder};
|
||||
use cretonne_codegen::result::{CtonError, CtonResult};
|
||||
use cretonne_codegen::timing;
|
||||
use cretonne_frontend::{FunctionBuilder, FunctionBuilderContext, Variable};
|
||||
use environ::FuncEnvironment;
|
||||
use state::TranslationState;
|
||||
@@ -233,8 +233,8 @@ fn cur_srcloc(reader: &BinaryReader) -> ir::SourceLoc {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::FuncTranslator;
|
||||
use cretonne::ir::types::I32;
|
||||
use cretonne::{ir, Context};
|
||||
use cretonne_codegen::ir::types::I32;
|
||||
use cretonne_codegen::{ir, Context};
|
||||
use environ::{DummyEnvironment, FuncEnvironment};
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, redundant_field_names))]
|
||||
|
||||
#[macro_use(dbg)]
|
||||
extern crate cretonne;
|
||||
extern crate cretonne_codegen;
|
||||
extern crate cretonne_frontend;
|
||||
extern crate wasmparser;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Translation skeleton that traverses the whole WebAssembly module and call helper functions
|
||||
//! to deal with each part of it.
|
||||
use cretonne::timing;
|
||||
use cretonne_codegen::timing;
|
||||
use environ::ModuleEnvironment;
|
||||
use sections_translator::{parse_data_section, parse_elements_section, parse_export_section,
|
||||
parse_function_section, parse_function_signatures, parse_global_section,
|
||||
@@ -11,7 +11,7 @@ use wasmparser::{BinaryReaderError, Parser, ParserInput, ParserState, SectionCod
|
||||
use std::string::String;
|
||||
|
||||
/// Translate a sequence of bytes forming a valid Wasm binary into a list of valid Cretonne IR
|
||||
/// [`Function`](../cretonne/ir/function/struct.Function.html).
|
||||
/// [`Function`](../codegen/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.
|
||||
pub fn translate_module<'data>(
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
//! The special case of the initialize expressions for table elements offsets or global variables
|
||||
//! is handled, according to the semantics of WebAssembly, to only specific expressions that are
|
||||
//! interpreted on the fly.
|
||||
use cretonne;
|
||||
use cretonne::ir::{AbiParam, CallConv, Signature};
|
||||
use cretonne_codegen::ir::{self, AbiParam, CallConv, Signature};
|
||||
use environ::ModuleEnvironment;
|
||||
use std::str::from_utf8;
|
||||
use std::string::String;
|
||||
@@ -38,13 +37,13 @@ pub fn parse_function_signatures(
|
||||
}) => {
|
||||
let mut sig = Signature::new(CallConv::SystemV);
|
||||
sig.params.extend(params.iter().map(|ty| {
|
||||
let cret_arg: cretonne::ir::Type = type_to_type(ty).expect(
|
||||
let cret_arg: ir::Type = type_to_type(ty).expect(
|
||||
"only numeric types are supported in function signatures",
|
||||
);
|
||||
AbiParam::new(cret_arg)
|
||||
}));
|
||||
sig.returns.extend(returns.iter().map(|ty| {
|
||||
let cret_arg: cretonne::ir::Type = type_to_type(ty).expect(
|
||||
let cret_arg: ir::Type = type_to_type(ty).expect(
|
||||
"only numeric types are supported in function signatures",
|
||||
);
|
||||
AbiParam::new(cret_arg)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! The `TranslationState` struct defined in this module is used to keep track of the WebAssembly
|
||||
//! value and control stacks during the translation of a single function.
|
||||
|
||||
use cretonne::ir::{self, Ebb, Inst, Value};
|
||||
use cretonne_codegen::ir::{self, Ebb, Inst, Value};
|
||||
use environ::{FuncEnvironment, GlobalValue};
|
||||
use std::collections::HashMap;
|
||||
use std::vec::Vec;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Helper functions and structures for the translation.
|
||||
use cretonne;
|
||||
use cretonne_codegen::ir;
|
||||
use std::u32;
|
||||
use wasmparser;
|
||||
|
||||
@@ -18,7 +18,7 @@ pub type SignatureIndex = usize;
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Global {
|
||||
/// The type of the value stored in the global.
|
||||
pub ty: cretonne::ir::Type,
|
||||
pub ty: ir::Type,
|
||||
/// A flag indicating whether the value may change at runtime.
|
||||
pub mutability: bool,
|
||||
/// The source of the initial value.
|
||||
@@ -56,7 +56,7 @@ pub struct Table {
|
||||
/// WebAssembly table element. Can be a function or a scalar type.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum TableElementType {
|
||||
Val(cretonne::ir::Type),
|
||||
Val(ir::Type),
|
||||
Func(),
|
||||
}
|
||||
|
||||
@@ -72,24 +72,24 @@ pub struct Memory {
|
||||
}
|
||||
|
||||
/// Helper function translating wasmparser types to Cretonne types when possible.
|
||||
pub fn type_to_type(ty: &wasmparser::Type) -> Result<cretonne::ir::Type, ()> {
|
||||
pub fn type_to_type(ty: &wasmparser::Type) -> Result<ir::Type, ()> {
|
||||
match *ty {
|
||||
wasmparser::Type::I32 => Ok(cretonne::ir::types::I32),
|
||||
wasmparser::Type::I64 => Ok(cretonne::ir::types::I64),
|
||||
wasmparser::Type::F32 => Ok(cretonne::ir::types::F32),
|
||||
wasmparser::Type::F64 => Ok(cretonne::ir::types::F64),
|
||||
wasmparser::Type::I32 => Ok(ir::types::I32),
|
||||
wasmparser::Type::I64 => Ok(ir::types::I64),
|
||||
wasmparser::Type::F32 => Ok(ir::types::F32),
|
||||
wasmparser::Type::F64 => Ok(ir::types::F64),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Turns a `wasmparser` `f32` into a `Cretonne` one.
|
||||
pub fn f32_translation(x: wasmparser::Ieee32) -> cretonne::ir::immediates::Ieee32 {
|
||||
cretonne::ir::immediates::Ieee32::with_bits(x.bits())
|
||||
pub fn f32_translation(x: wasmparser::Ieee32) -> ir::immediates::Ieee32 {
|
||||
ir::immediates::Ieee32::with_bits(x.bits())
|
||||
}
|
||||
|
||||
/// Turns a `wasmparser` `f64` into a `Cretonne` one.
|
||||
pub fn f64_translation(x: wasmparser::Ieee64) -> cretonne::ir::immediates::Ieee64 {
|
||||
cretonne::ir::immediates::Ieee64::with_bits(x.bits())
|
||||
pub fn f64_translation(x: wasmparser::Ieee64) -> ir::immediates::Ieee64 {
|
||||
ir::immediates::Ieee64::with_bits(x.bits())
|
||||
}
|
||||
|
||||
/// Translate a `wasmparser` type into its `Cretonne` equivalent, when possible
|
||||
|
||||
Reference in New Issue
Block a user