Introduce CPUStringIsValid() into MCSubtargetInfo and use it for ARM .cpu parsing.

Previously .cpu directive in ARM assembler didnt switch to the new CPU and
therefore acted as a nop. This implemented real action for .cpu and eg. 
allows to assembler FreeBSD kernel with -integrated-as.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223147 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Roman Divacky
2014-12-02 20:03:22 +00:00
parent 30892329d4
commit 2664ea938f
3 changed files with 33 additions and 0 deletions

View File

@@ -136,6 +136,15 @@ public:
/// Initialize an InstrItineraryData instance.
void initInstrItins(InstrItineraryData &InstrItins) const;
/// Check whether the CPU string is valid.
bool CPUStringIsValid(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