extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM, const char *Feature) { #if LLVM_VERSION_GE(6, 0) TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); return MCInfo->checkFeatures(std::string("+") + Feature); #else return false; #endif }
extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM, const char *Feature) { #if LLVM_RUSTLLVM TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); const FeatureBitset &Bits = MCInfo->getFeatureBits(); const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable(); for (auto &FeatureEntry : FeatTable) if (!strcmp(FeatureEntry.Key, Feature)) return (Bits & FeatureEntry.Value) == FeatureEntry.Value; #endif return false; }
extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM, const char *feature) { TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); const FeatureBitset &Bits = MCInfo->getFeatureBits(); const llvm::SubtargetFeatureKV *FeatureEntry; #define SUBTARGET(x) \ if (MCInfo->isCPUStringValid(x##SubTypeKV[0].Key)) { \ FeatureEntry = x##FeatureKV; \ } else GEN_SUBTARGETS { return false; } #undef SUBTARGET while (strcmp(feature, FeatureEntry->Key) != 0) FeatureEntry++; return (Bits & FeatureEntry->Value) == FeatureEntry->Value; }
extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM, const char *Feature) { TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); return MCInfo->checkFeatures(std::string("+") + Feature); }