Remove more old backend ISA concepts (#3402)
This also paves the way for unifying TargetIsa and MachBackend, since now they map one to one. In theory the two traits could be merged, which would be nice to limit the number of total concepts. Also they have quite different responsibilities, so it might be fine to keep them separate. Interestingly, this PR started as removing RegInfo from the TargetIsa trait since the adapter returned a dummy value there. From the fallout, noticed that all Display implementations didn't needed an ISA anymore (since these were only used to render ISA specific registers). Also the whole family of RegInfo / ValueLoc / RegUnit was exclusively used for the old backend, and these could be removed. Notably, some IR instructions needed to be removed, because they were using RegUnit too: this was the oddball of regfill / regmove / regspill / copy_special, which were IR instructions inserted by the old regalloc. Fare thee well!
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
//! Naming well-known routines in the runtime library.
|
||||
|
||||
use crate::ir::{
|
||||
types, AbiParam, ArgumentPurpose, ExtFuncData, ExternalName, FuncRef, Function, Opcode,
|
||||
Signature, Type,
|
||||
};
|
||||
use crate::isa::{CallConv, RegUnit, TargetIsa};
|
||||
use crate::ir::{types, ExternalName, FuncRef, Function, Opcode, Type};
|
||||
use core::fmt;
|
||||
use core::str::FromStr;
|
||||
#[cfg(feature = "enable-serde")]
|
||||
@@ -169,14 +165,8 @@ impl LibCall {
|
||||
/// Get a function reference for the probestack function in `func`.
|
||||
///
|
||||
/// If there is an existing reference, use it, otherwise make a new one.
|
||||
pub fn get_probestack_funcref(
|
||||
func: &mut Function,
|
||||
reg_type: Type,
|
||||
arg_reg: RegUnit,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
pub fn get_probestack_funcref(func: &mut Function) -> Option<FuncRef> {
|
||||
find_funcref(LibCall::Probestack, func)
|
||||
.unwrap_or_else(|| make_funcref_for_probestack(func, reg_type, arg_reg, isa))
|
||||
}
|
||||
|
||||
/// Get the existing function reference for `libcall` in `func` if it exists.
|
||||
@@ -196,38 +186,6 @@ fn find_funcref(libcall: LibCall, func: &Function) -> Option<FuncRef> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Create a funcref for `LibCall::Probestack`.
|
||||
fn make_funcref_for_probestack(
|
||||
func: &mut Function,
|
||||
reg_type: Type,
|
||||
arg_reg: RegUnit,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
let mut sig = Signature::new(CallConv::Probestack);
|
||||
let rax = AbiParam::special_reg(reg_type, ArgumentPurpose::Normal, arg_reg);
|
||||
sig.params.push(rax);
|
||||
if !isa.flags().probestack_func_adjusts_sp() {
|
||||
sig.returns.push(rax);
|
||||
}
|
||||
make_funcref(LibCall::Probestack, func, sig, isa)
|
||||
}
|
||||
|
||||
/// Create a funcref for `libcall`.
|
||||
fn make_funcref(
|
||||
libcall: LibCall,
|
||||
func: &mut Function,
|
||||
sig: Signature,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
let sigref = func.import_signature(sig);
|
||||
|
||||
func.import_function(ExtFuncData {
|
||||
name: ExternalName::LibCall(libcall),
|
||||
signature: sigref,
|
||||
colocated: isa.flags().use_colocated_libcalls(),
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user