38 StringRef triple = attr.getTriple();
39 StringRef chipAKAcpu = attr.getChip();
43 llvm::cast_if_present<LLVM::TargetFeaturesAttr>(attr.getFeatures());
44 std::string features = featuresAttr ? featuresAttr.getFeaturesString() :
"";
46 llvm::Triple parsedTriple(triple);
48 const llvm::Target *
target =
49 llvm::TargetRegistry::lookupTarget(parsedTriple, error);
50 if (!
target || !error.empty()) {
51 LDBG() <<
"Looking up target '" << triple <<
"' failed: " << error <<
"\n";
55 return std::unique_ptr<llvm::TargetMachine>(
56 target->createTargetMachine(parsedTriple, chipAKAcpu, features, {}, {}));