diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2018-11-26 18:36:58 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2018-11-29 18:19:44 +0100 |
| commit | d108a913c79660ab375aff33ea9caa2885ba3051 (patch) | |
| tree | e39beda40e305da7f481c95980b19b62c810cf0c /src/librustc_codegen_ssa | |
| parent | ceb29e2ac45474a560b04ce4061d8a6cc50e1a33 (diff) | |
| download | rust-d108a913c79660ab375aff33ea9caa2885ba3051.tar.gz rust-d108a913c79660ab375aff33ea9caa2885ba3051.zip | |
Move get_static from CodegenCx to Builder
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/place.rs | 2 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/traits/builder.rs | 3 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/traits/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/traits/statics.rs | 5 |
4 files changed, 8 insertions, 4 deletions
diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs index 1406714f293..1aba53255e7 100644 --- a/src/librustc_codegen_ssa/mir/place.rs +++ b/src/librustc_codegen_ssa/mir/place.rs @@ -423,7 +423,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } mir::Place::Static(box mir::Static { def_id, ty }) => { let layout = cx.layout_of(self.monomorphize(&ty)); - PlaceRef::new_sized(cx.get_static(def_id), layout, layout.align.abi) + PlaceRef::new_sized(bx.get_static(def_id), layout, layout.align.abi) }, mir::Place::Projection(box mir::Projection { ref base, diff --git a/src/librustc_codegen_ssa/traits/builder.rs b/src/librustc_codegen_ssa/traits/builder.rs index 063e7ba8ba2..c1349329c17 100644 --- a/src/librustc_codegen_ssa/traits/builder.rs +++ b/src/librustc_codegen_ssa/traits/builder.rs @@ -13,7 +13,7 @@ use super::asm::AsmBuilderMethods; use super::debuginfo::DebugInfoBuilderMethods; use super::intrinsic::IntrinsicCallMethods; use super::type_::ArgTypeMethods; -use super::HasCodegen; +use super::{HasCodegen, StaticBuilderMethods}; use common::{AtomicOrdering, AtomicRmwBinOp, IntPredicate, RealPredicate, SynchronizationScope}; use mir::operand::OperandRef; use mir::place::PlaceRef; @@ -40,6 +40,7 @@ pub trait BuilderMethods<'a, 'tcx: 'a>: + AbiBuilderMethods<'tcx> + IntrinsicCallMethods<'tcx> + AsmBuilderMethods<'tcx> + + StaticBuilderMethods<'tcx> { fn new_block<'b>(cx: &'a Self::CodegenCx, llfn: Self::Value, name: &'b str) -> Self; fn with_cx(cx: &'a Self::CodegenCx) -> Self; diff --git a/src/librustc_codegen_ssa/traits/mod.rs b/src/librustc_codegen_ssa/traits/mod.rs index 5cf48be6cf5..6251fc3d3f3 100644 --- a/src/librustc_codegen_ssa/traits/mod.rs +++ b/src/librustc_codegen_ssa/traits/mod.rs @@ -46,7 +46,7 @@ pub use self::debuginfo::{DebugInfoBuilderMethods, DebugInfoMethods}; pub use self::declare::{DeclareMethods, PreDefineMethods}; pub use self::intrinsic::IntrinsicCallMethods; pub use self::misc::MiscMethods; -pub use self::statics::StaticMethods; +pub use self::statics::{StaticMethods, StaticBuilderMethods}; pub use self::type_::{ ArgTypeMethods, BaseTypeMethods, DerivedTypeMethods, LayoutTypeMethods, TypeMethods, }; diff --git a/src/librustc_codegen_ssa/traits/statics.rs b/src/librustc_codegen_ssa/traits/statics.rs index 6f498892b71..0e665fc29fc 100644 --- a/src/librustc_codegen_ssa/traits/statics.rs +++ b/src/librustc_codegen_ssa/traits/statics.rs @@ -14,6 +14,9 @@ use rustc::ty::layout::Align; pub trait StaticMethods: BackendTypes { fn static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value; - fn get_static(&self, def_id: DefId) -> Self::Value; fn codegen_static(&self, def_id: DefId, is_mutable: bool); } + +pub trait StaticBuilderMethods<'tcx>: BackendTypes { + fn get_static(&self, def_id: DefId) -> Self::Value; +} |
