Add 'native' to -C target-cpu=help
This commit is contained in:
parent
2f1ef9ef11
commit
824fb3817c
1 changed files with 7 additions and 0 deletions
|
@ -299,10 +299,17 @@ static size_t getLongestEntryLength(ArrayRef<SubtargetFeatureKV> Table) {
|
||||||
extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) {
|
extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) {
|
||||||
const TargetMachine *Target = unwrap(TM);
|
const TargetMachine *Target = unwrap(TM);
|
||||||
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
|
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
|
||||||
|
const Triple::ArchType HostArch = Triple(sys::getProcessTriple()).getArch();
|
||||||
|
const Triple::ArchType TargetArch = Target->getTargetTriple().getArch();
|
||||||
const ArrayRef<SubtargetFeatureKV> CPUTable = MCInfo->getCPUTable();
|
const ArrayRef<SubtargetFeatureKV> CPUTable = MCInfo->getCPUTable();
|
||||||
unsigned MaxCPULen = getLongestEntryLength(CPUTable);
|
unsigned MaxCPULen = getLongestEntryLength(CPUTable);
|
||||||
|
|
||||||
printf("Available CPUs for this target:\n");
|
printf("Available CPUs for this target:\n");
|
||||||
|
if (HostArch == TargetArch) {
|
||||||
|
const StringRef HostCPU = sys::getHostCPUName();
|
||||||
|
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 - %s.\n", MaxCPULen, CPU.Key, CPU.Desc);
|
printf(" %-*s - %s.\n", MaxCPULen, CPU.Key, CPU.Desc);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue