about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorJames Dietz <jamesthespeedy@gmail.com>2023-04-28 17:23:40 -0400
committerJames Dietz <jamesthespeedy@gmail.com>2023-05-04 20:29:38 -0400
commit9aa596a014d2582c1c51166953bd3fd85c71cca8 (patch)
tree75801813d18bc867dd994014adfc0ff3783b9416 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parentea17aa9141cde9f26ec09b423ca2efe8aa08cc33 (diff)
downloadrust-9aa596a014d2582c1c51166953bd3fd85c71cca8.tar.gz
rust-9aa596a014d2582c1c51166953bd3fd85c71cca8.zip
moved default CPU message inline
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index b6578034275..03e76380c24 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -307,7 +307,7 @@ static size_t getLongestEntryLength(ArrayRef<KV> Table) {
   return MaxLen;
 }
 
-extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, &Char[]) {
+extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, const char* TargetCPU) {
   const TargetMachine *Target = unwrap(TM);
   const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
   const Triple::ArchType HostArch = Triple(sys::getDefaultTargetTriple()).getArch();
@@ -323,16 +323,14 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, &Char[]) {
     printf("    %-*s - Select the CPU of the current host (currently %.*s).\n",
       MaxCPULen, "native", (int)HostCPU.size(), HostCPU.data());
   }
-  for (auto &CPU : CPUTable)
-
+  for (auto &CPU : CPUTable) {
     printf("    %-*s", MaxCPULen, CPU.Key);
-    if (CPU.Key == Target->getTargetTriple().getArch()) {
-      printf("  default target\n");
-    }
-    else {
-      printf("\n");
+    // Compare cpu against current target to label the default
+    if (strcmp(CPU.Key, TargetCPU) == 0) {
+      printf("   - this is the default target cpu for the current target");
     }
-  printf("\n");
+    printf("\n");
+  }
 }
 
 extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) {