[llvm] 94da2cf - [X86] Avoid std::string creation in RecognizableInstr constructor. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 18 08:00:57 PST 2020
Author: Simon Pilgrim
Date: 2020-12-18T16:00:41Z
New Revision: 94da2cf650dd4397e8f84982c81e70f7a1825103
URL: https://github.com/llvm/llvm-project/commit/94da2cf650dd4397e8f84982c81e70f7a1825103
DIFF: https://github.com/llvm/llvm-project/commit/94da2cf650dd4397e8f84982c81e70f7a1825103.diff
LOG: [X86] Avoid std::string creation in RecognizableInstr constructor. NFCI.
The value names in byteFromRec calls are compile time constants - just create StringRef directly instead of via std::string.
Added:
Modified:
llvm/utils/TableGen/X86RecognizableInstr.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/X86RecognizableInstr.cpp b/llvm/utils/TableGen/X86RecognizableInstr.cpp
index 6a245b5eb425..e4b7c05cfb88 100644
--- a/llvm/utils/TableGen/X86RecognizableInstr.cpp
+++ b/llvm/utils/TableGen/X86RecognizableInstr.cpp
@@ -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);
}
More information about the llvm-commits
mailing list