|
@ -29,12 +29,7 @@ use sourcemap::{SourceMap, MutableSourceMap}; |
|
|
///
|
|
|
///
|
|
|
/// Any test commands or ISA declarations are ignored.
|
|
|
/// Any test commands or ISA declarations are ignored.
|
|
|
pub fn parse_functions(text: &str) -> Result<Vec<Function>> { |
|
|
pub fn parse_functions(text: &str) -> Result<Vec<Function>> { |
|
|
parse_test(text).map(|file| { |
|
|
parse_test(text).map(|file| file.functions.into_iter().map(|(func, _)| func).collect()) |
|
|
file.functions |
|
|
|
|
|
.into_iter() |
|
|
|
|
|
.map(|(func, _)| func) |
|
|
|
|
|
.collect() |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Parse the entire `text` as a test case file.
|
|
|
/// Parse the entire `text` as a test case file.
|
|
@ -753,9 +748,7 @@ impl<'a> Parser<'a> { |
|
|
sig.return_types = self.parse_argument_list(unique_isa)?; |
|
|
sig.return_types = self.parse_argument_list(unique_isa)?; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if sig.argument_types |
|
|
if sig.argument_types.iter().all(|a| a.location.is_assigned()) { |
|
|
.iter() |
|
|
|
|
|
.all(|a| a.location.is_assigned()) { |
|
|
|
|
|
sig.compute_argument_bytes(); |
|
|
sig.compute_argument_bytes(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1319,8 +1312,7 @@ impl<'a> Parser<'a> { |
|
|
inst_data: &InstructionData) |
|
|
inst_data: &InstructionData) |
|
|
-> Result<Type> { |
|
|
-> Result<Type> { |
|
|
let constraints = opcode.constraints(); |
|
|
let constraints = opcode.constraints(); |
|
|
let ctrl_type = |
|
|
let ctrl_type = match explicit_ctrl_type { |
|
|
match explicit_ctrl_type { |
|
|
|
|
|
Some(t) => t, |
|
|
Some(t) => t, |
|
|
None => { |
|
|
None => { |
|
|
if constraints.use_typevar_operand() { |
|
|
if constraints.use_typevar_operand() { |
|
@ -1333,13 +1325,16 @@ impl<'a> Parser<'a> { |
|
|
let ctrl_src_value = inst_data |
|
|
let ctrl_src_value = inst_data |
|
|
.typevar_operand(&ctx.function.dfg.value_lists) |
|
|
.typevar_operand(&ctx.function.dfg.value_lists) |
|
|
.expect("Constraints <-> Format inconsistency"); |
|
|
.expect("Constraints <-> Format inconsistency"); |
|
|
ctx.function.dfg.value_type(match ctx.map.get_value(ctrl_src_value) { |
|
|
ctx.function |
|
|
|
|
|
.dfg |
|
|
|
|
|
.value_type(match ctx.map.get_value(ctrl_src_value) { |
|
|
Some(v) => v, |
|
|
Some(v) => v, |
|
|
None => { |
|
|
None => { |
|
|
if let Some(v) = ctx.aliases |
|
|
if let Some(v) = ctx.aliases |
|
|
.get(&ctrl_src_value) |
|
|
.get(&ctrl_src_value) |
|
|
.and_then(|&(aliased, _)| ctx.map.get_value(aliased)) |
|
|
.and_then(|&(aliased, _)| { |
|
|
{ |
|
|
ctx.map.get_value(aliased) |
|
|
|
|
|
}) { |
|
|
v |
|
|
v |
|
|
} else { |
|
|
} else { |
|
|
return err!(self.loc, |
|
|
return err!(self.loc, |
|
@ -1616,8 +1611,7 @@ impl<'a> Parser<'a> { |
|
|
InstructionFormat::BranchTable => { |
|
|
InstructionFormat::BranchTable => { |
|
|
let arg = self.match_value("expected SSA value operand")?; |
|
|
let arg = self.match_value("expected SSA value operand")?; |
|
|
self.match_token(Token::Comma, "expected ',' between operands")?; |
|
|
self.match_token(Token::Comma, "expected ',' between operands")?; |
|
|
let table = self.match_jt() |
|
|
let table = self.match_jt().and_then(|num| ctx.get_jt(num, &self.loc))?; |
|
|
.and_then(|num| ctx.get_jt(num, &self.loc))?; |
|
|
|
|
|
InstructionData::BranchTable { opcode, arg, table } |
|
|
InstructionData::BranchTable { opcode, arg, table } |
|
|
} |
|
|
} |
|
|
InstructionFormat::StackLoad => { |
|
|
InstructionFormat::StackLoad => { |
|
|