File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed
src/doc/rustc/src/codegen-options Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -329,7 +329,13 @@ pub(crate) fn print(req: PrintRequest, sess: &Session) {
329329 require_inited ( ) ;
330330 let tm = create_informational_target_machine ( sess) ;
331331 match req {
332- PrintRequest :: TargetCPUs => unsafe { llvm:: LLVMRustPrintTargetCPUs ( tm) } ,
332+ PrintRequest :: TargetCPUs => {
333+ println ! (
334+ "Default CPU for this target:\n {}" ,
335+ handle_native( sess. target. cpu. as_ref( ) )
336+ ) ;
337+ unsafe { llvm:: LLVMRustPrintTargetCPUs ( tm, handle_native ( sess. target . cpu . as_ref ( ) ) ) } ;
338+ }
333339 PrintRequest :: TargetFeatures => print_target_features ( sess, tm) ,
334340 _ => bug ! ( "rustc_codegen_llvm can't handle print request: {:?}" , req) ,
335341 }
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ static size_t getLongestEntryLength(ArrayRef<KV> Table) {
307307 return MaxLen;
308308}
309309
310- extern " C" void LLVMRustPrintTargetCPUs (LLVMTargetMachineRef TM) {
310+ extern " C" void LLVMRustPrintTargetCPUs (LLVMTargetMachineRef TM, &Char[] ) {
311311 const TargetMachine *Target = unwrap (TM);
312312 const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo ();
313313 const Triple::ArchType HostArch = Triple (sys::getDefaultTargetTriple ()).getArch ();
@@ -324,7 +324,14 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) {
324324 MaxCPULen, " native" , (int )HostCPU.size (), HostCPU.data ());
325325 }
326326 for (auto &CPU : CPUTable)
327- printf (" %-*s\n " , MaxCPULen, CPU.Key );
327+
328+ printf (" %-*s" , MaxCPULen, CPU.Key );
329+ if (CPU.Key == Target->getTargetTriple ().getArch ()) {
330+ printf (" default target\n " );
331+ }
332+ else {
333+ printf (" \n " );
334+ }
328335 printf (" \n " );
329336}
330337
Original file line number Diff line number Diff line change @@ -574,7 +574,8 @@ change in the future.
574574This instructs ` rustc ` to generate code specifically for a particular processor.
575575
576576You can run ` rustc --print target-cpus ` to see the valid options to pass
577- here. Each target has a default base CPU. Special values include:
577+ and the default target CPU for the current buid target.
578+ Each target has a default base CPU. Special values include:
578579
579580* ` native ` can be passed to use the processor of the host machine.
580581* ` generic ` refers to an LLVM target with minimal features but modern tuning.
You can’t perform that action at this time.
0 commit comments