Use clippy (#276)
* cton-util: fix some clippy unnecessary pass-by-value warnings * clippy: ignore too many arguments / cyclomatic complexity in module since these functions are taking args coming from the command line, i dont think this is actually a valid lint, morally the arguments are all from one structure * cton-util: take care of remaining clippy warnings * cton-reader: fix all non-suspicious clippy warnings * cton-reader: disable clippy at site of suspicious lint * cton-frontend: disable clippy at the site of an invalid lint * cton-frontend: fix clippy warnings, or ignore benign ones * clippy: ignore the camelcase word WebAssembly in docs * cton-wasm: fix clippy complaints or ignore benign ones * cton-wasm tests: fix clippy complaints * cretonne: starting point turns off all clippy warnings * cretonne: clippy fixes, or lower allow() to source of problem * cretonne: more clippy fixes * cretonne: fix or disable needless_lifetimes lint this linter is buggy when the declared lifetime is used for another type constraint. * cretonne: fix clippy complaint about Pass::NoPass * rustfmt * fix prev minor api changes clippy suggested * add clippy to test-all * cton-filetests: clippy fixes * simplify clippy reporting in test-all * cretonne: document clippy allows better * cretonne: fix some more clippy lints * cretonne: fix clippy lints (mostly doc comments) * cretonne: allow all needless_lifetimes clippy warnings remove overrides at the false positives * rustfmt
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
//! For polymorphic opcodes, determine the controlling type variable first.
|
||||
//! - Branches and jumps must pass arguments to destination EBBs that match the
|
||||
//! expected types exactly. The number of arguments must match.
|
||||
//! - All EBBs in a jump_table must take no arguments.
|
||||
//! - All EBBs in a jump table must take no arguments.
|
||||
//! - Function calls are type checked against their signature.
|
||||
//! - The entry block must take arguments that match the signature of the current
|
||||
//! function.
|
||||
@@ -871,50 +871,47 @@ impl<'a> Verifier<'a> {
|
||||
// Check special-purpose type constraints that can't be expressed in the normal opcode
|
||||
// constraints.
|
||||
fn typecheck_special(&self, inst: Inst, ctrl_type: Type) -> Result {
|
||||
match self.func.dfg[inst] {
|
||||
ir::InstructionData::Unary { opcode, arg } => {
|
||||
let arg_type = self.func.dfg.value_type(arg);
|
||||
match opcode {
|
||||
Opcode::Bextend | Opcode::Uextend | Opcode::Sextend | Opcode::Fpromote => {
|
||||
if arg_type.lane_count() != ctrl_type.lane_count() {
|
||||
return err!(
|
||||
inst,
|
||||
"input {} and output {} must have same number of lanes",
|
||||
arg_type,
|
||||
ctrl_type
|
||||
);
|
||||
}
|
||||
if arg_type.lane_bits() >= ctrl_type.lane_bits() {
|
||||
return err!(
|
||||
inst,
|
||||
"input {} must be smaller than output {}",
|
||||
arg_type,
|
||||
ctrl_type
|
||||
);
|
||||
}
|
||||
if let ir::InstructionData::Unary { opcode, arg } = self.func.dfg[inst] {
|
||||
let arg_type = self.func.dfg.value_type(arg);
|
||||
match opcode {
|
||||
Opcode::Bextend | Opcode::Uextend | Opcode::Sextend | Opcode::Fpromote => {
|
||||
if arg_type.lane_count() != ctrl_type.lane_count() {
|
||||
return err!(
|
||||
inst,
|
||||
"input {} and output {} must have same number of lanes",
|
||||
arg_type,
|
||||
ctrl_type
|
||||
);
|
||||
}
|
||||
Opcode::Breduce | Opcode::Ireduce | Opcode::Fdemote => {
|
||||
if arg_type.lane_count() != ctrl_type.lane_count() {
|
||||
return err!(
|
||||
inst,
|
||||
"input {} and output {} must have same number of lanes",
|
||||
arg_type,
|
||||
ctrl_type
|
||||
);
|
||||
}
|
||||
if arg_type.lane_bits() <= ctrl_type.lane_bits() {
|
||||
return err!(
|
||||
inst,
|
||||
"input {} must be larger than output {}",
|
||||
arg_type,
|
||||
ctrl_type
|
||||
);
|
||||
}
|
||||
if arg_type.lane_bits() >= ctrl_type.lane_bits() {
|
||||
return err!(
|
||||
inst,
|
||||
"input {} must be smaller than output {}",
|
||||
arg_type,
|
||||
ctrl_type
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
Opcode::Breduce | Opcode::Ireduce | Opcode::Fdemote => {
|
||||
if arg_type.lane_count() != ctrl_type.lane_count() {
|
||||
return err!(
|
||||
inst,
|
||||
"input {} and output {} must have same number of lanes",
|
||||
arg_type,
|
||||
ctrl_type
|
||||
);
|
||||
}
|
||||
if arg_type.lane_bits() <= ctrl_type.lane_bits() {
|
||||
return err!(
|
||||
inst,
|
||||
"input {} must be larger than output {}",
|
||||
arg_type,
|
||||
ctrl_type
|
||||
);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user