File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -299,10 +299,17 @@ static size_t getLongestEntryLength(ArrayRef<SubtargetFeatureKV> Table) {
299
299
extern " C" void LLVMRustPrintTargetCPUs (LLVMTargetMachineRef TM) {
300
300
const TargetMachine *Target = unwrap (TM);
301
301
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo ();
302
+ const Triple::ArchType HostArch = Triple (sys::getProcessTriple ()).getArch ();
303
+ const Triple::ArchType TargetArch = Target->getTargetTriple ().getArch ();
302
304
const ArrayRef<SubtargetFeatureKV> CPUTable = MCInfo->getCPUTable ();
303
305
unsigned MaxCPULen = getLongestEntryLength (CPUTable);
304
306
305
307
printf (" Available CPUs for this target:\n " );
308
+ if (HostArch == TargetArch) {
309
+ const StringRef HostCPU = sys::getHostCPUName ();
310
+ printf (" %-*s - Select the CPU of the current host (currently %.*s).\n " ,
311
+ MaxCPULen, " native" , (int )HostCPU.size (), HostCPU.data ());
312
+ }
306
313
for (auto &CPU : CPUTable)
307
314
printf (" %-*s - %s.\n " , MaxCPULen, CPU.Key , CPU.Desc );
308
315
printf (" \n " );
You can’t perform that action at this time.
0 commit comments