Merge remote-tracking branch 'origin/master' into no_std

This commit is contained in:
Dan Gohman
2018-04-18 17:17:43 -07:00
92 changed files with 508 additions and 295 deletions

View File

@@ -102,8 +102,7 @@ impl<'a> FlagsVerifier<'a> {
if self.encinfo
.as_ref()
.and_then(|ei| ei.operand_constraints(self.func.encodings[inst]))
.map(|c| c.clobbers_flags)
.unwrap_or(false) && live_val.is_some()
.map_or(false, |c| c.clobbers_flags) && live_val.is_some()
{
return err!(inst, "encoding clobbers live CPU flags in {}", live);
}

View File

@@ -78,7 +78,7 @@ impl<'a> LivenessVerifier<'a> {
if encoding.is_legal() {
// A legal instruction is not allowed to define ghost values.
if lr.affinity.is_none() {
if lr.affinity.is_unassigned() {
return err!(
inst,
"{} is a ghost value defined by a real [{}] instruction",
@@ -86,7 +86,7 @@ impl<'a> LivenessVerifier<'a> {
self.isa.encoding_info().display(encoding)
);
}
} else if !lr.affinity.is_none() {
} else if !lr.affinity.is_unassigned() {
// A non-encoded instruction can only define ghost values.
return err!(
inst,
@@ -108,7 +108,7 @@ impl<'a> LivenessVerifier<'a> {
}
// A legal instruction is not allowed to depend on ghost values.
if encoding.is_legal() && lr.affinity.is_none() {
if encoding.is_legal() && lr.affinity.is_unassigned() {
return err!(
inst,
"{} is a ghost value used by a real [{}] instruction",

View File

@@ -200,7 +200,7 @@ impl<'a> Verifier<'a> {
);
}
if is_last_inst && !is_terminator {
return err!(ebb, "block does not end in a terminator instruction!");
return err!(ebb, "block does not end in a terminator instruction");
}
// Instructions belong to the correct ebb.
@@ -237,9 +237,9 @@ impl<'a> Verifier<'a> {
let fixed_results = inst_data.opcode().constraints().fixed_results();
// var_results is 0 if we aren't a call instruction
let var_results = dfg.call_signature(inst)
.map(|sig| dfg.signatures[sig].returns.len())
.unwrap_or(0);
let var_results = dfg.call_signature(inst).map_or(0, |sig| {
dfg.signatures[sig].returns.len()
});
let total_results = fixed_results + var_results;
// All result values for multi-valued instructions are created
@@ -1156,7 +1156,7 @@ mod tests {
macro_rules! assert_err_with_msg {
($e:expr, $msg:expr) => {
match $e {
Ok(_) => panic!("Expected an error!"),
Ok(_) => panic!("Expected an error"),
Err(Error { message, .. }) => {
if !message.contains($msg) {
#[cfg(feature = "std")]