[eddyb] rustc_codegen_llvm: remove unused parametrization of `CodegenCx` and `Builder` over `Value`s.

This commit is contained in:
Eduard-Mihai Burtescu 2018-11-16 13:48:26 +02:00
parent 0b569249c8
commit 756f84d7ce
4 changed files with 21 additions and 21 deletions

View File

@ -180,17 +180,17 @@ pub fn compile_codegen_unit<'ll, 'tcx>(tcx: TyCtxt<'ll, 'tcx, 'tcx>,
let mono_items = cx.codegen_unit
.items_in_deterministic_order(cx.tcx);
for &(mono_item, (linkage, visibility)) in &mono_items {
mono_item.predefine::<Builder<&Value>>(&cx, linkage, visibility);
mono_item.predefine::<Builder>(&cx, linkage, visibility);
}
// ... and now that we have everything pre-defined, fill out those definitions.
for &(mono_item, _) in &mono_items {
mono_item.define::<Builder<&Value>>(&cx);
mono_item.define::<Builder>(&cx);
}
// If this codegen unit contains the main function, also create the
// wrapper here
maybe_create_entry_wrapper::<Builder<&Value>>(&cx);
maybe_create_entry_wrapper::<Builder>(&cx);
// Run replace-all-uses-with for statics that need it
for &(old_g, new_g) in cx.statics_to_rauw().borrow().iter() {

View File

@ -34,12 +34,12 @@ use std::ptr;
// All Builders must have an llfn associated with them
#[must_use]
pub struct Builder<'a, 'll: 'a, 'tcx: 'll, V: 'll = &'ll Value> {
pub struct Builder<'a, 'll: 'a, 'tcx: 'll> {
pub llbuilder: &'ll mut llvm::Builder<'ll>,
pub cx: &'a CodegenCx<'ll, 'tcx, V>,
pub cx: &'a CodegenCx<'ll, 'tcx>,
}
impl<V> Drop for Builder<'a, 'll, 'tcx, V> {
impl Drop for Builder<'a, 'll, 'tcx> {
fn drop(&mut self) {
unsafe {
llvm::LLVMDisposeBuilder(&mut *(self.llbuilder as *mut _));

View File

@ -47,7 +47,7 @@ use abi::Abi;
/// There is one `CodegenCx` per compilation unit. Each one has its own LLVM
/// `llvm::Context` so that several compilation units may be optimized in parallel.
/// All other LLVM data structures in the `CodegenCx` are tied to that `llvm::Context`.
pub struct CodegenCx<'ll, 'tcx: 'll, V = &'ll Value> {
pub struct CodegenCx<'ll, 'tcx: 'll> {
pub tcx: TyCtxt<'ll, 'tcx, 'tcx>,
pub check_overflow: bool,
pub use_dll_storage_attrs: bool,
@ -59,11 +59,11 @@ pub struct CodegenCx<'ll, 'tcx: 'll, V = &'ll Value> {
pub codegen_unit: Arc<CodegenUnit<'tcx>>,
/// Cache instances of monomorphic and polymorphic items
pub instances: RefCell<FxHashMap<Instance<'tcx>, V>>,
pub instances: RefCell<FxHashMap<Instance<'tcx>, &'ll Value>>,
/// Cache generated vtables
pub vtables: RefCell<FxHashMap<(Ty<'tcx>, ty::PolyExistentialTraitRef<'tcx>), V>>,
pub vtables: RefCell<FxHashMap<(Ty<'tcx>, ty::PolyExistentialTraitRef<'tcx>), &'ll Value>>,
/// Cache of constant strings,
pub const_cstr_cache: RefCell<FxHashMap<LocalInternedString, V>>,
pub const_cstr_cache: RefCell<FxHashMap<LocalInternedString, &'ll Value>>,
/// Reverse-direction for const ptrs cast from globals.
/// Key is a Value holding a *T,
@ -73,20 +73,20 @@ pub struct CodegenCx<'ll, 'tcx: 'll, V = &'ll Value> {
/// when we ptrcast, and we have to ptrcast during codegen
/// of a [T] const because we form a slice, a (*T,usize) pair, not
/// a pointer to an LLVM array type. Similar for trait objects.
pub const_unsized: RefCell<FxHashMap<V, V>>,
pub const_unsized: RefCell<FxHashMap<&'ll Value, &'ll Value>>,
/// Cache of emitted const globals (value -> global)
pub const_globals: RefCell<FxHashMap<V, V>>,
pub const_globals: RefCell<FxHashMap<&'ll Value, &'ll Value>>,
/// List of globals for static variables which need to be passed to the
/// LLVM function ReplaceAllUsesWith (RAUW) when codegen is complete.
/// (We have to make sure we don't invalidate any Values referring
/// to constants.)
pub statics_to_rauw: RefCell<Vec<(V, V)>>,
pub statics_to_rauw: RefCell<Vec<(&'ll Value, &'ll Value)>>,
/// Statics that will be placed in the llvm.used variable
/// See http://llvm.org/docs/LangRef.html#the-llvm-used-global-variable for details
pub used_statics: RefCell<Vec<V>>,
pub used_statics: RefCell<Vec<&'ll Value>>,
pub lltypes: RefCell<FxHashMap<(Ty<'tcx>, Option<VariantIdx>), &'ll Type>>,
pub scalar_lltypes: RefCell<FxHashMap<Ty<'tcx>, &'ll Type>>,
@ -95,11 +95,11 @@ pub struct CodegenCx<'ll, 'tcx: 'll, V = &'ll Value> {
pub dbg_cx: Option<debuginfo::CrateDebugContext<'ll, 'tcx>>,
eh_personality: Cell<Option<V>>,
eh_unwind_resume: Cell<Option<V>>,
pub rust_try_fn: Cell<Option<V>>,
eh_personality: Cell<Option<&'ll Value>>,
eh_unwind_resume: Cell<Option<&'ll Value>>,
pub rust_try_fn: Cell<Option<&'ll Value>>,
intrinsics: RefCell<FxHashMap<&'static str, V>>,
intrinsics: RefCell<FxHashMap<&'static str, &'ll Value>>,
/// A counter that is used for generating local symbol names
local_gen_sym_counter: Cell<usize>,

View File

@ -29,12 +29,12 @@ While the LLVM-specific code will be left in `rustc_codegen_llvm`, all the new t
The two most important structures for the LLVM codegen are `CodegenCx` and `Builder`. They are parametrized by multiple liftime parameters and the type for `Value`.
```rust
struct CodegenCx<'ll, 'tcx: 'll, V: 'll = &'ll Value> {
struct CodegenCx<'ll, 'tcx: 'll> {
/* ... */
}
struct Builder<'a, 'll: 'a, 'tcx: 'll, V: 'll = &'ll Value> {
cx: &'a CodegenCx<'ll, 'tcx, V>,
struct Builder<'a, 'll: 'a, 'tcx: 'll> {
cx: &'a CodegenCx<'ll, 'tcx>,
/* ... */
}
```