From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 739F5381D4F8; Mon, 25 Jul 2022 13:16:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 739F5381D4F8 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/enhance-jit-docs)] jit, docs: use list-table instead of fixed table X-Act-Checkin: gcc X-Git-Author: marxin X-Git-Refname: refs/users/marxin/heads/enhance-jit-docs X-Git-Oldrev: 9ecda6da904b98dabd2b3b74e803b97993c9316b X-Git-Newrev: ccf1e1ae1c97c3d8b9c0418040e75216702cec02 Message-Id: <20220725131618.739F5381D4F8@sourceware.org> Date: Mon, 25 Jul 2022 13:16:18 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2022 13:16:18 -0000 https://gcc.gnu.org/g:ccf1e1ae1c97c3d8b9c0418040e75216702cec02 commit ccf1e1ae1c97c3d8b9c0418040e75216702cec02 Author: marxin Date: Mon Jul 25 12:35:26 2022 +0200 jit,docs: use list-table instead of fixed table Use rather list-table that is easible to maintainer and one does not have to wrap lines. Moreover, it provides great attribute :widths: that correctly works (tested for HTML and PDF). gcc/jit/ChangeLog: * docs/cp/intro/tutorial04.rst: Use list-table. * docs/intro/tutorial04.rst: Likewise. * docs/intro/tutorial05.rst: Likewise. * docs/topics/compilation.rst: Likewise. * docs/topics/expressions.rst: Likewise. * docs/topics/types.rst: Likewise. Diff: --- gcc/jit/docs/cp/intro/tutorial04.rst | 73 +++++++++++++++-------- gcc/jit/docs/intro/tutorial04.rst | 73 +++++++++++++++-------- gcc/jit/docs/intro/tutorial05.rst | 37 ++++++++---- gcc/jit/docs/topics/compilation.rst | 22 ++++--- gcc/jit/docs/topics/expressions.rst | 97 +++++++++++++++++++----------- gcc/jit/docs/topics/types.rst | 111 +++++++++++++++++++++++------------ 6 files changed, 270 insertions(+), 143 deletions(-) diff --git a/gcc/jit/docs/cp/intro/tutorial04.rst b/gcc/jit/docs/cp/intro/tutorial04.rst index 45198ce3d7a..66dcce903c6 100644 --- a/gcc/jit/docs/cp/intro/tutorial04.rst +++ b/gcc/jit/docs/cp/intro/tutorial04.rst @@ -50,30 +50,55 @@ Naturally, a real interpreter would be much more complicated that this. The following operations are supported: -====================== ======================== =============== ============== -Operation Meaning Old Stack New Stack -====================== ======================== =============== ============== -DUP Duplicate top of stack. ``[..., x]`` ``[..., x, x]`` -ROT Swap top two elements ``[..., x, y]`` ``[..., y, x]`` - of stack. -BINARY_ADD Add the top two elements ``[..., x, y]`` ``[..., (x+y)]`` - on the stack. -BINARY_SUBTRACT Likewise, but subtract. ``[..., x, y]`` ``[..., (x-y)]`` -BINARY_MULT Likewise, but multiply. ``[..., x, y]`` ``[..., (x*y)]`` -BINARY_COMPARE_LT Compare the top two ``[..., x, y]`` ``[..., (x`` ``idx += 1`` -``<`` ``idx -= 1`` -``+`` ``data[idx] += 1`` -``-`` ``data[idx] -= 1`` -``.`` ``output (data[idx])`` -``,`` ``data[idx] = input ()`` -``[`` loop until ``data[idx] == 0`` -``]`` end of loop -Anything else ignored -====================== ============================= +.. list-table:: + :header-rows: 1 + + * - Character + - Meaning + + * - ``>`` + - ``idx += 1`` + * - ``<`` + - ``idx -= 1`` + * - ``+`` + - ``data[idx] += 1`` + * - ``-`` + - ``data[idx] -= 1`` + * - ``.`` + - ``output (data[idx])`` + * - ``,`` + - ``data[idx] = input ()`` + * - ``[`` + - loop until ``data[idx] == 0`` + * - ``]`` + - end of loop + * - Anything else + - ignored Unlike the previous example, we'll implement an ahead-of-time compiler, which reads ``.bf`` scripts and outputs executables (though it would diff --git a/gcc/jit/docs/topics/compilation.rst b/gcc/jit/docs/topics/compilation.rst index 91b9c2533cf..adcde8d8eb9 100644 --- a/gcc/jit/docs/topics/compilation.rst +++ b/gcc/jit/docs/topics/compilation.rst @@ -169,14 +169,20 @@ For linking in object files, use :c:func:`gcc_jit_context_add_driver_option`. The available kinds of output are: -============================================== ============== -Output kind Typical suffix -============================================== ============== -:c:macro:`GCC_JIT_OUTPUT_KIND_ASSEMBLER` .s -:c:macro:`GCC_JIT_OUTPUT_KIND_OBJECT_FILE` .o -:c:macro:`GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY` .so or .dll -:c:macro:`GCC_JIT_OUTPUT_KIND_EXECUTABLE` None, or .exe -============================================== ============== +.. list-table:: + :header-rows: 1 + + * - Output kind + - Typical suffix + + * - :c:macro:`GCC_JIT_OUTPUT_KIND_ASSEMBLER` + - .s + * - :c:macro:`GCC_JIT_OUTPUT_KIND_OBJECT_FILE` + - .o + * - :c:macro:`GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY` + - .so or .dll + * - :c:macro:`GCC_JIT_OUTPUT_KIND_EXECUTABLE` + - None, or .exe .. c:macro:: GCC_JIT_OUTPUT_KIND_ASSEMBLER diff --git a/gcc/jit/docs/topics/expressions.rst b/gcc/jit/docs/topics/expressions.rst index 00e2ec8cfeb..ff1eec800ce 100644 --- a/gcc/jit/docs/topics/expressions.rst +++ b/gcc/jit/docs/topics/expressions.rst @@ -313,14 +313,20 @@ Unary Operations The available unary operations are: -========================================== ============ -Unary Operation C equivalent -========================================== ============ -:c:macro:`GCC_JIT_UNARY_OP_MINUS` `-(EXPR)` -:c:macro:`GCC_JIT_UNARY_OP_BITWISE_NEGATE` `~(EXPR)` -:c:macro:`GCC_JIT_UNARY_OP_LOGICAL_NEGATE` `!(EXPR)` -:c:macro:`GCC_JIT_UNARY_OP_ABS` `abs (EXPR)` -========================================== ============ +.. list-table:: + :header-rows: 1 + + * - Unary Operation + - C equivalent + + * - :c:macro:`GCC_JIT_UNARY_OP_MINUS` + - `-(EXPR)` + * - :c:macro:`GCC_JIT_UNARY_OP_BITWISE_NEGATE` + - `~(EXPR)` + * - :c:macro:`GCC_JIT_UNARY_OP_LOGICAL_NEGATE` + - `!(EXPR)` + * - :c:macro:`GCC_JIT_UNARY_OP_ABS` + - `abs (EXPR)` .. c:macro:: GCC_JIT_UNARY_OP_MINUS @@ -380,22 +386,36 @@ Binary Operations The available binary operations are: -======================================== ============ -Binary Operation C equivalent -======================================== ============ -:c:macro:`GCC_JIT_BINARY_OP_PLUS` `x + y` -:c:macro:`GCC_JIT_BINARY_OP_MINUS` `x - y` -:c:macro:`GCC_JIT_BINARY_OP_MULT` `x * y` -:c:macro:`GCC_JIT_BINARY_OP_DIVIDE` `x / y` -:c:macro:`GCC_JIT_BINARY_OP_MODULO` `x % y` -:c:macro:`GCC_JIT_BINARY_OP_BITWISE_AND` `x & y` -:c:macro:`GCC_JIT_BINARY_OP_BITWISE_XOR` `x ^ y` -:c:macro:`GCC_JIT_BINARY_OP_BITWISE_OR` `x | y` -:c:macro:`GCC_JIT_BINARY_OP_LOGICAL_AND` `x && y` -:c:macro:`GCC_JIT_BINARY_OP_LOGICAL_OR` `x || y` -:c:macro:`GCC_JIT_BINARY_OP_LSHIFT` `x << y` -:c:macro:`GCC_JIT_BINARY_OP_RSHIFT` `x >> y` -======================================== ============ +.. list-table:: + :header-rows: 1 + + * - Binary Operation + - C equivalent + + * - :c:macro:`GCC_JIT_BINARY_OP_PLUS` + - `x + y` + * - :c:macro:`GCC_JIT_BINARY_OP_MINUS` + - `x - y` + * - :c:macro:`GCC_JIT_BINARY_OP_MULT` + - `x * y` + * - :c:macro:`GCC_JIT_BINARY_OP_DIVIDE` + - `x / y` + * - :c:macro:`GCC_JIT_BINARY_OP_MODULO` + - `x % y` + * - :c:macro:`GCC_JIT_BINARY_OP_BITWISE_AND` + - `x & y` + * - :c:macro:`GCC_JIT_BINARY_OP_BITWISE_XOR` + - `x ^ y` + * - :c:macro:`GCC_JIT_BINARY_OP_BITWISE_OR` + - `x | y` + * - :c:macro:`GCC_JIT_BINARY_OP_LOGICAL_AND` + - `x && y` + * - :c:macro:`GCC_JIT_BINARY_OP_LOGICAL_OR` + - `x || y` + * - :c:macro:`GCC_JIT_BINARY_OP_LSHIFT` + - `x << y` + * - :c:macro:`GCC_JIT_BINARY_OP_RSHIFT` + - `x >> y` .. c:macro:: GCC_JIT_BINARY_OP_PLUS @@ -536,17 +556,24 @@ Comparisons .. enum:: gcc_jit_comparison -======================================= ============ -Comparison C equivalent -======================================= ============ -:c:macro:`GCC_JIT_COMPARISON_EQ` `x == y` -:c:macro:`GCC_JIT_COMPARISON_NE` `x != y` -:c:macro:`GCC_JIT_COMPARISON_LT` `x < y` -:c:macro:`GCC_JIT_COMPARISON_LE` `x <= y` -:c:macro:`GCC_JIT_COMPARISON_GT` `x > y` -:c:macro:`GCC_JIT_COMPARISON_GE` `x >= y` -======================================= ============ - +.. list-table:: + :header-rows: 1 + + * - Comparison + - C equivalent + + * - :c:macro:`GCC_JIT_COMPARISON_EQ` + - `x == y` + * - :c:macro:`GCC_JIT_COMPARISON_NE` + - `x != y` + * - :c:macro:`GCC_JIT_COMPARISON_LT` + - `x < y` + * - :c:macro:`GCC_JIT_COMPARISON_LE` + - `x <= y` + * - :c:macro:`GCC_JIT_COMPARISON_GT` + - `x > y` + * - :c:macro:`GCC_JIT_COMPARISON_GE` + - `x >= y` Function calls ************** diff --git a/gcc/jit/docs/topics/types.rst b/gcc/jit/docs/topics/types.rst index db7fac6b267..457b3623ec9 100644 --- a/gcc/jit/docs/topics/types.rst +++ b/gcc/jit/docs/topics/types.rst @@ -57,45 +57,78 @@ Standard types Access a specific type. The available types are: - ========================================== ================================ - `enum gcc_jit_types` value Meaning - ========================================== ================================ - :c:data:`GCC_JIT_TYPE_VOID` C's ``void`` type. - :c:data:`GCC_JIT_TYPE_VOID_PTR` C's ``void *``. - :c:data:`GCC_JIT_TYPE_BOOL` C++'s ``bool`` type; also C99's - ``_Bool`` type, aka ``bool`` if - using stdbool.h. - :c:data:`GCC_JIT_TYPE_CHAR` C's ``char`` (of some signedness) - :c:data:`GCC_JIT_TYPE_SIGNED_CHAR` C's ``signed char`` - :c:data:`GCC_JIT_TYPE_UNSIGNED_CHAR` C's ``unsigned char`` - :c:data:`GCC_JIT_TYPE_SHORT` C's ``short`` (signed) - :c:data:`GCC_JIT_TYPE_UNSIGNED_SHORT` C's ``unsigned short`` - :c:data:`GCC_JIT_TYPE_INT` C's ``int`` (signed) - :c:data:`GCC_JIT_TYPE_UNSIGNED_INT` C's ``unsigned int`` - :c:data:`GCC_JIT_TYPE_LONG` C's ``long`` (signed) - :c:data:`GCC_JIT_TYPE_UNSIGNED_LONG` C's ``unsigned long`` - :c:data:`GCC_JIT_TYPE_LONG_LONG` C99's ``long long`` (signed) - :c:data:`GCC_JIT_TYPE_UNSIGNED_LONG_LONG` C99's ``unsigned long long`` - :c:data:`GCC_JIT_TYPE_UINT8_T` C99's ``uint8_t`` - :c:data:`GCC_JIT_TYPE_UINT16_T` C99's ``uint16_t`` - :c:data:`GCC_JIT_TYPE_UINT32_T` C99's ``uint32_t`` - :c:data:`GCC_JIT_TYPE_UINT64_T` C99's ``uint64_t`` - :c:data:`GCC_JIT_TYPE_UINT128_T` C99's ``__uint128_t`` - :c:data:`GCC_JIT_TYPE_INT8_T` C99's ``int8_t`` - :c:data:`GCC_JIT_TYPE_INT16_T` C99's ``int16_t`` - :c:data:`GCC_JIT_TYPE_INT32_T` C99's ``int32_t`` - :c:data:`GCC_JIT_TYPE_INT64_T` C99's ``int64_t`` - :c:data:`GCC_JIT_TYPE_INT128_T` C99's ``__int128_t`` - :c:data:`GCC_JIT_TYPE_FLOAT` - :c:data:`GCC_JIT_TYPE_DOUBLE` - :c:data:`GCC_JIT_TYPE_LONG_DOUBLE` - :c:data:`GCC_JIT_TYPE_CONST_CHAR_PTR` C type: ``(const char *)`` - :c:data:`GCC_JIT_TYPE_SIZE_T` C's ``size_t`` type - :c:data:`GCC_JIT_TYPE_FILE_PTR` C type: ``(FILE *)`` - :c:data:`GCC_JIT_TYPE_COMPLEX_FLOAT` C99's ``_Complex float`` - :c:data:`GCC_JIT_TYPE_COMPLEX_DOUBLE` C99's ``_Complex double`` - :c:data:`GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE` C99's ``_Complex long double`` - ========================================== ================================ + .. list-table:: + :header-rows: 1 + + * - `enum gcc_jit_types` value + - Meaning + + * - :c:data:`GCC_JIT_TYPE_VOID` + - C's ``void`` type. + * - :c:data:`GCC_JIT_TYPE_VOID_PTR` + - C's ``void *``. + * - :c:data:`GCC_JIT_TYPE_BOOL` + - C++'s ``bool`` type; also C99's ``_Bool`` type, aka ``bool`` if using stdbool.h. + * - :c:data:`GCC_JIT_TYPE_CHAR` + - C's ``char`` (of some signedness) + * - :c:data:`GCC_JIT_TYPE_SIGNED_CHAR` + - C's ``signed char`` + * - :c:data:`GCC_JIT_TYPE_UNSIGNED_CHAR` + - C's ``unsigned char`` + * - :c:data:`GCC_JIT_TYPE_SHORT` + - C's ``short`` (signed) + * - :c:data:`GCC_JIT_TYPE_UNSIGNED_SHORT` + - C's ``unsigned short`` + * - :c:data:`GCC_JIT_TYPE_INT` + - C's ``int`` (signed) + * - :c:data:`GCC_JIT_TYPE_UNSIGNED_INT` + - C's ``unsigned int`` + * - :c:data:`GCC_JIT_TYPE_LONG` + - C's ``long`` (signed) + * - :c:data:`GCC_JIT_TYPE_UNSIGNED_LONG` + - C's ``unsigned long`` + * - :c:data:`GCC_JIT_TYPE_LONG_LONG` + - C99's ``long long`` (signed) + * - :c:data:`GCC_JIT_TYPE_UNSIGNED_LONG_LONG` + - C99's ``unsigned long long`` + * - :c:data:`GCC_JIT_TYPE_UINT8_T` + - C99's ``uint8_t`` + * - :c:data:`GCC_JIT_TYPE_UINT16_T` + - C99's ``uint16_t`` + * - :c:data:`GCC_JIT_TYPE_UINT32_T` + - C99's ``uint32_t`` + * - :c:data:`GCC_JIT_TYPE_UINT64_T` + - C99's ``uint64_t`` + * - :c:data:`GCC_JIT_TYPE_UINT128_T` + - C99's ``__uint128_t`` + * - :c:data:`GCC_JIT_TYPE_INT8_T` + - C99's ``int8_t`` + * - :c:data:`GCC_JIT_TYPE_INT16_T` + - C99's ``int16_t`` + * - :c:data:`GCC_JIT_TYPE_INT32_T` + - C99's ``int32_t`` + * - :c:data:`GCC_JIT_TYPE_INT64_T` + - C99's ``int64_t`` + * - :c:data:`GCC_JIT_TYPE_INT128_T` + - C99's ``__int128_t`` + * - :c:data:`GCC_JIT_TYPE_FLOAT` + - + * - :c:data:`GCC_JIT_TYPE_DOUBLE` + - + * - :c:data:`GCC_JIT_TYPE_LONG_DOUBLE` + - + * - :c:data:`GCC_JIT_TYPE_CONST_CHAR_PTR` + - C type: ``(const char *)`` + * - :c:data:`GCC_JIT_TYPE_SIZE_T` + - C's ``size_t`` type + * - :c:data:`GCC_JIT_TYPE_FILE_PTR` + - C type: ``(FILE *)`` + * - :c:data:`GCC_JIT_TYPE_COMPLEX_FLOAT` + - C99's ``_Complex float`` + * - :c:data:`GCC_JIT_TYPE_COMPLEX_DOUBLE` + - C99's ``_Complex double`` + * - :c:data:`GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE` + - C99's ``_Complex long double`` .. function:: gcc_jit_type *\ gcc_jit_context_get_int_type (gcc_jit_context *ctxt, \