Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
0a298ed
Show files produced by --emit foo in json artifact notifications
pacak Apr 6, 2024
ed7d97e
Merge commit '3270432f4b0583104c8b9b6f695bf97d6bbf3ac2' into sync_cg_…
bjorn3 May 13, 2024
f0dffd9
Merge branch 'sync_from_rust'
bjorn3 May 13, 2024
8aa7112
Rename Unsafe to Safety
spastorino May 17, 2024
6965b4a
Remove `Rvalue::CheckedBinaryOp`
scottmcm May 16, 2024
0c204c3
Sync from rust b1ec1bd65f89c1375d2cf2fb733a87ef390276d3
bjorn3 May 19, 2024
bff31bd
Rustup to rustc 1.80.0-nightly (b1ec1bd65 2024-05-18)
bjorn3 May 19, 2024
8cea8a7
Fix rustc test suite
bjorn3 May 19, 2024
7a53ba2
cg_clif: support simd_ctpop
workingjubilee May 20, 2024
14134c1
Rollup merge of #125173 - scottmcm:never-checked, r=davidtwco
matthiaskrgr May 20, 2024
39daa5a
Update to Cranelift 0.108
bjorn3 May 20, 2024
2c219ce
Rollup merge of #125266 - workingjubilee:stream-plastic-love, r=RalfJ…
matthiaskrgr May 21, 2024
715f226
rustc_codegen_llvm: add support for writing summary bitcode
durin42 Jan 19, 2024
cc6c5ec
Sync from rust 9cdfe285ca724c801dc9f78d22b24ea69b787f26
bjorn3 May 23, 2024
8bb463a
Rustup to rustc 1.80.0-nightly (9cdfe285c 2024-05-22)
bjorn3 May 23, 2024
ba8c695
Stop passing --check-cfg to rustc
bjorn3 May 23, 2024
05b1415
Rollup merge of #125345 - durin42:thin-link-bitcode, r=bjorn3
GuillaumeGomez May 23, 2024
9ddcc59
Omit non-needs_drop drop_in_place in vtables
Mark-Simulacrum Mar 17, 2024
676fec7
Add an intrinsic for `ptr::metadata`
scottmcm Apr 21, 2024
db4dbc8
Rollup merge of #124251 - scottmcm:unop-ptr-metadata, r=oli-obk
jieyouxu May 29, 2024
a0ea60b
Sync from rust debd22da66cfa97c74040ebf68e420672ac8560e
bjorn3 May 30, 2024
a255965
Rustup to rustc 1.80.0-nightly (debd22da6 2024-05-29)
bjorn3 May 30, 2024
ab10da2
Fix rustc test suite
bjorn3 May 30, 2024
8f1d41e
Implement _rdtsc x86 vendor intrinsic
bjorn3 Jun 2, 2024
be961b0
Auto merge of #122597 - pacak:master, r=bjorn3
bors Jun 4, 2024
eb449c1
Move error on -Cinstrument-coverage earlier and elaborate that it is …
bjorn3 Jun 4, 2024
97d47f7
Fix rustc tests
bjorn3 Jun 4, 2024
4067700
Don't require the bench job to pass for a new release
bjorn3 Jun 4, 2024
632e5df
Remove unreachable fatal error
bjorn3 Jun 4, 2024
5d0ec8d
Misc fixes to cranelift/clippy/miri
BoxyUwU Jun 4, 2024
63cb28e
add `llvm.x86.sse2.cvtps2dq`
folkertdev Jun 6, 2024
c511676
Merge pull request #1495 from folkertdev/add-llvm-sse2-cvtps2dq
bjorn3 Jun 6, 2024
6210c26
offset_of: allow (unstably) taking the offset of slice tail fields
RalfJung Jun 8, 2024
0eb782b
ScalarInt: size mismatches are a bug, do not delay the panic
RalfJung Jun 8, 2024
c0477a1
Sync from rust b5b13568fb5da4ac988bde370008d6134d3dfe6c
bjorn3 Jun 11, 2024
c06cbc8
Rustup to rustc 1.81.0-nightly (b5b13568f 2024-06-10)
bjorn3 Jun 11, 2024
ee188ca
Fix rustc test suite
bjorn3 Jun 11, 2024
02b20f8
Update a cranelift patch file for formatting changes.
nnethercote Jun 11, 2024
0b7375f
Use `tidy` to sort crate attributes for all compiler crates.
nnethercote Jun 12, 2024
4e0af7c
Require any function with a tait in its signature to actually constra…
oli-obk Jun 10, 2024
03a2764
Rollup merge of #126301 - nnethercote:sort-crate-attributes, r=davidtwco
workingjubilee Jun 12, 2024
c7d3c4f
Auto merge of #126319 - workingjubilee:rollup-lendnud, r=workingjubilee
bors Jun 12, 2024
c867677
Use is_lang_item more aggressively
compiler-errors Jun 14, 2024
5ccfa78
Only compute vtable information during codegen
compiler-errors Jun 15, 2024
5c6849b
Auto merge of #126505 - compiler-errors:no-vtable, r=lcnr
bors Jun 16, 2024
54aa510
Rename InstanceDef -> InstanceKind
compiler-errors Jun 17, 2024
0d1d004
Sync from rust d7f6ebacee13b6c03623c4b74197280454ede8de
bjorn3 Jun 17, 2024
a4b36e5
Rustup to rustc 1.81.0-nightly (d7f6ebace 2024-06-16)
bjorn3 Jun 17, 2024
e241176
Fix rustc tests
bjorn3 Jun 17, 2024
afef64c
Use a dedicated type instead of a reference for the diagnostic context
oli-obk Jun 18, 2024
88a5f32
Sync from rust 59e2c01c2217a01546222e4d9ff4e6695ee8a1db
bjorn3 Jun 18, 2024
c5bd2e3
Rustup to rustc 1.81.0-nightly (59e2c01c2 2024-06-17)
bjorn3 Jun 18, 2024
729cb08
Fix rustc tests
bjorn3 Jun 18, 2024
1cb7282
Re-enable `tests/run-make/const_fn_mir` (#1497)
GuillaumeGomez Jun 18, 2024
e79dc76
`bug!` more uses of these in runtime stuff
scottmcm Jun 15, 2024
8556604
Fix varargs support on `aarch64-apple-darwin`
beetrees Jun 18, 2024
b0fcf2e
Add `aarch64-apple-darwin` to CI
beetrees Jun 18, 2024
cdad523
Merge pull request #1500 from beetrees/mac-arm64-va-call
bjorn3 Jun 20, 2024
2a37825
Update to Cranelift 0.109
bjorn3 Jun 5, 2024
aa5d7a0
Update platform support table for the new arm64 macOS support
bjorn3 Jun 21, 2024
f1052eb
cg_clif: Define build opts from FramePointer
workingjubilee May 4, 2024
dbf7018
Fix simd_gather documentation
betelgeuse Jun 24, 2024
8d11939
Sync from rust fda509e817abeeecb5b76bc1de844f355675c81e
bjorn3 Jun 26, 2024
476b7bd
Rustup to rustc 1.81.0-nightly (fda509e81 2024-06-25)
bjorn3 Jun 26, 2024
94c2e7a
Fix rustc test suite
bjorn3 Jun 26, 2024
c053e89
Remove the `box_pointers` lint.
nnethercote Jun 5, 2024
cc05efe
Introduce UnwindModule wrapper around a Module and UnwindContext
bjorn3 Jun 28, 2024
e97cebb
Use dyn Module instead of impl Module where possible
bjorn3 Jun 28, 2024
3d54358
Update object to 0.36.1
bjorn3 Jun 29, 2024
35f2093
small correction to fmt::Pointer impl
Sky9x Jun 28, 2024
30be8bc
Remove --cfg no_unstable_features
bjorn3 Jun 29, 2024
4560034
Stop pinning XCode 14
bjorn3 Jun 29, 2024
617de8c
coverage: Move span unexpansion into its own submodule
Zalathar Jun 30, 2024
ad575b0
Replace a magic boolean with enum `DeclareLetBindings`
Zalathar Jun 26, 2024
3b22589
Replace a magic boolean with enum `EmitStorageLive`
Zalathar Jun 26, 2024
ed07712
Replace a magic boolean with enum `ScheduleDrops`
Zalathar Jun 26, 2024
6c33149
coverage: Avoid getting extra unexpansion info when we don't need it
Zalathar Jun 30, 2024
4b516f5
Improve `run-make-support` library `args` API
GuillaumeGomez Jun 30, 2024
8a0e1ab
Add a regression test for #123630
pacak Jun 30, 2024
49cd5dd
Rustup to rustc 1.81.0-nightly (ba1d7f4a0 2024-06-29)
bjorn3 Jun 30, 2024
9ec6a02
Merge commit '49cd5dd454d0115cfbe9e39102a8b3ba4616aa40' into sync_cg_…
bjorn3 Jun 30, 2024
fb021c1
Rollup merge of #126018 - nnethercote:rm-box_pointers-lint, r=lcnr
matthiaskrgr Jun 30, 2024
3787ac9
Rollup merge of #126895 - betelgeuse:improve_simd_gather_documentatio…
matthiaskrgr Jun 30, 2024
e592e5c
Rollup merge of #126981 - Zalathar:enums, r=Nadrieril
matthiaskrgr Jun 30, 2024
5bb4229
Rollup merge of #127069 - Sky9x:fmt-pointer-use-addr, r=Nilstrieb
matthiaskrgr Jun 30, 2024
e9d04d2
Rollup merge of #127157 - Zalathar:unexpand, r=cjgillot
matthiaskrgr Jun 30, 2024
7207dd6
Rollup merge of #127160 - pacak:123630-test, r=Nadrieril
matthiaskrgr Jun 30, 2024
e5efa9f
Rollup merge of #127161 - GuillaumeGomez:improve-run-make-args, r=Kobzol
matthiaskrgr Jun 30, 2024
a0aa7ab
Rollup merge of #127162 - bjorn3:sync_cg_clif-2024-06-30, r=bjorn3
matthiaskrgr Jun 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Introduce UnwindModule wrapper around a Module and UnwindContext
This way all UnwindContext::add_function calls can be done automatically
in a single place.
  • Loading branch information
bjorn3 committed Jun 28, 2024
commit cc05efe29e7184efa127d235d00be6ec2332d123
10 changes: 1 addition & 9 deletions src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@ use rustc_session::config::OomStrategy;
use crate::prelude::*;

/// Returns whether an allocator shim was created
pub(crate) fn codegen(
tcx: TyCtxt<'_>,
module: &mut impl Module,
unwind_context: &mut UnwindContext,
) -> bool {
pub(crate) fn codegen(tcx: TyCtxt<'_>, module: &mut impl Module) -> bool {
let Some(kind) = allocator_kind_for_codegen(tcx) else { return false };
codegen_inner(
module,
unwind_context,
kind,
tcx.alloc_error_handler_kind(()).unwrap(),
tcx.sess.opts.unstable_opts.oom,
Expand All @@ -29,7 +24,6 @@ pub(crate) fn codegen(

fn codegen_inner(
module: &mut impl Module,
unwind_context: &mut UnwindContext,
kind: AllocatorKind,
alloc_error_handler_kind: AllocatorKind,
oom_strategy: OomStrategy,
Expand Down Expand Up @@ -67,7 +61,6 @@ fn codegen_inner(
};
crate::common::create_wrapper_function(
module,
unwind_context,
sig,
&global_fn_name(method.name),
&default_fn_name(method.name),
Expand All @@ -82,7 +75,6 @@ fn codegen_inner(
};
crate::common::create_wrapper_function(
module,
unwind_context,
sig,
"__rust_alloc_error_handler",
&alloc_error_handler_name(alloc_error_handler_kind),
Expand Down
3 changes: 0 additions & 3 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,7 @@ pub(crate) fn compile_fn(
}

// Define debuginfo for function
let isa = module.isa();
let debug_context = &mut cx.debug_context;
let unwind_context = &mut cx.unwind_context;
cx.profiler.generic_activity("generate debug info").run(|| {
if let Some(debug_context) = debug_context {
codegened_func.func_debug_cx.unwrap().finalize(
Expand All @@ -260,7 +258,6 @@ pub(crate) fn compile_fn(
context,
);
}
unwind_context.add_function(codegened_func.func_id, &context, isa);
});
}

Expand Down
2 changes: 0 additions & 2 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ pub(crate) fn type_sign(ty: Ty<'_>) -> bool {

pub(crate) fn create_wrapper_function(
module: &mut dyn Module,
unwind_context: &mut UnwindContext,
sig: Signature,
wrapper_name: &str,
callee_name: &str,
Expand Down Expand Up @@ -280,7 +279,6 @@ pub(crate) fn create_wrapper_function(
bcx.finalize();
}
module.define_function(wrapper_func_id, &mut ctx).unwrap();
unwind_context.add_function(wrapper_func_id, &ctx, module.isa());
}

pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> {
Expand Down
31 changes: 11 additions & 20 deletions src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use rustc_session::Session;
use crate::concurrency_limiter::{ConcurrencyLimiter, ConcurrencyLimiterToken};
use crate::debuginfo::TypeDebugContext;
use crate::global_asm::GlobalAsmConfig;
use crate::unwind_module::UnwindModule;
use crate::{prelude::*, BackendConfig};

struct ModuleCodegenResult {
Expand Down Expand Up @@ -318,7 +319,11 @@ fn produce_final_output_artifacts(
// These are used in linking steps and will be cleaned up afterward.
}

fn make_module(sess: &Session, backend_config: &BackendConfig, name: String) -> ObjectModule {
fn make_module(
sess: &Session,
backend_config: &BackendConfig,
name: String,
) -> UnwindModule<ObjectModule> {
let isa = crate::build_isa(sess, backend_config);

let mut builder =
Expand All @@ -327,16 +332,15 @@ fn make_module(sess: &Session, backend_config: &BackendConfig, name: String) ->
// is important, while cg_clif cares more about compilation times. Enabling -Zfunction-sections
// can easily double the amount of time necessary to perform linking.
builder.per_function_section(sess.opts.unstable_opts.function_sections.unwrap_or(false));
ObjectModule::new(builder)
UnwindModule::new(ObjectModule::new(builder), true)
}

fn emit_cgu(
output_filenames: &OutputFilenames,
prof: &SelfProfilerRef,
name: String,
module: ObjectModule,
module: UnwindModule<ObjectModule>,
debug: Option<DebugContext>,
unwind_context: UnwindContext,
global_asm_object_file: Option<PathBuf>,
producer: &str,
) -> Result<ModuleCodegenResult, String> {
Expand All @@ -346,8 +350,6 @@ fn emit_cgu(
debug.emit(&mut product);
}

unwind_context.emit(&mut product);

let module_regular = emit_module(
output_filenames,
prof,
Expand Down Expand Up @@ -494,7 +496,6 @@ fn module_codegen(

let mut cx = crate::CodegenCx::new(
tcx,
backend_config.clone(),
module.isa(),
tcx.sess.opts.debuginfo != DebugInfo::None,
cgu_name,
Expand Down Expand Up @@ -531,13 +532,7 @@ fn module_codegen(
}
}
}
crate::main_shim::maybe_create_entry_wrapper(
tcx,
&mut module,
&mut cx.unwind_context,
false,
cgu.is_primary(),
);
crate::main_shim::maybe_create_entry_wrapper(tcx, &mut module, false, cgu.is_primary());

let cgu_name = cgu.name().as_str().to_owned();

Expand Down Expand Up @@ -571,7 +566,6 @@ fn module_codegen(
cgu_name,
module,
cx.debug_context,
cx.unwind_context,
global_asm_object_file,
&producer,
)
Expand Down Expand Up @@ -665,13 +659,10 @@ pub(crate) fn run_aot(
});

let mut allocator_module = make_module(tcx.sess, &backend_config, "allocator_shim".to_string());
let mut allocator_unwind_context = UnwindContext::new(allocator_module.isa(), true);
let created_alloc_shim =
crate::allocator::codegen(tcx, &mut allocator_module, &mut allocator_unwind_context);
let created_alloc_shim = crate::allocator::codegen(tcx, &mut allocator_module);

let allocator_module = if created_alloc_shim {
let mut product = allocator_module.finish();
allocator_unwind_context.emit(&mut product);
let product = allocator_module.finish();

match emit_module(
tcx.output_filenames(()),
Expand Down
50 changes: 16 additions & 34 deletions src/driver/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ use rustc_session::Session;
use rustc_span::Symbol;

use crate::debuginfo::TypeDebugContext;
use crate::unwind_module::UnwindModule;
use crate::{prelude::*, BackendConfig};
use crate::{CodegenCx, CodegenMode};

struct JitState {
backend_config: BackendConfig,
jit_module: JITModule,
jit_module: UnwindModule<JITModule>,
}

thread_local! {
Expand Down Expand Up @@ -63,7 +63,7 @@ fn create_jit_module(
tcx: TyCtxt<'_>,
backend_config: &BackendConfig,
hotswap: bool,
) -> (JITModule, CodegenCx) {
) -> (UnwindModule<JITModule>, CodegenCx) {
let crate_info = CrateInfo::new(tcx, "dummy_target_cpu".to_string());

let isa = crate::build_isa(tcx.sess, backend_config);
Expand All @@ -72,17 +72,11 @@ fn create_jit_module(
crate::compiler_builtins::register_functions_for_jit(&mut jit_builder);
jit_builder.symbol_lookup_fn(dep_symbol_lookup_fn(tcx.sess, crate_info));
jit_builder.symbol("__clif_jit_fn", clif_jit_fn as *const u8);
let mut jit_module = JITModule::new(jit_builder);
let mut jit_module = UnwindModule::new(JITModule::new(jit_builder), false);

let mut cx = crate::CodegenCx::new(
tcx,
backend_config.clone(),
jit_module.isa(),
false,
Symbol::intern("dummy_cgu_name"),
);
let cx = crate::CodegenCx::new(tcx, jit_module.isa(), false, Symbol::intern("dummy_cgu_name"));

crate::allocator::codegen(tcx, &mut jit_module, &mut cx.unwind_context);
crate::allocator::codegen(tcx, &mut jit_module);

(jit_module, cx)
}
Expand Down Expand Up @@ -128,7 +122,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
);
}
CodegenMode::JitLazy => {
codegen_shim(tcx, &mut cx, &mut cached_context, &mut jit_module, inst)
codegen_shim(tcx, &mut cached_context, &mut jit_module, inst)
}
},
MonoItem::Static(def_id) => {
Expand All @@ -146,18 +140,11 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
tcx.dcx().fatal("Inline asm is not supported in JIT mode");
}

crate::main_shim::maybe_create_entry_wrapper(
tcx,
&mut jit_module,
&mut cx.unwind_context,
true,
true,
);
crate::main_shim::maybe_create_entry_wrapper(tcx, &mut jit_module, true, true);

tcx.dcx().abort_if_errors();

jit_module.finalize_definitions().unwrap();
unsafe { cx.unwind_context.register_jit(&jit_module) };
jit_module.finalize_definitions();

println!(
"Rustc codegen cranelift will JIT run the executable, because -Cllvm-args=mode=jit was passed"
Expand All @@ -177,12 +164,12 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
call_conv: jit_module.target_config().default_call_conv,
};
let start_func_id = jit_module.declare_function("main", Linkage::Import, &start_sig).unwrap();
let finalized_start: *const u8 = jit_module.get_finalized_function(start_func_id);
let finalized_start: *const u8 = jit_module.module.get_finalized_function(start_func_id);

LAZY_JIT_STATE.with(|lazy_jit_state| {
let mut lazy_jit_state = lazy_jit_state.borrow_mut();
assert!(lazy_jit_state.is_none());
*lazy_jit_state = Some(JitState { backend_config, jit_module });
*lazy_jit_state = Some(JitState { jit_module });
});

let f: extern "C" fn(c_int, *const *const c_char) -> c_int =
Expand Down Expand Up @@ -268,7 +255,6 @@ fn jit_fn(instance_ptr: *const Instance<'static>, trampoline_ptr: *const u8) ->
let mut lazy_jit_state = lazy_jit_state.borrow_mut();
let lazy_jit_state = lazy_jit_state.as_mut().unwrap();
let jit_module = &mut lazy_jit_state.jit_module;
let backend_config = lazy_jit_state.backend_config.clone();

let name = tcx.symbol_name(instance).name;
let sig = crate::abi::get_function_sig(
Expand All @@ -278,7 +264,7 @@ fn jit_fn(instance_ptr: *const Instance<'static>, trampoline_ptr: *const u8) ->
);
let func_id = jit_module.declare_function(name, Linkage::Export, &sig).unwrap();

let current_ptr = jit_module.read_got_entry(func_id);
let current_ptr = jit_module.module.read_got_entry(func_id);

// If the function's GOT entry has already been updated to point at something other
// than the shim trampoline, don't re-jit but just return the new pointer instead.
Expand All @@ -288,21 +274,19 @@ fn jit_fn(instance_ptr: *const Instance<'static>, trampoline_ptr: *const u8) ->
return current_ptr;
}

jit_module.prepare_for_function_redefine(func_id).unwrap();
jit_module.module.prepare_for_function_redefine(func_id).unwrap();

let mut cx = crate::CodegenCx::new(
tcx,
backend_config,
jit_module.isa(),
false,
Symbol::intern("dummy_cgu_name"),
);
codegen_and_compile_fn(tcx, &mut cx, &mut Context::new(), jit_module, instance);

assert!(cx.global_asm.is_empty());
jit_module.finalize_definitions().unwrap();
unsafe { cx.unwind_context.register_jit(&jit_module) };
jit_module.get_finalized_function(func_id)
jit_module.finalize_definitions();
jit_module.module.get_finalized_function(func_id)
})
})
}
Expand Down Expand Up @@ -362,9 +346,8 @@ fn dep_symbol_lookup_fn(

fn codegen_shim<'tcx>(
tcx: TyCtxt<'tcx>,
cx: &mut CodegenCx,
cached_context: &mut Context,
module: &mut JITModule,
module: &mut UnwindModule<JITModule>,
inst: Instance<'tcx>,
) {
let pointer_type = module.target_config().pointer_type();
Expand Down Expand Up @@ -413,5 +396,4 @@ fn codegen_shim<'tcx>(
trampoline_builder.ins().return_(&ret_vals);

module.define_function(func_id, context).unwrap();
cx.unwind_context.add_function(func_id, context, module.isa());
}
16 changes: 2 additions & 14 deletions src/inline_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,7 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
);
let sig =
get_function_sig(fx.tcx, fx.target_config.default_call_conv, instance);
create_wrapper_function(
fx.module,
&mut fx.cx.unwind_context,
sig,
&wrapper_name,
symbol.name,
);
create_wrapper_function(fx.module, sig, &wrapper_name, symbol.name);

CInlineAsmOperand::Symbol { symbol: wrapper_name }
} else {
Expand Down Expand Up @@ -283,13 +277,7 @@ pub(crate) fn codegen_naked_asm<'tcx>(
);
let sig =
get_function_sig(tcx, module.target_config().default_call_conv, instance);
create_wrapper_function(
module,
&mut cx.unwind_context,
sig,
&wrapper_name,
symbol.name,
);
create_wrapper_function(module, sig, &wrapper_name, symbol.name);

CInlineAsmOperand::Symbol { symbol: wrapper_name }
} else {
Expand Down
13 changes: 2 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ mod pretty_clif;
mod toolchain;
mod trap;
mod unsize;
mod unwind_module;
mod value_and_place;
mod vtable;

Expand Down Expand Up @@ -130,22 +131,13 @@ struct CodegenCx {
global_asm: String,
inline_asm_index: Cell<usize>,
debug_context: Option<DebugContext>,
unwind_context: UnwindContext,
cgu_name: Symbol,
}

impl CodegenCx {
fn new(
tcx: TyCtxt<'_>,
backend_config: BackendConfig,
isa: &dyn TargetIsa,
debug_info: bool,
cgu_name: Symbol,
) -> Self {
fn new(tcx: TyCtxt<'_>, isa: &dyn TargetIsa, debug_info: bool, cgu_name: Symbol) -> Self {
assert_eq!(pointer_ty(tcx), isa.pointer_type());

let unwind_context =
UnwindContext::new(isa, matches!(backend_config.codegen_mode, CodegenMode::Aot));
let debug_context = if debug_info && !tcx.sess.target.options.is_like_windows {
Some(DebugContext::new(tcx, isa, cgu_name.as_str()))
} else {
Expand All @@ -158,7 +150,6 @@ impl CodegenCx {
global_asm: String::new(),
inline_asm_index: Cell::new(0),
debug_context,
unwind_context,
cgu_name,
}
}
Expand Down
Loading