@@ -77,17 +77,17 @@ struct RuntimeLibcallsInfo {
7777
7878  // / Get the libcall routine name for the specified libcall.
7979  //  FIXME: This should be removed. Only LibcallImpl should have a name.
80-   StringRef  getLibcallName (RTLIB::Libcall Call) const  {
80+   const   char  * getLibcallName (RTLIB::Libcall Call) const  {
8181    return  getLibcallImplName (LibcallImpls[Call]);
8282  }
8383
8484  // / Get the libcall routine name for the specified libcall implementation.
85-   static  StringRef getLibcallImplName (RTLIB::LibcallImpl CallImpl) {
85+   //  FIXME: Change to return StringRef
86+   static  const  char  *getLibcallImplName (RTLIB::LibcallImpl CallImpl) {
8687    if  (CallImpl == RTLIB::Unsupported)
87-       return  StringRef ();
88-     return  StringRef (RuntimeLibcallImplNameTable.getCString (
89-                          RuntimeLibcallNameOffsetTable[CallImpl]),
90-                      RuntimeLibcallNameSizeTable[CallImpl]);
88+       return  nullptr ;
89+     return  RuntimeLibcallImplNameTable[RuntimeLibcallNameOffsetTable[CallImpl]]
90+         .data ();
9191  }
9292
9393  // / Return the lowering's selection of implementation call for \p Call
@@ -119,10 +119,9 @@ struct RuntimeLibcallsInfo {
119119
120120  // / Return a function name compatible with RTLIB::MEMCPY, or nullptr if fully
121121  // / unsupported.
122-   StringRef getMemcpyName () const  {
123-     RTLIB::LibcallImpl Memcpy = getLibcallImpl (RTLIB::MEMCPY);
124-     if  (Memcpy != RTLIB::Unsupported)
125-       return  getLibcallImplName (Memcpy);
122+   const  char  *getMemcpyName () const  {
123+     if  (const  char  *Memcpy = getLibcallName (RTLIB::MEMCPY))
124+       return  Memcpy;
126125
127126    //  Fallback to memmove if memcpy isn't available.
128127    return  getLibcallName (RTLIB::MEMMOVE);
@@ -133,41 +132,11 @@ struct RuntimeLibcallsInfo {
133132    return  ImplToLibcall[Impl];
134133  }
135134
136-   // / Check if a function name is a recognized runtime call of any kind. This
137-   // / does not consider if this call is available for any current compilation,
138-   // / just that it is a known call somewhere. This returns the set of all
139-   // / LibcallImpls which match the name; multiple implementations with the same
140-   // / name may exist but differ in interpretation based on the target context.
141-   // /
142-   // / Generated by tablegen.
143-   LLVM_ABI static  inline  iota_range<RTLIB::LibcallImpl>
144-   lookupLibcallImplName (StringRef Name){
145-   //  Inlining the early exit on the string name appears to be worthwhile when
146-   //  querying a real set of symbols
147- #define  GET_LOOKUP_LIBCALL_IMPL_NAME_BODY 
148- #include  " llvm/IR/RuntimeLibcalls.inc" 
149- #undef  GET_LOOKUP_LIBCALL_IMPL_NAME_BODY
150-   }
151- 
152135  // / Check if this is valid libcall for the current module, otherwise
153136  // / RTLIB::Unsupported.
154-   LLVM_ABI RTLIB::LibcallImpl
155-       getSupportedLibcallImpl (StringRef FuncName) const  {
156-     for  (RTLIB::LibcallImpl Impl : lookupLibcallImplName (FuncName)) {
157-       //  FIXME: This should not depend on looking up ImplToLibcall, only the
158-       //  list of libcalls for the module.
159-       RTLIB::LibcallImpl Recognized = LibcallImpls[ImplToLibcall[Impl]];
160-       if  (Recognized != RTLIB::Unsupported)
161-         return  Recognized;
162-     }
163- 
164-     return  RTLIB::Unsupported;
165-   }
137+   LLVM_ABI RTLIB::LibcallImpl getSupportedLibcallImpl (StringRef FuncName) const ;
166138
167139private: 
168-   LLVM_ABI static  iota_range<RTLIB::LibcallImpl>
169-   lookupLibcallImplNameImpl (StringRef Name);
170- 
171140  // / Stores the implementation choice for each each libcall.
172141  RTLIB::LibcallImpl LibcallImpls[RTLIB::UNKNOWN_LIBCALL + 1 ] = {
173142      RTLIB::Unsupported};
@@ -184,16 +153,17 @@ struct RuntimeLibcallsInfo {
184153  LLVM_ABI static  const  char  RuntimeLibcallImplNameTableStorage[];
185154  LLVM_ABI static  const  StringTable RuntimeLibcallImplNameTable;
186155  LLVM_ABI static  const  uint16_t  RuntimeLibcallNameOffsetTable[];
187-   LLVM_ABI static  const  uint8_t  RuntimeLibcallNameSizeTable[];
188156
189157  // / Map from a concrete LibcallImpl implementation to its RTLIB::Libcall kind.
190158  LLVM_ABI static  const  RTLIB::Libcall ImplToLibcall[RTLIB::NumLibcallImpls];
191159
192-   // / Utility function for tablegenerated lookup function. Return a range of
193-   // / enum values that apply for the function name at \p NameOffsetEntry with
194-   // / the value \p StrOffset.
195-   static  inline  iota_range<RTLIB::LibcallImpl>
196-   libcallImplNameHit (uint16_t  NameOffsetEntry, uint16_t  StrOffset);
160+   // / Check if a function name is a recognized runtime call of any kind. This
161+   // / does not consider if this call is available for any current compilation,
162+   // / just that it is a known call somewhere. This returns the set of all
163+   // / LibcallImpls which match the name; multiple implementations with the same
164+   // / name may exist but differ in interpretation based on the target context.
165+   LLVM_ABI static  iterator_range<ArrayRef<uint16_t >::const_iterator>
166+   getRecognizedLibcallImpls (StringRef FuncName);
197167
198168  static  bool  darwinHasSinCosStret (const  Triple &TT) {
199169    if  (!TT.isOSDarwin ())
0 commit comments