File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
llvm/lib/ExecutionEngine/Orc Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,21 @@ JITTargetMachineBuilder::JITTargetMachineBuilder(Triple TT)
22
22
Expected<JITTargetMachineBuilder> JITTargetMachineBuilder::detectHost () {
23
23
// FIXME: getProcessTriple is bogus. It returns the host LLVM was compiled on,
24
24
// rather than a valid triple for the current process.
25
- return JITTargetMachineBuilder (Triple (sys::getProcessTriple ()));
25
+ JITTargetMachineBuilder TMBuilder ((Triple (sys::getProcessTriple ())));
26
+
27
+ // Retrieve host CPU name and sub-target features and add them to builder.
28
+ // Relocation model, code model and codegen opt level are kept to default
29
+ // values.
30
+ llvm::SubtargetFeatures SubtargetFeatures;
31
+ llvm::StringMap<bool > FeatureMap;
32
+ llvm::sys::getHostCPUFeatures (FeatureMap);
33
+ for (auto &Feature : FeatureMap)
34
+ SubtargetFeatures.AddFeature (Feature.first (), Feature.second );
35
+
36
+ TMBuilder.setCPU (llvm::sys::getHostCPUName ());
37
+ TMBuilder.addFeatures (SubtargetFeatures.getFeatures ());
38
+
39
+ return TMBuilder;
26
40
}
27
41
28
42
Expected<std::unique_ptr<TargetMachine>>
You can’t perform that action at this time.
0 commit comments