Created
November 16, 2020 14:27
-
-
Save advancedwebdeveloper/09033869445a09a2e297a73387d46c41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "llvm/ADT/StringRef.h" | |
#include "llvm/ADT/StringMap.h" | |
#include "llvm/MC/SubtargetFeature.h" | |
#include "llvm/Support/Host.h" | |
using namespace llvm; | |
SubtargetFeatures Features1; | |
int main (int argc, char **argv) | |
{ | |
sys::getHostCPUName(); | |
StringMap<bool> HostFeatures; | |
if (sys::getHostCPUFeatures(HostFeatures)) | |
for (auto &F : HostFeatures) | |
Features1.AddFeature(F.first(), F.second); | |
printf("test %s", Features1.getString().c_str()); | |
printf("\nsomething else\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Linux use case:
$clang++-11 -I/usr/include/llvm-c-11 -I/usr/include/llvm-11 -L/usr/lib/i386-linux-gnu/ -lLLVM-11 ~/workarea/llvm_cpu_features_investigation.cpp
MacOS use case (Clang 10):
$clang -I/usr/local/opt/llvm/include/llvm-c -I/usr/local/opt/llvm/include -I/usr/local/Cellar/llvm/11.0.0/ -L/usr/local/opt/llvm/lib -L/usr/local/Cellar/llvm/11.0.0/lib -lLLVM -lstdc++ llvm_cpu_features_investigation.cpp