[PATCH] D79867: [VectorUtils] Expose vector-function-abi-variant mangling as a utility. NFC

Francesco Petrogalli via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 14 13:03:51 PDT 2020


fpetrogalli added inline comments.


================
Comment at: llvm/include/llvm/Analysis/VectorUtils.h:184
+/// <vectorname> = the name of the vector function.
+std::string mangleVectorName(StringRef VectorName, StringRef ScalarName,
+                             unsigned numArgs, unsigned VF);
----------------
simoll wrote:
> Since this is for the LLVM-specific VectorABI, why not rename it to `mangleLLVMVectorName` for less potential confusion?
I was thinking... given that we are talking about exposing an API that would be needed for all target ISA (including the `_LLVM_` one), should we just get it done straight from the beginning? Instead of exposing a TLI only method, implement the following:

```
std::string VFABI::mangleScalarName(StringRef ScalarName, VFISAKind ISA, VFShape Shape);
```

This would implement the mangling rules described at https://llvm.org/docs/LangRef.html#call-site-attributes, including unit tests for it.

Then for TLI names, all we need to do would be to invoke it (for example in the frontend, and in the InjectTLIMappings, in a separate patch), as follows:

```
 ... = VFABI:mangleScalarName(CI->getCalledFunction()->getName(), VFIsaKind::LLVM, VFShape::get(CI, {VF, false}, false))
```

@anna , is this something you have time to do? If not, I am fine with exposing the TLI specific method, just make sure that the fact that it is TLI specific is mentioned in the name.

@simoll, regarding: 

> why not rename it to mangleLLVMVectorName for less potential confusion

I see your point, but the LLVM-specific ABI does not prevent using tokens other than `"v"`, so the method as it is now is really TLI specific, not LLVM-ABI specific.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79867/new/

https://reviews.llvm.org/D79867





More information about the llvm-commits mailing list