Use the term "Function parameter" instead of "argument".
Rename the ArgumentType type to AbiParam since it describes the ABI characteristics of a parameter or return value, not just the value type. In Signature, rename members argument_types and return_types to "params" and "returns". Again, they are not just types. Fix a couple lingering references to "EBB arguments".
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
//! larger register class instead.
|
||||
|
||||
use std::fmt;
|
||||
use ir::{ArgumentType, ArgumentLoc};
|
||||
use ir::{AbiParam, ArgumentLoc};
|
||||
use isa::{TargetIsa, RegInfo, RegClassIndex, OperandConstraint, ConstraintKind};
|
||||
|
||||
/// Preferred register allocation for an SSA value.
|
||||
@@ -48,7 +48,7 @@ impl Affinity {
|
||||
}
|
||||
|
||||
/// Create an affinity that matches an ABI argument for `isa`.
|
||||
pub fn abi(arg: &ArgumentType, isa: &TargetIsa) -> Affinity {
|
||||
pub fn abi(arg: &AbiParam, isa: &TargetIsa) -> Affinity {
|
||||
match arg.location {
|
||||
ArgumentLoc::Unassigned => Affinity::None,
|
||||
ArgumentLoc::Reg(_) => Affinity::Reg(isa.regclass_for_abi_type(arg.value_type).into()),
|
||||
|
||||
@@ -418,14 +418,12 @@ impl<'a> Context<'a> {
|
||||
self.func.dfg.display_inst(pred_inst, self.isa)
|
||||
);
|
||||
|
||||
// Never coalesce incoming function arguments on the stack. These arguments are
|
||||
// Never coalesce incoming function parameters on the stack. These parameters are
|
||||
// pre-spilled, and the rest of the virtual register would be forced to spill to the
|
||||
// `incoming_arg` stack slot too.
|
||||
if let ValueDef::Param(def_ebb, def_num) = self.func.dfg.value_def(pred_val) {
|
||||
if Some(def_ebb) == self.func.layout.entry_block() &&
|
||||
self.func.signature.argument_types[def_num]
|
||||
.location
|
||||
.is_stack()
|
||||
self.func.signature.params[def_num].location.is_stack()
|
||||
{
|
||||
dbg!("Isolating incoming stack parameter {}", pred_val);
|
||||
let new_val = self.split_pred(pred_inst, pred_ebb, argnum, pred_val);
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
use cursor::{Cursor, EncCursor};
|
||||
use dominator_tree::DominatorTree;
|
||||
use ir::{Ebb, Inst, Value, Function, ValueLoc, SigRef};
|
||||
use ir::{InstBuilder, ArgumentType, ArgumentLoc, ValueDef};
|
||||
use ir::{InstBuilder, AbiParam, ArgumentLoc, ValueDef};
|
||||
use isa::{RegUnit, RegClass, RegInfo, regs_overlap};
|
||||
use isa::{TargetIsa, EncInfo, RecipeConstraints, OperandConstraint, ConstraintKind};
|
||||
use packed_option::PackedOption;
|
||||
@@ -188,10 +188,10 @@ impl<'a> Context<'a> {
|
||||
);
|
||||
|
||||
if self.cur.func.layout.entry_block() == Some(ebb) {
|
||||
// Arguments to the entry block have ABI constraints.
|
||||
self.color_entry_args(tracker.live())
|
||||
// Parameters on the entry block have ABI constraints.
|
||||
self.color_entry_params(tracker.live())
|
||||
} else {
|
||||
// The live-ins and arguments to a non-entry EBB have already been assigned a register.
|
||||
// The live-ins and parameters of a non-entry EBB have already been assigned a register.
|
||||
// Reconstruct the allocatable set.
|
||||
self.livein_regs(tracker.live())
|
||||
}
|
||||
@@ -230,19 +230,19 @@ impl<'a> Context<'a> {
|
||||
regs
|
||||
}
|
||||
|
||||
/// Color the arguments to the entry block.
|
||||
/// Color the parameters on the entry block.
|
||||
///
|
||||
/// These are function arguments that should already have assigned register units in the
|
||||
/// These are function parameters that should already have assigned register units in the
|
||||
/// function signature.
|
||||
///
|
||||
/// Return the set of remaining allocatable registers after filtering out the dead arguments.
|
||||
fn color_entry_args(&mut self, args: &[LiveValue]) -> AvailableRegs {
|
||||
fn color_entry_params(&mut self, args: &[LiveValue]) -> AvailableRegs {
|
||||
let sig = &self.cur.func.signature;
|
||||
assert_eq!(sig.argument_types.len(), args.len());
|
||||
assert_eq!(sig.params.len(), args.len());
|
||||
|
||||
let mut regs = AvailableRegs::new(&self.usable_regs);
|
||||
|
||||
for (lv, abi) in args.iter().zip(&sig.argument_types) {
|
||||
for (lv, abi) in args.iter().zip(&sig.params) {
|
||||
match lv.affinity {
|
||||
Affinity::Reg(rci) => {
|
||||
let rc = self.reginfo.rc(rci);
|
||||
@@ -305,7 +305,7 @@ impl<'a> Context<'a> {
|
||||
program_input_abi(
|
||||
&mut self.solver,
|
||||
inst,
|
||||
&self.cur.func.dfg.signatures[sig].argument_types,
|
||||
&self.cur.func.dfg.signatures[sig].params,
|
||||
&self.cur.func,
|
||||
&self.liveness,
|
||||
&self.reginfo,
|
||||
@@ -315,7 +315,7 @@ impl<'a> Context<'a> {
|
||||
program_input_abi(
|
||||
&mut self.solver,
|
||||
inst,
|
||||
&self.cur.func.signature.return_types,
|
||||
&self.cur.func.signature.returns,
|
||||
&self.cur.func,
|
||||
&self.liveness,
|
||||
&self.reginfo,
|
||||
@@ -687,12 +687,9 @@ impl<'a> Context<'a> {
|
||||
// It's technically possible for a call instruction to have fixed results before the
|
||||
// variable list of results, but we have no known instances of that.
|
||||
// Just assume all results are variable return values.
|
||||
assert_eq!(
|
||||
defs.len(),
|
||||
self.cur.func.dfg.signatures[sig].return_types.len()
|
||||
);
|
||||
assert_eq!(defs.len(), self.cur.func.dfg.signatures[sig].returns.len());
|
||||
for (i, lv) in defs.iter().enumerate() {
|
||||
let abi = self.cur.func.dfg.signatures[sig].return_types[i];
|
||||
let abi = self.cur.func.dfg.signatures[sig].returns[i];
|
||||
if let ArgumentLoc::Reg(reg) = abi.location {
|
||||
if let Affinity::Reg(rci) = lv.affinity {
|
||||
let rc = self.reginfo.rc(rci);
|
||||
@@ -1015,7 +1012,7 @@ impl<'a> Context<'a> {
|
||||
fn program_input_abi(
|
||||
solver: &mut Solver,
|
||||
inst: Inst,
|
||||
abi_types: &[ArgumentType],
|
||||
abi_types: &[AbiParam],
|
||||
func: &Function,
|
||||
liveness: &Liveness,
|
||||
reginfo: &RegInfo,
|
||||
|
||||
@@ -216,7 +216,7 @@ fn get_or_create<'a>(
|
||||
.or_else(|| {
|
||||
// If this is a call, get the return value affinity.
|
||||
func.dfg.call_signature(inst).map(|sig| {
|
||||
Affinity::abi(&func.dfg.signatures[sig].return_types[rnum], isa)
|
||||
Affinity::abi(&func.dfg.signatures[sig].returns[rnum], isa)
|
||||
})
|
||||
})
|
||||
.unwrap_or_default();
|
||||
@@ -226,7 +226,7 @@ fn get_or_create<'a>(
|
||||
if func.layout.entry_block() == Some(ebb) {
|
||||
// The affinity for entry block parameters can be inferred from the function
|
||||
// signature.
|
||||
affinity = Affinity::abi(&func.signature.argument_types[num], isa);
|
||||
affinity = Affinity::abi(&func.signature.params[num], isa);
|
||||
} else {
|
||||
// Don't apply any affinity to normal EBB parameters.
|
||||
// They could be in a register or on the stack.
|
||||
|
||||
@@ -13,7 +13,7 @@ use cursor::{Cursor, EncCursor};
|
||||
use dominator_tree::DominatorTree;
|
||||
use entity::{SparseMap, SparseMapValue};
|
||||
use ir::{Ebb, Inst, Value, Function};
|
||||
use ir::{InstBuilder, ArgumentType, ArgumentLoc};
|
||||
use ir::{InstBuilder, AbiParam, ArgumentLoc};
|
||||
use isa::RegClass;
|
||||
use isa::{TargetIsa, Encoding, EncInfo, RecipeConstraints, ConstraintKind};
|
||||
use regalloc::affinity::Affinity;
|
||||
@@ -137,20 +137,20 @@ impl<'a> Context<'a> {
|
||||
|
||||
if self.cur.func.layout.entry_block() == Some(ebb) {
|
||||
assert_eq!(liveins.len(), 0);
|
||||
self.visit_entry_args(ebb, args);
|
||||
self.visit_entry_params(ebb, args);
|
||||
} else {
|
||||
self.visit_ebb_params(ebb, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// Visit the arguments to the entry block.
|
||||
/// Visit the parameters on the entry block.
|
||||
/// These values have ABI constraints from the function signature.
|
||||
fn visit_entry_args(&mut self, ebb: Ebb, args: &[LiveValue]) {
|
||||
assert_eq!(self.cur.func.signature.argument_types.len(), args.len());
|
||||
fn visit_entry_params(&mut self, ebb: Ebb, args: &[LiveValue]) {
|
||||
assert_eq!(self.cur.func.signature.params.len(), args.len());
|
||||
self.cur.goto_first_inst(ebb);
|
||||
|
||||
for (arg_idx, arg) in args.iter().enumerate() {
|
||||
let abi = self.cur.func.signature.argument_types[arg_idx];
|
||||
let abi = self.cur.func.signature.params[arg_idx];
|
||||
match abi.location {
|
||||
ArgumentLoc::Reg(_) => {
|
||||
if arg.affinity.is_stack() {
|
||||
@@ -266,7 +266,7 @@ impl<'a> Context<'a> {
|
||||
"Extra results on non-call instruction",
|
||||
);
|
||||
for (i, lv) in retvals.iter().enumerate() {
|
||||
let abi = self.cur.func.dfg.signatures[sig].return_types[i];
|
||||
let abi = self.cur.func.dfg.signatures[sig].returns[i];
|
||||
debug_assert!(abi.location.is_reg());
|
||||
if lv.affinity.is_stack() {
|
||||
let reg = self.cur.func.dfg.replace_result(lv.value, abi.value_type);
|
||||
@@ -308,7 +308,7 @@ impl<'a> Context<'a> {
|
||||
if let Some(sig) = self.cur.func.dfg.call_signature(inst) {
|
||||
handle_abi_args(
|
||||
self.candidates,
|
||||
&self.cur.func.dfg.signatures[sig].argument_types,
|
||||
&self.cur.func.dfg.signatures[sig].params,
|
||||
var_args,
|
||||
self.cur.isa,
|
||||
self.liveness,
|
||||
@@ -316,7 +316,7 @@ impl<'a> Context<'a> {
|
||||
} else if self.cur.func.dfg[inst].opcode().is_return() {
|
||||
handle_abi_args(
|
||||
self.candidates,
|
||||
&self.cur.func.signature.return_types,
|
||||
&self.cur.func.signature.returns,
|
||||
var_args,
|
||||
self.cur.isa,
|
||||
self.liveness,
|
||||
@@ -348,7 +348,7 @@ impl<'a> Context<'a> {
|
||||
/// return values and call arguments.
|
||||
fn handle_abi_args(
|
||||
candidates: &mut Vec<ReloadCandidate>,
|
||||
abi_types: &[ArgumentType],
|
||||
abi_types: &[AbiParam],
|
||||
var_args: &[Value],
|
||||
isa: &TargetIsa,
|
||||
liveness: &Liveness,
|
||||
|
||||
@@ -324,7 +324,7 @@ impl<'a> Context<'a> {
|
||||
let args = self.cur.func.dfg.inst_variable_args(inst);
|
||||
for (idx, (abi, &arg)) in
|
||||
self.cur.func.dfg.signatures[sig]
|
||||
.argument_types
|
||||
.params
|
||||
.iter()
|
||||
.zip(args)
|
||||
.enumerate()
|
||||
|
||||
Reference in New Issue
Block a user