Skip to content

Commit

Permalink
Remove ancient register allocation (#3401)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnjbvr authored Sep 30, 2021
1 parent 80336f4 commit bae4ec6
Show file tree
Hide file tree
Showing 66 changed files with 112 additions and 15,380 deletions.
180 changes: 0 additions & 180 deletions cranelift/codegen/src/abi.rs

This file was deleted.

21 changes: 2 additions & 19 deletions cranelift/codegen/src/binemit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@
//! binary machine code.

mod memorysink;
mod relaxation;
mod shrink;
mod stack_map;

pub use self::memorysink::{
MemoryCodeSink, NullRelocSink, NullStackMapSink, NullTrapSink, RelocSink, StackMapSink,
TrapSink,
};
pub use self::relaxation::relax_branches;
pub use self::shrink::shrink_instructions;
pub use self::stack_map::StackMap;
use crate::ir::entities::Value;
use crate::ir::{
ConstantOffset, ExternalName, Function, Inst, JumpTable, Opcode, SourceLoc, TrapCode,
};
use crate::isa::TargetIsa;
pub use crate::regalloc::RegDiversions;
use core::fmt;
#[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -183,31 +178,19 @@ pub trait CodeSink {
}
}

/// Report a bad encoding error.
#[cold]
pub fn bad_encoding(func: &Function, inst: Inst) -> ! {
panic!(
"Bad encoding {} for {}",
func.encodings[inst],
func.dfg.display_inst(inst, None)
);
}

/// Emit a function to `sink`, given an instruction emitter function.
///
/// This function is called from the `TargetIsa::emit_function()` implementations with the
/// appropriate instruction emitter.
pub fn emit_function<CS, EI>(func: &Function, emit_inst: EI, sink: &mut CS, isa: &dyn TargetIsa)
where
CS: CodeSink,
EI: Fn(&Function, Inst, &mut RegDiversions, &mut CS, &dyn TargetIsa),
EI: Fn(&Function, Inst, &mut CS, &dyn TargetIsa),
{
let mut divert = RegDiversions::new();
for block in func.layout.blocks() {
divert.at_block(&func.entry_diversions, block);
debug_assert_eq!(func.offsets[block], sink.offset());
for inst in func.layout.block_insts(block) {
emit_inst(func, inst, &mut divert, sink, isa);
emit_inst(func, inst, sink, isa);
}
}

Expand Down
Loading

0 comments on commit bae4ec6

Please sign in to comment.