From cc94adca3bc9c8f11a64af28429f09ae19b9a0cd Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 26 Jun 2018 13:06:16 -0700 Subject: [PATCH] Update to the rustfmt in rust 1.27, which is now stable. (#377) --- lib/codegen/src/bitset.rs | 9 +++++++-- lib/codegen/src/context.rs | 4 +++- lib/codegen/src/dce.rs | 12 +++++++++--- lib/codegen/src/ir/function.rs | 6 ++++-- lib/codegen/src/ir/libcall.rs | 6 ++++-- lib/codegen/src/ir/mod.rs | 4 +++- lib/codegen/src/isa/x86/abi.rs | 6 ++++-- lib/codegen/src/legalizer/boundary.rs | 9 ++++++--- lib/codegen/src/licm.rs | 12 +++++++++--- lib/codegen/src/nan_canonicalization.rs | 14 ++++++++++---- lib/codegen/src/regalloc/coloring.rs | 3 ++- lib/codegen/src/simple_gvn.rs | 12 +++++++++--- lib/codegen/src/verifier/mod.rs | 6 ++++-- lib/faerie/src/backend.rs | 6 ++++-- lib/frontend/src/frontend.rs | 13 ++++++++----- lib/frontend/src/ssa.rs | 7 +++++-- lib/module/src/lib.rs | 5 +++-- lib/reader/src/parser.rs | 11 ++++++----- lib/simplejit/src/backend.rs | 6 ++++-- lib/umbrella/src/lib.rs | 6 ++++-- lib/wasm/src/environ/dummy.rs | 5 +++-- lib/wasm/src/environ/spec.rs | 5 +++-- lib/wasm/src/lib.rs | 11 +++++++---- lib/wasm/src/module_translator.rs | 9 +++++---- lib/wasm/src/sections_translator.rs | 12 ++++++++---- 25 files changed, 134 insertions(+), 65 deletions(-) diff --git a/lib/codegen/src/bitset.rs b/lib/codegen/src/bitset.rs index 0029b0c42c..10d624d8a2 100644 --- a/lib/codegen/src/bitset.rs +++ b/lib/codegen/src/bitset.rs @@ -107,8 +107,13 @@ mod tests { let s4 = BitSet::(4 | 8 | 256 | 1024); assert!( - !s4.contains(0) && !s4.contains(1) && !s4.contains(4) && !s4.contains(5) - && !s4.contains(6) && !s4.contains(7) && !s4.contains(9) + !s4.contains(0) + && !s4.contains(1) + && !s4.contains(4) + && !s4.contains(5) + && !s4.contains(6) + && !s4.contains(7) + && !s4.contains(9) && !s4.contains(11) ); assert!(s4.contains(2) && s4.contains(3) && s4.contains(8) && s4.contains(10)); diff --git a/lib/codegen/src/context.rs b/lib/codegen/src/context.rs index fa8b761ad4..955fe6111d 100644 --- a/lib/codegen/src/context.rs +++ b/lib/codegen/src/context.rs @@ -9,7 +9,9 @@ //! contexts concurrently. Typically, you would have one context per compilation thread and only a //! 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 dominator_tree::DominatorTree; use flowgraph::ControlFlowGraph; diff --git a/lib/codegen/src/dce.rs b/lib/codegen/src/dce.rs index 5373948e88..2c5d5e2a32 100644 --- a/lib/codegen/src/dce.rs +++ b/lib/codegen/src/dce.rs @@ -13,8 +13,13 @@ use timing; /// Test whether the given opcode is unsafe to even consider for DCE. fn trivially_unsafe_for_dce(opcode: Opcode) -> bool { - opcode.is_call() || opcode.is_branch() || opcode.is_terminator() || opcode.is_return() - || opcode.can_trap() || opcode.other_side_effects() || opcode.can_store() + opcode.is_call() + || 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. @@ -50,7 +55,8 @@ pub fn do_dce(func: &mut Function, domtree: &mut DominatorTree) { { let data = &pos.func.dfg[inst]; 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) { for arg in pos.func.dfg.inst_args(inst) { diff --git a/lib/codegen/src/ir/function.rs b/lib/codegen/src/ir/function.rs index e060c94029..9c6647ba0c 100644 --- a/lib/codegen/src/ir/function.rs +++ b/lib/codegen/src/ir/function.rs @@ -7,8 +7,10 @@ use binemit::CodeOffset; use entity::{EntityMap, PrimaryMap}; use ir; use ir::{DataFlowGraph, ExternalName, Layout, Signature}; -use ir::{Ebb, ExtFuncData, FuncRef, GlobalValue, GlobalValueData, Heap, HeapData, JumpTable, - JumpTableData, SigRef, StackSlot, StackSlotData}; +use ir::{ + Ebb, ExtFuncData, FuncRef, GlobalValue, GlobalValueData, Heap, HeapData, JumpTable, + JumpTableData, SigRef, StackSlot, StackSlotData, +}; use ir::{EbbOffsets, InstEncodings, JumpTables, SourceLocs, StackSlots, ValueLocations}; use isa::{EncInfo, Encoding, Legalize, TargetIsa}; use settings::CallConv; diff --git a/lib/codegen/src/ir/libcall.rs b/lib/codegen/src/ir/libcall.rs index 26440d4235..43ac22e568 100644 --- a/lib/codegen/src/ir/libcall.rs +++ b/lib/codegen/src/ir/libcall.rs @@ -1,7 +1,9 @@ //! Naming well-known routines in the runtime library. -use ir::{types, AbiParam, ArgumentPurpose, ExtFuncData, ExternalName, FuncRef, Function, Inst, - Opcode, Signature, Type}; +use ir::{ + types, AbiParam, ArgumentPurpose, ExtFuncData, ExternalName, FuncRef, Function, Inst, Opcode, + Signature, Type, +}; use isa::{RegUnit, TargetIsa}; use settings::CallConv; use std::fmt; diff --git a/lib/codegen/src/ir/mod.rs b/lib/codegen/src/ir/mod.rs index 71e56ec5a0..1133f90af9 100644 --- a/lib/codegen/src/ir/mod.rs +++ b/lib/codegen/src/ir/mod.rs @@ -24,7 +24,9 @@ mod valueloc; pub use ir::builder::{InsertBuilder, InstBuilder, InstBuilderBase, InstInserterBase}; 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::extname::ExternalName; pub use ir::function::Function; diff --git a/lib/codegen/src/isa/x86/abi.rs b/lib/codegen/src/isa/x86/abi.rs index c74572ecc7..5b9639e622 100644 --- a/lib/codegen/src/isa/x86/abi.rs +++ b/lib/codegen/src/isa/x86/abi.rs @@ -6,8 +6,10 @@ use cursor::{Cursor, CursorPosition, EncCursor}; use ir; use ir::immediates::Imm64; use ir::stackslot::{StackOffset, StackSize}; -use ir::{get_probestack_funcref, AbiParam, ArgumentExtension, ArgumentLoc, ArgumentPurpose, - InstBuilder, ValueLoc}; +use ir::{ + get_probestack_funcref, AbiParam, ArgumentExtension, ArgumentLoc, ArgumentPurpose, InstBuilder, + ValueLoc, +}; use isa::{RegClass, RegUnit, TargetIsa}; use regalloc::RegisterSet; use result::CodegenResult; diff --git a/lib/codegen/src/legalizer/boundary.rs b/lib/codegen/src/legalizer/boundary.rs index 4a865f2965..dfc4629566 100644 --- a/lib/codegen/src/legalizer/boundary.rs +++ b/lib/codegen/src/legalizer/boundary.rs @@ -21,8 +21,10 @@ use abi::{legalize_abi_value, ValueConversion}; use cursor::{Cursor, FuncCursor}; use flowgraph::ControlFlowGraph; use ir::instructions::CallInfo; -use ir::{AbiParam, ArgumentLoc, ArgumentPurpose, DataFlowGraph, Ebb, Function, Inst, InstBuilder, - SigRef, Signature, Type, Value, ValueLoc}; +use ir::{ + AbiParam, ArgumentLoc, ArgumentPurpose, DataFlowGraph, Ebb, Function, Inst, InstBuilder, + SigRef, Signature, Type, Value, ValueLoc, +}; use isa::TargetIsa; use legalizer::split::{isplit, vsplit}; use std::vec::Vec; @@ -553,7 +555,8 @@ pub fn handle_return_abi(inst: Inst, func: &mut Function, cfg: &ControlFlowGraph .iter() .rev() .take_while(|&rt| { - rt.purpose == ArgumentPurpose::Link || rt.purpose == ArgumentPurpose::StructReturn + rt.purpose == ArgumentPurpose::Link + || rt.purpose == ArgumentPurpose::StructReturn || rt.purpose == ArgumentPurpose::VMContext }) .count(); diff --git a/lib/codegen/src/licm.rs b/lib/codegen/src/licm.rs index 5771e89fb1..8f32b640ac 100644 --- a/lib/codegen/src/licm.rs +++ b/lib/codegen/src/licm.rs @@ -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. fn trivially_unsafe_for_licm(opcode: Opcode) -> bool { - opcode.can_load() || opcode.can_store() || opcode.is_call() || opcode.is_branch() - || opcode.is_terminator() || opcode.is_return() || opcode.can_trap() - || opcode.other_side_effects() || opcode.writes_cpu_flags() + opcode.can_load() + || opcode.can_store() + || 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. diff --git a/lib/codegen/src/nan_canonicalization.rs b/lib/codegen/src/nan_canonicalization.rs index 0db8c12056..0f11c39fe8 100644 --- a/lib/codegen/src/nan_canonicalization.rs +++ b/lib/codegen/src/nan_canonicalization.rs @@ -33,12 +33,18 @@ pub fn do_nan_canonicalization(func: &mut Function) { fn is_fp_arith(pos: &mut FuncCursor, inst: Inst) -> bool { match pos.func.dfg[inst] { InstructionData::Unary { opcode, .. } => { - opcode == Opcode::Ceil || opcode == Opcode::Floor || opcode == Opcode::Nearest - || opcode == Opcode::Sqrt || opcode == Opcode::Trunc + opcode == Opcode::Ceil + || opcode == Opcode::Floor + || opcode == Opcode::Nearest + || opcode == Opcode::Sqrt + || opcode == Opcode::Trunc } InstructionData::Binary { opcode, .. } => { - opcode == Opcode::Fadd || opcode == Opcode::Fdiv || opcode == Opcode::Fmax - || opcode == Opcode::Fmin || opcode == Opcode::Fmul + opcode == Opcode::Fadd + || opcode == Opcode::Fdiv + || opcode == Opcode::Fmax + || opcode == Opcode::Fmin + || opcode == Opcode::Fmul || opcode == Opcode::Fsub } InstructionData::Ternary { opcode, .. } => opcode == Opcode::Fma, diff --git a/lib/codegen/src/regalloc/coloring.rs b/lib/codegen/src/regalloc/coloring.rs index 33ce0ff3b4..8bb29c62cc 100644 --- a/lib/codegen/src/regalloc/coloring.rs +++ b/lib/codegen/src/regalloc/coloring.rs @@ -869,7 +869,8 @@ impl<'a> Context<'a> { // not actually constrained by the instruction. We just want it out of the way. let toprc2 = self.reginfo.toprc(rci); 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.solver.add_through_var(lv.value, toprc2, reg2); diff --git a/lib/codegen/src/simple_gvn.rs b/lib/codegen/src/simple_gvn.rs index 141199b3d9..cc8e7c37c5 100644 --- a/lib/codegen/src/simple_gvn.rs +++ b/lib/codegen/src/simple_gvn.rs @@ -9,9 +9,15 @@ use timing; /// Test whether the given opcode is unsafe to even consider for GVN. fn trivially_unsafe_for_gvn(opcode: Opcode) -> bool { - opcode.is_call() || opcode.is_branch() || opcode.is_terminator() || opcode.is_return() - || opcode.can_trap() || opcode.other_side_effects() || opcode.can_store() - || opcode.can_load() || opcode.writes_cpu_flags() + opcode.is_call() + || opcode.is_branch() + || 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`. diff --git a/lib/codegen/src/verifier/mod.rs b/lib/codegen/src/verifier/mod.rs index b25d770c3f..4bd027a58f 100644 --- a/lib/codegen/src/verifier/mod.rs +++ b/lib/codegen/src/verifier/mod.rs @@ -63,8 +63,10 @@ use flowgraph::ControlFlowGraph; use ir; use ir::entities::AnyEntity; use ir::instructions::{BranchInfo, CallInfo, InstructionFormat, ResolvedConstraint}; -use ir::{types, ArgumentLoc, Ebb, FuncRef, Function, GlobalValue, Inst, JumpTable, Opcode, SigRef, - StackSlot, StackSlotKind, Type, Value, ValueDef, ValueList, ValueLoc}; +use ir::{ + types, ArgumentLoc, Ebb, FuncRef, Function, GlobalValue, Inst, JumpTable, Opcode, SigRef, + StackSlot, StackSlotKind, Type, Value, ValueDef, ValueList, ValueLoc, +}; use isa::TargetIsa; use iterators::IteratorExtras; use settings::{Flags, FlagsOrIsa}; diff --git a/lib/faerie/src/backend.rs b/lib/faerie/src/backend.rs index 0bb82efa9e..4126ed7582 100644 --- a/lib/faerie/src/backend.rs +++ b/lib/faerie/src/backend.rs @@ -4,8 +4,10 @@ use container; use cretonne_codegen::binemit::{Addend, CodeOffset, NullTrapSink, Reloc, RelocSink}; use cretonne_codegen::isa::TargetIsa; use cretonne_codegen::{self, binemit, ir}; -use cretonne_module::{Backend, DataContext, DataDescription, Init, Linkage, ModuleError, - ModuleNamespace, ModuleResult}; +use cretonne_module::{ + Backend, DataContext, DataDescription, Init, Linkage, ModuleError, ModuleNamespace, + ModuleResult, +}; use faerie; use failure::Error; use std::fs::File; diff --git a/lib/frontend/src/frontend.rs b/lib/frontend/src/frontend.rs index 89d933d2ae..eabadad15f 100644 --- a/lib/frontend/src/frontend.rs +++ b/lib/frontend/src/frontend.rs @@ -3,10 +3,11 @@ use cretonne_codegen::cursor::{Cursor, FuncCursor}; use cretonne_codegen::entity::{EntityMap, EntityRef, EntitySet}; use cretonne_codegen::ir; use cretonne_codegen::ir::function::DisplayFunction; -use cretonne_codegen::ir::{DataFlowGraph, Ebb, ExtFuncData, FuncRef, Function, GlobalValue, - GlobalValueData, Heap, HeapData, Inst, InstBuilderBase, - InstructionData, JumpTable, JumpTableData, SigRef, Signature, - StackSlot, StackSlotData, Type, Value}; +use cretonne_codegen::ir::{ + DataFlowGraph, Ebb, ExtFuncData, FuncRef, Function, GlobalValue, GlobalValueData, Heap, + HeapData, Inst, InstBuilderBase, InstructionData, JumpTable, JumpTableData, SigRef, Signature, + StackSlot, StackSlotData, Type, Value, +}; use cretonne_codegen::isa::TargetIsa; use cretonne_codegen::packed_option::PackedOption; use ssa::{Block, SSABuilder, SideEffects}; @@ -273,7 +274,9 @@ where pub fn switch_to_block(&mut self, ebb: Ebb) { // First we check that the previous block has been filled. 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(), "you have to fill your block before switching" ); diff --git a/lib/frontend/src/ssa.rs b/lib/frontend/src/ssa.rs index 59a031f6d1..a7f4833fc3 100644 --- a/lib/frontend/src/ssa.rs +++ b/lib/frontend/src/ssa.rs @@ -172,8 +172,11 @@ where /// Tests whether an `SSABuilder` is in a cleared state. pub fn is_empty(&self) -> bool { - self.variables.is_empty() && self.blocks.is_empty() && self.ebb_headers.is_empty() - && self.calls.is_empty() && self.results.is_empty() + self.variables.is_empty() + && self.blocks.is_empty() + && self.ebb_headers.is_empty() + && self.calls.is_empty() + && self.results.is_empty() && self.side_effects.is_empty() } } diff --git a/lib/module/src/lib.rs b/lib/module/src/lib.rs index 85e04caaff..4d251413d3 100644 --- a/lib/module/src/lib.rs +++ b/lib/module/src/lib.rs @@ -33,8 +33,9 @@ mod module; pub use backend::Backend; pub use data_context::{DataContext, DataDescription, Init, Writability}; -pub use module::{DataId, FuncId, FuncOrDataId, Linkage, Module, ModuleError, ModuleNamespace, - ModuleResult}; +pub use module::{ + DataId, FuncId, FuncOrDataId, Linkage, Module, ModuleError, ModuleNamespace, ModuleResult, +}; /// This replaces `std` in builds with `core`. #[cfg(not(feature = "std"))] diff --git a/lib/reader/src/parser.rs b/lib/reader/src/parser.rs index 72dc466335..a8bea8b2b0 100644 --- a/lib/reader/src/parser.rs +++ b/lib/reader/src/parser.rs @@ -6,11 +6,12 @@ use cretonne_codegen::ir::entities::AnyEntity; use cretonne_codegen::ir::immediates::{Ieee32, Ieee64, Imm64, Offset32, Uimm32}; use cretonne_codegen::ir::instructions::{InstructionData, InstructionFormat, VariableArgs}; use cretonne_codegen::ir::types::VOID; -use cretonne_codegen::ir::{AbiParam, ArgumentExtension, ArgumentLoc, Ebb, ExtFuncData, - ExternalName, FuncRef, Function, GlobalValue, GlobalValueData, Heap, - HeapBase, HeapData, HeapStyle, JumpTable, JumpTableData, MemFlags, - Opcode, SigRef, Signature, StackSlot, StackSlotData, StackSlotKind, - Type, Value, ValueLoc}; +use cretonne_codegen::ir::{ + AbiParam, ArgumentExtension, ArgumentLoc, Ebb, ExtFuncData, ExternalName, FuncRef, Function, + GlobalValue, GlobalValueData, Heap, HeapBase, HeapData, HeapStyle, JumpTable, JumpTableData, + MemFlags, Opcode, SigRef, Signature, StackSlot, StackSlotData, StackSlotKind, Type, Value, + ValueLoc, +}; use cretonne_codegen::isa::{self, Encoding, RegUnit, TargetIsa}; use cretonne_codegen::packed_option::ReservedValue; use cretonne_codegen::settings::CallConv; diff --git a/lib/simplejit/src/backend.rs b/lib/simplejit/src/backend.rs index 5886b7ad76..23bed09bdc 100644 --- a/lib/simplejit/src/backend.rs +++ b/lib/simplejit/src/backend.rs @@ -3,8 +3,10 @@ use cretonne_codegen::binemit::{Addend, CodeOffset, NullTrapSink, Reloc, RelocSink}; use cretonne_codegen::isa::TargetIsa; use cretonne_codegen::{self, ir, settings}; -use cretonne_module::{Backend, DataContext, DataDescription, Init, Linkage, ModuleNamespace, - ModuleResult, Writability}; +use cretonne_module::{ + Backend, DataContext, DataDescription, Init, Linkage, ModuleNamespace, ModuleResult, + Writability, +}; use cretonne_native; use libc; use memory::Memory; diff --git a/lib/umbrella/src/lib.rs b/lib/umbrella/src/lib.rs index 1048b4d780..c586227df2 100644 --- a/lib/umbrella/src/lib.rs +++ b/lib/umbrella/src/lib.rs @@ -24,8 +24,10 @@ pub mod prelude { pub use codegen::ir::condcodes::{FloatCC, IntCC}; pub use codegen::ir::immediates::{Ieee32, Ieee64, Imm64}; pub use codegen::ir::types; - pub use codegen::ir::{AbiParam, Ebb, ExtFuncData, GlobalValueData, InstBuilder, JumpTableData, - MemFlags, Signature, StackSlotData, StackSlotKind, TrapCode, Type, Value}; + pub use codegen::ir::{ + AbiParam, Ebb, ExtFuncData, GlobalValueData, InstBuilder, JumpTableData, MemFlags, + Signature, StackSlotData, StackSlotKind, TrapCode, Type, Value, + }; pub use codegen::isa; pub use codegen::settings::{self, CallConv, Configurable}; diff --git a/lib/wasm/src/environ/dummy.rs b/lib/wasm/src/environ/dummy.rs index 0bd7fc1a94..6ccefe3213 100644 --- a/lib/wasm/src/environ/dummy.rs +++ b/lib/wasm/src/environ/dummy.rs @@ -9,8 +9,9 @@ use func_translator::FuncTranslator; use std::string::String; use std::vec::Vec; use target_lexicon::Triple; -use translation_utils::{FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, - Table, TableIndex}; +use translation_utils::{ + FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex, +}; use wasmparser; /// Compute a `ir::ExternalName` for a given wasm function index. diff --git a/lib/wasm/src/environ/spec.rs b/lib/wasm/src/environ/spec.rs index 38ed9e6f1b..09a8dd5371 100644 --- a/lib/wasm/src/environ/spec.rs +++ b/lib/wasm/src/environ/spec.rs @@ -5,8 +5,9 @@ use cretonne_codegen::ir::{self, InstBuilder}; use cretonne_codegen::settings::Flags; use std::vec::Vec; use target_lexicon::Triple; -use translation_utils::{FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, - Table, TableIndex}; +use translation_utils::{ + FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex, +}; use wasmparser::BinaryReaderError; /// The value of a WebAssembly global value. diff --git a/lib/wasm/src/lib.rs b/lib/wasm/src/lib.rs index 35256c924c..5d4fd24a37 100644 --- a/lib/wasm/src/lib.rs +++ b/lib/wasm/src/lib.rs @@ -42,12 +42,15 @@ mod sections_translator; mod state; mod translation_utils; -pub use environ::{DummyEnvironment, FuncEnvironment, GlobalValue, ModuleEnvironment, WasmError, - WasmResult}; +pub use environ::{ + DummyEnvironment, FuncEnvironment, GlobalValue, ModuleEnvironment, WasmError, WasmResult, +}; pub use func_translator::FuncTranslator; pub use module_translator::translate_module; -pub use translation_utils::{FunctionIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex, - SignatureIndex, Table, TableIndex}; +pub use translation_utils::{ + FunctionIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex, SignatureIndex, Table, + TableIndex, +}; #[cfg(not(feature = "std"))] mod std { diff --git a/lib/wasm/src/module_translator.rs b/lib/wasm/src/module_translator.rs index 835a26fb3f..ffeafc2378 100644 --- a/lib/wasm/src/module_translator.rs +++ b/lib/wasm/src/module_translator.rs @@ -2,10 +2,11 @@ //! to deal with each part of it. use cretonne_codegen::timing; use environ::{ModuleEnvironment, WasmError, WasmResult}; -use sections_translator::{parse_data_section, parse_elements_section, parse_export_section, - parse_function_section, parse_function_signatures, parse_global_section, - parse_import_section, parse_memory_section, parse_start_section, - parse_table_section}; +use sections_translator::{ + parse_data_section, parse_elements_section, parse_export_section, parse_function_section, + parse_function_signatures, parse_global_section, parse_import_section, parse_memory_section, + parse_start_section, parse_table_section, +}; use wasmparser::{Parser, ParserInput, ParserState, SectionCode, WasmDecoder}; /// Translate a sequence of bytes forming a valid Wasm binary into a list of valid Cretonne IR diff --git a/lib/wasm/src/sections_translator.rs b/lib/wasm/src/sections_translator.rs index 5fec99afb3..112bd3784e 100644 --- a/lib/wasm/src/sections_translator.rs +++ b/lib/wasm/src/sections_translator.rs @@ -11,11 +11,15 @@ use cretonne_codegen::ir::{self, AbiParam, Signature}; use environ::{ModuleEnvironment, WasmError, WasmResult}; use std::str::from_utf8; use std::vec::Vec; -use translation_utils::{type_to_type, FunctionIndex, Global, GlobalIndex, GlobalInit, Memory, - MemoryIndex, SignatureIndex, Table, TableElementType, TableIndex}; +use translation_utils::{ + type_to_type, FunctionIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex, + SignatureIndex, Table, TableElementType, TableIndex, +}; use wasmparser; -use wasmparser::{ExternalKind, FuncType, ImportSectionEntryType, MemoryType, Operator, Parser, - ParserState, WasmDecoder}; +use wasmparser::{ + ExternalKind, FuncType, ImportSectionEntryType, MemoryType, Operator, Parser, ParserState, + WasmDecoder, +}; /// Reads the Type Section of the wasm module and returns the corresponding function signatures. pub fn parse_function_signatures(