Files
rust/compiler/rustc_codegen_ssa/src/traits/statics.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
1.0 KiB
Rust
Raw Normal View History

use super::BackendTypes;
use rustc_hir::def_id::DefId;
use rustc_target::abi::Align;
2018-09-10 16:28:47 +02:00
pub trait StaticMethods: BackendTypes {
2018-09-13 14:58:19 +02:00
fn static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value;
fn codegen_static(&self, def_id: DefId, is_mutable: bool);
/// Mark the given global value as "used", to prevent the compiler and linker from potentially
/// removing a static variable that may otherwise appear unused.
fn add_used_global(&self, global: Self::Value);
/// Same as add_used_global(), but only prevent the compiler from potentially removing an
/// otherwise unused symbol. The linker is still permitted to drop it.
///
/// This corresponds to the documented semantics of the `#[used]` attribute, although
/// on some targets (non-ELF), we may use `add_used_global` for `#[used]` statics
/// instead.
fn add_compiler_used_global(&self, global: Self::Value);
2018-09-10 16:28:47 +02:00
}
pub trait StaticBuilderMethods: BackendTypes {
2018-12-02 14:35:11 +01:00
fn get_static(&mut self, def_id: DefId) -> Self::Value;
}