llvm/llvm/include/llvm/Analysis/TargetLibraryInfo.def

//===-- TargetLibraryInfo.def - Library information -------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// This .def file will either fill in the enum definition or fill in the
// string representation array definition for TargetLibraryInfo.
// Which is defined depends on whether TLI_DEFINE_ENUM is defined or
// TLI_DEFINE_STRING is defined. Only one should be defined at a time.

// NOTE: The nofree attribute is added to Libfuncs which are not
// listed as free or realloc functions in MemoryBuiltins.cpp
//
// When adding a function which frees memory include the LibFunc
// in lib/Analysis/MemoryBuiltins.cpp "isLibFreeFunction".
//
// When adding a LibFunc which reallocates memory include the LibFunc
// in lib/Analysis/MemoryBuiltins.cpp "AllocationFnData[]".

#if (defined(TLI_DEFINE_ENUM) +                 \
     defined(TLI_DEFINE_STRING) +               \
     defined(TLI_DEFINE_SIG) != 1)
#error "Must define exactly one of TLI_DEFINE_ENUM, TLI_DEFINE_STRING, or TLI_DEFINE_SIG for TLI .def."
#else
// Exactly one of TLI_DEFINE_ENUM/STRING/SIG is defined.

#if defined(TLI_DEFINE_ENUM)
#define TLI_DEFINE_ENUM_INTERNAL(enum_variant) LibFunc_##enum_variant,
#define TLI_DEFINE_STRING_INTERNAL(string_repr)
#define TLI_DEFINE_SIG_INTERNAL(...)
#elif defined(TLI_DEFINE_STRING)
#define TLI_DEFINE_ENUM_INTERNAL(enum_variant)
#define TLI_DEFINE_STRING_INTERNAL(string_repr) string_repr,
#define TLI_DEFINE_SIG_INTERNAL(...)
#else
#define TLI_DEFINE_ENUM_INTERNAL(enum_variant)
#define TLI_DEFINE_STRING_INTERNAL(string_repr)
#define TLI_DEFINE_SIG_INTERNAL(...) {}