Skip to content

Commit 756f84d

Browse files
committed
[eddyb] rustc_codegen_llvm: remove unused parametrization of CodegenCx and Builder over Values.
1 parent 0b56924 commit 756f84d

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/librustc_codegen_llvm/base.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,17 @@ pub fn compile_codegen_unit<'ll, 'tcx>(tcx: TyCtxt<'ll, 'tcx, 'tcx>,
180180
let mono_items = cx.codegen_unit
181181
.items_in_deterministic_order(cx.tcx);
182182
for &(mono_item, (linkage, visibility)) in &mono_items {
183-
mono_item.predefine::<Builder<&Value>>(&cx, linkage, visibility);
183+
mono_item.predefine::<Builder>(&cx, linkage, visibility);
184184
}
185185

186186
// ... and now that we have everything pre-defined, fill out those definitions.
187187
for &(mono_item, _) in &mono_items {
188-
mono_item.define::<Builder<&Value>>(&cx);
188+
mono_item.define::<Builder>(&cx);
189189
}
190190

191191
// If this codegen unit contains the main function, also create the
192192
// wrapper here
193-
maybe_create_entry_wrapper::<Builder<&Value>>(&cx);
193+
maybe_create_entry_wrapper::<Builder>(&cx);
194194

195195
// Run replace-all-uses-with for statics that need it
196196
for &(old_g, new_g) in cx.statics_to_rauw().borrow().iter() {

src/librustc_codegen_llvm/builder.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ use std::ptr;
3434

3535
// All Builders must have an llfn associated with them
3636
#[must_use]
37-
pub struct Builder<'a, 'll: 'a, 'tcx: 'll, V: 'll = &'ll Value> {
37+
pub struct Builder<'a, 'll: 'a, 'tcx: 'll> {
3838
pub llbuilder: &'ll mut llvm::Builder<'ll>,
39-
pub cx: &'a CodegenCx<'ll, 'tcx, V>,
39+
pub cx: &'a CodegenCx<'ll, 'tcx>,
4040
}
4141

42-
impl<V> Drop for Builder<'a, 'll, 'tcx, V> {
42+
impl Drop for Builder<'a, 'll, 'tcx> {
4343
fn drop(&mut self) {
4444
unsafe {
4545
llvm::LLVMDisposeBuilder(&mut *(self.llbuilder as *mut _));

src/librustc_codegen_llvm/context.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use abi::Abi;
4747
/// There is one `CodegenCx` per compilation unit. Each one has its own LLVM
4848
/// `llvm::Context` so that several compilation units may be optimized in parallel.
4949
/// All other LLVM data structures in the `CodegenCx` are tied to that `llvm::Context`.
50-
pub struct CodegenCx<'ll, 'tcx: 'll, V = &'ll Value> {
50+
pub struct CodegenCx<'ll, 'tcx: 'll> {
5151
pub tcx: TyCtxt<'ll, 'tcx, 'tcx>,
5252
pub check_overflow: bool,
5353
pub use_dll_storage_attrs: bool,
@@ -59,11 +59,11 @@ pub struct CodegenCx<'ll, 'tcx: 'll, V = &'ll Value> {
5959
pub codegen_unit: Arc<CodegenUnit<'tcx>>,
6060

6161
/// Cache instances of monomorphic and polymorphic items
62-
pub instances: RefCell<FxHashMap<Instance<'tcx>, V>>,
62+
pub instances: RefCell<FxHashMap<Instance<'tcx>, &'ll Value>>,
6363
/// Cache generated vtables
64-
pub vtables: RefCell<FxHashMap<(Ty<'tcx>, ty::PolyExistentialTraitRef<'tcx>), V>>,
64+
pub vtables: RefCell<FxHashMap<(Ty<'tcx>, ty::PolyExistentialTraitRef<'tcx>), &'ll Value>>,
6565
/// Cache of constant strings,
66-
pub const_cstr_cache: RefCell<FxHashMap<LocalInternedString, V>>,
66+
pub const_cstr_cache: RefCell<FxHashMap<LocalInternedString, &'ll Value>>,
6767

6868
/// Reverse-direction for const ptrs cast from globals.
6969
/// Key is a Value holding a *T,
@@ -73,20 +73,20 @@ pub struct CodegenCx<'ll, 'tcx: 'll, V = &'ll Value> {
7373
/// when we ptrcast, and we have to ptrcast during codegen
7474
/// of a [T] const because we form a slice, a (*T,usize) pair, not
7575
/// a pointer to an LLVM array type. Similar for trait objects.
76-
pub const_unsized: RefCell<FxHashMap<V, V>>,
76+
pub const_unsized: RefCell<FxHashMap<&'ll Value, &'ll Value>>,
7777

7878
/// Cache of emitted const globals (value -> global)
79-
pub const_globals: RefCell<FxHashMap<V, V>>,
79+
pub const_globals: RefCell<FxHashMap<&'ll Value, &'ll Value>>,
8080

8181
/// List of globals for static variables which need to be passed to the
8282
/// LLVM function ReplaceAllUsesWith (RAUW) when codegen is complete.
8383
/// (We have to make sure we don't invalidate any Values referring
8484
/// to constants.)
85-
pub statics_to_rauw: RefCell<Vec<(V, V)>>,
85+
pub statics_to_rauw: RefCell<Vec<(&'ll Value, &'ll Value)>>,
8686

8787
/// Statics that will be placed in the llvm.used variable
8888
/// See http://llvm.org/docs/LangRef.html#the-llvm-used-global-variable for details
89-
pub used_statics: RefCell<Vec<V>>,
89+
pub used_statics: RefCell<Vec<&'ll Value>>,
9090

9191
pub lltypes: RefCell<FxHashMap<(Ty<'tcx>, Option<VariantIdx>), &'ll Type>>,
9292
pub scalar_lltypes: RefCell<FxHashMap<Ty<'tcx>, &'ll Type>>,
@@ -95,11 +95,11 @@ pub struct CodegenCx<'ll, 'tcx: 'll, V = &'ll Value> {
9595

9696
pub dbg_cx: Option<debuginfo::CrateDebugContext<'ll, 'tcx>>,
9797

98-
eh_personality: Cell<Option<V>>,
99-
eh_unwind_resume: Cell<Option<V>>,
100-
pub rust_try_fn: Cell<Option<V>>,
98+
eh_personality: Cell<Option<&'ll Value>>,
99+
eh_unwind_resume: Cell<Option<&'ll Value>>,
100+
pub rust_try_fn: Cell<Option<&'ll Value>>,
101101

102-
intrinsics: RefCell<FxHashMap<&'static str, V>>,
102+
intrinsics: RefCell<FxHashMap<&'static str, &'ll Value>>,
103103

104104
/// A counter that is used for generating local symbol names
105105
local_gen_sym_counter: Cell<usize>,

src/librustc_codegen_ssa/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ While the LLVM-specific code will be left in `rustc_codegen_llvm`, all the new t
2929
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`.
3030

3131
```rust
32-
struct CodegenCx<'ll, 'tcx: 'll, V: 'll = &'ll Value> {
32+
struct CodegenCx<'ll, 'tcx: 'll> {
3333
/* ... */
3434
}
3535

36-
struct Builder<'a, 'll: 'a, 'tcx: 'll, V: 'll = &'ll Value> {
37-
cx: &'a CodegenCx<'ll, 'tcx, V>,
36+
struct Builder<'a, 'll: 'a, 'tcx: 'll> {
37+
cx: &'a CodegenCx<'ll, 'tcx>,
3838
/* ... */
3939
}
4040
```

0 commit comments

Comments
 (0)