use rustc::session::Session;
use rustc::util::nodemap::FxHashMap;
use time_graph::{self, TimeGraph, Timeline};
-use llvm::{self, DiagnosticInfo, PassManager, SMDiagnostic, BasicBlock, True};
+use llvm::{self, DiagnosticInfo, PassManager, SMDiagnostic, BasicBlock};
use llvm_util;
use {CodegenResults, ModuleCodegen, CompiledModule, ModuleKind, // ModuleLlvm,
CachedModuleCodegen};
use type_::Type;
use context::{is_pie_binary, get_reloc_model};
use interfaces::{Backend, CommonWriteMethods};
+use common;
use jobserver::{Client, Acquired};
use rustc_demangle;
use value::Value;
impl CommonWriteMethods for CodegenContext<'ll> {
fn val_ty(&self, v: &'ll Value) -> &'ll Type {
- unsafe {
- llvm::LLVMTypeOf(v)
- }
+ common::val_ty(v)
}
fn c_bytes_in_context(&self, llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
- unsafe {
- let ptr = bytes.as_ptr() as *const c_char;
- return llvm::LLVMConstStringInContext(llcx, ptr, bytes.len() as c_uint, True);
- }
+ common::c_bytes_in_context(llcx, bytes)
}
fn c_struct_in_context(
elts: &[&'a Value],
packed: bool,
) -> &'a Value {
- unsafe {
- llvm::LLVMConstStructInContext(llcx,
- elts.as_ptr(), elts.len() as c_uint,
- packed as llvm::Bool)
- }
+ common::c_struct_in_context(llcx, elts, packed)
}
}