Use the term "EBB parameter" everywhere.

Add EBB parameter and EBB argument to the langref glossary to clarify
the distinction between formal EBB parameter values and arguments passed
to branches.

- Replace "ebb_arg" with "ebb_param" in function names that deal with
  EBB parameters.
- Rename the ValueDef variants to Result and Param.
- A bunch of other small langref fixes.

No functional changes intended.
This commit is contained in:
Jakob Stoklund Olesen
2017-10-19 14:15:23 -07:00
parent ea68a69f8b
commit 921bcc6c25
30 changed files with 392 additions and 366 deletions

View File

@@ -26,19 +26,10 @@ pub fn expand_global_addr(inst: ir::Inst, func: &mut ir::Function, _cfg: &mut Co
/// Expand a `global_addr` instruction for a vmctx global.
fn vmctx_addr(inst: ir::Inst, func: &mut ir::Function, offset: i64) {
// Find the incoming `vmctx` function argument. Start searching from the back since the special
// arguments are appended by signature legalization.
//
// This argument must exist; `vmctx` global variables can not be used in functions with calling
// conventions that don't add a `vmctx` argument.
let argidx = func.signature
.argument_types
.iter()
.rposition(|abi| abi.purpose == ir::ArgumentPurpose::VMContext)
.expect("Need vmctx argument for vmctx global");
// Get the value representing the `vmctx` argument.
let vmctx = func.dfg.ebb_args(func.layout.entry_block().unwrap())[argidx];
let vmctx = func.special_arg(ir::ArgumentPurpose::VMContext).expect(
"Missing vmctx parameter",
);
// Simply replace the `global_addr` instruction with an `iadd_imm`, reusing the result value.
func.dfg.replace(inst).iadd_imm(vmctx, offset);