File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 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) {
299299extern  " C"   void  LLVMRustPrintTargetCPUs (LLVMTargetMachineRef TM) {
300300  const  TargetMachine *Target = unwrap (TM);
301301  const  MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo ();
302+   const  Triple::ArchType HostArch = Triple (sys::getProcessTriple ()).getArch ();
303+   const  Triple::ArchType TargetArch = Target->getTargetTriple ().getArch ();
302304  const  ArrayRef<SubtargetFeatureKV> CPUTable = MCInfo->getCPUTable ();
303305  unsigned  MaxCPULen = getLongestEntryLength (CPUTable);
304306
305307  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+   }
306313  for  (auto  &CPU : CPUTable)
307314    printf ("     %-*s - %s.\n "  , MaxCPULen, CPU.Key , CPU.Desc );
308315  printf (" \n "  );
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments