Update to the rustfmt in rust 1.27, which is now stable. (#377)

This commit is contained in:
Dan Gohman
2018-06-26 13:06:16 -07:00
committed by GitHub
parent 7d2b44289c
commit cc94adca3b
25 changed files with 134 additions and 65 deletions

View File

@@ -107,8 +107,13 @@ mod tests {
let s4 = BitSet::<u16>(4 | 8 | 256 | 1024); let s4 = BitSet::<u16>(4 | 8 | 256 | 1024);
assert!( assert!(
!s4.contains(0) && !s4.contains(1) && !s4.contains(4) && !s4.contains(5) !s4.contains(0)
&& !s4.contains(6) && !s4.contains(7) && !s4.contains(9) && !s4.contains(1)
&& !s4.contains(4)
&& !s4.contains(5)
&& !s4.contains(6)
&& !s4.contains(7)
&& !s4.contains(9)
&& !s4.contains(11) && !s4.contains(11)
); );
assert!(s4.contains(2) && s4.contains(3) && s4.contains(8) && s4.contains(10)); assert!(s4.contains(2) && s4.contains(3) && s4.contains(8) && s4.contains(10));

View File

@@ -9,7 +9,9 @@
//! contexts concurrently. Typically, you would have one context per compilation thread and only a //! contexts concurrently. Typically, you would have one context per compilation thread and only a
//! single ISA instance. //! single ISA instance.
use binemit::{relax_branches, shrink_instructions, CodeOffset, MemoryCodeSink, RelocSink, TrapSink}; use binemit::{
relax_branches, shrink_instructions, CodeOffset, MemoryCodeSink, RelocSink, TrapSink,
};
use dce::do_dce; use dce::do_dce;
use dominator_tree::DominatorTree; use dominator_tree::DominatorTree;
use flowgraph::ControlFlowGraph; use flowgraph::ControlFlowGraph;

View File

@@ -13,8 +13,13 @@ use timing;
/// Test whether the given opcode is unsafe to even consider for DCE. /// Test whether the given opcode is unsafe to even consider for DCE.
fn trivially_unsafe_for_dce(opcode: Opcode) -> bool { fn trivially_unsafe_for_dce(opcode: Opcode) -> bool {
opcode.is_call() || opcode.is_branch() || opcode.is_terminator() || opcode.is_return() opcode.is_call()
|| opcode.can_trap() || opcode.other_side_effects() || opcode.can_store() || opcode.is_branch()
|| opcode.is_terminator()
|| opcode.is_return()
|| opcode.can_trap()
|| opcode.other_side_effects()
|| opcode.can_store()
} }
/// Preserve instructions with used result values. /// Preserve instructions with used result values.
@@ -50,7 +55,8 @@ pub fn do_dce(func: &mut Function, domtree: &mut DominatorTree) {
{ {
let data = &pos.func.dfg[inst]; let data = &pos.func.dfg[inst];
let opcode = data.opcode(); let opcode = data.opcode();
if trivially_unsafe_for_dce(opcode) || is_load_with_defined_trapping(opcode, &data) if trivially_unsafe_for_dce(opcode)
|| is_load_with_defined_trapping(opcode, &data)
|| any_inst_results_used(inst, &live, &pos.func.dfg) || any_inst_results_used(inst, &live, &pos.func.dfg)
{ {
for arg in pos.func.dfg.inst_args(inst) { for arg in pos.func.dfg.inst_args(inst) {

View File

@@ -7,8 +7,10 @@ use binemit::CodeOffset;
use entity::{EntityMap, PrimaryMap}; use entity::{EntityMap, PrimaryMap};
use ir; use ir;
use ir::{DataFlowGraph, ExternalName, Layout, Signature}; use ir::{DataFlowGraph, ExternalName, Layout, Signature};
use ir::{Ebb, ExtFuncData, FuncRef, GlobalValue, GlobalValueData, Heap, HeapData, JumpTable, use ir::{
JumpTableData, SigRef, StackSlot, StackSlotData}; Ebb, ExtFuncData, FuncRef, GlobalValue, GlobalValueData, Heap, HeapData, JumpTable,
JumpTableData, SigRef, StackSlot, StackSlotData,
};
use ir::{EbbOffsets, InstEncodings, JumpTables, SourceLocs, StackSlots, ValueLocations}; use ir::{EbbOffsets, InstEncodings, JumpTables, SourceLocs, StackSlots, ValueLocations};
use isa::{EncInfo, Encoding, Legalize, TargetIsa}; use isa::{EncInfo, Encoding, Legalize, TargetIsa};
use settings::CallConv; use settings::CallConv;

View File

@@ -1,7 +1,9 @@
//! Naming well-known routines in the runtime library. //! Naming well-known routines in the runtime library.
use ir::{types, AbiParam, ArgumentPurpose, ExtFuncData, ExternalName, FuncRef, Function, Inst, use ir::{
Opcode, Signature, Type}; types, AbiParam, ArgumentPurpose, ExtFuncData, ExternalName, FuncRef, Function, Inst, Opcode,
Signature, Type,
};
use isa::{RegUnit, TargetIsa}; use isa::{RegUnit, TargetIsa};
use settings::CallConv; use settings::CallConv;
use std::fmt; use std::fmt;

View File

@@ -24,7 +24,9 @@ mod valueloc;
pub use ir::builder::{InsertBuilder, InstBuilder, InstBuilderBase, InstInserterBase}; pub use ir::builder::{InsertBuilder, InstBuilder, InstBuilderBase, InstInserterBase};
pub use ir::dfg::{DataFlowGraph, ValueDef}; pub use ir::dfg::{DataFlowGraph, ValueDef};
pub use ir::entities::{Ebb, FuncRef, GlobalValue, Heap, Inst, JumpTable, SigRef, StackSlot, Value}; pub use ir::entities::{
Ebb, FuncRef, GlobalValue, Heap, Inst, JumpTable, SigRef, StackSlot, Value,
};
pub use ir::extfunc::{AbiParam, ArgumentExtension, ArgumentPurpose, ExtFuncData, Signature}; pub use ir::extfunc::{AbiParam, ArgumentExtension, ArgumentPurpose, ExtFuncData, Signature};
pub use ir::extname::ExternalName; pub use ir::extname::ExternalName;
pub use ir::function::Function; pub use ir::function::Function;

View File

@@ -6,8 +6,10 @@ use cursor::{Cursor, CursorPosition, EncCursor};
use ir; use ir;
use ir::immediates::Imm64; use ir::immediates::Imm64;
use ir::stackslot::{StackOffset, StackSize}; use ir::stackslot::{StackOffset, StackSize};
use ir::{get_probestack_funcref, AbiParam, ArgumentExtension, ArgumentLoc, ArgumentPurpose, use ir::{
InstBuilder, ValueLoc}; get_probestack_funcref, AbiParam, ArgumentExtension, ArgumentLoc, ArgumentPurpose, InstBuilder,
ValueLoc,
};
use isa::{RegClass, RegUnit, TargetIsa}; use isa::{RegClass, RegUnit, TargetIsa};
use regalloc::RegisterSet; use regalloc::RegisterSet;
use result::CodegenResult; use result::CodegenResult;

View File

@@ -21,8 +21,10 @@ use abi::{legalize_abi_value, ValueConversion};
use cursor::{Cursor, FuncCursor}; use cursor::{Cursor, FuncCursor};
use flowgraph::ControlFlowGraph; use flowgraph::ControlFlowGraph;
use ir::instructions::CallInfo; use ir::instructions::CallInfo;
use ir::{AbiParam, ArgumentLoc, ArgumentPurpose, DataFlowGraph, Ebb, Function, Inst, InstBuilder, use ir::{
SigRef, Signature, Type, Value, ValueLoc}; AbiParam, ArgumentLoc, ArgumentPurpose, DataFlowGraph, Ebb, Function, Inst, InstBuilder,
SigRef, Signature, Type, Value, ValueLoc,
};
use isa::TargetIsa; use isa::TargetIsa;
use legalizer::split::{isplit, vsplit}; use legalizer::split::{isplit, vsplit};
use std::vec::Vec; use std::vec::Vec;
@@ -553,7 +555,8 @@ pub fn handle_return_abi(inst: Inst, func: &mut Function, cfg: &ControlFlowGraph
.iter() .iter()
.rev() .rev()
.take_while(|&rt| { .take_while(|&rt| {
rt.purpose == ArgumentPurpose::Link || rt.purpose == ArgumentPurpose::StructReturn rt.purpose == ArgumentPurpose::Link
|| rt.purpose == ArgumentPurpose::StructReturn
|| rt.purpose == ArgumentPurpose::VMContext || rt.purpose == ArgumentPurpose::VMContext
}) })
.count(); .count();

View File

@@ -132,9 +132,15 @@ fn change_branch_jump_destination(inst: Inst, new_ebb: Ebb, func: &mut Function)
/// Test whether the given opcode is unsafe to even consider for LICM. /// Test whether the given opcode is unsafe to even consider for LICM.
fn trivially_unsafe_for_licm(opcode: Opcode) -> bool { fn trivially_unsafe_for_licm(opcode: Opcode) -> bool {
opcode.can_load() || opcode.can_store() || opcode.is_call() || opcode.is_branch() opcode.can_load()
|| opcode.is_terminator() || opcode.is_return() || opcode.can_trap() || opcode.can_store()
|| opcode.other_side_effects() || opcode.writes_cpu_flags() || opcode.is_call()
|| opcode.is_branch()
|| opcode.is_terminator()
|| opcode.is_return()
|| opcode.can_trap()
|| opcode.other_side_effects()
|| opcode.writes_cpu_flags()
} }
/// Test whether the given instruction is loop-invariant. /// Test whether the given instruction is loop-invariant.

View File

@@ -33,12 +33,18 @@ pub fn do_nan_canonicalization(func: &mut Function) {
fn is_fp_arith(pos: &mut FuncCursor, inst: Inst) -> bool { fn is_fp_arith(pos: &mut FuncCursor, inst: Inst) -> bool {
match pos.func.dfg[inst] { match pos.func.dfg[inst] {
InstructionData::Unary { opcode, .. } => { InstructionData::Unary { opcode, .. } => {
opcode == Opcode::Ceil || opcode == Opcode::Floor || opcode == Opcode::Nearest opcode == Opcode::Ceil
|| opcode == Opcode::Sqrt || opcode == Opcode::Trunc || opcode == Opcode::Floor
|| opcode == Opcode::Nearest
|| opcode == Opcode::Sqrt
|| opcode == Opcode::Trunc
} }
InstructionData::Binary { opcode, .. } => { InstructionData::Binary { opcode, .. } => {
opcode == Opcode::Fadd || opcode == Opcode::Fdiv || opcode == Opcode::Fmax opcode == Opcode::Fadd
|| opcode == Opcode::Fmin || opcode == Opcode::Fmul || opcode == Opcode::Fdiv
|| opcode == Opcode::Fmax
|| opcode == Opcode::Fmin
|| opcode == Opcode::Fmul
|| opcode == Opcode::Fsub || opcode == Opcode::Fsub
} }
InstructionData::Ternary { opcode, .. } => opcode == Opcode::Fma, InstructionData::Ternary { opcode, .. } => opcode == Opcode::Fma,

View File

@@ -869,7 +869,8 @@ impl<'a> Context<'a> {
// not actually constrained by the instruction. We just want it out of the way. // not actually constrained by the instruction. We just want it out of the way.
let toprc2 = self.reginfo.toprc(rci); let toprc2 = self.reginfo.toprc(rci);
let reg2 = self.divert.reg(lv.value, &self.cur.func.locations); let reg2 = self.divert.reg(lv.value, &self.cur.func.locations);
if rc.contains(reg2) && self.solver.can_add_var(lv.value, toprc2, reg2) if rc.contains(reg2)
&& self.solver.can_add_var(lv.value, toprc2, reg2)
&& !self.is_live_on_outgoing_edge(lv.value) && !self.is_live_on_outgoing_edge(lv.value)
{ {
self.solver.add_through_var(lv.value, toprc2, reg2); self.solver.add_through_var(lv.value, toprc2, reg2);

View File

@@ -9,9 +9,15 @@ use timing;
/// Test whether the given opcode is unsafe to even consider for GVN. /// Test whether the given opcode is unsafe to even consider for GVN.
fn trivially_unsafe_for_gvn(opcode: Opcode) -> bool { fn trivially_unsafe_for_gvn(opcode: Opcode) -> bool {
opcode.is_call() || opcode.is_branch() || opcode.is_terminator() || opcode.is_return() opcode.is_call()
|| opcode.can_trap() || opcode.other_side_effects() || opcode.can_store() || opcode.is_branch()
|| opcode.can_load() || opcode.writes_cpu_flags() || opcode.is_terminator()
|| opcode.is_return()
|| opcode.can_trap()
|| opcode.other_side_effects()
|| opcode.can_store()
|| opcode.can_load()
|| opcode.writes_cpu_flags()
} }
/// Perform simple GVN on `func`. /// Perform simple GVN on `func`.

View File

@@ -63,8 +63,10 @@ use flowgraph::ControlFlowGraph;
use ir; use ir;
use ir::entities::AnyEntity; use ir::entities::AnyEntity;
use ir::instructions::{BranchInfo, CallInfo, InstructionFormat, ResolvedConstraint}; use ir::instructions::{BranchInfo, CallInfo, InstructionFormat, ResolvedConstraint};
use ir::{types, ArgumentLoc, Ebb, FuncRef, Function, GlobalValue, Inst, JumpTable, Opcode, SigRef, use ir::{
StackSlot, StackSlotKind, Type, Value, ValueDef, ValueList, ValueLoc}; types, ArgumentLoc, Ebb, FuncRef, Function, GlobalValue, Inst, JumpTable, Opcode, SigRef,
StackSlot, StackSlotKind, Type, Value, ValueDef, ValueList, ValueLoc,
};
use isa::TargetIsa; use isa::TargetIsa;
use iterators::IteratorExtras; use iterators::IteratorExtras;
use settings::{Flags, FlagsOrIsa}; use settings::{Flags, FlagsOrIsa};

View File

@@ -4,8 +4,10 @@ use container;
use cretonne_codegen::binemit::{Addend, CodeOffset, NullTrapSink, Reloc, RelocSink}; use cretonne_codegen::binemit::{Addend, CodeOffset, NullTrapSink, Reloc, RelocSink};
use cretonne_codegen::isa::TargetIsa; use cretonne_codegen::isa::TargetIsa;
use cretonne_codegen::{self, binemit, ir}; use cretonne_codegen::{self, binemit, ir};
use cretonne_module::{Backend, DataContext, DataDescription, Init, Linkage, ModuleError, use cretonne_module::{
ModuleNamespace, ModuleResult}; Backend, DataContext, DataDescription, Init, Linkage, ModuleError, ModuleNamespace,
ModuleResult,
};
use faerie; use faerie;
use failure::Error; use failure::Error;
use std::fs::File; use std::fs::File;

View File

@@ -3,10 +3,11 @@ use cretonne_codegen::cursor::{Cursor, FuncCursor};
use cretonne_codegen::entity::{EntityMap, EntityRef, EntitySet}; use cretonne_codegen::entity::{EntityMap, EntityRef, EntitySet};
use cretonne_codegen::ir; use cretonne_codegen::ir;
use cretonne_codegen::ir::function::DisplayFunction; use cretonne_codegen::ir::function::DisplayFunction;
use cretonne_codegen::ir::{DataFlowGraph, Ebb, ExtFuncData, FuncRef, Function, GlobalValue, use cretonne_codegen::ir::{
GlobalValueData, Heap, HeapData, Inst, InstBuilderBase, DataFlowGraph, Ebb, ExtFuncData, FuncRef, Function, GlobalValue, GlobalValueData, Heap,
InstructionData, JumpTable, JumpTableData, SigRef, Signature, HeapData, Inst, InstBuilderBase, InstructionData, JumpTable, JumpTableData, SigRef, Signature,
StackSlot, StackSlotData, Type, Value}; StackSlot, StackSlotData, Type, Value,
};
use cretonne_codegen::isa::TargetIsa; use cretonne_codegen::isa::TargetIsa;
use cretonne_codegen::packed_option::PackedOption; use cretonne_codegen::packed_option::PackedOption;
use ssa::{Block, SSABuilder, SideEffects}; use ssa::{Block, SSABuilder, SideEffects};
@@ -273,7 +274,9 @@ where
pub fn switch_to_block(&mut self, ebb: Ebb) { pub fn switch_to_block(&mut self, ebb: Ebb) {
// First we check that the previous block has been filled. // First we check that the previous block has been filled.
debug_assert!( debug_assert!(
self.position.is_default() || self.is_unreachable() || self.is_pristine() self.position.is_default()
|| self.is_unreachable()
|| self.is_pristine()
|| self.is_filled(), || self.is_filled(),
"you have to fill your block before switching" "you have to fill your block before switching"
); );

View File

@@ -172,8 +172,11 @@ where
/// Tests whether an `SSABuilder` is in a cleared state. /// Tests whether an `SSABuilder` is in a cleared state.
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.variables.is_empty() && self.blocks.is_empty() && self.ebb_headers.is_empty() self.variables.is_empty()
&& self.calls.is_empty() && self.results.is_empty() && self.blocks.is_empty()
&& self.ebb_headers.is_empty()
&& self.calls.is_empty()
&& self.results.is_empty()
&& self.side_effects.is_empty() && self.side_effects.is_empty()
} }
} }

View File

@@ -33,8 +33,9 @@ mod module;
pub use backend::Backend; pub use backend::Backend;
pub use data_context::{DataContext, DataDescription, Init, Writability}; pub use data_context::{DataContext, DataDescription, Init, Writability};
pub use module::{DataId, FuncId, FuncOrDataId, Linkage, Module, ModuleError, ModuleNamespace, pub use module::{
ModuleResult}; DataId, FuncId, FuncOrDataId, Linkage, Module, ModuleError, ModuleNamespace, ModuleResult,
};
/// This replaces `std` in builds with `core`. /// This replaces `std` in builds with `core`.
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]

View File

@@ -6,11 +6,12 @@ use cretonne_codegen::ir::entities::AnyEntity;
use cretonne_codegen::ir::immediates::{Ieee32, Ieee64, Imm64, Offset32, Uimm32}; use cretonne_codegen::ir::immediates::{Ieee32, Ieee64, Imm64, Offset32, Uimm32};
use cretonne_codegen::ir::instructions::{InstructionData, InstructionFormat, VariableArgs}; use cretonne_codegen::ir::instructions::{InstructionData, InstructionFormat, VariableArgs};
use cretonne_codegen::ir::types::VOID; use cretonne_codegen::ir::types::VOID;
use cretonne_codegen::ir::{AbiParam, ArgumentExtension, ArgumentLoc, Ebb, ExtFuncData, use cretonne_codegen::ir::{
ExternalName, FuncRef, Function, GlobalValue, GlobalValueData, Heap, AbiParam, ArgumentExtension, ArgumentLoc, Ebb, ExtFuncData, ExternalName, FuncRef, Function,
HeapBase, HeapData, HeapStyle, JumpTable, JumpTableData, MemFlags, GlobalValue, GlobalValueData, Heap, HeapBase, HeapData, HeapStyle, JumpTable, JumpTableData,
Opcode, SigRef, Signature, StackSlot, StackSlotData, StackSlotKind, MemFlags, Opcode, SigRef, Signature, StackSlot, StackSlotData, StackSlotKind, Type, Value,
Type, Value, ValueLoc}; ValueLoc,
};
use cretonne_codegen::isa::{self, Encoding, RegUnit, TargetIsa}; use cretonne_codegen::isa::{self, Encoding, RegUnit, TargetIsa};
use cretonne_codegen::packed_option::ReservedValue; use cretonne_codegen::packed_option::ReservedValue;
use cretonne_codegen::settings::CallConv; use cretonne_codegen::settings::CallConv;

View File

@@ -3,8 +3,10 @@
use cretonne_codegen::binemit::{Addend, CodeOffset, NullTrapSink, Reloc, RelocSink}; use cretonne_codegen::binemit::{Addend, CodeOffset, NullTrapSink, Reloc, RelocSink};
use cretonne_codegen::isa::TargetIsa; use cretonne_codegen::isa::TargetIsa;
use cretonne_codegen::{self, ir, settings}; use cretonne_codegen::{self, ir, settings};
use cretonne_module::{Backend, DataContext, DataDescription, Init, Linkage, ModuleNamespace, use cretonne_module::{
ModuleResult, Writability}; Backend, DataContext, DataDescription, Init, Linkage, ModuleNamespace, ModuleResult,
Writability,
};
use cretonne_native; use cretonne_native;
use libc; use libc;
use memory::Memory; use memory::Memory;

View File

@@ -24,8 +24,10 @@ pub mod prelude {
pub use codegen::ir::condcodes::{FloatCC, IntCC}; pub use codegen::ir::condcodes::{FloatCC, IntCC};
pub use codegen::ir::immediates::{Ieee32, Ieee64, Imm64}; pub use codegen::ir::immediates::{Ieee32, Ieee64, Imm64};
pub use codegen::ir::types; pub use codegen::ir::types;
pub use codegen::ir::{AbiParam, Ebb, ExtFuncData, GlobalValueData, InstBuilder, JumpTableData, pub use codegen::ir::{
MemFlags, Signature, StackSlotData, StackSlotKind, TrapCode, Type, Value}; AbiParam, Ebb, ExtFuncData, GlobalValueData, InstBuilder, JumpTableData, MemFlags,
Signature, StackSlotData, StackSlotKind, TrapCode, Type, Value,
};
pub use codegen::isa; pub use codegen::isa;
pub use codegen::settings::{self, CallConv, Configurable}; pub use codegen::settings::{self, CallConv, Configurable};

View File

@@ -9,8 +9,9 @@ use func_translator::FuncTranslator;
use std::string::String; use std::string::String;
use std::vec::Vec; use std::vec::Vec;
use target_lexicon::Triple; use target_lexicon::Triple;
use translation_utils::{FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, use translation_utils::{
Table, TableIndex}; FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex,
};
use wasmparser; use wasmparser;
/// Compute a `ir::ExternalName` for a given wasm function index. /// Compute a `ir::ExternalName` for a given wasm function index.

View File

@@ -5,8 +5,9 @@ use cretonne_codegen::ir::{self, InstBuilder};
use cretonne_codegen::settings::Flags; use cretonne_codegen::settings::Flags;
use std::vec::Vec; use std::vec::Vec;
use target_lexicon::Triple; use target_lexicon::Triple;
use translation_utils::{FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, use translation_utils::{
Table, TableIndex}; FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex,
};
use wasmparser::BinaryReaderError; use wasmparser::BinaryReaderError;
/// The value of a WebAssembly global value. /// The value of a WebAssembly global value.

View File

@@ -42,12 +42,15 @@ mod sections_translator;
mod state; mod state;
mod translation_utils; mod translation_utils;
pub use environ::{DummyEnvironment, FuncEnvironment, GlobalValue, ModuleEnvironment, WasmError, pub use environ::{
WasmResult}; DummyEnvironment, FuncEnvironment, GlobalValue, ModuleEnvironment, WasmError, WasmResult,
};
pub use func_translator::FuncTranslator; pub use func_translator::FuncTranslator;
pub use module_translator::translate_module; pub use module_translator::translate_module;
pub use translation_utils::{FunctionIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex, pub use translation_utils::{
SignatureIndex, Table, TableIndex}; FunctionIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex, SignatureIndex, Table,
TableIndex,
};
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
mod std { mod std {

View File

@@ -2,10 +2,11 @@
//! to deal with each part of it. //! to deal with each part of it.
use cretonne_codegen::timing; use cretonne_codegen::timing;
use environ::{ModuleEnvironment, WasmError, WasmResult}; use environ::{ModuleEnvironment, WasmError, WasmResult};
use sections_translator::{parse_data_section, parse_elements_section, parse_export_section, use sections_translator::{
parse_function_section, parse_function_signatures, parse_global_section, parse_data_section, parse_elements_section, parse_export_section, parse_function_section,
parse_import_section, parse_memory_section, parse_start_section, parse_function_signatures, parse_global_section, parse_import_section, parse_memory_section,
parse_table_section}; parse_start_section, parse_table_section,
};
use wasmparser::{Parser, ParserInput, ParserState, SectionCode, WasmDecoder}; use wasmparser::{Parser, ParserInput, ParserState, SectionCode, WasmDecoder};
/// Translate a sequence of bytes forming a valid Wasm binary into a list of valid Cretonne IR /// Translate a sequence of bytes forming a valid Wasm binary into a list of valid Cretonne IR

View File

@@ -11,11 +11,15 @@ use cretonne_codegen::ir::{self, AbiParam, Signature};
use environ::{ModuleEnvironment, WasmError, WasmResult}; use environ::{ModuleEnvironment, WasmError, WasmResult};
use std::str::from_utf8; use std::str::from_utf8;
use std::vec::Vec; use std::vec::Vec;
use translation_utils::{type_to_type, FunctionIndex, Global, GlobalIndex, GlobalInit, Memory, use translation_utils::{
MemoryIndex, SignatureIndex, Table, TableElementType, TableIndex}; type_to_type, FunctionIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex,
SignatureIndex, Table, TableElementType, TableIndex,
};
use wasmparser; use wasmparser;
use wasmparser::{ExternalKind, FuncType, ImportSectionEntryType, MemoryType, Operator, Parser, use wasmparser::{
ParserState, WasmDecoder}; ExternalKind, FuncType, ImportSectionEntryType, MemoryType, Operator, Parser, ParserState,
WasmDecoder,
};
/// Reads the Type Section of the wasm module and returns the corresponding function signatures. /// Reads the Type Section of the wasm module and returns the corresponding function signatures.
pub fn parse_function_signatures( pub fn parse_function_signatures(