rustc_codegen_llvm: use safe references for TargetMachine.
This commit is contained in:
parent
55af020194
commit
0e3a705269
@ -14,7 +14,7 @@ use back::write::{ModuleConfig, with_llvm_pmb, CodegenContext};
|
||||
use back::write;
|
||||
use errors::{FatalError, Handler};
|
||||
use llvm::archive_ro::ArchiveRO;
|
||||
use llvm::{TargetMachineRef, True, False};
|
||||
use llvm::{True, False};
|
||||
use llvm;
|
||||
use rustc::hir::def_id::LOCAL_CRATE;
|
||||
use rustc::middle::exported_symbols::SymbolExportLevel;
|
||||
@ -452,7 +452,7 @@ fn thin_lto(diag_handler: &Handler,
|
||||
}
|
||||
|
||||
fn run_pass_manager(cgcx: &CodegenContext,
|
||||
tm: TargetMachineRef,
|
||||
tm: &llvm::TargetMachine,
|
||||
llmod: &llvm::Module,
|
||||
config: &ModuleConfig,
|
||||
thin: bool) {
|
||||
|
@ -26,7 +26,7 @@ use rustc::session::Session;
|
||||
use rustc::util::nodemap::FxHashMap;
|
||||
use time_graph::{self, TimeGraph, Timeline};
|
||||
use llvm;
|
||||
use llvm::{TargetMachineRef, PassManagerRef, DiagnosticInfoRef};
|
||||
use llvm::{PassManagerRef, DiagnosticInfoRef};
|
||||
use llvm::SMDiagnosticRef;
|
||||
use {CodegenResults, ModuleSource, ModuleCodegen, CompiledModule, ModuleKind};
|
||||
use CrateInfo;
|
||||
@ -94,7 +94,7 @@ pub fn llvm_err(handler: &errors::Handler, msg: String) -> FatalError {
|
||||
|
||||
pub fn write_output_file(
|
||||
handler: &errors::Handler,
|
||||
target: llvm::TargetMachineRef,
|
||||
target: &llvm::TargetMachine,
|
||||
pm: llvm::PassManagerRef,
|
||||
m: &llvm::Module,
|
||||
output: &Path,
|
||||
@ -638,7 +638,7 @@ unsafe fn codegen(cgcx: &CodegenContext,
|
||||
// pass manager passed to the closure should be ensured to not
|
||||
// escape the closure itself, and the manager should only be
|
||||
// used once.
|
||||
unsafe fn with_codegen<F, R>(tm: TargetMachineRef,
|
||||
unsafe fn with_codegen<F, R>(tm: &llvm::TargetMachine,
|
||||
llmod: &llvm::Module,
|
||||
no_builtins: bool,
|
||||
f: F) -> R
|
||||
|
@ -398,7 +398,6 @@ extern { pub type SectionIterator; }
|
||||
pub type SectionIteratorRef = *mut SectionIterator;
|
||||
extern { pub type Pass; }
|
||||
extern { pub type TargetMachine; }
|
||||
pub type TargetMachineRef = *const TargetMachine;
|
||||
extern { pub type Archive; }
|
||||
pub type ArchiveRef = *mut Archive;
|
||||
extern { pub type ArchiveIterator; }
|
||||
@ -1417,10 +1416,10 @@ extern "C" {
|
||||
pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
|
||||
pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: &'static mut Pass);
|
||||
|
||||
pub fn LLVMRustHasFeature(T: TargetMachineRef, s: *const c_char) -> bool;
|
||||
pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
|
||||
|
||||
pub fn LLVMRustPrintTargetCPUs(T: TargetMachineRef);
|
||||
pub fn LLVMRustPrintTargetFeatures(T: TargetMachineRef);
|
||||
pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
|
||||
pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
|
||||
|
||||
pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
|
||||
CPU: *const c_char,
|
||||
@ -1436,7 +1435,7 @@ extern "C" {
|
||||
Singlethread: bool)
|
||||
-> Option<&'static mut TargetMachine>;
|
||||
pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
|
||||
pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef, PM: PassManagerRef, M: &Module);
|
||||
pub fn LLVMRustAddAnalysisPasses(T: &TargetMachine, PM: PassManagerRef, M: &Module);
|
||||
pub fn LLVMRustAddBuilderLibraryInfo(PMB: &'a PassManagerBuilder,
|
||||
M: &'a Module,
|
||||
DisableSimplifyLibCalls: bool);
|
||||
@ -1452,9 +1451,9 @@ extern "C" {
|
||||
M: &Module,
|
||||
DisableSimplifyLibCalls: bool);
|
||||
pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: &Module);
|
||||
pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
|
||||
pub fn LLVMRustWriteOutputFile(T: &'a TargetMachine,
|
||||
PM: PassManagerRef,
|
||||
M: &Module,
|
||||
M: &'a Module,
|
||||
Output: *const c_char,
|
||||
FileType: FileType)
|
||||
-> LLVMRustResult;
|
||||
@ -1522,7 +1521,7 @@ extern "C" {
|
||||
-> RustArchiveMemberRef;
|
||||
pub fn LLVMRustArchiveMemberFree(Member: RustArchiveMemberRef);
|
||||
|
||||
pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &Module, TM: TargetMachineRef);
|
||||
pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
|
||||
|
||||
pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
|
||||
Inputs: *const &Value,
|
||||
|
Loading…
Reference in New Issue
Block a user