[libc-commits] [PATCH] D143911: [libc][doc] Update macros documentation

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Aug 8 01:00:55 PDT 2023


gchatelet updated this revision to Diff 548094.
gchatelet added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143911

Files:
  libc/docs/dev/code_style.rst


Index: libc/docs/dev/code_style.rst
===================================================================
--- libc/docs/dev/code_style.rst
+++ libc/docs/dev/code_style.rst
@@ -27,7 +27,7 @@
 Macro style
 ===========
 
-We define two kinds of macros: **code defined** and **build defined** macros.
+We define two kinds of macros:
 
 #. **Build defined** macros are generated by `CMake` or `Bazel` and are passed
    down to the compiler with the ``-D`` command line flag. They start with the
@@ -35,15 +35,27 @@
    They either denote an action or define a constant.
 
 #. **Code defined** macros are defined within the ``src/__support/macros``
-   folder. They all start with the ``LIBC_`` prefix. They are of two kinds
-
-   * **Properties** - Build related properties like used compiler, target
-     architecture or enabled CPU features defined by introspecting compiler
-     defined preprocessor definitions. e.g., ``LIBC_TARGET_ARCH_IS_ARM``,
-     ``LIBC_TARGET_CPU_HAS_AVX2``, ``LIBC_COMPILER_IS_CLANG``, ...
-   * **Attributes** - Compiler agnostic attributes or functions to handle
-     specific operations. e.g., ``LIBC_INLINE``, ``LIBC_NO_LOOP_UNROLL``,
-     ``LIBC_LIKELY``, ``LIBC_INLINE_ASM``.
+   folder. They all start with the ``LIBC_`` prefix.
+
+   * ``src/__support/macros/properties/`` - Build related properties like
+     target architecture or enabled CPU features defined by introspecting
+     compiler defined preprocessor defininitions.
+
+     * ``architectures.h`` - Target architecture properties.
+       e.g., ``LIBC_TARGET_ARCH_IS_ARM``.
+     * ``compiler.h`` - Host compiler properties.
+       e.g., ``LIBC_COMPILER_IS_CLANG``.
+     * ``cpu_features.h`` - Target cpu apu feature availability.
+       e.g., ``LIBC_TARGET_CPU_HAS_AVX2``.
+
+   * ``src/__support/macros/config.h`` - Important compiler and platform
+     features. Such macros can be used to produce portable code by
+     parameterizing compilation based on the presence or lack of a given
+     feature. e.g., ``LIBC_HAS_BUILTIN``
+   * ``src/__support/macros/attributes.h`` - Attributes for functions, types,
+     and variables. e.g., ``LIBC_UNUSED``
+   * ``src/__support/macros/optimization.h`` - Portable macros for performance
+     optimization. e.g., ``LIBC_LIKELY``, ``LIBC_LOOP_NOUNROLL``
 
 Inline functions and variables defined in header files
 ======================================================


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143911.548094.patch
Type: text/x-patch
Size: 2418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230808/da55f66d/attachment.bin>


More information about the libc-commits mailing list