aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/MC/MCSubtargetInfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/MC/MCSubtargetInfo.h')
-rw-r--r--include/llvm/MC/MCSubtargetInfo.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/MC/MCSubtargetInfo.h b/include/llvm/MC/MCSubtargetInfo.h
index 9d09bd8..3984a1f 100644
--- a/include/llvm/MC/MCSubtargetInfo.h
+++ b/include/llvm/MC/MCSubtargetInfo.h
@@ -28,6 +28,7 @@ class StringRef;
///
class MCSubtargetInfo {
std::string TargetTriple; // Target triple
+ std::string CPU; // CPU being targeted.
ArrayRef<SubtargetFeatureKV> ProcFeatures; // Processor feature list
ArrayRef<SubtargetFeatureKV> ProcDesc; // Processor descriptions
@@ -59,6 +60,11 @@ public:
return TargetTriple;
}
+ /// getCPU - Return the CPU string.
+ StringRef getCPU() const {
+ return CPU;
+ }
+
/// getFeatureBits - Return the feature bits.
///
uint64_t getFeatureBits() const {
@@ -136,6 +142,15 @@ public:
/// Initialize an InstrItineraryData instance.
void initInstrItins(InstrItineraryData &InstrItins) const;
+
+ /// Check whether the CPU string is valid.
+ bool isCPUStringValid(StringRef CPU) {
+ auto Found = std::find_if(ProcDesc.begin(), ProcDesc.end(),
+ [=](const SubtargetFeatureKV &KV) {
+ return CPU == KV.Key;
+ });
+ return Found != ProcDesc.end();
+ }
};
} // End llvm namespace