rustfmt 0.8.1

This commit is contained in:
Jakob Stoklund Olesen
2017-04-05 09:00:11 -07:00
parent e641c97670
commit 1984c96f7c
38 changed files with 497 additions and 334 deletions

View File

@@ -107,7 +107,8 @@ fn legalize_inst_results<ResType>(dfg: &mut DataFlowGraph,
-> Inst
where ResType: FnMut(&DataFlowGraph, usize) -> ArgumentType
{
let mut call = pos.current_inst().expect("Cursor must point to a call instruction");
let mut call = pos.current_inst()
.expect("Cursor must point to a call instruction");
// We theoretically allow for call instructions that return a number of fixed results before
// the call return values. In practice, it doesn't happen.
@@ -364,10 +365,13 @@ fn legalize_inst_arguments<ArgType>(dfg: &mut DataFlowGraph,
mut get_abi_type: ArgType)
where ArgType: FnMut(&DataFlowGraph, usize) -> ArgumentType
{
let inst = pos.current_inst().expect("Cursor must point to a call instruction");
let inst = pos.current_inst()
.expect("Cursor must point to a call instruction");
// Lift the value list out of the call instruction so we modify it.
let mut vlist = dfg[inst].take_value_list().expect("Call must have a value list");
let mut vlist = dfg[inst]
.take_value_list()
.expect("Call must have a value list");
// The value list contains all arguments to the instruction, including the callee on an
// indirect call which isn't part of the call arguments that must match the ABI signature.
@@ -405,7 +409,9 @@ fn legalize_inst_arguments<ArgType>(dfg: &mut DataFlowGraph,
let mut abi_arg = 0;
for old_arg in 0..have_args {
let old_value = vlist.get(old_arg_offset + old_arg, &dfg.value_lists).unwrap();
let old_value = vlist
.get(old_arg_offset + old_arg, &dfg.value_lists)
.unwrap();
let mut put_arg = |dfg: &mut DataFlowGraph, arg| {
let abi_type = get_abi_type(dfg, abi_arg);
if dfg.value_type(arg) == abi_type.value_type {
@@ -435,7 +441,8 @@ fn legalize_inst_arguments<ArgType>(dfg: &mut DataFlowGraph,
///
/// Returns `true` if any instructions were inserted.
pub fn handle_call_abi(dfg: &mut DataFlowGraph, cfg: &ControlFlowGraph, pos: &mut Cursor) -> bool {
let mut inst = pos.current_inst().expect("Cursor must point to a call instruction");
let mut inst = pos.current_inst()
.expect("Cursor must point to a call instruction");
// Start by checking if the argument types already match the signature.
let sig_ref = match check_call_signature(dfg, inst) {
@@ -475,7 +482,8 @@ pub fn handle_return_abi(dfg: &mut DataFlowGraph,
pos: &mut Cursor,
sig: &Signature)
-> bool {
let inst = pos.current_inst().expect("Cursor must point to a return instruction");
let inst = pos.current_inst()
.expect("Cursor must point to a return instruction");
// Check if the returned types already match the signature.
if check_return_signature(dfg, inst, sig) {

View File

@@ -125,7 +125,9 @@ fn split_any(dfg: &mut DataFlowGraph,
"Predecessor not a branch: {}",
dfg.display_inst(inst));
let fixed_args = branch_opc.constraints().fixed_value_arguments();
let mut args = dfg[inst].take_value_list().expect("Branches must have value lists.");
let mut args = dfg[inst]
.take_value_list()
.expect("Branches must have value lists.");
let num_args = args.len(&dfg.value_lists);
// Get the old value passed to the EBB argument we're repairing.
let old_arg = args.get(fixed_args + repair.num, &dfg.value_lists)
@@ -142,12 +144,14 @@ fn split_any(dfg: &mut DataFlowGraph,
let (lo, hi) = split_value(dfg, pos, old_arg, repair.concat, &mut repairs);
// The `lo` part replaces the original argument.
*args.get_mut(fixed_args + repair.num, &mut dfg.value_lists).unwrap() = lo;
*args.get_mut(fixed_args + repair.num, &mut dfg.value_lists)
.unwrap() = lo;
// The `hi` part goes at the end. Since multiple repairs may have been scheduled to the
// same EBB, there could be multiple arguments missing.
if num_args > fixed_args + repair.hi_num {
*args.get_mut(fixed_args + repair.hi_num, &mut dfg.value_lists).unwrap() = hi;
*args.get_mut(fixed_args + repair.hi_num, &mut dfg.value_lists)
.unwrap() = hi;
} else {
// We need to append one or more arguments. If we're adding more than one argument,
// there must be pending repairs on the stack that will fill in the correct values