Skip to content

Commit 29912b0

Browse files
celinvaltedinski
authored andcommitted
rust-lang#295: Use upstream version of the monomorphizer (rust-lang#495)
Instead of keeping our own copy of the monomorphizer, we would like to start using rustc monomorphizer as is. This is the first step towards that goal. For now, we will use the upstream version of the monomorphizer with a few small changes. Use a query to skip monomorphization for rmc instead of hooks. This change, adds a query to allow RMC to skip monomorphizing functions. It also does the following: - Adds a default query to codegen base that don't skip anything. - Adds a query implementation to RMC that checks our hooks. - Skips monomorphizing the start function if --cfg=rmc Issue rust-lang#485 tracks the rest of the changes needed.
1 parent 42810a3 commit 29912b0

File tree

10 files changed

+46
-2047
lines changed

10 files changed

+46
-2047
lines changed

compiler/rustc_codegen_llvm/src/gotoc/mir_to_goto/compiler_interface.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use crate::gotoc::cbmc::goto_program::symtab_transformer;
77
use crate::gotoc::cbmc::goto_program::SymbolTable;
8-
use crate::gotoc::mir_to_goto::monomorphize;
8+
use crate::gotoc::mir_to_goto::overrides::skip_monomorphize;
99
use crate::gotoc::mir_to_goto::GotocCtx;
1010
use bitflags::_core::any::Any;
1111
use rustc_codegen_ssa::traits::CodegenBackend;
@@ -42,7 +42,7 @@ impl CodegenBackend for GotocCodegenBackend {
4242
}
4343

4444
fn provide(&self, providers: &mut Providers) {
45-
monomorphize::partitioning::provide(providers);
45+
providers.skip_monomorphize = skip_monomorphize;
4646
}
4747

4848
fn provide_extern(&self, _providers: &mut ty::query::Providers) {}

compiler/rustc_codegen_llvm/src/gotoc/mir_to_goto/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
mod codegen;
77
mod compiler_interface;
88
mod context;
9-
mod monomorphize;
109
mod overrides;
1110
mod utils;
1211

0 commit comments

Comments
 (0)