[compiler-rt] [llvm] [nsan] Emit calls to optimized functions (PR #98900)

Alexander Shaposhnikov via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 23:14:26 PDT 2024


================
@@ -493,6 +493,58 @@ class ValueToShadowMap {
   DenseMap<Value *, Value *> Map;
 };
 
+// First parameter is the number of functions
+// Second parameter is the number of fallback function arguments
+template <size_t N> class NsanMemOpFn {
+public:
+  NsanMemOpFn(Module &M, ArrayRef<StringRef> Sized, StringRef Fallback,
+              int NFallbackArgs);
+  // Number of parameters can be extracted from FunctionCallee
+  FunctionCallee getFunctionFor(uint64_t MemOpSize) const;
+  FunctionCallee getFallback() const;
+
+private:
+  std::array<FunctionCallee, N> Funcs;
+};
+
+template <size_t N>
+NsanMemOpFn<N>::NsanMemOpFn(Module &M, ArrayRef<StringRef> Sized,
+                            StringRef Fallback, int NFallbackArgs) {
----------------
alexander-shaposhnikov wrote:

nit: int NFallBackArgs -> size_t NumArgs


https://github.com/llvm/llvm-project/pull/98900


More information about the llvm-commits mailing list