Skip to content

Commit da0cf8c

Browse files
committed
Added 'll lifetime parameter to backend
1 parent c71c6cc commit da0cf8c

26 files changed

+450
-450
lines changed

src/librustc_codegen_llvm/abi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl<'a, 'll: 'a, 'tcx: 'll> ArgTypeMethods<'a, 'll, 'tcx> for Builder<'a, 'll,
284284
fn store_fn_arg(
285285
&self,
286286
ty: &ArgType<'tcx, Ty<'tcx>>,
287-
idx: &mut usize, dst: PlaceRef<'tcx, <Self::CodegenCx as Backend>::Value>
287+
idx: &mut usize, dst: PlaceRef<'tcx, <Self::CodegenCx as Backend<'ll>>::Value>
288288
) {
289289
ty.store_fn_arg(&self, idx, dst)
290290
}
@@ -797,7 +797,7 @@ impl AbiBuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx, &'ll Value> {
797797
fn apply_attrs_callsite(
798798
&self,
799799
ty: &FnType<'tcx, Ty<'tcx>>,
800-
callsite: <Self::CodegenCx as Backend>::Value
800+
callsite: <Self::CodegenCx as Backend<'ll>>::Value
801801
) {
802802
ty.apply_attrs_callsite(&self, callsite)
803803
}

src/librustc_codegen_llvm/base.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ pub fn bin_op_to_fcmp_predicate(op: hir::BinOpKind) -> RealPredicate {
156156

157157
pub fn compare_simd_types<'a, 'll:'a, 'tcx:'ll, Builder : BuilderMethods<'a, 'll, 'tcx>>(
158158
bx: &Builder,
159-
lhs: <Builder::CodegenCx as Backend>::Value,
160-
rhs: <Builder::CodegenCx as Backend>::Value,
159+
lhs: <Builder::CodegenCx as Backend<'ll>>::Value,
160+
rhs: <Builder::CodegenCx as Backend<'ll>>::Value,
161161
t: Ty<'tcx>,
162-
ret_ty: <Builder::CodegenCx as Backend>::Type,
162+
ret_ty: <Builder::CodegenCx as Backend<'ll>>::Type,
163163
op: hir::BinOpKind
164-
) -> <Builder::CodegenCx as Backend>::Value {
164+
) -> <Builder::CodegenCx as Backend<'ll>>::Value {
165165
let signed = match t.sty {
166166
ty::Float(_) => {
167167
let cmp = bin_op_to_fcmp_predicate(op);
@@ -218,10 +218,10 @@ pub fn unsized_info<'a, 'll: 'a, 'tcx: 'll, Cx: 'a + CodegenMethods<'ll, 'tcx>>(
218218
/// Coerce `src` to `dst_ty`. `src_ty` must be a thin pointer.
219219
pub fn unsize_thin_ptr<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll, 'tcx>>(
220220
bx: &Bx,
221-
src: <Bx::CodegenCx as Backend>::Value,
221+
src: <Bx::CodegenCx as Backend<'ll>>::Value,
222222
src_ty: Ty<'tcx>,
223223
dst_ty: Ty<'tcx>
224-
) -> (<Bx::CodegenCx as Backend>::Value, <Bx::CodegenCx as Backend>::Value) where
224+
) -> (<Bx::CodegenCx as Backend<'ll>>::Value, <Bx::CodegenCx as Backend<'ll>>::Value) where
225225
&'a Bx::CodegenCx: LayoutOf<Ty = Ty<'tcx>, TyLayout = TyLayout<'tcx>> + HasTyCtxt<'tcx>
226226
{
227227
debug!("unsize_thin_ptr: {:?} => {:?}", src_ty, dst_ty);
@@ -275,8 +275,8 @@ pub fn unsize_thin_ptr<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll, 'tcx>
275275
/// to a value of type `dst_ty` and store the result in `dst`
276276
pub fn coerce_unsized_into<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll, 'tcx>>(
277277
bx: &Bx,
278-
src: PlaceRef<'tcx, <Bx::CodegenCx as Backend>::Value>,
279-
dst: PlaceRef<'tcx, <Bx::CodegenCx as Backend>::Value>
278+
src: PlaceRef<'tcx, <Bx::CodegenCx as Backend<'ll>>::Value>,
279+
dst: PlaceRef<'tcx, <Bx::CodegenCx as Backend<'ll>>::Value>
280280
) where &'a Bx::CodegenCx: LayoutOf<Ty = Ty<'tcx>, TyLayout = TyLayout<'tcx>> + HasTyCtxt<'tcx>
281281
{
282282
let src_ty = src.layout.ty;
@@ -336,28 +336,28 @@ pub fn coerce_unsized_into<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll, '
336336
pub fn cast_shift_expr_rhs<'a, 'll: 'a, 'tcx: 'll, Builder : BuilderMethods<'a, 'll, 'tcx>>(
337337
bx: &Builder,
338338
op: hir::BinOpKind,
339-
lhs: <Builder::CodegenCx as Backend>::Value,
340-
rhs: <Builder::CodegenCx as Backend>::Value
341-
) -> <Builder::CodegenCx as Backend>::Value {
339+
lhs: <Builder::CodegenCx as Backend<'ll>>::Value,
340+
rhs: <Builder::CodegenCx as Backend<'ll>>::Value
341+
) -> <Builder::CodegenCx as Backend<'ll>>::Value {
342342
cast_shift_rhs(bx, op, lhs, rhs, |a, b| bx.trunc(a, b), |a, b| bx.zext(a, b))
343343
}
344344

345345
fn cast_shift_rhs<'a, 'll :'a, 'tcx : 'll, F, G, Builder : BuilderMethods<'a, 'll, 'tcx>>(
346346
bx: &Builder,
347347
op: hir::BinOpKind,
348-
lhs: <Builder::CodegenCx as Backend>::Value,
349-
rhs: <Builder::CodegenCx as Backend>::Value,
348+
lhs: <Builder::CodegenCx as Backend<'ll>>::Value,
349+
rhs: <Builder::CodegenCx as Backend<'ll>>::Value,
350350
trunc: F,
351351
zext: G
352-
) -> <Builder::CodegenCx as Backend>::Value
352+
) -> <Builder::CodegenCx as Backend<'ll>>::Value
353353
where F: FnOnce(
354-
<Builder::CodegenCx as Backend>::Value,
355-
<Builder::CodegenCx as Backend>::Type
356-
) -> <Builder::CodegenCx as Backend>::Value,
354+
<Builder::CodegenCx as Backend<'ll>>::Value,
355+
<Builder::CodegenCx as Backend<'ll>>::Type
356+
) -> <Builder::CodegenCx as Backend<'ll>>::Value,
357357
G: FnOnce(
358-
<Builder::CodegenCx as Backend>::Value,
359-
<Builder::CodegenCx as Backend>::Type
360-
) -> <Builder::CodegenCx as Backend>::Value
358+
<Builder::CodegenCx as Backend<'ll>>::Value,
359+
<Builder::CodegenCx as Backend<'ll>>::Type
360+
) -> <Builder::CodegenCx as Backend<'ll>>::Value
361361
{
362362
// Shifts may have any size int on the rhs
363363
if op.is_shift() {
@@ -396,16 +396,16 @@ pub fn wants_msvc_seh(sess: &Session) -> bool {
396396

397397
pub fn call_assume<'a, 'll: 'a, 'tcx: 'll, Bx : BuilderMethods<'a, 'll ,'tcx>>(
398398
bx: &Bx,
399-
val: <Bx::CodegenCx as Backend>::Value
399+
val: <Bx::CodegenCx as Backend<'ll>>::Value
400400
) {
401401
let assume_intrinsic = bx.cx().get_intrinsic("llvm.assume");
402402
bx.call(assume_intrinsic, &[val], None);
403403
}
404404

405405
pub fn from_immediate<'a, 'll: 'a, 'tcx: 'll, Bx : BuilderMethods<'a, 'll ,'tcx>>(
406406
bx: &Bx,
407-
val: <Bx::CodegenCx as Backend>::Value
408-
) -> <Bx::CodegenCx as Backend>::Value {
407+
val: <Bx::CodegenCx as Backend<'ll>>::Value
408+
) -> <Bx::CodegenCx as Backend<'ll>>::Value {
409409
if bx.cx().val_ty(val) == bx.cx().type_i1() {
410410
bx.zext(val, bx.cx().type_i8())
411411
} else {
@@ -415,9 +415,9 @@ pub fn from_immediate<'a, 'll: 'a, 'tcx: 'll, Bx : BuilderMethods<'a, 'll ,'tcx>
415415

416416
pub fn to_immediate<'a, 'll: 'a, 'tcx: 'll, Builder : BuilderMethods<'a, 'll, 'tcx>>(
417417
bx: &Builder,
418-
val: <Builder::CodegenCx as Backend>::Value,
418+
val: <Builder::CodegenCx as Backend<'ll>>::Value,
419419
layout: layout::TyLayout,
420-
) -> <Builder::CodegenCx as Backend>::Value {
420+
) -> <Builder::CodegenCx as Backend<'ll>>::Value {
421421
if let layout::Abi::Scalar(ref scalar) = layout.abi {
422422
return to_immediate_scalar(bx, val, scalar);
423423
}
@@ -426,9 +426,9 @@ pub fn to_immediate<'a, 'll: 'a, 'tcx: 'll, Builder : BuilderMethods<'a, 'll, 't
426426

427427
pub fn to_immediate_scalar<'a, 'll :'a, 'tcx :'ll, Builder : BuilderMethods<'a, 'll, 'tcx>>(
428428
bx: &Builder,
429-
val: <Builder::CodegenCx as Backend>::Value,
429+
val: <Builder::CodegenCx as Backend<'ll>>::Value,
430430
scalar: &layout::Scalar,
431-
) -> <Builder::CodegenCx as Backend>::Value {
431+
) -> <Builder::CodegenCx as Backend<'ll>>::Value {
432432
if scalar.is_bool() {
433433
return bx.trunc(val, bx.cx().type_i1());
434434
}
@@ -437,8 +437,8 @@ pub fn to_immediate_scalar<'a, 'll :'a, 'tcx :'ll, Builder : BuilderMethods<'a,
437437

438438
pub fn memcpy_ty<'a, 'll: 'a, 'tcx: 'll, Builder : BuilderMethods<'a, 'll, 'tcx>>(
439439
bx: &Builder,
440-
dst: <Builder::CodegenCx as Backend>::Value,
441-
src: <Builder::CodegenCx as Backend>::Value,
440+
dst: <Builder::CodegenCx as Backend<'ll>>::Value,
441+
src: <Builder::CodegenCx as Backend<'ll>>::Value,
442442
layout: TyLayout<'tcx>,
443443
align: Align,
444444
flags: MemFlags,

src/librustc_codegen_llvm/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ pub fn get_fn(
205205
}
206206

207207
pub fn resolve_and_get_fn<'ll, 'tcx: 'll,
208-
Cx : Backend + MiscMethods<'tcx> + TypeMethods<'ll, 'tcx>
208+
Cx : Backend<'ll> + MiscMethods<'ll, 'tcx> + TypeMethods<'ll, 'tcx>
209209
>(
210210
cx: &Cx,
211211
def_id: DefId,

src/librustc_codegen_llvm/common.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,14 @@ impl<'ll, V : CodegenObject> Funclet<'ll, V> {
217217
}
218218
}
219219

220-
impl Backend for CodegenCx<'ll, 'tcx, &'ll Value> {
220+
impl Backend<'ll> for CodegenCx<'ll, 'tcx, &'ll Value> {
221221
type Value = &'ll Value;
222222
type BasicBlock = &'ll BasicBlock;
223223
type Type = &'ll Type;
224224
type Context = &'ll llvm::Context;
225225
}
226226

227-
impl<'ll, 'tcx : 'll> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
227+
impl<'ll, 'tcx : 'll> ConstMethods<'ll, 'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
228228

229229
// LLVM constant constructors.
230230
fn const_null(&self, t: &'ll Type) -> &'ll Value {
@@ -547,9 +547,9 @@ pub fn langcall(tcx: TyCtxt,
547547

548548
pub fn build_unchecked_lshift<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll, 'tcx>>(
549549
bx: &Bx,
550-
lhs: <Bx::CodegenCx as Backend>::Value,
551-
rhs: <Bx::CodegenCx as Backend>::Value
552-
) -> <Bx::CodegenCx as Backend>::Value {
550+
lhs: <Bx::CodegenCx as Backend<'ll>>::Value,
551+
rhs: <Bx::CodegenCx as Backend<'ll>>::Value
552+
) -> <Bx::CodegenCx as Backend<'ll>>::Value {
553553
let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shl, lhs, rhs);
554554
// #1877, #10183: Ensure that input is always valid
555555
let rhs = shift_mask_rhs(bx, rhs);
@@ -559,9 +559,9 @@ pub fn build_unchecked_lshift<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll
559559
pub fn build_unchecked_rshift<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll, 'tcx>>(
560560
bx: &Bx,
561561
lhs_t: Ty<'tcx>,
562-
lhs: <Bx::CodegenCx as Backend>::Value,
563-
rhs: <Bx::CodegenCx as Backend>::Value
564-
) -> <Bx::CodegenCx as Backend>::Value {
562+
lhs: <Bx::CodegenCx as Backend<'ll>>::Value,
563+
rhs: <Bx::CodegenCx as Backend<'ll>>::Value
564+
) -> <Bx::CodegenCx as Backend<'ll>>::Value {
565565
let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shr, lhs, rhs);
566566
// #1877, #10183: Ensure that input is always valid
567567
let rhs = shift_mask_rhs(bx, rhs);
@@ -575,18 +575,18 @@ pub fn build_unchecked_rshift<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll
575575

576576
fn shift_mask_rhs<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll, 'tcx>>(
577577
bx: &Bx,
578-
rhs: <Bx::CodegenCx as Backend>::Value
579-
) -> <Bx::CodegenCx as Backend>::Value {
578+
rhs: <Bx::CodegenCx as Backend<'ll>>::Value
579+
) -> <Bx::CodegenCx as Backend<'ll>>::Value {
580580
let rhs_llty = bx.cx().val_ty(rhs);
581581
bx.and(rhs, shift_mask_val(bx, rhs_llty, rhs_llty, false))
582582
}
583583

584584
pub fn shift_mask_val<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll, 'tcx>>(
585585
bx: &Bx,
586-
llty: <Bx::CodegenCx as Backend>::Type,
587-
mask_llty: <Bx::CodegenCx as Backend>::Type,
586+
llty: <Bx::CodegenCx as Backend<'ll>>::Type,
587+
mask_llty: <Bx::CodegenCx as Backend<'ll>>::Type,
588588
invert: bool
589-
) -> <Bx::CodegenCx as Backend>::Value {
589+
) -> <Bx::CodegenCx as Backend<'ll>>::Value {
590590
let kind = bx.cx().type_kind(llty);
591591
match kind {
592592
TypeKind::Integer => {

src/librustc_codegen_llvm/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub fn ptrcast(val: &'ll Value, ty: &'ll Type) -> &'ll Value {
116116
}
117117
}
118118

119-
impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
119+
impl StaticMethods<'ll> for CodegenCx<'ll, 'tcx, &'ll Value> {
120120

121121
fn static_ptrcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {
122122
ptrcast(val, ty)

src/librustc_codegen_llvm/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ impl<'a, 'tcx, Value : Eq+Hash> CodegenCx<'a, 'tcx, Value> {
316316
}
317317
}
318318

319-
impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
319+
impl MiscMethods<'ll, 'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
320320
fn vtables(&self) -> &RefCell<FxHashMap<(Ty<'tcx>,
321321
Option<ty::PolyExistentialTraitRef<'tcx>>), &'ll Value>>
322322
{
@@ -422,7 +422,7 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
422422

423423
impl<'ll, 'tcx: 'll> CodegenMethods<'ll, 'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {}
424424

425-
impl IntrinsicDeclarationMethods for CodegenCx<'b, 'tcx, &'b Value> {
425+
impl IntrinsicDeclarationMethods<'b> for CodegenCx<'b, 'tcx, &'b Value> {
426426
fn get_intrinsic(&self, key: &str) -> &'b Value {
427427
if let Some(v) = self.intrinsics.borrow().get(key).cloned() {
428428
return v;

src/librustc_codegen_llvm/declare.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn declare_raw_fn(
9696
llfn
9797
}
9898

99-
impl DeclareMethods<'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
99+
impl DeclareMethods<'ll, 'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
100100

101101
/// Declare a global value.
102102
///

src/librustc_codegen_llvm/glue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub fn size_and_align_of_dst<'a, 'll: 'a, 'tcx: 'll,
2525
>(
2626
bx: &Bx,
2727
t: Ty<'tcx>,
28-
info: Option<<Bx::CodegenCx as Backend>::Value>
29-
) -> (<Bx::CodegenCx as Backend>::Value, <Bx::CodegenCx as Backend>::Value) where
28+
info: Option<<Bx::CodegenCx as Backend<'ll>>::Value>
29+
) -> (<Bx::CodegenCx as Backend<'ll>>::Value, <Bx::CodegenCx as Backend<'ll>>::Value) where
3030
&'a Bx::CodegenCx: LayoutOf<Ty = Ty<'tcx>, TyLayout = TyLayout<'tcx>> + HasTyCtxt<'tcx>
3131
{
3232
debug!("calculate size of DST: {}; with lost info: {:?}",

src/librustc_codegen_llvm/interfaces/abi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ pub trait AbiBuilderMethods<'a, 'll: 'a, 'tcx: 'll> : HasCodegen<'a, 'll, 'tcx>
2727
fn apply_attrs_callsite(
2828
&self,
2929
ty: &FnType<'tcx, Ty<'tcx>>,
30-
callsite: <Self::CodegenCx as Backend>::Value
30+
callsite: <Self::CodegenCx as Backend<'ll>>::Value
3131
);
3232
}

src/librustc_codegen_llvm/interfaces/asm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ pub trait AsmBuilderMethods<'a, 'll: 'a, 'tcx: 'll> : HasCodegen<'a, 'll, 'tcx>{
1717
fn codegen_inline_asm(
1818
&self,
1919
ia: &InlineAsm,
20-
outputs: Vec<PlaceRef<'tcx, <Self::CodegenCx as Backend>::Value>>,
21-
inputs: Vec<<Self::CodegenCx as Backend>::Value>
20+
outputs: Vec<PlaceRef<'tcx, <Self::CodegenCx as Backend<'ll>>::Value>>,
21+
inputs: Vec<<Self::CodegenCx as Backend<'ll>>::Value>
2222
);
2323
}
2424

0 commit comments

Comments
 (0)