Commit 95e36fa2 authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano
Browse files

Updated rust formating (again)

parent 59cde7c2
......@@ -90,7 +90,7 @@ pub trait CodeGenerator {
&mut self,
dest1: Reg, /*GPR or FPR*/
dest2: Reg, /*GPR or FPR*/
src: Mem,
src: Mem
); // [base, #simm7]
// Stores
......@@ -108,7 +108,7 @@ pub trait CodeGenerator {
&mut self,
dest: Mem,
src1: Reg, /*GPR or FPR*/
src2: Reg, /*GPR or FPR*/
src2: Reg /*GPR or FPR*/
); // [base, #simm7]
// Calls
......@@ -118,14 +118,14 @@ pub trait CodeGenerator {
func: MuName,
pe: Option<MuName>,
args: Vec<P<Value>>,
is_native: bool,
is_native: bool
) -> ValueLocation;
fn emit_blr(
&mut self,
callsite: String,
func: Reg,
pe: Option<MuName>,
args: Vec<P<Value>>,
args: Vec<P<Value>>
) -> ValueLocation;
// Branches
......@@ -214,7 +214,7 @@ pub trait CodeGenerator {
src1: Reg, /*GPR or SP*/
src2: Reg,
signed: bool,
shift: u8,
shift: u8
);
fn emit_adds_ext(
&mut self,
......@@ -222,7 +222,7 @@ pub trait CodeGenerator {
src1: Reg, /*GPR or SP*/
src2: Reg,
signed: bool,
shift: u8,
shift: u8
);
fn emit_sub_ext(
&mut self,
......@@ -230,7 +230,7 @@ pub trait CodeGenerator {
src1: Reg, /*GPR or SP*/
src2: Reg,
signed: bool,
shift: u8,
shift: u8
);
fn emit_subs_ext(
&mut self,
......@@ -238,7 +238,7 @@ pub trait CodeGenerator {
src1: Reg, /*GPR or SP*/
src2: Reg,
signed: bool,
shift: u8,
shift: u8
);
// Multiplication
......@@ -307,7 +307,7 @@ pub trait CodeGenerator {
dest: Reg, /*GPR or SP*/
src1: Reg, /*GPR or SP*/
src2: u16,
shift: bool,
shift: bool
);
fn emit_adds_imm(&mut self, dest: Reg, src1: Reg /*GPR or SP*/, src2: u16, shift: bool);
fn emit_sub_imm(
......@@ -315,7 +315,7 @@ pub trait CodeGenerator {
dest: Reg, /*GPR or SP*/
src1: Reg, /*GPR or SP*/
src2: u16,
shift: bool,
shift: bool
);
fn emit_subs_imm(&mut self, dest: Reg, src1: Reg /*GPR or SP*/, src2: u16, shift: bool);
......@@ -338,28 +338,28 @@ pub trait CodeGenerator {
dest: Reg, /*64*/
src1: Reg, /*32*/
src2: Reg, /*32*/
src3: Reg, /*64*/
src3: Reg /*64*/
);
fn emit_smsubl(
&mut self,
dest: Reg, /*64*/
src1: Reg, /*32*/
src2: Reg, /*32*/
src3: Reg, /*64*/
src3: Reg /*64*/
);
fn emit_umaddl(
&mut self,
dest: Reg, /*64*/
src1: Reg, /*32*/
src2: Reg, /*32*/
src3: Reg, /*64*/
src3: Reg /*64*/
);
fn emit_umsubl(
&mut self,
dest: Reg, /*64*/
src1: Reg, /*32*/
src2: Reg, /*32*/
src3: Reg, /*64*/
src3: Reg /*64*/
);
fn emit_fmadd(&mut self, dest: Reg, src1: Reg, src2: Reg, src3: Reg);
fn emit_fmsub(&mut self, dest: Reg, src1: Reg, src2: Reg, src3: Reg);
......
This diff is collapsed.
......@@ -227,21 +227,21 @@ pub trait CodeGenerator {
func: MuName,
pe: Option<MuName>,
args: Vec<P<Value>>,
is_native: bool,
is_native: bool
) -> ValueLocation;
fn emit_call_near_r64(
&mut self,
callsite: String,
func: &P<Value>,
pe: Option<MuName>,
args: Vec<P<Value>>,
args: Vec<P<Value>>
) -> ValueLocation;
fn emit_call_near_mem64(
&mut self,
callsite: String,
func: &P<Value>,
pe: Option<MuName>,
args: Vec<P<Value>>,
args: Vec<P<Value>>
) -> ValueLocation;
fn emit_ret(&mut self);
......
......@@ -179,7 +179,7 @@ pub fn get_alias_for_length(id: MuID, length: usize) -> P<Value> {
if id < FPR_ID_START {
let vec = match GPR_ALIAS_TABLE.get(&id) {
Some(vec) => vec,
None => panic!("didnt find {} as GPR", id),
None => panic!("didnt find {} as GPR", id)
};
match length {
......@@ -188,7 +188,7 @@ pub fn get_alias_for_length(id: MuID, length: usize) -> P<Value> {
16 => vec[2].clone(),
8 => vec[3].clone(),
1 => vec[3].clone(),
_ => panic!("unexpected length {} for {}", length, vec[0]),
_ => panic!("unexpected length {} for {}", length, vec[0])
}
} else {
for r in ALL_FPRS.iter() {
......@@ -235,7 +235,7 @@ pub fn get_color_for_precolored(id: MuID) -> MuID {
if id < FPR_ID_START {
match GPR_ALIAS_LOOKUP.get(&id) {
Some(val) => val.id(),
None => panic!("cannot find GPR {}", id),
None => panic!("cannot find GPR {}", id)
}
} else {
// we do not have alias for FPRs
......@@ -252,7 +252,7 @@ pub fn check_op_len(op: &P<Value>) -> usize {
Some(16) => 16,
Some(8) => 8,
Some(1) => 8,
_ => panic!("unsupported register length for x64: {}", op.ty),
_ => panic!("unsupported register length for x64: {}", op.ty)
}
}
......@@ -510,7 +510,7 @@ pub fn number_of_usable_regs_in_group(group: RegGroup) -> usize {
match group {
RegGroup::GPR => ALL_USABLE_GPRS.len(),
RegGroup::GPREX => ALL_USABLE_GPRS.len(),
RegGroup::FPR => ALL_USABLE_FPRS.len(),
RegGroup::FPR => ALL_USABLE_FPRS.len()
}
}
......@@ -599,7 +599,7 @@ pub fn is_valid_x86_imm(op: &P<Value>) -> bool {
match op.v {
Value_::Constant(Constant::Int(val))
if val as i32 >= i32::MIN && val as i32 <= i32::MAX => true,
_ => false,
_ => false
}
} else {
false
......@@ -661,6 +661,6 @@ pub fn estimate_insts_for_ir(inst: &Instruction) -> usize {
PrintHex(_) => 10,
SetRetval(_) => 10,
ExnInstruction { ref inner, .. } => estimate_insts_for_ir(&inner),
_ => unimplemented!(),
_ => unimplemented!()
}
}
......@@ -31,13 +31,13 @@ pub const EMIT_MUIR: bool = true;
pub const EMIT_MC_DOT: bool = true;
pub struct CodeEmission {
name: &'static str,
name: &'static str
}
impl CodeEmission {
pub fn new() -> CodeEmission {
CodeEmission {
name: "Code Emission",
name: "Code Emission"
}
}
}
......@@ -85,7 +85,7 @@ fn create_emit_file(name: String, vm: &VM) -> File {
why
)
}
Ok(file) => file,
Ok(file) => file
}
}
......@@ -105,7 +105,7 @@ pub fn emit_mu_types(suffix: &str, vm: &VM) {
why
)
}
Ok(file) => file,
Ok(file) => file
};
{
......
......@@ -209,7 +209,7 @@ pub struct BackendType {
pub elem_size: Option<ByteSize>,
/// GC type, containing information for GC (this is a temporary design)
/// See Issue#12
pub gc_type: P<GCType>,
pub gc_type: P<GCType>
}
rodal_struct!(BackendType {
......@@ -217,7 +217,7 @@ rodal_struct!(BackendType {
alignment,
struct_layout,
elem_size,
gc_type,
gc_type
});
impl BackendType {
......@@ -243,37 +243,37 @@ impl BackendType {
alignment: 1,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(1, 1)),
gc_type: mm::add_gc_type(GCType::new_noreftype(1, 1))
},
9...16 => BackendType {
size: 2,
alignment: 2,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(2, 2)),
gc_type: mm::add_gc_type(GCType::new_noreftype(2, 2))
},
17...32 => BackendType {
size: 4,
alignment: 4,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(4, 4)),
gc_type: mm::add_gc_type(GCType::new_noreftype(4, 4))
},
33...64 => BackendType {
size: 8,
alignment: 8,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8)),
gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8))
},
128 => BackendType {
size: 16,
alignment: 16,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(16, 16)),
gc_type: mm::add_gc_type(GCType::new_noreftype(16, 16))
},
_ => unimplemented!(),
_ => unimplemented!()
}
}
// reference of any type
......@@ -282,7 +282,7 @@ impl BackendType {
alignment: 8,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_reftype()),
gc_type: mm::add_gc_type(GCType::new_reftype())
},
// pointer/opque ref
MuType_::UPtr(_) |
......@@ -294,7 +294,7 @@ impl BackendType {
alignment: 8,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8)),
gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8))
},
// tagref
MuType_::Tagref64 => BackendType {
......@@ -302,7 +302,7 @@ impl BackendType {
alignment: 8,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_reftype()),
gc_type: mm::add_gc_type(GCType::new_reftype())
},
// floating point
MuType_::Float => BackendType {
......@@ -310,14 +310,14 @@ impl BackendType {
alignment: 4,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(4, 4)),
gc_type: mm::add_gc_type(GCType::new_noreftype(4, 4))
},
MuType_::Double => BackendType {
size: 8,
alignment: 8,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8)),
gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8))
},
// array
MuType_::Array(ref ty, len) => {
......@@ -344,9 +344,9 @@ impl BackendType {
align,
Some(RefPattern::Repeat {
pattern: Box::new(RefPattern::NestedType(vec![ele_ty.gc_type])),
count: len,
}),
)),
count: len
})
))
}
}
// struct
......@@ -393,10 +393,10 @@ impl BackendType {
alignment: 1,
struct_layout: None,
elem_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(0, 1)),
gc_type: mm::add_gc_type(GCType::new_noreftype(0, 1))
},
// vector
MuType_::Vector(_, _) => unimplemented!(),
MuType_::Vector(_, _) => unimplemented!()
}
}
......@@ -454,12 +454,12 @@ impl BackendType {
Some(if use_ref_offsets {
RefPattern::Map {
offsets: ref_offsets,
size: size,
size: size
}
} else {
RefPattern::NestedType(gc_types)
}),
)),
})
))
}
}
......@@ -501,7 +501,7 @@ pub enum RegGroup {
/// requires two general purpose register
GPREX,
/// floating point register
FPR,
FPR
}
rodal_enum!(RegGroup { GPR, GPREX, FPR });
......@@ -527,7 +527,7 @@ impl RegGroup {
MuType_::Float => RegGroup::FPR,
MuType_::Double => RegGroup::FPR,
_ => unimplemented!(),
_ => unimplemented!()
}
}
......
......@@ -21,7 +21,7 @@ use compiler::backend;
use std::any::Any;
pub struct PeepholeOptimization {
name: &'static str,
name: &'static str
}
impl CompilerPass for PeepholeOptimization {
......@@ -52,7 +52,7 @@ impl CompilerPass for PeepholeOptimization {
impl PeepholeOptimization {
pub fn new() -> PeepholeOptimization {
PeepholeOptimization {
name: "Peephole Optimization",
name: "Peephole Optimization"
}
}
......@@ -78,13 +78,13 @@ impl PeepholeOptimization {
let src_machine_reg: MuID = {
match cf.temps.get(&src) {
Some(reg) => *reg,
None => src,
None => src
}
};
let dst_machine_reg: MuID = {
match cf.temps.get(&dst) {
Some(reg) => *reg,
None => dst,
None => dst
}
};
......
......@@ -92,7 +92,7 @@ pub struct GraphColoring<'a> {
/// we need to log all registers get spilled with their spill location
spill_history: LinkedHashMap<MuID, P<Value>>,
/// we need to know the mapping between scratch temp -> original temp
spill_scratch_temps: LinkedHashMap<MuID, MuID>,
spill_scratch_temps: LinkedHashMap<MuID, MuID>
}
impl<'a> GraphColoring<'a> {
......@@ -100,7 +100,7 @@ impl<'a> GraphColoring<'a> {
pub fn start(
func: &'a mut MuFunctionVersion,
cf: &'a mut CompiledFunction,
vm: &'a VM,
vm: &'a VM
) -> GraphColoring<'a> {
GraphColoring::start_with_spill_history(
LinkedHashMap::new(),
......@@ -108,7 +108,7 @@ impl<'a> GraphColoring<'a> {
0,
func,
cf,
vm,
vm
)
}
......@@ -119,7 +119,7 @@ impl<'a> GraphColoring<'a> {
iteration_count: usize,
func: &'a mut MuFunctionVersion,
cf: &'a mut CompiledFunction,
vm: &'a VM,
vm: &'a VM
) -> GraphColoring<'a> {
assert!(
iteration_count < MAX_REWRITE_ITERATIONS_ALLOWED,
......@@ -163,7 +163,7 @@ impl<'a> GraphColoring<'a> {
worklist_freeze: LinkedHashSet::new(),
frozen_moves: LinkedHashSet::new(),
worklist_simplify: LinkedHashSet::new(),
select_stack: Vec::new(),
select_stack: Vec::new()
};
coloring.regalloc()
......@@ -267,7 +267,7 @@ impl<'a> GraphColoring<'a> {
self.iteration_count,
self.func,
self.cf,
self.vm,
self.vm
);
}
......@@ -374,7 +374,7 @@ impl<'a> GraphColoring<'a> {
// holding an immmutable reference of self(self.ig)
fn movelist_mut(
list: &mut LinkedHashMap<NodeIndex, RefCell<Vec<Move>>>,
node: NodeIndex,
node: NodeIndex
) -> &RefCell<Vec<Move>> {
GraphColoring::movelist_check(list, node);
unsafe { GraphColoring::movelist_nocheck(list, node) }
......@@ -389,7 +389,7 @@ impl<'a> GraphColoring<'a> {
// allows getting the Vec<Move> without a mutable reference of the hashmap
unsafe fn movelist_nocheck(
list: &LinkedHashMap<NodeIndex, RefCell<Vec<Move>>>,
node: NodeIndex,
node: NodeIndex
) -> &RefCell<Vec<Move>> {
list.get(&node).unwrap()
}
......@@ -430,7 +430,7 @@ impl<'a> GraphColoring<'a> {
fn degree(&self, n: NodeIndex) -> usize {
match self.degree.get(&n) {
Some(d) => *d,
None => 0,
None => 0
}
}
......@@ -803,7 +803,7 @@ impl<'a> GraphColoring<'a> {
for reg_id in spills.iter() {
let ssa_entry = match self.func.context.get_value(*reg_id) {
Some(entry) => entry,
None => panic!("The spilled register {} is not in func context", reg_id),
None => panic!("The spilled register {} is not in func context", reg_id)
};
let mem = self.cf
.frame
......
......@@ -29,7 +29,7 @@ use compiler::backend::reg_alloc::validate;
use std::any::Any;
pub struct RegisterAllocation {
name: &'static str,
name: &'static str
}
impl CompilerPass for RegisterAllocation {
......@@ -49,7 +49,7 @@ impl CompilerPass for RegisterAllocation {
impl RegisterAllocation {
pub fn new() -> RegisterAllocation {
RegisterAllocation {
name: "Register Allocation",
name: "Register Allocation"
}
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
  • Actually when you were merging from develop, you should have used theirs option to overwrite your out-of-date aarch64 branch. I also put a pre-commit hook in GitLab's Snippets. You can use it to ensure format is correct before every commit.

  • Sorry about that @u4776528, I thought by using rusftmt before merging I would reduce merge conflicts, I didn't wan't to use theirs as I had made changes and didn't wan't them to all be automatically overridden, I have mostly fixed it now, I just need to reduce the line length of like 50 lines of my code...

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment