Skip to content

Commit 4fec62a

Browse files
authored
Rollup merge of rust-lang#135581 - EnzymeAD:refactor-codgencx, r=oli-obk
Separate Builder methods from tcx As part of the autodiff upstreaming we noticed, that it would be nice to have various builder methods available without the TypeContext, which prevents the normal CodegenCx to be passed around between threads. We introduce a SimpleCx which just owns the llvm module and llvm context, to encapsulate them. The previous CodegenCx now implements deref and forwards access to the llvm module or context to it's SimpleCx sub-struct. This gives us a bit more flexibility, because now we can pass (or construct) the SimpleCx in locations where we don't have enough information to construct a CodegenCx, or are not able to pass it around due to the tcx lifetimes (and it not implementing send/sync). This also introduces an SBuilder, similar to the SimpleCx. The SBuilder uses a SimpleCx, whereas the existing Builder uses the larger CodegenCx. I will push updates to make implementations generic (where possible) to be implemented once and work for either of the two. I'll also clean up the leftover code. `call` is a bit tricky, because it requires a tcx, I probably need to duplicate it after all. Tracking: - rust-lang#124509
2 parents c482251 + 0692ca3 commit 4fec62a

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ impl WriteBackendMethods for GccCodegenBackend {
444444
}
445445
fn autodiff(
446446
_cgcx: &CodegenContext<Self>,
447-
_tcx: TyCtxt<'_>,
448447
_module: &ModuleCodegen<Self::Module>,
449448
_diff_fncs: Vec<AutoDiffItem>,
450449
_config: &ModuleConfig,

0 commit comments

Comments
 (0)