[PATCH] D65760: [ORC] Add host CPU name and sub-target features to JITTargetMachineBuilder::detectHost()
Diego Caballero via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 16:03:47 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367944: [ORC] Add CPU name and sub-target features to detectHost (authored by dcaballe, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D65760?vs=213405&id=213485#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65760/new/
https://reviews.llvm.org/D65760
Files:
llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
Index: llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
===================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
+++ llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
@@ -22,7 +22,21 @@
Expected<JITTargetMachineBuilder> JITTargetMachineBuilder::detectHost() {
// FIXME: getProcessTriple is bogus. It returns the host LLVM was compiled on,
// rather than a valid triple for the current process.
- return JITTargetMachineBuilder(Triple(sys::getProcessTriple()));
+ JITTargetMachineBuilder TMBuilder(Triple(sys::getProcessTriple()));
+
+ // Retrieve host CPU name and sub-target features and add them to builder.
+ // Relocation model, code model and codegen opt level are kept to default
+ // values.
+ llvm::SubtargetFeatures SubtargetFeatures;
+ llvm::StringMap<bool> FeatureMap;
+ llvm::sys::getHostCPUFeatures(FeatureMap);
+ for (auto &Feature : FeatureMap)
+ SubtargetFeatures.AddFeature(Feature.first(), Feature.second);
+
+ TMBuilder.setCPU(llvm::sys::getHostCPUName());
+ TMBuilder.addFeatures(SubtargetFeatures.getFeatures());
+
+ return TMBuilder;
}
Expected<std::unique_ptr<TargetMachine>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65760.213485.patch
Type: text/x-patch
Size: 1237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190805/38d6dd45/attachment.bin>
More information about the llvm-commits
mailing list