#[non_exhaustive]pub enum RegAllocError {
Mir(MirError),
PhysLiveIn {
block: Block,
reg: PReg,
},
PhysClobbered {
block: Block,
reg: PReg,
},
TooLarge,
NoRegister {
class: RegClass,
},
}Expand description
Why a function could not be allocated.
§Examples
use backend_lang::mir::{Function, Operand};
use backend_lang::regalloc::{self, RegAllocError};
use backend_lang::x86_64::{op, GPR, SYSV};
let mut f = Function::new("f", &SYSV);
let b = f.block()?;
let v = f.vreg(GPR)?;
let w = f.vreg(GPR)?;
f.push(b, op::MOV64, &[w.into(), v.into()])?; // v is never defined
f.push(b, op::RET, &[])?;
assert!(matches!(regalloc::allocate(&mut f), Err(RegAllocError::Mir(_))));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Mir(MirError)
The function is malformed or not in SSA form
(Function::verify_ssa).
PhysLiveIn
A physical register is live into a block other than through the entry block’s parameters. Physical registers must be block-local: copy values out of them into virtual registers.
PhysClobbered
An instruction writes a physical register that holds a live value (two fixed-register ranges overlap).
TooLarge
The live sets exceed the budget.
NoRegister
No register of the class can hold a value even after spilling everything spillable (the class has no allocatable registers, or a single instruction needs more than the class has).
Trait Implementations§
Source§impl Clone for RegAllocError
impl Clone for RegAllocError
impl Copy for RegAllocError
Source§impl Debug for RegAllocError
impl Debug for RegAllocError
Source§impl Display for RegAllocError
impl Display for RegAllocError
impl Eq for RegAllocError
Source§impl Error for RegAllocError
impl Error for RegAllocError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<MirError> for RegAllocError
impl From<MirError> for RegAllocError
Source§fn from(e: MirError) -> RegAllocError
fn from(e: MirError) -> RegAllocError
Converts to this type from the input type.
Source§impl Hash for RegAllocError
impl Hash for RegAllocError
Source§impl PartialEq for RegAllocError
impl PartialEq for RegAllocError
impl StructuralPartialEq for RegAllocError
Auto Trait Implementations§
impl Freeze for RegAllocError
impl RefUnwindSafe for RegAllocError
impl Send for RegAllocError
impl Sync for RegAllocError
impl Unpin for RegAllocError
impl UnsafeUnpin for RegAllocError
impl UnwindSafe for RegAllocError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more