[llvm] r237641 - Move Function::lookupIntrinsicID to a static method. NFC

Pete Cooper peter_cooper at apple.com
Mon May 18 17:02:25 PDT 2015


Author: pete
Date: Mon May 18 19:02:25 2015
New Revision: 237641

URL: http://llvm.org/viewvc/llvm-project?rev=237641&view=rev
Log:
Move Function::lookupIntrinsicID to a static method.  NFC

Modified:
    llvm/trunk/include/llvm/IR/Function.h
    llvm/trunk/lib/IR/Function.cpp

Modified: llvm/trunk/include/llvm/IR/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Function.h?rev=237641&r1=237640&r2=237641&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Function.h (original)
+++ llvm/trunk/include/llvm/IR/Function.h Mon May 18 19:02:25 2015
@@ -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.

Modified: llvm/trunk/lib/IR/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Function.cpp?rev=237641&r1=237640&r2=237641&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Function.cpp (original)
+++ llvm/trunk/lib/IR/Function.cpp Mon May 18 19:02:25 2015
@@ -433,6 +433,19 @@ void Function::copyAttributesFrom(const
     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() cons
   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





More information about the llvm-commits mailing list