1
Fork 0

Removing LLVM content from CommonMethods -> ConstMethods

This commit is contained in:
Denis Merigoux 2018-09-06 14:44:51 -07:00 committed by Eduard-Mihai Burtescu
parent e224f063e8
commit a1d0d4f943
25 changed files with 55 additions and 124 deletions

View file

@ -54,7 +54,7 @@ use attributes;
use builder::{Builder, MemFlags};
use callee;
use rustc_mir::monomorphize::item::DefPathBasedNames;
use common::{IntPredicate, RealPredicate};
use common::{self, IntPredicate, RealPredicate};
use consts;
use context::CodegenCx;
use debuginfo;
@ -74,7 +74,7 @@ use rustc_data_structures::small_c_str::SmallCStr;
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::indexed_vec::Idx;
use interfaces::{BuilderMethods, CommonMethods, CommonWriteMethods, TypeMethods};
use interfaces::{BuilderMethods, ConstMethods, TypeMethods};
use std::any::Any;
use std::cmp;
@ -649,12 +649,12 @@ fn write_metadata<'a, 'gcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>,
DeflateEncoder::new(&mut compressed, Compression::fast())
.write_all(&metadata.raw_data).unwrap();
let llmeta = llvm_module.const_bytes_in_context(metadata_llcx, &compressed);
let llconst = llvm_module.const_struct_in_context(metadata_llcx, &[llmeta], false);
let llmeta = common::bytes_in_context(metadata_llcx, &compressed);
let llconst = common::struct_in_context(metadata_llcx, &[llmeta], false);
let name = exported_symbols::metadata_symbol_name(tcx);
let buf = CString::new(name).unwrap();
let llglobal = unsafe {
llvm::LLVMAddGlobal(metadata_llmod, llvm_module.val_ty(llconst), buf.as_ptr())
llvm::LLVMAddGlobal(metadata_llmod, common::val_ty(llconst), buf.as_ptr())
};
unsafe {
llvm::LLVMSetInitializer(llglobal, llconst);