Skip to content

Commit 31cd44b

Browse files
MabezDevreitermarkus
authored andcommitted
Merge pull request rust-lang#10 from chocol4te/tidy_fix
Fix tidy issues
1 parent d2e0c93 commit 31cd44b

File tree

4 files changed

+26
-34
lines changed

4 files changed

+26
-34
lines changed

src/librustc_target/abi/call/xtensa.rs

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform};
44

55
const NUM_ARG_GPR: u64 = 6;
6-
const MAX_ARG_IN_REGS_SIZE: u64 = 4 * 32;
6+
const MAX_ARG_IN_REGS_SIZE: u64 = 4 * 32;
77
// const MAX_ARG_DIRECT_SIZE: u64 = MAX_ARG_IN_REGS_SIZE;
8-
const MAX_RET_IN_REGS_SIZE: u64 = 2 * 32;
8+
const MAX_RET_IN_REGS_SIZE: u64 = 2 * 32;
99

1010
fn classify_ret_ty<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64) {
1111
// The rules for return and argument types are the same, so defer to
1212
// classifyArgumentType.
1313
classify_arg_ty(arg, xlen, &mut 2); // two as max return size
1414
}
1515

16-
1716
fn classify_arg_ty<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64, remaining_gpr: &mut u64) {
1817
// Determine the number of GPRs needed to pass the current argument
1918
// according to the ABI. 2*XLen-aligned varargs are passed in "aligned"
@@ -29,7 +28,7 @@ fn classify_arg_ty<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64, remaining_gpr: &mut
2928
let mut required_gpr = 1u64; // at least one per arg
3029
if alignment.bits() == 2 * xlen {
3130
required_gpr = 2 + (*remaining_gpr % 2);
32-
} else if arg_size.bits() > xlen && arg_size.bits() <= MAX_ARG_IN_REGS_SIZE {
31+
} else if arg_size.bits() > xlen && arg_size.bits() <= MAX_ARG_IN_REGS_SIZE {
3332
required_gpr = (arg_size.bits() + (xlen - 1)) / xlen;
3433
}
3534

@@ -59,12 +58,9 @@ fn classify_arg_ty<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64, remaining_gpr: &mut
5958
// arg.extend_integer_width_to(arg_size + (xlen - 1) / xlen);
6059
// }
6160
if alignment.bits() == 2 * xlen {
62-
arg.cast_to(Uniform {
63-
unit: Reg::i64(),
64-
total: arg_size
65-
});
61+
arg.cast_to(Uniform { unit: Reg::i64(), total: arg_size });
6662
} else {
67-
//TODO array type - this should be a homogenous array type
63+
// FIXME array type - this should be a homogenous array type
6864
// arg.extend_integer_width_to(arg_size + (xlen - 1) / xlen);
6965
}
7066
} else {
@@ -73,30 +69,26 @@ fn classify_arg_ty<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64, remaining_gpr: &mut
7369
arg.make_indirect();
7470
}
7571

76-
// if arg_size as u64 <= MAX_ARG_IN_REGS_SIZE {
77-
// let align = arg.layout.align.abi.bytes();
78-
// let total = arg.layout.size;
79-
// arg.cast_to(Uniform {
80-
// unit: if align <= 4 { Reg::i32() } else { Reg::i64() },
81-
// total
82-
// });
83-
// return;
84-
// }
72+
// if arg_size as u64 <= MAX_ARG_IN_REGS_SIZE {
73+
// let align = arg.layout.align.abi.bytes();
74+
// let total = arg.layout.size;
75+
// arg.cast_to(Uniform {
76+
// unit: if align <= 4 { Reg::i32() } else { Reg::i64() },
77+
// total
78+
// });
79+
// return;
80+
// }
8581
}
8682

8783
pub fn compute_abi_info<Ty>(fty: &mut FnAbi<'_, Ty>, xlen: u64) {
8884
if !fty.ret.is_ignore() {
8985
classify_ret_ty(&mut fty.ret, xlen);
9086
}
9187

92-
let return_indirect = fty.ret.layout.size.bits() > MAX_RET_IN_REGS_SIZE ||
93-
fty.ret.is_indirect();
88+
let return_indirect =
89+
fty.ret.layout.size.bits() > MAX_RET_IN_REGS_SIZE || fty.ret.is_indirect();
9490

95-
let mut remaining_gpr = if return_indirect {
96-
NUM_ARG_GPR - 1
97-
} else {
98-
NUM_ARG_GPR
99-
};
91+
let mut remaining_gpr = if return_indirect { NUM_ARG_GPR - 1 } else { NUM_ARG_GPR };
10092

10193
for arg in &mut fty.args {
10294
if arg.is_ignore() {

src/librustc_target/spec/xtensa_esp32_none_elf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult, abi::Abi};
1+
use crate::spec::{abi::Abi, LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult};
22
// use crate::spec::abi::Abi;
33

44
pub fn target() -> TargetResult {
@@ -60,7 +60,7 @@ pub fn target() -> TargetResult {
6060
Abi::SysV64,
6161
],
6262

63-
.. Default::default( )
64-
}
63+
..Default::default()
64+
},
6565
})
6666
}

src/librustc_target/spec/xtensa_esp8266_none_elf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult, abi::Abi};
1+
use crate::spec::{abi::Abi, LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult};
22
// use crate::spec::abi::Abi;
33

44
pub fn target() -> TargetResult {
@@ -60,7 +60,7 @@ pub fn target() -> TargetResult {
6060
Abi::SysV64,
6161
],
6262

63-
.. Default::default( )
64-
}
63+
..Default::default()
64+
},
6565
})
6666
}

src/librustc_target/spec/xtensa_none_elf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult, abi::Abi};
1+
use crate::spec::{abi::Abi, LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult};
22
// use crate::spec::abi::Abi;
33

44
pub fn target() -> TargetResult {
@@ -60,7 +60,7 @@ pub fn target() -> TargetResult {
6060
Abi::SysV64,
6161
],
6262

63-
.. Default::default( )
64-
}
63+
..Default::default()
64+
},
6565
})
6666
}

0 commit comments

Comments
 (0)