Hide even more of rustc_trans
This commit is contained in:
parent
bd2e808180
commit
6dffaa9175
5 changed files with 31 additions and 31 deletions
|
@ -19,7 +19,7 @@ use rustc_allocator::{ALLOCATOR_METHODS, AllocatorTy};
|
|||
use ModuleLlvm;
|
||||
use llvm::{self, False, True};
|
||||
|
||||
pub unsafe fn trans(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind) {
|
||||
pub(crate) unsafe fn trans(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind) {
|
||||
let llcx = mods.llcx;
|
||||
let llmod = mods.llmod;
|
||||
let usize = match &tcx.sess.target.target.target_pointer_width[..] {
|
||||
|
|
|
@ -141,10 +141,10 @@ pub fn remove(sess: &Session, path: &Path) {
|
|||
|
||||
/// Perform the linkage portion of the compilation phase. This will generate all
|
||||
/// of the requested outputs for this compilation session.
|
||||
pub fn link_binary(sess: &Session,
|
||||
trans: &CrateTranslation,
|
||||
outputs: &OutputFilenames,
|
||||
crate_name: &str) -> Vec<PathBuf> {
|
||||
pub(crate) fn link_binary(sess: &Session,
|
||||
trans: &CrateTranslation,
|
||||
outputs: &OutputFilenames,
|
||||
crate_name: &str) -> Vec<PathBuf> {
|
||||
let mut out_filenames = Vec::new();
|
||||
for &crate_type in sess.crate_types.borrow().iter() {
|
||||
// Ignore executable crates if we have -Z no-trans, as they will error.
|
||||
|
@ -201,9 +201,9 @@ fn filename_for_metadata(sess: &Session, crate_name: &str, outputs: &OutputFilen
|
|||
out_filename
|
||||
}
|
||||
|
||||
pub fn each_linked_rlib(sess: &Session,
|
||||
info: &CrateInfo,
|
||||
f: &mut FnMut(CrateNum, &Path)) -> Result<(), String> {
|
||||
pub(crate) fn each_linked_rlib(sess: &Session,
|
||||
info: &CrateInfo,
|
||||
f: &mut FnMut(CrateNum, &Path)) -> Result<(), String> {
|
||||
let crates = info.used_crates_static.iter();
|
||||
let fmts = sess.dependency_formats.borrow();
|
||||
let fmts = fmts.get(&config::CrateTypeExecutable)
|
||||
|
@ -247,7 +247,7 @@ pub fn each_linked_rlib(sess: &Session,
|
|||
/// It's unusual for a crate to not participate in LTO. Typically only
|
||||
/// compiler-specific and unstable crates have a reason to not participate in
|
||||
/// LTO.
|
||||
pub fn ignored_for_lto(sess: &Session, info: &CrateInfo, cnum: CrateNum) -> bool {
|
||||
pub(crate) fn ignored_for_lto(sess: &Session, info: &CrateInfo, cnum: CrateNum) -> bool {
|
||||
// If our target enables builtin function lowering in LLVM then the
|
||||
// crates providing these functions don't participate in LTO (e.g.
|
||||
// no_builtins or compiler builtins crates).
|
||||
|
|
|
@ -42,7 +42,7 @@ pub fn crate_type_allows_lto(crate_type: config::CrateType) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
pub enum LtoModuleTranslation {
|
||||
pub(crate) enum LtoModuleTranslation {
|
||||
Fat {
|
||||
module: Option<ModuleTranslation>,
|
||||
_serialized_bitcode: Vec<SerializedModule>,
|
||||
|
@ -65,9 +65,9 @@ impl LtoModuleTranslation {
|
|||
/// points to LLVM data structures owned by this `LtoModuleTranslation`.
|
||||
/// It's intended that the module returned is immediately code generated and
|
||||
/// dropped, and then this LTO module is dropped.
|
||||
pub unsafe fn optimize(&mut self,
|
||||
cgcx: &CodegenContext,
|
||||
timeline: &mut Timeline)
|
||||
pub(crate) unsafe fn optimize(&mut self,
|
||||
cgcx: &CodegenContext,
|
||||
timeline: &mut Timeline)
|
||||
-> Result<ModuleTranslation, FatalError>
|
||||
{
|
||||
match *self {
|
||||
|
@ -100,7 +100,7 @@ pub enum LTOMode {
|
|||
JustThisCrate,
|
||||
}
|
||||
|
||||
pub fn run(cgcx: &CodegenContext,
|
||||
pub(crate) fn run(cgcx: &CodegenContext,
|
||||
modules: Vec<ModuleTranslation>,
|
||||
mode: LTOMode,
|
||||
timeline: &mut Timeline)
|
||||
|
|
|
@ -363,7 +363,7 @@ impl CodegenContext {
|
|||
Handler::with_emitter(true, false, Box::new(self.diag_emitter.clone()))
|
||||
}
|
||||
|
||||
pub fn config(&self, kind: ModuleKind) -> &ModuleConfig {
|
||||
pub(crate) fn config(&self, kind: ModuleKind) -> &ModuleConfig {
|
||||
match kind {
|
||||
ModuleKind::Regular => &self.regular_module_config,
|
||||
ModuleKind::Metadata => &self.metadata_module_config,
|
||||
|
@ -371,7 +371,7 @@ impl CodegenContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn save_temp_bitcode(&self, trans: &ModuleTranslation, name: &str) {
|
||||
pub(crate) fn save_temp_bitcode(&self, trans: &ModuleTranslation, name: &str) {
|
||||
if !self.save_temps {
|
||||
return
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ fn binaryen_assemble(cgcx: &CodegenContext,
|
|||
}
|
||||
}
|
||||
|
||||
pub struct CompiledModules {
|
||||
pub(crate) struct CompiledModules {
|
||||
pub modules: Vec<CompiledModule>,
|
||||
pub metadata_module: CompiledModule,
|
||||
pub allocator_module: Option<CompiledModule>,
|
||||
|
@ -1162,7 +1162,7 @@ fn produce_final_output_artifacts(sess: &Session,
|
|||
// These are used in linking steps and will be cleaned up afterward.
|
||||
}
|
||||
|
||||
pub fn dump_incremental_data(trans: &CrateTranslation) {
|
||||
pub(crate) fn dump_incremental_data(trans: &CrateTranslation) {
|
||||
println!("[incremental] Re-using {} out of {} modules",
|
||||
trans.modules.iter().filter(|m| m.pre_existing).count(),
|
||||
trans.modules.len());
|
||||
|
@ -2144,7 +2144,7 @@ pub struct OngoingCrateTranslation {
|
|||
}
|
||||
|
||||
impl OngoingCrateTranslation {
|
||||
pub fn join(self, sess: &Session, dep_graph: &DepGraph) -> CrateTranslation {
|
||||
pub(crate) fn join(self, sess: &Session, dep_graph: &DepGraph) -> CrateTranslation {
|
||||
self.shared_emitter_main.check(sess, true);
|
||||
let compiled_modules = match self.future.join() {
|
||||
Ok(Ok(compiled_modules)) => compiled_modules,
|
||||
|
@ -2212,9 +2212,9 @@ impl OngoingCrateTranslation {
|
|||
trans
|
||||
}
|
||||
|
||||
pub fn submit_pre_translated_module_to_llvm(&self,
|
||||
tcx: TyCtxt,
|
||||
mtrans: ModuleTranslation) {
|
||||
pub(crate) fn submit_pre_translated_module_to_llvm(&self,
|
||||
tcx: TyCtxt,
|
||||
mtrans: ModuleTranslation) {
|
||||
self.wait_for_signal_to_translate_item();
|
||||
self.check_for_errors(tcx.sess);
|
||||
|
||||
|
@ -2247,9 +2247,9 @@ impl OngoingCrateTranslation {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn submit_translated_module_to_llvm(tcx: TyCtxt,
|
||||
mtrans: ModuleTranslation,
|
||||
cost: u64) {
|
||||
pub(crate) fn submit_translated_module_to_llvm(tcx: TyCtxt,
|
||||
mtrans: ModuleTranslation,
|
||||
cost: u64) {
|
||||
let llvm_work_item = WorkItem::Optimize(mtrans);
|
||||
drop(tcx.tx_to_llvm_workers.send(Box::new(Message::TranslationDone {
|
||||
llvm_work_item,
|
||||
|
|
|
@ -250,7 +250,7 @@ impl TransCrate for LlvmTransCrate {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct ModuleTranslation {
|
||||
struct ModuleTranslation {
|
||||
/// The name of the module. When the crate may be saved between
|
||||
/// compilations, incremental compilation requires that name be
|
||||
/// unique amongst **all** crates. Therefore, it should contain
|
||||
|
@ -263,7 +263,7 @@ pub struct ModuleTranslation {
|
|||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub enum ModuleKind {
|
||||
enum ModuleKind {
|
||||
Regular,
|
||||
Metadata,
|
||||
Allocator,
|
||||
|
@ -316,7 +316,7 @@ impl ModuleTranslation {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CompiledModule {
|
||||
struct CompiledModule {
|
||||
name: String,
|
||||
llmod_id: String,
|
||||
kind: ModuleKind,
|
||||
|
@ -335,7 +335,7 @@ enum ModuleSource {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ModuleLlvm {
|
||||
struct ModuleLlvm {
|
||||
llcx: llvm::ContextRef,
|
||||
llmod: llvm::ModuleRef,
|
||||
tm: llvm::TargetMachineRef,
|
||||
|
@ -354,7 +354,7 @@ impl Drop for ModuleLlvm {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct CrateTranslation {
|
||||
struct CrateTranslation {
|
||||
crate_name: Symbol,
|
||||
modules: Vec<CompiledModule>,
|
||||
allocator_module: Option<CompiledModule>,
|
||||
|
@ -367,7 +367,7 @@ pub struct CrateTranslation {
|
|||
}
|
||||
|
||||
// Misc info we load from metadata to persist beyond the tcx
|
||||
pub struct CrateInfo {
|
||||
struct CrateInfo {
|
||||
panic_runtime: Option<CrateNum>,
|
||||
compiler_builtins: Option<CrateNum>,
|
||||
profiler_runtime: Option<CrateNum>,
|
||||
|
|
Loading…
Reference in a new issue