Make CodegenCx and Builder generic
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
This commit is contained in:
parent
a48e7b0057
commit
386c233858
10 changed files with 239 additions and 56 deletions
|
@ -4,7 +4,6 @@ use std::sync::Arc;
|
|||
use rustc_ast::expand::autodiff_attrs::AutoDiffItem;
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
use rustc_errors::FatalError;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
||||
use super::write::CodegenContext;
|
||||
use crate::ModuleCodegen;
|
||||
|
@ -89,13 +88,12 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
|
|||
pub unsafe fn autodiff(
|
||||
self,
|
||||
cgcx: &CodegenContext<B>,
|
||||
tcx: TyCtxt<'_>,
|
||||
diff_fncs: Vec<AutoDiffItem>,
|
||||
config: &ModuleConfig,
|
||||
) -> Result<LtoModuleCodegen<B>, FatalError> {
|
||||
match &self {
|
||||
LtoModuleCodegen::Fat(module) => {
|
||||
B::autodiff(cgcx, tcx, &module, diff_fncs, config)?;
|
||||
B::autodiff(cgcx, &module, diff_fncs, config)?;
|
||||
}
|
||||
_ => panic!("autodiff called with non-fat LTO module"),
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use rustc_ast::expand::autodiff_attrs::AutoDiffItem;
|
||||
use rustc_errors::{DiagCtxtHandle, FatalError};
|
||||
use rustc_middle::dep_graph::WorkProduct;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
||||
use crate::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
|
||||
use crate::back::write::{CodegenContext, FatLtoInput, ModuleConfig};
|
||||
|
@ -65,7 +64,6 @@ pub trait WriteBackendMethods: 'static + Sized + Clone {
|
|||
fn serialize_module(module: ModuleCodegen<Self::Module>) -> (String, Self::ModuleBuffer);
|
||||
fn autodiff(
|
||||
cgcx: &CodegenContext<Self>,
|
||||
tcx: TyCtxt<'_>,
|
||||
module: &ModuleCodegen<Self::Module>,
|
||||
diff_fncs: Vec<AutoDiffItem>,
|
||||
config: &ModuleConfig,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue