]> granicus.if.org Git - llvm/commit
Refactor getHostCPUName to allow testing on non-native hardware.
authorKristof Beyls <kristof.beyls@arm.com>
Thu, 30 Mar 2017 07:24:49 +0000 (07:24 +0000)
committerKristof Beyls <kristof.beyls@arm.com>
Thu, 30 Mar 2017 07:24:49 +0000 (07:24 +0000)
commitf1d06b8e0a71dd752bc1ba8e29862bc1b34b04b7
tree8ffc0a2f22f420235e94cf26741acbe9697a9869
parent8dac88a6524ec083efb76ffa8c8a825a13184265
Refactor getHostCPUName to allow testing on non-native hardware.

This refactors getHostCPUName so that for the architectures that get the
host cpu info on linux from /proc/cpuinfo, the /proc/cpuinfo parsing
logic is present in the build, even if it wasn't built on a linux system
for that architecture.

Since the code is present in the build, we can then test that code also
on other systems, i.e. we don't need to have buildbots setup for all
architectures on linux to be able to test this. Instead, developers will
test this as part of the regression test run.

As an example, a few unit tests are added to test getHostCPUName for ARM
running linux. A unit test is preferred over a lit-based test, since the
expectation is that in the future, the functionality here will grow over
what can be tested with "llc -mcpu=native".

This is a preparation step to enable implementing the range of
improvements discussed on PR30516, such as adding AArch64 support,
support for big.LITTLE systems, reducing code duplication.

Differential Revision: https://reviews.llvm.org/D31236

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299060 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Host.h
lib/Support/Host.cpp
unittests/Support/Host.cpp