From d42228154fc11813e0f91fee978ac6576402b374 Mon Sep 17 00:00:00 2001 From: Pete Cooper Date: Tue, 19 May 2015 00:02:25 +0000 Subject: [PATCH] Move Function::lookupIntrinsicID to a static method. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237641 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/Function.h | 4 ---- lib/IR/Function.cpp | 29 ++++++++++++++--------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/include/llvm/IR/Function.h b/include/llvm/IR/Function.h index 33602a3a8c1..c084895fedf 100644 --- a/include/llvm/IR/Function.h +++ b/include/llvm/IR/Function.h @@ -109,10 +109,6 @@ private: Function(const Function&) = delete; void operator=(const Function&) = delete; - /// Do the actual lookup of an intrinsic ID when the query could not be - /// answered from the cache. - unsigned lookupIntrinsicID() const LLVM_READONLY; - /// Function ctor - If the (optional) Module argument is specified, the /// function is automatically inserted into the end of the function list for /// the module. diff --git a/lib/IR/Function.cpp b/lib/IR/Function.cpp index a5d4d1c4b1e..71e07ea04cb 100644 --- a/lib/IR/Function.cpp +++ b/lib/IR/Function.cpp @@ -433,6 +433,19 @@ void Function::copyAttributesFrom(const GlobalValue *Src) { setPrologueData(nullptr); } +/// \brief This does the actual lookup of an intrinsic ID which +/// matches the given function name. +static Intrinsic::ID lookupIntrinsicID(const ValueName *ValName) { + unsigned Len = ValName->getKeyLength(); + const char *Name = ValName->getKeyData(); + +#define GET_FUNCTION_RECOGNIZER +#include "llvm/IR/Intrinsics.gen" +#undef GET_FUNCTION_RECOGNIZER + + return Intrinsic::not_intrinsic; +} + /// getIntrinsicID - This method returns the ID number of the specified /// function, or Intrinsic::not_intrinsic if the function is not an /// intrinsic, or if the pointer is null. This value is always defined to be @@ -449,27 +462,13 @@ unsigned Function::getIntrinsicID() const { LLVMContextImpl::IntrinsicIDCacheTy &IntrinsicIDCache = getContext().pImpl->IntrinsicIDCache; if (!IntrinsicIDCache.count(this)) { - unsigned Id = lookupIntrinsicID(); + unsigned Id = lookupIntrinsicID(ValName); IntrinsicIDCache[this]=Id; return Id; } return IntrinsicIDCache[this]; } -/// This private method does the actual lookup of an intrinsic ID when the query -/// could not be answered from the cache. -unsigned Function::lookupIntrinsicID() const { - const ValueName *ValName = this->getValueName(); - unsigned Len = ValName->getKeyLength(); - const char *Name = ValName->getKeyData(); - -#define GET_FUNCTION_RECOGNIZER -#include "llvm/IR/Intrinsics.gen" -#undef GET_FUNCTION_RECOGNIZER - - return 0; -} - /// Returns a stable mangling for the type specified for use in the name /// mangling scheme used by 'any' types in intrinsic signatures. The mangling /// of named types is simply their name. Manglings for unnamed types consist -- 2.34.1