aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp')
-rw-r--r--llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
index 652bea9..7f90d6b 100644
--- a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
@@ -236,8 +236,19 @@ public:
for (RuntimeLibcall &LibCall : RuntimeLibcallDefList)
Def2RuntimeLibcall[LibCall.getDef()] = &LibCall;
- ArrayRef<const Record *> AllRuntimeLibcallImpls =
+ ArrayRef<const Record *> AllRuntimeLibcallImplsRaw =
Records.getAllDerivedDefinitions("RuntimeLibcallImpl");
+
+ SmallVector<const Record *, 1024> AllRuntimeLibcallImpls(
+ AllRuntimeLibcallImplsRaw);
+
+ // Sort by libcall impl name, not the enum name. This keeps the order
+ // suitable for using the name table for libcall recognition binary search.
+ llvm::sort(AllRuntimeLibcallImpls, [](const Record *A, const Record *B) {
+ return A->getValueAsString("LibCallFuncName") <
+ B->getValueAsString("LibCallFuncName");
+ });
+
RuntimeLibcallImplDefList.reserve(AllRuntimeLibcallImpls.size());
size_t LibCallImplEnumVal = 1;