Skip to content

Commit ff46476

Browse files
committed
Traitified IntrinsicCallMethods
1 parent 037bc7a commit ff46476

File tree

13 files changed

+790
-762
lines changed

13 files changed

+790
-762
lines changed

src/librustc_codegen_llvm/attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use value::Value;
3333

3434
/// Mark LLVM function to use provided inline heuristic.
3535
#[inline]
36-
pub fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr) {
36+
pub fn inline(cx: &CodegenCx<'ll, '_, &'ll Value>, val: &'ll Value, inline: InlineAttr) {
3737
use self::InlineAttr::*;
3838
match inline {
3939
Hint => Attribute::InlineHint.apply_llfn(Function, val),

src/librustc_codegen_llvm/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ use CrateInfo;
7373
use rustc_data_structures::small_c_str::SmallCStr;
7474
use rustc_data_structures::sync::Lrc;
7575

76-
use interfaces::{BuilderMethods, ConstMethods, BaseTypeMethods, DerivedTypeMethods, Backend, DerivedIntrinsicMethods};
76+
use interfaces::*;
7777

7878
use std::any::Any;
7979
use std::ffi::CString;
@@ -409,7 +409,7 @@ pub fn from_immediate<'a, 'll: 'a, 'tcx: 'll, Builder : BuilderMethods<'a, 'll ,
409409
}
410410
}
411411

412-
pub fn to_immediate<'a, 'll, 'tcx, Builder : BuilderMethods<'a, 'll, 'tcx>>(
412+
pub fn to_immediate<'a, 'll: 'a, 'tcx: 'll, Builder : BuilderMethods<'a, 'll, 'tcx>>(
413413
bx: &Builder,
414414
val: <Builder::CodegenCx as Backend>::Value,
415415
layout: layout::TyLayout,
@@ -420,7 +420,7 @@ pub fn to_immediate<'a, 'll, 'tcx, Builder : BuilderMethods<'a, 'll, 'tcx>>(
420420
val
421421
}
422422

423-
pub fn to_immediate_scalar<'a, 'll, 'tcx, Builder : BuilderMethods<'a, 'll, 'tcx>>(
423+
pub fn to_immediate_scalar<'a, 'll :'a, 'tcx :'ll, Builder : BuilderMethods<'a, 'll, 'tcx>>(
424424
bx: &Builder,
425425
val: <Builder::CodegenCx as Backend>::Value,
426426
scalar: &layout::Scalar,

src/librustc_codegen_llvm/builder.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rustc::ty::TyCtxt;
1919
use rustc::ty::layout::{Align, Size};
2020
use rustc::session::{config, Session};
2121
use rustc_data_structures::small_c_str::SmallCStr;
22-
use interfaces::{BuilderMethods, ConstMethods, BaseTypeMethods, DerivedTypeMethods, DerivedIntrinsicMethods};
22+
use interfaces::*;
2323
use syntax;
2424

2525
use std::borrow::Cow;
@@ -56,10 +56,12 @@ bitflags! {
5656
}
5757
}
5858

59-
impl BuilderMethods<'a, 'll, 'tcx>
60-
for Builder<'a, 'll, 'tcx, &'ll Value> {
61-
59+
impl<'a, 'll: 'a, 'tcx: 'll> HasCodegen<'a> for Builder<'a, 'll, 'tcx, &'ll Value> {
6260
type CodegenCx = CodegenCx<'ll, 'tcx, &'ll Value>;
61+
}
62+
63+
impl<'a, 'll: 'a, 'tcx: 'll> BuilderMethods<'a, 'll, 'tcx>
64+
for Builder<'a, 'll, 'tcx, &'ll Value> {
6365

6466
fn new_block<'b>(
6567
cx: &'a CodegenCx<'ll, 'tcx, &'ll Value>,

src/librustc_codegen_llvm/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
274274
// This item is external but not foreign, i.e. it originates from an external Rust
275275
// crate. Since we don't know whether this crate will be linked dynamically or
276276
// statically in the final application, we always mark such symbols as 'dllimport'.
277-
// If final linkage happens to be static, we rely on compiler-emitted __imp_ stubs to
278-
// make things work.
277+
// If final linkage happens to be static, we rely on compiler-emitted __imp_ stubs
278+
// to make things work.
279279
//
280280
// However, in some scenarios we defer emission of statics to downstream
281281
// crates, so there are cases where a static with an upstream DefId

src/librustc_codegen_llvm/context.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ use value::Value;
2323
use monomorphize::partitioning::CodegenUnit;
2424
use type_::Type;
2525
use type_of::PointeeInfo;
26-
use interfaces::{BaseTypeMethods, DerivedTypeMethods,
27-
IntrinsicMethods, BaseIntrinsicMethods, DerivedIntrinsicMethods};
26+
use interfaces::{BaseTypeMethods, DerivedTypeMethods, IntrinsicDeclarationMethods};
2827

2928
use rustc_data_structures::base_n;
3029
use rustc_data_structures::small_c_str::SmallCStr;
@@ -324,9 +323,7 @@ impl<'b, 'tcx> CodegenCx<'b, 'tcx, &'b Value> {
324323
}
325324
}
326325

327-
impl BaseIntrinsicMethods for CodegenCx<'b, 'tcx, &'b Value> {}
328-
329-
impl DerivedIntrinsicMethods for CodegenCx<'b, 'tcx, &'b Value> {
326+
impl IntrinsicDeclarationMethods for CodegenCx<'b, 'tcx, &'b Value> {
330327
fn get_intrinsic(&self, key: &str) -> &'b Value {
331328
if let Some(v) = self.intrinsics.borrow().get(key).cloned() {
332329
return v;
@@ -642,8 +639,6 @@ impl DerivedIntrinsicMethods for CodegenCx<'b, 'tcx, &'b Value> {
642639
}
643640
}
644641

645-
impl IntrinsicMethods for CodegenCx<'b, 'tcx, &'b Value> {}
646-
647642
impl<'b, 'tcx> CodegenCx<'b, 'tcx, &'b Value> {
648643
/// Generate a new symbol name with the given prefix. This symbol name must
649644
/// only be used for definitions with `internal` or `private` linkage.

0 commit comments

Comments
 (0)