File tree 3 files changed +18
-4
lines changed
src/doc/rustc/src/codegen-options
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) {
329
329
require_inited ( ) ;
330
330
let tm = create_informational_target_machine ( sess) ;
331
331
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
+ }
333
339
PrintRequest :: TargetFeatures => print_target_features ( sess, tm) ,
334
340
_ => bug ! ( "rustc_codegen_llvm can't handle print request: {:?}" , req) ,
335
341
}
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ static size_t getLongestEntryLength(ArrayRef<KV> Table) {
307
307
return MaxLen;
308
308
}
309
309
310
- extern " C" void LLVMRustPrintTargetCPUs (LLVMTargetMachineRef TM) {
310
+ extern " C" void LLVMRustPrintTargetCPUs (LLVMTargetMachineRef TM, &Char[] ) {
311
311
const TargetMachine *Target = unwrap (TM);
312
312
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo ();
313
313
const Triple::ArchType HostArch = Triple (sys::getDefaultTargetTriple ()).getArch ();
@@ -324,7 +324,14 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) {
324
324
MaxCPULen, " native" , (int )HostCPU.size (), HostCPU.data ());
325
325
}
326
326
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
+ }
328
335
printf (" \n " );
329
336
}
330
337
Original file line number Diff line number Diff line change @@ -574,7 +574,8 @@ change in the future.
574
574
This instructs ` rustc ` to generate code specifically for a particular processor.
575
575
576
576
You 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:
578
579
579
580
* ` native ` can be passed to use the processor of the host machine.
580
581
* ` generic ` refers to an LLVM target with minimal features but modern tuning.
You can’t perform that action at this time.
0 commit comments