diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-09-09 01:16:45 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-11-22 05:01:49 +0200 |
| commit | 5b4747ded7c964ea4e871b3ea6b10bf20862462a (patch) | |
| tree | ed3a2e43eb3e775a14954ae0d7ca94a2ecbb76d8 /src/librustc_codegen_llvm/consts.rs | |
| parent | 3ce8d444affefb61ee733aa21da7f1ebc1b515e9 (diff) | |
| download | rust-5b4747ded7c964ea4e871b3ea6b10bf20862462a.tar.gz rust-5b4747ded7c964ea4e871b3ea6b10bf20862462a.zip | |
rustc_target: avoid using AbiAndPrefAlign where possible.
Diffstat (limited to 'src/librustc_codegen_llvm/consts.rs')
| -rw-r--r-- | src/librustc_codegen_llvm/consts.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index b5b2e22fed0..07dde2d0301 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -28,7 +28,7 @@ use value::Value; use rustc::ty::{self, Ty}; use rustc_codegen_ssa::traits::*; -use rustc::ty::layout::{self, Size, Align, AbiAndPrefAlign, LayoutOf}; +use rustc::ty::layout::{self, Size, Align, LayoutOf}; use rustc::hir::{self, CodegenFnAttrs, CodegenFnAttrFlags}; @@ -89,20 +89,20 @@ pub fn codegen_static_initializer( fn set_global_alignment(cx: &CodegenCx<'ll, '_>, gv: &'ll Value, - mut align: AbiAndPrefAlign) { + mut align: Align) { // The target may require greater alignment for globals than the type does. // Note: GCC and Clang also allow `__attribute__((aligned))` on variables, // which can force it to be smaller. Rust doesn't support this yet. if let Some(min) = cx.sess().target.target.options.min_global_align { match Align::from_bits(min) { - Ok(min) => align = align.max(AbiAndPrefAlign::new(min)), + Ok(min) => align = align.max(min), Err(err) => { cx.sess().err(&format!("invalid minimum global alignment: {}", err)); } } } unsafe { - llvm::LLVMSetAlignment(gv, align.abi.bytes() as u32); + llvm::LLVMSetAlignment(gv, align.bytes() as u32); } } @@ -186,7 +186,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn static_addr_of_mut( &self, cv: &'ll Value, - align: AbiAndPrefAlign, + align: Align, kind: Option<&str>, ) -> &'ll Value { unsafe { @@ -212,14 +212,14 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn static_addr_of( &self, cv: &'ll Value, - align: AbiAndPrefAlign, + align: Align, kind: Option<&str>, ) -> &'ll Value { if let Some(&gv) = self.const_globals.borrow().get(&cv) { unsafe { // Upgrade the alignment in cases where the same constant is used with different // alignment requirements - let llalign = align.abi.bytes() as u32; + let llalign = align.bytes() as u32; if llalign > llvm::LLVMGetAlignment(gv) { llvm::LLVMSetAlignment(gv, llalign); } |
