diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2023-05-05 18:40:35 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-05 18:40:35 +0530 |
| commit | 65702bfd6bfb8616e182ddd19d0520ce7e35314a (patch) | |
| tree | d7ddb2a50d8369bb147b7b35763cb611039b2b79 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | de7e29e5935e35c2ec88d1b87253a128543402e0 (diff) | |
| parent | f239cd6a35776cbc91400a9e498d8b7487fe4975 (diff) | |
| download | rust-65702bfd6bfb8616e182ddd19d0520ce7e35314a.tar.gz rust-65702bfd6bfb8616e182ddd19d0520ce7e35314a.zip | |
Rollup merge of #110876 - mj10021:issue-110647-fix, r=b-naber
Added default target cpu to `--print target-cpus` output and updated docs Added default target cpu info as requested in issue #110647 and noted the new output in the documentation
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 1acdc95ca8d..e88a3cdf620 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) { +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,9 +323,18 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) { printf(" %-*s - Select the CPU of the current host (currently %.*s).\n", MaxCPULen, "native", (int)HostCPU.size(), HostCPU.data()); } - for (auto &CPU : CPUTable) - printf(" %-*s\n", MaxCPULen, CPU.Key); - printf("\n"); + for (auto &CPU : CPUTable) { + // Compare cpu against current target to label the default + if (strcmp(CPU.Key, TargetCPU) == 0) { + printf(" %-*s - This is the default target CPU" + " for the current build target (currently %s).", + MaxCPULen, CPU.Key, Target->getTargetTriple().str().c_str()); + } + else { + printf(" %-*s", MaxCPULen, CPU.Key); + } + printf("\n"); + } } extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) { |
