Merge commit '09fae60a86
' into sync_cg_clif-2024-03-28
This commit is contained in:
commit
987ed345af
24 changed files with 840 additions and 291 deletions
|
@ -1,12 +1,9 @@
|
|||
use cranelift_codegen::isa::TargetFrontendConfig;
|
||||
use gimli::write::FileId;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_middle::ty::layout::{
|
||||
FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers,
|
||||
};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::SourceFile;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::abi::{Integer, Primitive};
|
||||
use rustc_target::spec::{HasTargetSpec, Target};
|
||||
|
@ -294,7 +291,7 @@ pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> {
|
|||
pub(crate) instance: Instance<'tcx>,
|
||||
pub(crate) symbol_name: String,
|
||||
pub(crate) mir: &'tcx Body<'tcx>,
|
||||
pub(crate) fn_abi: Option<&'tcx FnAbi<'tcx, Ty<'tcx>>>,
|
||||
pub(crate) fn_abi: &'tcx FnAbi<'tcx, Ty<'tcx>>,
|
||||
|
||||
pub(crate) bcx: FunctionBuilder<'clif>,
|
||||
pub(crate) block_map: IndexVec<BasicBlock, Block>,
|
||||
|
@ -305,11 +302,6 @@ pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> {
|
|||
|
||||
pub(crate) clif_comments: crate::pretty_clif::CommentWriter,
|
||||
|
||||
/// Last accessed source file and it's debuginfo file id.
|
||||
///
|
||||
/// For optimization purposes only
|
||||
pub(crate) last_source_file: Option<(Lrc<SourceFile>, FileId)>,
|
||||
|
||||
/// This should only be accessed by `CPlace::new_var`.
|
||||
pub(crate) next_ssa_var: u32,
|
||||
}
|
||||
|
@ -419,25 +411,8 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
|
|||
|
||||
pub(crate) fn set_debug_loc(&mut self, source_info: mir::SourceInfo) {
|
||||
if let Some(debug_context) = &mut self.cx.debug_context {
|
||||
let (file, line, column) =
|
||||
DebugContext::get_span_loc(self.tcx, self.mir.span, source_info.span);
|
||||
|
||||
// add_source_file is very slow.
|
||||
// Optimize for the common case of the current file not being changed.
|
||||
let mut cached_file_id = None;
|
||||
if let Some((ref last_source_file, last_file_id)) = self.last_source_file {
|
||||
// If the allocations are not equal, the files may still be equal, but that
|
||||
// doesn't matter, as this is just an optimization.
|
||||
if rustc_data_structures::sync::Lrc::ptr_eq(last_source_file, &file) {
|
||||
cached_file_id = Some(last_file_id);
|
||||
}
|
||||
}
|
||||
|
||||
let file_id = if let Some(file_id) = cached_file_id {
|
||||
file_id
|
||||
} else {
|
||||
debug_context.add_source_file(&file)
|
||||
};
|
||||
let (file_id, line, column) =
|
||||
debug_context.get_span_loc(self.tcx, self.mir.span, source_info.span);
|
||||
|
||||
let source_loc =
|
||||
self.func_debug_cx.as_mut().unwrap().add_dbg_loc(file_id, line, column);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue