Update to the rustfmt in rust 1.27, which is now stable. (#377)
This commit is contained in:
@@ -107,8 +107,13 @@ mod tests {
|
||||
|
||||
let s4 = BitSet::<u16>(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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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`.
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user