Remove unused code in machinst

This commit is contained in:
Benjamin Bouvier
2021-04-14 11:51:41 +02:00
parent aa5d837428
commit 91c65d739f
4 changed files with 3 additions and 48 deletions

View File

@@ -77,7 +77,6 @@ pub mod flowgraph;
pub mod ir; pub mod ir;
pub mod isa; pub mod isa;
pub mod loop_analysis; pub mod loop_analysis;
pub mod machinst;
pub mod print_errors; pub mod print_errors;
pub mod settings; pub mod settings;
pub mod timing; pub mod timing;
@@ -85,6 +84,7 @@ pub mod verifier;
pub mod write; pub mod write;
pub use crate::entity::packed_option; pub use crate::entity::packed_option;
pub use crate::machinst::buffer::MachSrcLoc;
mod abi; mod abi;
mod bitset; mod bitset;
@@ -98,6 +98,7 @@ mod iterators;
mod legalizer; mod legalizer;
mod licm; mod licm;
mod log; mod log;
mod machinst;
mod nan_canonicalization; mod nan_canonicalization;
mod partition_slice; mod partition_slice;
mod postopt; mod postopt;

View File

@@ -420,25 +420,11 @@ impl BlockLoweringOrder {
&self.lowered_order[..] &self.lowered_order[..]
} }
/// Get the successors for a lowered block, by index in `lowered_order()`'s
/// returned slice. Each successsor is paired with the edge-instruction
/// (branch) corresponding to this edge.
pub fn succs(&self, block: BlockIndex) -> &[(Inst, LoweredBlock)] {
let range = self.lowered_succ_ranges[block as usize];
&self.lowered_succs[range.0..range.1]
}
/// Get the successor indices for a lowered block. /// Get the successor indices for a lowered block.
pub fn succ_indices(&self, block: BlockIndex) -> &[(Inst, BlockIndex)] { pub fn succ_indices(&self, block: BlockIndex) -> &[(Inst, BlockIndex)] {
let range = self.lowered_succ_ranges[block as usize]; let range = self.lowered_succ_ranges[block as usize];
&self.lowered_succ_indices[range.0..range.1] &self.lowered_succ_indices[range.0..range.1]
} }
/// Get the lowered block index containing a CLIF block, if any. (May not be
/// present if the original CLIF block was unreachable.)
pub fn lowered_block_for_bb(&self, bb: Block) -> Option<BlockIndex> {
self.orig_map[bb]
}
} }
#[cfg(test)] #[cfg(test)]

View File

@@ -41,8 +41,6 @@ use std::string::String;
pub type InsnIndex = u32; pub type InsnIndex = u32;
/// Index referring to a basic block in VCode. /// Index referring to a basic block in VCode.
pub type BlockIndex = u32; pub type BlockIndex = u32;
/// Range of an instructions in VCode.
pub type InsnRange = core::ops::Range<InsnIndex>;
/// VCodeInst wraps all requirements for a MachInst to be in VCode: it must be /// VCodeInst wraps all requirements for a MachInst to be in VCode: it must be
/// a `MachInst` and it must be able to emit itself at least to a `SizeCodeSink`. /// a `MachInst` and it must be able to emit itself at least to a `SizeCodeSink`.
@@ -207,11 +205,6 @@ impl<I: VCodeInst> VCodeBuilder<I> {
} }
} }
/// Are there any reference-typed values at all among the vregs?
pub fn have_ref_values(&self) -> bool {
self.vcode.have_ref_values()
}
/// Set the current block as the entry block. /// Set the current block as the entry block.
pub fn set_entry(&mut self, block: BlockIndex) { pub fn set_entry(&mut self, block: BlockIndex) {
self.vcode.entry = block; self.vcode.entry = block;
@@ -264,11 +257,6 @@ impl<I: VCodeInst> VCodeBuilder<I> {
} }
} }
/// Get the current source location.
pub fn get_srcloc(&self) -> SourceLoc {
self.cur_srcloc
}
/// Set the current source location. /// Set the current source location.
pub fn set_srcloc(&mut self, srcloc: SourceLoc) { pub fn set_srcloc(&mut self, srcloc: SourceLoc) {
self.cur_srcloc = srcloc; self.cur_srcloc = srcloc;
@@ -344,16 +332,6 @@ impl<I: VCodeInst> VCode<I> {
self.vreg_types[vreg.get_index()] self.vreg_types[vreg.get_index()]
} }
/// Are there any reference-typed values at all among the vregs?
pub fn have_ref_values(&self) -> bool {
self.have_ref_values
}
/// Get the entry block.
pub fn entry(&self) -> BlockIndex {
self.entry
}
/// Get the number of blocks. Block indices will be in the range `0 .. /// Get the number of blocks. Block indices will be in the range `0 ..
/// (self.num_blocks() - 1)`. /// (self.num_blocks() - 1)`.
pub fn num_blocks(&self) -> usize { pub fn num_blocks(&self) -> usize {
@@ -365,11 +343,6 @@ impl<I: VCodeInst> VCode<I> {
self.abi.frame_size() self.abi.frame_size()
} }
/// Inbound stack-args size.
pub fn stack_args_size(&self) -> u32 {
self.abi.stack_args_size()
}
/// Get the successors for a block. /// Get the successors for a block.
pub fn succs(&self, block: BlockIndex) -> &[BlockIx] { pub fn succs(&self, block: BlockIndex) -> &[BlockIx] {
let (start, end) = self.block_succ_range[block as usize]; let (start, end) = self.block_succ_range[block as usize];
@@ -886,11 +859,6 @@ impl VCodeConstants {
} }
} }
/// Retrieve a byte slice for the given [VCodeConstant], if available.
pub fn get(&self, constant: VCodeConstant) -> Option<&[u8]> {
self.constants.get(constant).map(|d| d.as_slice())
}
/// Return the number of constants inserted. /// Return the number of constants inserted.
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.constants.len() self.constants.len()

View File

@@ -91,8 +91,8 @@
use crate::func_environ::{get_func_name, FuncEnvironment}; use crate::func_environ::{get_func_name, FuncEnvironment};
use cranelift_codegen::ir::{self, ExternalName}; use cranelift_codegen::ir::{self, ExternalName};
use cranelift_codegen::isa::{CallConv, TargetIsa}; use cranelift_codegen::isa::{CallConv, TargetIsa};
use cranelift_codegen::machinst::buffer::MachSrcLoc;
use cranelift_codegen::print_errors::pretty_error; use cranelift_codegen::print_errors::pretty_error;
use cranelift_codegen::MachSrcLoc;
use cranelift_codegen::{binemit, isa, Context}; use cranelift_codegen::{binemit, isa, Context};
use cranelift_wasm::{DefinedFuncIndex, FuncIndex, FuncTranslator, SignatureIndex, WasmType}; use cranelift_wasm::{DefinedFuncIndex, FuncIndex, FuncTranslator, SignatureIndex, WasmType};
use std::convert::TryFrom; use std::convert::TryFrom;