Add a func_addr instruction.

Get the callable address of a function. Use for long distance calls and
for creating arguments to call_indirect in general.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-19 15:54:02 -07:00
parent 0cfea8858a
commit d92686d1cd
8 changed files with 42 additions and 8 deletions

View File

@@ -2098,6 +2098,14 @@ impl<'a> Parser<'a> {
args: args.into_value_list(&[callee], &mut ctx.function.dfg.value_lists),
}
}
InstructionFormat::FuncAddr => {
let func_ref = self.match_fn("expected function reference").and_then(
|num| {
ctx.get_fn(num, &self.loc)
},
)?;
InstructionData::FuncAddr { opcode, func_ref }
}
InstructionFormat::BranchTable => {
let arg = self.match_value("expected SSA value operand")?;
self.match_token(