Skip to content
/ rust Public
forked from rust-lang/rust

Commit 3b44f5b

Browse files
committed
Use standard Rust capitalization rules for names containing "LTO".
1 parent a08220b commit 3b44f5b

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

compiler/rustc_codegen_gcc/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ use gccjit::{Context, OptimizationLevel, CType};
7171
use rustc_ast::expand::allocator::AllocatorKind;
7272
use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen};
7373
use rustc_codegen_ssa::base::codegen_crate;
74-
use rustc_codegen_ssa::back::write::{CodegenContext, FatLTOInput, ModuleConfig, TargetMachineFactoryFn};
74+
use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, ModuleConfig, TargetMachineFactoryFn};
7575
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
7676
use rustc_codegen_ssa::target_features::supported_target_features;
7777
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ModuleBufferMethods, ThinBufferMethods, WriteBackendMethods};
@@ -217,14 +217,14 @@ impl WriteBackendMethods for GccCodegenBackend {
217217
type ThinData = ();
218218
type ThinBuffer = ThinBuffer;
219219

220-
fn run_fat_lto(_cgcx: &CodegenContext<Self>, mut modules: Vec<FatLTOInput<Self>>, _cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>) -> Result<LtoModuleCodegen<Self>, FatalError> {
220+
fn run_fat_lto(_cgcx: &CodegenContext<Self>, mut modules: Vec<FatLtoInput<Self>>, _cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>) -> Result<LtoModuleCodegen<Self>, FatalError> {
221221
// TODO(antoyo): implement LTO by sending -flto to libgccjit and adding the appropriate gcc linker plugins.
222222
// NOTE: implemented elsewhere.
223223
// TODO(antoyo): what is implemented elsewhere ^ ?
224224
let module =
225225
match modules.remove(0) {
226-
FatLTOInput::InMemory(module) => module,
227-
FatLTOInput::Serialized { .. } => {
226+
FatLtoInput::InMemory(module) => module,
227+
FatLtoInput::Serialized { .. } => {
228228
unimplemented!();
229229
}
230230
};

compiler/rustc_codegen_llvm/src/back/lto.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{LlvmCodegenBackend, ModuleLlvm};
77
use object::read::archive::ArchiveFile;
88
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared};
99
use rustc_codegen_ssa::back::symbol_export;
10-
use rustc_codegen_ssa::back::write::{CodegenContext, FatLTOInput, TargetMachineFactoryConfig};
10+
use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, TargetMachineFactoryConfig};
1111
use rustc_codegen_ssa::traits::*;
1212
use rustc_codegen_ssa::{looks_like_rust_object_file, ModuleCodegen, ModuleKind};
1313
use rustc_data_structures::fx::FxHashMap;
@@ -166,7 +166,7 @@ fn get_bitcode_slice_from_object_data(obj: &[u8]) -> Result<&[u8], LtoBitcodeFro
166166
/// for further optimization.
167167
pub(crate) fn run_fat(
168168
cgcx: &CodegenContext<LlvmCodegenBackend>,
169-
modules: Vec<FatLTOInput<LlvmCodegenBackend>>,
169+
modules: Vec<FatLtoInput<LlvmCodegenBackend>>,
170170
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
171171
) -> Result<LtoModuleCodegen<LlvmCodegenBackend>, FatalError> {
172172
let diag_handler = cgcx.create_diag_handler();
@@ -220,7 +220,7 @@ pub(crate) fn prepare_thin(module: ModuleCodegen<ModuleLlvm>) -> (String, ThinBu
220220
fn fat_lto(
221221
cgcx: &CodegenContext<LlvmCodegenBackend>,
222222
diag_handler: &Handler,
223-
modules: Vec<FatLTOInput<LlvmCodegenBackend>>,
223+
modules: Vec<FatLtoInput<LlvmCodegenBackend>>,
224224
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
225225
mut serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>,
226226
symbols_below_threshold: &[*const libc::c_char],
@@ -245,8 +245,8 @@ fn fat_lto(
245245
}));
246246
for module in modules {
247247
match module {
248-
FatLTOInput::InMemory(m) => in_memory.push(m),
249-
FatLTOInput::Serialized { name, buffer } => {
248+
FatLtoInput::InMemory(m) => in_memory.push(m),
249+
FatLtoInput::Serialized { name, buffer } => {
250250
info!("pushing serialized module {:?}", name);
251251
let buffer = SerializedModule::Local(buffer);
252252
serialized_modules.push((buffer, CString::new(name).unwrap()));

compiler/rustc_codegen_llvm/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub use llvm_util::target_features;
2828
use rustc_ast::expand::allocator::AllocatorKind;
2929
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
3030
use rustc_codegen_ssa::back::write::{
31-
CodegenContext, FatLTOInput, ModuleConfig, TargetMachineFactoryConfig, TargetMachineFactoryFn,
31+
CodegenContext, FatLtoInput, ModuleConfig, TargetMachineFactoryConfig, TargetMachineFactoryFn,
3232
};
3333
use rustc_codegen_ssa::traits::*;
3434
use rustc_codegen_ssa::ModuleCodegen;
@@ -200,7 +200,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
200200
}
201201
fn run_fat_lto(
202202
cgcx: &CodegenContext<Self>,
203-
modules: Vec<FatLTOInput<Self>>,
203+
modules: Vec<FatLtoInput<Self>>,
204204
cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
205205
) -> Result<LtoModuleCodegen<Self>, FatalError> {
206206
back::lto::run_fat(cgcx, modules, cached_modules)

compiler/rustc_codegen_ssa/src/back/write.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ impl<B: WriteBackendMethods> CodegenContext<B> {
374374

375375
fn generate_lto_work<B: ExtraBackendMethods>(
376376
cgcx: &CodegenContext<B>,
377-
needs_fat_lto: Vec<FatLTOInput<B>>,
377+
needs_fat_lto: Vec<FatLtoInput<B>>,
378378
needs_thin_lto: Vec<(String, B::ThinBuffer)>,
379379
import_only_modules: Vec<(SerializedModule<B::ModuleBuffer>, WorkProduct)>,
380380
) -> Vec<(WorkItem<B>, u64)> {
@@ -758,14 +758,14 @@ pub(crate) enum WorkItemResult<B: WriteBackendMethods> {
758758

759759
/// The backend has finished compiling a CGU, which now needs to go through
760760
/// fat LTO.
761-
NeedsFatLTO(FatLTOInput<B>),
761+
NeedsFatLto(FatLtoInput<B>),
762762

763763
/// The backend has finished compiling a CGU, which now needs to go through
764764
/// thin LTO.
765-
NeedsThinLTO(String, B::ThinBuffer),
765+
NeedsThinLto(String, B::ThinBuffer),
766766
}
767767

768-
pub enum FatLTOInput<B: WriteBackendMethods> {
768+
pub enum FatLtoInput<B: WriteBackendMethods> {
769769
Serialized { name: String, buffer: B::ModuleBuffer },
770770
InMemory(ModuleCodegen<B::Module>),
771771
}
@@ -854,17 +854,17 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
854854
panic!("Error writing pre-lto-bitcode file `{}`: {}", path.display(), e);
855855
});
856856
}
857-
Ok(WorkItemResult::NeedsThinLTO(name, thin_buffer))
857+
Ok(WorkItemResult::NeedsThinLto(name, thin_buffer))
858858
}
859859
ComputedLtoType::Fat => match bitcode {
860860
Some(path) => {
861861
let (name, buffer) = B::serialize_module(module);
862862
fs::write(&path, buffer.data()).unwrap_or_else(|e| {
863863
panic!("Error writing pre-lto-bitcode file `{}`: {}", path.display(), e);
864864
});
865-
Ok(WorkItemResult::NeedsFatLTO(FatLTOInput::Serialized { name, buffer }))
865+
Ok(WorkItemResult::NeedsFatLto(FatLtoInput::Serialized { name, buffer }))
866866
}
867-
None => Ok(WorkItemResult::NeedsFatLTO(FatLTOInput::InMemory(module))),
867+
None => Ok(WorkItemResult::NeedsFatLto(FatLtoInput::InMemory(module))),
868868
},
869869
}
870870
}
@@ -1554,12 +1554,12 @@ fn start_executing_work<B: ExtraBackendMethods>(
15541554
assert!(compiled_modules.is_empty());
15551555
needs_link.push(module);
15561556
}
1557-
Ok(WorkItemResult::NeedsFatLTO(fat_lto_input)) => {
1557+
Ok(WorkItemResult::NeedsFatLto(fat_lto_input)) => {
15581558
assert!(!started_lto);
15591559
assert!(needs_thin_lto.is_empty());
15601560
needs_fat_lto.push(fat_lto_input);
15611561
}
1562-
Ok(WorkItemResult::NeedsThinLTO(name, thin_buffer)) => {
1562+
Ok(WorkItemResult::NeedsThinLto(name, thin_buffer)) => {
15631563
assert!(!started_lto);
15641564
assert!(needs_fat_lto.is_empty());
15651565
needs_thin_lto.push((name, thin_buffer));

compiler/rustc_codegen_ssa/src/traits/write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
2-
use crate::back::write::{CodegenContext, FatLTOInput, ModuleConfig};
2+
use crate::back::write::{CodegenContext, FatLtoInput, ModuleConfig};
33
use crate::{CompiledModule, ModuleCodegen};
44

55
use rustc_errors::{FatalError, Handler};
@@ -23,7 +23,7 @@ pub trait WriteBackendMethods: 'static + Sized + Clone {
2323
/// for further optimization.
2424
fn run_fat_lto(
2525
cgcx: &CodegenContext<Self>,
26-
modules: Vec<FatLTOInput<Self>>,
26+
modules: Vec<FatLtoInput<Self>>,
2727
cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
2828
) -> Result<LtoModuleCodegen<Self>, FatalError>;
2929
/// Performs thin LTO by performing necessary global analysis and returning two

0 commit comments

Comments
 (0)