[X86] Avoid std::string creation in RecognizableInstr constructor. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 18 Dec 2020 16:00:27 +0000 (16:00 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 18 Dec 2020 16:00:41 +0000 (16:00 +0000)
The value names in byteFromRec calls are compile time constants - just create StringRef directly instead of via std::string.

llvm/utils/TableGen/X86RecognizableInstr.cpp

index 6a245b5..e4b7c05 100644 (file)
@@ -54,7 +54,7 @@ static uint8_t byteFromBitsInit(BitsInit &init) {
 /// @param rec  - The record from which to extract the value.
 /// @param name - The name of the field in the record.
 /// @return     - The field, as translated by byteFromBitsInit().
-static uint8_t byteFromRec(const Record* rec, const std::string &name) {
+static uint8_t byteFromRec(const Record* rec, StringRef name) {
   BitsInit* bits = rec->getValueAsBitsInit(name);
   return byteFromBitsInit(*bits);
 }