https://github.com/Lancern updated 
https://github.com/llvm/llvm-project/pull/190354

>From 6d673976da4a50708b1da3f18c53e7844f4ccdda Mon Sep 17 00:00:00 2001
From: Sirui Mu <[email protected]>
Date: Fri, 3 Apr 2026 23:27:56 +0800
Subject: [PATCH] [clang][doc] Add auto-generated ClangIR documentation

ClangIR has a collection of documentation pages that we want to upstream as part
of the main clang documentation. These pages are originally available at
https://clangir.org/, maintained in the incubator repository which has been
archived a few months ago.

This patch makes a first step towards the upstreaming of ClangIR documentation.
The pages included in this patch are those automatically generated from MLIR
TableGen. Specifically, this patch mades the following changes to the main clang
documentation tree:

  - It adds a new subdirectory `CIR` under `clang/docs` to hold all ClangIR
    documentation. There are already 3 ClangIR design documents put under
    `clang/docs`, and I moved all of them to this new subdirectory.
  - It touches the necessary CMake files and Python scripts to:
    - Generate ClangIR language reference automatically from MLIR TableGen when
      building the clang documentation with `CLANG_ENABLE_CIR=ON`.
    - Incorporate these automatically generated documents (if any) into the main
      clang documentation build tree.
---
 .../ABILowering.md}                           |   0
 .../CleanupAndEHDesign.md}                    |   0
 .../CodeDuplication.rst}                      |   0
 clang/docs/CIR/_raw/PostProcessCIRDocs.py     |  54 ++++
 clang/docs/CIR/index.rst                      |  23 ++
 clang/docs/CMakeLists.txt                     |  10 +
 clang/docs/conf.py                            |   2 +-
 clang/docs/index.rst                          |   4 +-
 .../include/clang/CIR/Dialect/CMakeLists.txt  |  20 ++
 .../include/clang/CIR/Dialect/IR/CIRAttrs.td  |  27 +-
 clang/include/clang/CIR/Dialect/IR/CIROps.td  | 276 +++++++++---------
 .../include/clang/CIR/Dialect/IR/CIRTypes.td  |  16 +-
 .../clang/CIR/Dialect/IR/CMakeLists.txt       |   3 +
 13 files changed, 272 insertions(+), 163 deletions(-)
 rename clang/docs/{ClangIRABILowering.md => CIR/ABILowering.md} (100%)
 rename clang/docs/{ClangIRCleanupAndEHDesign.md => CIR/CleanupAndEHDesign.md} 
(100%)
 rename clang/docs/{ClangIRCodeDuplication.rst => CIR/CodeDuplication.rst} 
(100%)
 create mode 100644 clang/docs/CIR/_raw/PostProcessCIRDocs.py
 create mode 100644 clang/docs/CIR/index.rst

diff --git a/clang/docs/ClangIRABILowering.md b/clang/docs/CIR/ABILowering.md
similarity index 100%
rename from clang/docs/ClangIRABILowering.md
rename to clang/docs/CIR/ABILowering.md
diff --git a/clang/docs/ClangIRCleanupAndEHDesign.md 
b/clang/docs/CIR/CleanupAndEHDesign.md
similarity index 100%
rename from clang/docs/ClangIRCleanupAndEHDesign.md
rename to clang/docs/CIR/CleanupAndEHDesign.md
diff --git a/clang/docs/ClangIRCodeDuplication.rst 
b/clang/docs/CIR/CodeDuplication.rst
similarity index 100%
rename from clang/docs/ClangIRCodeDuplication.rst
rename to clang/docs/CIR/CodeDuplication.rst
diff --git a/clang/docs/CIR/_raw/PostProcessCIRDocs.py 
b/clang/docs/CIR/_raw/PostProcessCIRDocs.py
new file mode 100644
index 0000000000000..fb42b0524981a
--- /dev/null
+++ b/clang/docs/CIR/_raw/PostProcessCIRDocs.py
@@ -0,0 +1,54 @@
+# This script embeds MLIR generated documentations (in Markdown format) into
+# CIRLangRef_Template.md to generate CIRLangRef.md
+
+import os
+import sys
+
+
+docs_src_dir = sys.argv[1]
+docs_bin_dir = sys.argv[2]
+
+DIALECT_DOC_PATH = os.path.join(docs_bin_dir, "CIR", "_raw", "CIRDialect.md")
+DIALECT_DOC_OUTPUT_PATH = os.path.join(docs_bin_dir, "CIR", "CIRDialect.md")
+
+INDEX_PATH = os.path.join(docs_src_dir, "CIR", "index.rst")
+INDEX_OUTPUT_PATH = os.path.join(docs_bin_dir, "CIR", "index.rst")
+
+cir_docs_toctree = []
+
+# ===============================================
+# Post-process CIRDialect.md
+# ===============================================
+if os.path.exists(DIALECT_DOC_PATH):
+    cir_docs_toctree.append("CIRDialect")
+    with open(DIALECT_DOC_PATH, encoding="utf-8") as fp:
+        dialect_doc = fp.read()
+    dialect_doc = dialect_doc.replace("[TOC]", """
+```{contents}
+---
+local:
+depth: 2
+---
+```""".strip())
+    with open(DIALECT_DOC_OUTPUT_PATH, "w", encoding="utf-8") as fp:
+        fp.write(dialect_doc)
+
+# ===============================================
+# Add toctree to index.rst if CIR docs are generated
+# ===============================================
+if len(cir_docs_toctree) > 0:
+    with open(INDEX_PATH, encoding="utf-8") as fp:
+        index_content = fp.read()
+    index_content += f"""
+
+CIR Dialect Reference
+==========================
+
+.. toctree::
+    :numbered:
+    :maxdepth: 1
+
+    {"\n    ".join(cir_docs_toctree)}
+"""
+    with open(INDEX_OUTPUT_PATH, "w", encoding="utf-8") as fp:
+        fp.write(index_content)
diff --git a/clang/docs/CIR/index.rst b/clang/docs/CIR/index.rst
new file mode 100644
index 0000000000000..e4b2acba15502
--- /dev/null
+++ b/clang/docs/CIR/index.rst
@@ -0,0 +1,23 @@
+=======
+ClangIR
+=======
+
+.. warning::
+    The project of upstreaming ClangIR support from the incubator repository is
+    still in progress, and ClangIR is not included in a default clang build. 
The
+    documentation may be incomplete and out-of-date.
+
+ClangIR is a high-level representation in Clang that reflects aspects of the
+C/C++ languages and their extensions. It is implemented using MLIR and occupies
+a position between Clang's AST and LLVM IR.
+
+ClangIR Design Documents
+========================
+
+.. toctree::
+    :numbered:
+    :maxdepth: 1
+
+    ABILowering
+    CleanupAndEHDesign
+    CodeDuplication
diff --git a/clang/docs/CMakeLists.txt b/clang/docs/CMakeLists.txt
index e69d4750aeb4c..766f0d1575eee 100644
--- a/clang/docs/CMakeLists.txt
+++ b/clang/docs/CMakeLists.txt
@@ -112,6 +112,16 @@ if (LLVM_ENABLE_SPHINX)
       "${CMAKE_CURRENT_BINARY_DIR}"
     )
 
+    add_custom_command(TARGET copy-clang-rst-docs POST_BUILD
+      COMMAND "${Python3_EXECUTABLE}"
+      ARGS "${CMAKE_CURRENT_BINARY_DIR}/CIR/_raw/PostProcessCIRDocs.py"
+           "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"
+      BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/CIR/CIRDialect.md
+    )
+    if (CLANG_ENABLE_CIR)
+      add_dependencies(copy-clang-rst-docs clang-cir-doc)
+    endif()
+
     set(docs_targets "")
 
     if (${SPHINX_OUTPUT_HTML})
diff --git a/clang/docs/conf.py b/clang/docs/conf.py
index 4cee382a718fa..23e059baeb863 100644
--- a/clang/docs/conf.py
+++ b/clang/docs/conf.py
@@ -69,7 +69,7 @@
 
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
-exclude_patterns = ["_build"]
+exclude_patterns = ["_build", "CIR/_raw/*"]
 
 # The reST default role (used for this markup: `text`) to use for all 
documents.
 # default_role = None
diff --git a/clang/docs/index.rst b/clang/docs/index.rst
index 89ca6d73d9d8d..898667e36011d 100644
--- a/clang/docs/index.rst
+++ b/clang/docs/index.rst
@@ -69,6 +69,7 @@ Using Clang as a Compiler
    DebuggingCoroutines
    AMDGPUSupport
    CXXTypeAwareAllocators
+   CIR/index
    CommandGuide/index
    FAQ
 
@@ -127,9 +128,6 @@ Design Documents
    HardwareAssistedAddressSanitizerDesign.rst
    ConstantInterpreter
    LLVMExceptionHandlingCodeGen
-   ClangIRCodeDuplication
-   ClangIRABILowering
-   ClangIRCleanupAndEHDesign
 
 Indices and tables
 ==================
diff --git a/clang/include/clang/CIR/Dialect/CMakeLists.txt 
b/clang/include/clang/CIR/Dialect/CMakeLists.txt
index 3d4e6586e1c62..34d2b712e3541 100644
--- a/clang/include/clang/CIR/Dialect/CMakeLists.txt
+++ b/clang/include/clang/CIR/Dialect/CMakeLists.txt
@@ -1,3 +1,23 @@
+add_custom_target(clang-cir-doc)
+
+# This replicates part of the add_mlir_doc cmake function from MLIR that cannot
+# be used here. This happens because it expects to be run inside MLIR directory
+# which is not the case for CIR (and also FIR, both have similar workarounds).
+function(add_clang_mlir_doc doc_filename output_file output_directory command)
+  set(LLVM_TARGET_DEFINITIONS ${doc_filename}.td)
+  tablegen(MLIR ${output_file}.md ${command} ${ARGN}
+           "-I${MLIR_MAIN_SRC_DIR}" "-I${MLIR_INCLUDE_DIR}")
+  set(GEN_DOC_FILE 
${CLANG_BINARY_DIR}/docs/CIR/_raw/${output_directory}${output_file}.md)
+  add_custom_command(
+          OUTPUT ${GEN_DOC_FILE}
+          COMMAND ${CMAKE_COMMAND} -E copy
+                  ${CMAKE_CURRENT_BINARY_DIR}/${output_file}.md
+                  ${GEN_DOC_FILE}
+          DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${output_file}.md)
+  add_custom_target(${output_file}DocGen DEPENDS ${GEN_DOC_FILE})
+  add_dependencies(clang-cir-doc ${output_file}DocGen)
+endfunction()
+
 add_subdirectory(IR)
 
 set(LLVM_TARGET_DEFINITIONS Passes.td)
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td 
b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
index 01bac73e441a8..2e295ba7f5bcc 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
@@ -145,7 +145,7 @@ def CIR_OptInfoAttr : CIR_Attr<"OptInfo", "opt_info"> {
 
     Examples:
 
-    ```mlir
+    ```
     #cir.opt_info<level = 2, size = 0>  // -O2
     ```
   }];
@@ -553,6 +553,7 @@ def CIR_MethodAttr : CIR_ValueLikeAttr<"Method", "method"> {
     // Null method pointer
     %0 = cir.const #cir.method<null> :
              !cir.method<!cir.func<(!s32i)> in !rec_S>
+    ```
   }];
 
   let parameters = (ins AttributeSelfTypeParameter<
@@ -626,7 +627,7 @@ def CIR_CmpThreeWayInfoAttr : CIR_Attr<"CmpThreeWayInfo", 
"cmp3way_info"> {
 
     Example:
 
-    ```mlir
+    ```
     !s32i = !cir.int<s, 32>
 
     #cmpinfo_partial_ltn1eq0gt1unn127 = #cir.cmp3way_info<partial, lt = -1, eq 
= 0, gt = 1, unordered = -127>
@@ -779,7 +780,7 @@ def CIR_VTableAttr : CIR_ValueLikeAttr<"VTable", "vtable"> {
     multiple arrays, each of which is a vtable.
 
     Example 1 (single vtable):
-    ```mlir
+    ```
     cir.global linkonce_odr @_ZTV6Mother =
       #cir.vtable<{
         #cir.const_array<[
@@ -792,7 +793,7 @@ def CIR_VTableAttr : CIR_ValueLikeAttr<"VTable", "vtable"> {
     ```
 
     Example 2 (multiple vtables):
-    ```mlir
+    ```
     cir.global linkonce_odr @_ZTV5Child =
       #cir.vtable<{
         #cir.const_array<[
@@ -904,7 +905,7 @@ def CIR_LangAddressSpaceAttr : 
CIR_EnumAttr<CIR_LangAddressSpace,
     numbers.
 
     Example:
-    ```mlir
+    ```
     !cir.ptr<!s32i, lang_address_space(offload_local)>
     cir.global constant external lang_address_space(offload_constant)
     ```
@@ -951,7 +952,7 @@ def CIR_TargetAddressSpaceAttr : CIR_Attr< 
"TargetAddressSpace",
     address spaces are target-specific.
 
     Example:
-    ```mlir
+    ```
     // Target-specific numeric address spaces
     !cir.ptr<!s32i, addrspace(target<1>)>
     !cir.ptr<!s32i, addrspace(target<10>)>
@@ -977,7 +978,7 @@ def CIR_ConstComplexAttr : 
CIR_ValueLikeAttr<"ConstComplex", "const_complex"> {
     The `real` and `imag` parameters must both reference the same type and must
     be either IntAttr or FPAttr.
 
-    ```mlir
+    ```
     %ci = #cir.const_complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i>
         : !cir.complex<!s32i>
     %cf = #cir.const_complex<#cir.fp<1.000000e+00> : !cir.float,
@@ -1124,7 +1125,7 @@ def CIR_CXXCtorAttr : CIR_Attr<"CXXCtor", "cxx_ctor"> {
     - `move`: a move constructor
 
     Example:
-    ```mlir
+    ```
     #cir.cxx_ctor<!rec_a, copy>
     #cir.cxx_ctor<!rec_b, default, trivial>
     ```
@@ -1235,12 +1236,12 @@ def CIR_BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", 
"bitfield_info"> {
         ```
 
       The CIR representation of the struct `S` might look like:
-      ```mlir
+      ```
         !rec_S = !cir.record<struct "S" packed padded {!u64i, !u16i,
                                                        !cir.array<!u8i x 2>}>
       ```
       And the bitfield info attribute for member `a` would be:
-      ```mlir
+      ```
         #bfi_a = #cir.bitfield_info<name = "a", storage_type = !u64i,
                                     size = 4, offset = 0, is_signed = true>
       ```
@@ -1291,7 +1292,7 @@ def CIR_AddressPointAttr : CIR_Attr<"AddressPoint", 
"address_point"> {
     within that vtable where the address begins.
 
     Example:
-    ```mlir
+    ```
     cir.global linkonce_odr @_ZTV1B = ...
     ...
     %3 = cir.vtable.address_point(@_ZTV1B,
@@ -1438,7 +1439,7 @@ def CIR_SideEffect : CIR_I32EnumAttr<
 
     Examples:
 
-    ```mlir
+    ```
     %2 = cir.call @add(%0, %1) : (!s32i, !s32i) -> !s32i
     %2 = cir.call @add(%0, %1) : (!s32i, !s32i) -> !s32i side_effect(pure)
     %2 = cir.call @add(%0, %1) : (!s32i, !s32i) -> !s32i side_effect(const)
@@ -1458,7 +1459,7 @@ def CIR_StaticLocalGuardAttr : 
CIR_Attr<"StaticLocalGuard",
     initialization.
 
     Example:
-    ```mlir
+    ```
     cir.global internal static_local_guard<"_ZGVZ3foovE1x"> @_ZZ3foovE1x = ...
     ```
   }];
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td 
b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index b806800275c7b..e10b9102dae78 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -241,7 +241,7 @@ def CIR_CastOp : CIR_Op<"cast", [
 
     Example:
 
-    ```mlir
+    ```
     %4 = cir.cast int_to_bool %3 : i32 -> !cir.bool
     ...
     %x = cir.cast array_to_ptrdecay %0 
@@ -313,7 +313,7 @@ def CIR_DynamicCastOp : CIR_Op<"dyn_cast"> {
 
     Examples:
 
-    ```mlir
+    ```
     %0 = cir.dyn_cast ptr %p : !cir.ptr<!rec_Base> -> !cir.ptr<!rec_Derived>
     %1 = cir.dyn_cast ptr relative_layout %p : !cir.ptr<!rec_Base>
               -> !cir.ptr<!rec_Derived>
@@ -375,7 +375,7 @@ def CIR_PtrStrideOp : CIR_Op<"ptr_stride", [
     and an integer stride, similar to a single-index `getelementptr` in LLVM 
IR.
     It moves the pointer by `stride * sizeof(element_type)` bytes.
 
-    ```mlir
+    ```
     %3 = cir.const 0 : i32
     %3 = cir.ptr_stride %1, %2 : (!cir.ptr<i32>, i32) -> !cir.ptr<i32>
     ```
@@ -412,7 +412,7 @@ def CIR_ConstantOp : CIR_Op<"const", [
     The `cir.const` operation turns a literal into an SSA value. The data is
     attached to the operation as an attribute.
 
-    ```mlir
+    ```
       %0 = cir.const #cir.int<4> : !u32i
       %1 = cir.const #cir.fp<1.500000e+00> : !cir.float
       %2 = cir.const #cir.ptr<null> : !cir.ptr<!void>
@@ -581,7 +581,7 @@ def CIR_AllocaOp : CIR_Op<"alloca", [
 
     Example:
 
-    ```mlir
+    ```
     // int count;
     %0 = cir.alloca i32, !cir.ptr<i32>, ["count"] {alignment = 4 : i64}
 
@@ -666,7 +666,7 @@ def CIR_LoadOp : CIR_Op<"load", [
 
     Example:
 
-    ```mlir
+    ```
 
     // Read from local variable, address in %0.
     %1 = cir.load %0 : !cir.ptr<i32>, i32
@@ -725,7 +725,7 @@ def CIR_VecMaskedLoadOp : CIR_Op<"vec.masked_load", [
 
     Example:
 
-    ```mlir
+    ```
     %v = cir.masked_load align(16) %ptr, %mask, %passthru
          : !cir.ptr<i32>, <4xi1>, <4xi32> -> <4xi32>
     ```
@@ -770,7 +770,7 @@ def CIR_StoreOp : CIR_Op<"store", [
 
     Example:
 
-    ```mlir
+    ```
     // Store a function argument to local storage, address in %0.
     cir.store %arg0, %0 : i32, !cir.ptr<i32>
 
@@ -820,7 +820,7 @@ def CIR_ReturnOp : CIR_Op<"return", [
     The operand type must match the signature of the function that contains
     the operation.
 
-    ```mlir
+    ```
       func @foo() -> i32 {
         ...
         cir.return %0 : i32
@@ -864,7 +864,7 @@ def CIR_IfOp : CIR_Op<"if", [
 
     Examples:
 
-    ```mlir
+    ```
     cir.if %cond  {
       ...
     } else {
@@ -925,7 +925,7 @@ def CIR_ConditionOp : CIR_Op<"condition", [
 
     Example:
 
-    ```mlir
+    ```
     cir.for cond {
       cir.condition(%val) // Branches to `step` region or exits.
     } body {
@@ -980,7 +980,7 @@ def CIR_YieldOp : CIR_Op<"yield", [
     `cir.return` terminated.
 
     Examples:
-    ```mlir
+    ```
     cir.if %4 {
       ...
       cir.yield
@@ -1081,7 +1081,7 @@ def CIR_ResumeOp : CIR_Op<"resume", [
     caller after cleanup code has been executed.
 
     Examples:
-    ```mlir
+    ```
     // Before CFG flattening (in try unwind region)
     cir.try {
       cir.yield
@@ -1117,7 +1117,7 @@ def CIR_ResumeFlatOp : CIR_Op<"resume.flat", [
     This operation is used only after the CFG flatterning pass.
 
     Examples:
-    ```mlir
+    ```
     cir.resume.flat %exception_ptr, %type_id
     ```
   }];
@@ -1152,7 +1152,7 @@ def CIR_ScopeOp : CIR_Op<"scope", [
     coming out of C++ full-expressions) via `cir.yield`:
 
 
-    ```mlir
+    ```
     %rvalue = cir.scope {
       ...
       cir.yield %value
@@ -1259,7 +1259,7 @@ def CIR_CleanupScopeOp : CIR_Op<"cleanup.scope", [
 
     Examples:
 
-    ```mlir
+    ```
     // Cleanup that runs on both normal and exception paths
     cir.cleanup.scope {
       cir.call @mayThrow() : () -> ()
@@ -1323,7 +1323,7 @@ def CIR_CmpThreeWayOp : CIR_Op<"cmp3way", [Pure, 
SameTypeOperands]> {
 
     Example:
 
-    ```mlir
+    ```
     !s32i = !cir.int<s, 32>
 
     #cmpinfo_partial_ltn1eq0gt1unn127 =
@@ -1690,7 +1690,7 @@ def CIR_BrOp : CIR_Op<"br",[
 
     Example:
 
-    ```mlir
+    ```
       ...
         cir.br ^bb3
       ^bb3:
@@ -1745,7 +1745,7 @@ def CIR_GotoOp : CIR_Op<"goto", [Terminator]> {
     }
   ```
 
-  ```mlir
+  ```
     cir.scope {  // REGION #1
       %2 = cir.load %0 : !cir.ptr<!s32i>, !s32i
       %3 = cir.cast int_to_bool %2 : !s32i -> !cir.bool
@@ -1840,7 +1840,7 @@ def CIR_IncOp : CIR_UnaryOpWithOverflowFlag<"inc", 
CIR_AnyType> {
 
     Example:
 
-    ```mlir
+    ```
     %1 = cir.inc %0 : !s32i
     %3 = cir.inc nsw %2 : !s32i
     ```
@@ -1864,7 +1864,7 @@ def CIR_DecOp : CIR_UnaryOpWithOverflowFlag<"dec", 
CIR_AnyType> {
 
     Example:
 
-    ```mlir
+    ```
     %1 = cir.dec %0 : !s32i
     %3 = cir.dec nsw %2 : !s32i
     ```
@@ -1889,7 +1889,7 @@ def CIR_MinusOp : CIR_UnaryOpWithOverflowFlag<"minus", 
CIR_AnyType> {
 
     Example:
 
-    ```mlir
+    ```
     %1 = cir.minus %0 : !s32i
     %3 = cir.minus nsw %2 : !s32i
     %5 = cir.minus %4 : !cir.float
@@ -1912,7 +1912,7 @@ def CIR_NotOp : CIR_UnaryOp<"not", CIR_AnyType, 
[Involution]> {
 
     Example:
 
-    ```mlir
+    ```
     %1 = cir.not %0 : !s32i
     %3 = cir.not %2 : !cir.bool
     ```
@@ -1937,7 +1937,7 @@ def CIR_BrCondOp : CIR_Op<"brcond", [
 
     Example:
 
-    ```mlir
+    ```
       ...
         cir.brcond %a, ^bb3, ^bb4
       ^bb3:
@@ -1992,7 +1992,7 @@ def CIR_IndirectBrOp : CIR_Op<"indirect_br", [
 
     Example:
 
-    ```mlir
+    ```
       %0 = cir.block_address <@A, "A"> : !cir.ptr<!void>
       cir.indirectbr %0 poison : <!void>, [
       ^bb1
@@ -2078,7 +2078,7 @@ def CIR_WhileOp : CIR_WhileOpBase<"while"> {
 
     Example:
 
-    ```mlir
+    ```
     cir.while {
       cir.break
     ^bb2:
@@ -2106,7 +2106,7 @@ def CIR_DoWhileOp : CIR_WhileOpBase<"do"> {
 
     Example:
 
-    ```mlir
+    ```
     cir.do {
       cir.break
     ^bb2:
@@ -2136,7 +2136,7 @@ def CIR_ForOp : CIR_LoopOpBase<"for"> {
 
     Example:
 
-    ```mlir
+    ```
     cir.for cond {
       cir.condition(%val)
     } body {
@@ -2221,7 +2221,7 @@ def CIR_CmpOp : CIR_Op<"cmp", [Pure, SameTypeOperands]> {
     For floating-point comparisons, the predicate follows C semantics (e.g.
     NaN comparisons return false for all predicates except `ne`).
 
-    ```mlir
+    ```
     %0 = cir.cmp gt %1, %2 : !s32i
     %1 = cir.cmp eq %a, %b : !cir.ptr<!u8i>
     ```
@@ -2298,7 +2298,7 @@ def CIR_AddOverflowOp : CIR_BinOpOverflow<"add.overflow", 
[Commutative]> {
 
     Example:
 
-    ```mlir
+    ```
     %result, %overflow = cir.add.overflow %a, %b : !u32i -> !u32i
     %result, %overflow = cir.add.overflow %a, %b : !cir.int<s, 33> -> !s32i
     ```
@@ -2313,7 +2313,7 @@ def CIR_SubOverflowOp : CIR_BinOpOverflow<"sub.overflow"> 
{
 
     Example:
 
-    ```mlir
+    ```
     %result, %overflow = cir.sub.overflow %a, %b : !u32i -> !u32i
     ```
   }];
@@ -2327,7 +2327,7 @@ def CIR_MulOverflowOp : CIR_BinOpOverflow<"mul.overflow", 
[Commutative]> {
 
     Example:
 
-    ```mlir
+    ```
     %result, %overflow = cir.mul.overflow %a, %b : !u32i -> !u32i
     ```
   }];
@@ -2399,7 +2399,7 @@ def CIR_AddOp : CIR_BinaryOpWithOverflowFlags<"add", 
CIR_AnyArithType> {
     
     Example:
 
-    ```mlir
+    ```
     %0 = cir.add %a, %b : !s32i
     %1 = cir.add nsw %a, %b : !s32i
     %2 = cir.add nuw %a, %b : !u32i
@@ -2427,7 +2427,7 @@ def CIR_SubOp : CIR_BinaryOpWithOverflowFlags<"sub", 
CIR_AnyArithType> {
     
     Example:
 
-    ```mlir
+    ```
     %0 = cir.sub %a, %b : !s32i
     %1 = cir.sub nsw %a, %b : !s32i
     %2 = cir.sub sat %a, %b : !s32i
@@ -2452,7 +2452,7 @@ def CIR_MulOp : CIR_BinaryOp<"mul", CIR_AnyArithType> {
 
     Example:
 
-    ```mlir
+    ```
     %0 = cir.mul %a, %b : !s32i
     %1 = cir.mul nsw %a, %b : !s32i
     %2 = cir.mul nuw %a, %b : !u32i
@@ -2487,7 +2487,7 @@ def CIR_DivOp : CIR_BinaryOp<"div", CIR_AnyArithType> {
 
     Example:
 
-    ```mlir
+    ```
     %0 = cir.div %a, %b : !s32i
     %1 = cir.div %a, %b : !u32i
     %2 = cir.div %a, %b : !cir.float
@@ -2508,7 +2508,7 @@ def CIR_RemOp : CIR_BinaryOp<"rem", CIR_AnyArithType> {
     
     Example:
 
-    ```mlir
+    ```
     %0 = cir.rem %a, %b : !s32i
     %1 = cir.rem %a, %b : !u32i
     %2 = cir.rem %a, %b : !cir.float
@@ -2530,7 +2530,7 @@ def CIR_AndOp : CIR_BinaryOp<"and", CIR_AnyBitwiseType, [
     
     Example:
 
-    ```mlir
+    ```
     %0 = cir.and %a, %b : !s32i
     %1 = cir.and %a, %b : !cir.bool
     ```
@@ -2551,7 +2551,7 @@ def CIR_OrOp : CIR_BinaryOp<"or", CIR_AnyBitwiseType, [
     
     Example:
 
-    ```mlir
+    ```
     %0 = cir.or %a, %b : !s32i
     %1 = cir.or %a, %b : !cir.bool
     ```
@@ -2570,7 +2570,7 @@ def CIR_XorOp : CIR_BinaryOp<"xor", CIR_AnyBitwiseType, 
[Commutative]> {
 
     Example:
 
-    ```mlir
+    ```
     %0 = cir.xor %a, %b : !s32i
     %1 = cir.xor %a, %b : !cir.bool
     ```
@@ -2592,7 +2592,7 @@ def CIR_MaxOp : CIR_BinaryOp<"max", 
CIR_AnyIntOrVecOfIntType, [
 
     Example:
 
-    ```mlir
+    ```
     %0 = cir.max %a, %b : !s32i
     %1 = cir.max %a, %b : !u32i
     %2 = cir.max %a, %b : !cir.vector<4 x !s32i>
@@ -2615,7 +2615,7 @@ def CIR_MinOp : CIR_BinaryOp<"min", 
CIR_AnyIntOrVecOfIntType, [
 
     Example:
 
-    ```mlir
+    ```
     %0 = cir.min %a, %b : !s32i
     %1 = cir.min %a, %b : !u32i
     %2 = cir.min %a, %b : !cir.vector<4 x !s32i>
@@ -2638,7 +2638,7 @@ def CIR_ShiftOp : CIR_Op<"shift", [Pure]> {
     the shift target is shifted by the corresponding shift amount in
     the shift amount vector.
 
-    ```mlir
+    ```
     %res = cir.shift(left, %lhs : !u64i, %amount : !s32i) -> !u64i
     %new_vec = cir.shift(left, %lhs : !cir.vector<2 x !s32i>, %rhs :
         !cir.vector<2 x !s32i>) -> !cir.vector<2 x !s32i>
@@ -2687,7 +2687,7 @@ def CIR_SelectOp : CIR_Op<"select", [
 
     Example:
 
-    ```mlir
+    ```
     %0 = cir.const #cir.bool<true> : !cir.bool
     %1 = cir.const #cir.int<42> : !s32i
     %2 = cir.const #cir.int<72> : !s32i
@@ -2738,7 +2738,7 @@ def CIR_TernaryOp : CIR_Op<"ternary", [
 
     Example:
 
-    ```mlir
+    ```
     // cond = a && b;
 
     %x = cir.ternary (%cond, true_region {
@@ -2955,7 +2955,7 @@ def CIR_GetGlobalOp : CIR_Op<"get_global", [
     local variables with non-constant initializers).
 
     Example:
-    ```mlir
+    ```
     %x = cir.get_global @gv : !cir.ptr<i32>
     ...
     %y = cir.get_global thread_local @tls_gv : !cir.ptr<i32>
@@ -2995,7 +2995,7 @@ def CIR_VTableAddrPointOp : 
CIR_Op<"vtable.address_point", [
     The return type is always `!cir.vptr`.
 
     Example:
-    ```mlir
+    ```
     cir.global linkonce_odr @_ZTV1B = ...
     ...
     %3 = cir.vtable.address_point(@_ZTV1B,
@@ -3034,7 +3034,7 @@ def CIR_VTableGetVPtrOp : CIR_Op<"vtable.get_vptr", 
[Pure]> {
     The return type is always `!cir.ptr<!cir.vptr>`.
 
     Example:
-    ```mlir
+    ```
     %2 = cir.load %0 : !cir.ptr<!cir.ptr<!rec_C>>, !cir.ptr<!rec_C>
     %3 = cir.vtable.get_vptr %2 : !cir.ptr<!rec_C> -> !cir.ptr<!cir.vptr>
     ```
@@ -3073,7 +3073,7 @@ def CIR_VTableGetVirtualFnAddrOp : 
CIR_Op<"vtable.get_virtual_fn_addr", [
     The return type is a pointer-to-pointer to the function type.
 
     Example:
-    ```mlir
+    ```
     %2 = cir.load %0 : !cir.ptr<!cir.ptr<!rec_C>>, !cir.ptr<!rec_C>
     %3 = cir.vtable.get_vptr %2 : !cir.ptr<!rec_C> -> !cir.ptr<!cir.vptr>
     %4 = cir.load %3 : !cir.ptr<!cir.vptr>, !cir.vptr
@@ -3118,7 +3118,7 @@ def CIR_VTableGetTypeInfoOp : 
CIR_Op<"vtable.get_type_info", [
     The return type is a loadable pointer to a `type_info` struct.
 
     Example:
-    ```mlir
+    ```
     %5 = cir.vtable.get_vptr %2 : !cir.ptr<!rec_A> -> !cir.ptr<!cir.vptr>
     %6 = cir.load align(8) %5 : !cir.ptr<!cir.vptr>, !cir.vptr
     %7 = cir.vtable.get_type_info %6 : !cir.vptr -> 
!cir.ptr<!cir.ptr<!rec_std3A3Atype_info>>
@@ -3171,7 +3171,7 @@ def CIR_VTTAddrPointOp : CIR_Op<"vtt.address_point", [
     The return type is always a `!cir.ptr<!cir.ptr<void>>`.
 
     Example:
-    ```mlir
+    ```
     cir.global linkonce_odr @_ZTV1B = ...
     ...
     %3 = cir.base_class_addr(%1 : !cir.ptr<!rec_D> nonnull) [0]
@@ -3181,7 +3181,7 @@ def CIR_VTTAddrPointOp : CIR_Op<"vtt.address_point", [
     cir.call @_ZN1BC2Ev(%3, %4)
     ```
     Or:
-    ```mlir
+    ```
     %7 = cir.vtt.address_point %3 : !cir.ptr<!cir.ptr<!void>>, offset = 1
              -> !cir.ptr<!cir.ptr<!void>>
     ```
@@ -3220,7 +3220,7 @@ def CIR_SetBitfieldOp : CIR_Op<"set_bitfield"> {
 
     A unit attribute `volatile` can be used to indicate a volatile store of the
     bitfield.
-      ```mlir
+      ```
         cir.set_bitfield(#bfi, %0 : !cir.ptr<!u32i>, %1 : !s32i) {is_volatile}
                                                                        -> !s32i
       ```
@@ -3243,7 +3243,7 @@ def CIR_SetBitfieldOp : CIR_Op<"set_bitfield"> {
     }
     ```
 
-    ```mlir
+    ```
     // 'e' is in the storage with the index 1
     !record_type = !cir.record<struct "S" packed padded {!u64i, !u16i,
                                !cir.array<!u8i x 2>} #cir.record.decl.ast>
@@ -3312,7 +3312,7 @@ def CIR_GetBitfieldOp : CIR_Op<"get_bitfield"> {
 
     A unit attribute `volatile` can be used to indicate a volatile load of the
     bitfield.
-    ```mlir
+    ```
       cir.get_bitfield(#bfi, %0 {is_volatile} : !cir.ptr<!u64i>) -> !s32i
     ```
 
@@ -3334,7 +3334,7 @@ def CIR_GetBitfieldOp : CIR_Op<"get_bitfield"> {
     }
     ```
 
-    ```mlir
+    ```
     // 'e' is in the storage with the index 1
     !cir.record<struct "S" packed padded {!u64i, !u16i, !cir.array<!u8i x 2>}>
     #bfi_e = #cir.bitfield_info<name = "e", storage_type = !u16i, size = 15,
@@ -3396,7 +3396,7 @@ def CIR_GetMemberOp : CIR_Op<"get_member", [Pure]> {
     and its field index.
 
     Example:
-    ```mlir
+    ```
     // Suppose we have a record with multiple members.
     !s32i = !cir.int<s, 32>
     !s8i = !cir.int<s, 8>
@@ -3457,7 +3457,7 @@ def CIR_ExtractMemberOp : CIR_Op<"extract_member", 
[Pure]> {
 
     Example:
 
-    ```mlir
+    ```
     // Suppose we have a record with multiple members.
     !s32i = !cir.int<s, 32>
     !s8i = !cir.int<s, 32>
@@ -3511,7 +3511,7 @@ def CIR_InsertMemberOp : CIR_Op<"insert_member", [
 
     Example:
 
-    ```mlir
+    ```
     // Suppose we have a record with multiple members.
     !s32i = !cir.int<s, 32>
     !s8i = !cir.int<s, 32>
@@ -3559,7 +3559,7 @@ def CIR_GetElementOp : CIR_Op<"get_element", [
     It expects a pointer to the `base` array and the `index` of the element.
 
     Example:
-    ```mlir
+    ```
     // Suppose we have a array.
     !s32i = !cir.int<s, 32>
     !arr_ty = !cir.array<!s32i x 4>
@@ -3659,7 +3659,7 @@ def CIR_FuncOp : CIR_Op<"func", [
 
     Example:
 
-    ```mlir
+    ```
     // External function definitions.
     cir.func @abort()
 
@@ -3944,7 +3944,7 @@ def CIR_CallOp : CIR_CallOpBase<"call", 
[NoRegionArguments]> {
 
     Example:
 
-    ```mlir
+    ```
     %0 = cir.call @foo()
     ```
   }];
@@ -3980,7 +3980,7 @@ def CIR_TryCallOp : CIR_CallOpBase<"try_call",[
 
     Example:
 
-    ```mlir
+    ```
     // Before CFG flattening
     cir.try {
       %call = cir.call @division(%a, %b) : () -> !s32i
@@ -4103,7 +4103,7 @@ def CIR_AwaitOp : CIR_Op<"await",[
     - `yield`: user written `co_yield` expressions.
     - `final`: compiler generated final suspend via implicit `co_await`.
 
-    ```mlir
+    ```
       cir.scope {
         ... // auto &&x = CommonExpr();
         cir.await(user, ready : {
@@ -4176,7 +4176,7 @@ def CIR_CopyOp : CIR_Op<"copy",[
 
     Examples:
 
-    ```mlir
+    ```
       // Copying contents from one record to another:
       cir.copy %0 to %1 : !cir.ptr<!record_ty>
 
@@ -4244,7 +4244,7 @@ def CIR_MemCpyOp : CIR_MemOp<"libc.memcpy"> {
 
     Examples:
 
-    ```mlir
+    ```
       // Copying 2 bytes from one array to a record:
       %2 = cir.const #cir.int<2> : !u32i
       cir.libc.memcpy %2 bytes from %arr to %record : !cir.ptr<!arr> -> 
!cir.ptr<!record>
@@ -4274,7 +4274,7 @@ def CIR_MemMoveOp : CIR_MemOp<"libc.memmove"> {
 
     Examples:
 
-    ```mlir
+    ```
       // Copying 2 bytes from one array to a record:
       %2 = cir.const #cir.int<2> : !u32i
       cir.libc.memmove %2 bytes from %arr to %record : !cir.ptr<!void>, !u64i
@@ -4306,7 +4306,7 @@ def CIR_MemSetOp : CIR_Op<"libc.memset"> {
 
     Examples:
 
-    ```mlir
+    ```
       // Set 2 bytes in a record to 0:
       %len = cir.const #cir.int<2> : !u32i
       %zero = cir.const #cir.int<0> : !u8i
@@ -4348,7 +4348,7 @@ def CIR_ReturnAddrOp : CIR_Op<"return_address"> {
 
     Examples:
 
-    ```mlir
+    ```
     %p = return_address(%level) : !cir.ptr<!void>
     ```
   }];
@@ -4380,7 +4380,7 @@ def CIR_FrameAddrOp : CIR_Op<"frame_address"> {
 
     Examples:
 
-    ```mlir
+    ```
     %p = frame_address(%level) : !cir.ptr<!u8i>
     ```
   }];
@@ -4404,7 +4404,7 @@ def CIR_AddrOfReturnAddrOp : 
CIR_Op<"address_of_return_address"> {
 
     Examples:
 
-    ```mlir
+    ```
     %addr = address_of_return_address() : !cir.ptr<!u8i>
     ```
   }];
@@ -4426,7 +4426,7 @@ def CIR_StackSaveOp : CIR_Op<"stacksave"> {
 
     This operation corresponds to LLVM intrinsic `stacksave`.
 
-    ```mlir
+    ```
     %0 = cir.stacksave : <!u8i>
     ```
   }];
@@ -4444,7 +4444,7 @@ def CIR_StackRestoreOp : CIR_Op<"stackrestore"> {
 
     This operation corresponds to LLVM intrinsic `stackrestore`.
 
-    ```mlir
+    ```
     %0 = cir.alloca !cir.ptr<!u8i>, !cir.ptr<!cir.ptr<!u8i>>, ["saved_stack"] 
{alignment = 8 : i64}
     %1 = cir.stacksave : <!u8i>
     cir.store %1, %0 : !cir.ptr<!u8i>, !cir.ptr<!cir.ptr<!u8i>>
@@ -4491,7 +4491,7 @@ def CIR_InlineAsmOp : CIR_Op<"asm", 
[RecursiveMemoryEffects]> {
     __asm__("baz $42 %[val]" : [val] "=r" (x), "+&r"(x) : "[val]"(y));
     ```
 
-    ```mlir
+    ```
     !rec_22anon2E022 = !cir.record<struct "anon.0" {!cir.int<s, 32>, 
!cir.int<s, 32>}>
     !rec_22anon2E122 = !cir.record<struct "anon.1" {!cir.int<s, 32>, 
!cir.int<s, 32>}>
     ...
@@ -4602,7 +4602,7 @@ def CIR_ArrayCtor : CIR_Op<"array.ctor", [
 
     Examples:
 
-    ```mlir
+    ```
     // Fixed size without partial destructor:
     cir.array.ctor(%0 : !cir.ptr<!cir.array<!rec_S x 42>>) {
       ^bb0(%arg0: !cir.ptr<!rec_S>):
@@ -4698,7 +4698,7 @@ def CIR_ArrayDtor : CIR_Op<"array.dtor", [
 
     Examples:
 
-    ```mlir
+    ```
     // Fixed-size (stack array, global):
     cir.array.dtor %0 : !cir.ptr<!cir.array<!rec_S x 42>> {
       ^bb0(%arg0: !cir.ptr<!rec_S>):
@@ -4839,7 +4839,7 @@ def CIR_GetMethodOp : CIR_Op<"get_method"> {
 
     The code above will generate CIR similar to:
 
-    ```mlir
+    ```
     %callee, %this = cir.get_method %method, %object
     cir.call %callee(%this, %arg)
     ```
@@ -4905,7 +4905,7 @@ def CIR_VecInsertOp : CIR_Op<"vec.insert", [
     The `cir.vec.insert` operation produces a new vector by replacing
     the element of the input vector at `index` with `value`.
 
-    ```mlir
+    ```
     %value = cir.const #cir.int<5> : !s32i
     %index = cir.const #cir.int<2> : !s32i
     %vec_tmp = cir.load %0 : !cir.ptr<!cir.vector<4 x !s32i>>, !cir.vector<4 x 
!s32i>
@@ -4941,7 +4941,7 @@ def CIR_VecExtractOp : CIR_Op<"vec.extract", [
     The `cir.vec.extract` operation extracts the element at the given index
     from a vector object.
 
-    ```mlir
+    ```
     %tmp = cir.load %vec : !cir.ptr<!cir.vector<4 x !s32i>>, !cir.vector<4 x 
!s32i>
     %idx = cir.const #cir.int<1> : !s32i
     %element = cir.vec.extract %tmp[%idx : !s32i] : !cir.vector<4 x !s32i>
@@ -4970,7 +4970,7 @@ def CIR_VecCmpOp : CIR_Op<"vec.cmp", [Pure, 
SameTypeOperands]> {
     whose element type is the signed integral type that is the same size as the
     element type of the operands. The values in the result are 0 or -1.
 
-    ```mlir
+    ```
     %eq = cir.vec.cmp(eq, %vec_a, %vec_b) : !cir.vector<4 x !s32i>, 
!cir.vector<4 x !s32i>
     %lt = cir.vec.cmp(lt, %vec_a, %vec_b) : !cir.vector<4 x !s32i>, 
!cir.vector<4 x !s32i>
     ```
@@ -5019,7 +5019,7 @@ def CIR_VecShuffleOp : CIR_Op<"vec.shuffle", [
     not have to match the size of the individual input vectors or of the
     concatenated vector.
 
-    ```mlir
+    ```
     %new_vec = cir.vec.shuffle(%vec_1, %vec_2 : !cir.vector<2 x !s32i>)
         [#cir.int<3> : !s64i, #cir.int<1> : !s64i] : !cir.vector<2 x !s32i>
     ```
@@ -5060,7 +5060,7 @@ def CIR_VecShuffleDynamicOp : 
CIR_Op<"vec.shuffle.dynamic", [
     result vector is constructed by taking the elements from the first input
     vector from the indices indicated by the elements of the second vector.
 
-    ```mlir
+    ```
     %new_vec = cir.vec.shuffle.dynamic %vec : !cir.vector<4 x !s32i>, %indices
         : !cir.vector<4 x !s32i>
     ```
@@ -5135,7 +5135,7 @@ def CIR_VecSplatOp : CIR_Op<"vec.splat", [
     analysis passes can benefit from knowing that all elements of the vector
     have the same value.
 
-    ```mlir
+    ```
     %value = cir.const #cir.int<3> : !s32i
     %value_vec = cir.vec.splat %value : !s32i, !cir.vector<4 x !s32i>
     ```
@@ -5176,7 +5176,7 @@ def CIR_BaseClassAddrOp : CIR_Op<"base_class_addr", 
[Pure]> {
     Base& b = d;
     ```
     will generate
-    ```mlir
+    ```
     %3 = cir.base_class_addr %1 : !cir.ptr<!rec_Derived> nonnull [0] -> 
!cir.ptr<!rec_Base>
     ```
   }];
@@ -5225,7 +5225,7 @@ def CIR_DerivedClassAddrOp : CIR_Op<"derived_class_addr", 
[Pure]> {
     ```
 
     leads to
-    ```mlir
+    ```
       %2 = cir.load %0 : !cir.ptr<!cir.ptr<!rec_A>>, !cir.ptr<!rec_A>
       %3 = cir.base_class_addr %2 : !cir.ptr<!rec_B> [0] -> !cir.ptr<!rec_A>
     ```
@@ -5318,7 +5318,7 @@ def CIR_BaseMethodOp : CIR_Op<"base_method", [Pure]> {
 
     Example:
 
-    ```mlir
+    ```
     %1 = cir.base_method %0 [16] : !cir.method<!cir.func<(!s32i)> in 
!rec_Derived> -> !cir.method<!cir.func<(!s32i)> in !rec_Base>
     ```
   }];
@@ -5352,7 +5352,7 @@ def CIR_DerivedMethodOp : CIR_Op<"derived_method", 
[Pure]> {
 
     Example:
 
-    ```mlir
+    ```
     %1 = cir.derived_method %0 [16] : !cir.method<!cir.func<(!s32i)> in 
!rec_Base> -> !cir.method<!cir.func<(!s32i)> in !rec_Derived>
     ```
   }];
@@ -5380,7 +5380,7 @@ def CIR_ComplexCreateOp : CIR_Op<"complex.create", [Pure, 
SameTypeOperands]> {
     The `cir.complex.create` operation takes two operands that represent the
     real and imaginary part of a complex number, and yields the complex number.
 
-    ```mlir
+    ```
     %0 = cir.const #cir.fp<1.000000e+00> : !cir.double
     %1 = cir.const #cir.fp<2.000000e+00> : !cir.double
     %2 = cir.complex.create %0, %1 : !cir.double -> !cir.complex<!cir.double>
@@ -5428,7 +5428,7 @@ def CIR_ComplexRealOp : CIR_ComplexPartOp<"complex.real"> 
{
 
     Example:
 
-    ```mlir
+    ```
     %real = cir.complex.real %complex : !cir.complex<!cir.float> -> !cir.float
     %real = cir.complex.real %scalar : !cir.float -> !cir.float
     ```
@@ -5444,7 +5444,7 @@ def CIR_ComplexImagOp : CIR_ComplexPartOp<"complex.imag"> 
{
 
     Example:
 
-    ```mlir
+    ```
     %imag = cir.complex.imag %complex : !cir.complex<!cir.float> -> !cir.float
     %imag = cir.complex.imag %scalar : !cir.float -> !cir.float
     ```
@@ -5476,7 +5476,7 @@ def CIR_ComplexRealPtrOp : 
CIR_ComplexPartPtrOp<"complex.real_ptr"> {
 
     Example:
 
-    ```mlir
+    ```
     %1 = cir.complex.real_ptr %0 : !cir.ptr<!cir.complex<!cir.double>>
       -> !cir.ptr<!cir.double>
     ```
@@ -5492,7 +5492,7 @@ def CIR_ComplexImagPtrOp : 
CIR_ComplexPartPtrOp<"complex.imag_ptr"> {
 
     Example:
 
-    ```mlir
+    ```
     %1 = cir.complex.imag_ptr %0 : !cir.ptr<!cir.complex<!cir.double>>
       -> !cir.ptr<!cir.double>
     ```
@@ -5521,7 +5521,7 @@ def CIR_ComplexAddOp : CIR_ComplexBinOp<"complex.add"> {
 
     Example:
 
-    ```mlir
+    ```
     %2 = cir.complex.add %0, %1 : !cir.complex<!cir.float>
     ```
   }];
@@ -5535,7 +5535,7 @@ def CIR_ComplexSubOp : CIR_ComplexBinOp<"complex.sub"> {
 
     Example:
 
-    ```mlir
+    ```
     %2 = cir.complex.sub %0, %1 : !cir.complex<!cir.float>
     ```
   }];
@@ -5586,7 +5586,7 @@ def CIR_ComplexMulOp : 
CIR_ComplexRangeBinOp<"complex.mul"> {
 
     Example:
 
-    ```mlir
+    ```
     %2 = cir.complex.mul %0, %1 range(basic) : !cir.complex<!cir.float>
     %2 = cir.complex.mul %0, %1 range(full) : !cir.complex<!cir.float>
     ```
@@ -5614,7 +5614,7 @@ def CIR_ComplexDivOp : 
CIR_ComplexRangeBinOp<"complex.div"> {
 
     Example:
 
-    ```mlir
+    ```
     %2 = cir.complex.div %0, %1 range(basic) : !cir.complex<!cir.float>
     %2 = cir.complex.div %0, %1 range(full) : !cir.complex<!cir.float>
     ```
@@ -5661,7 +5661,7 @@ def CIR_BitClrsbOp : CIR_BitOpBase<"clrsb", 
CIR_SIntOfWidths<[32, 64]>> {
 
     Examples:
 
-    ```mlir
+    ```
     // %0 = 0b1101_1110_1010_1101_1011_1110_1110_1111
     %0 = cir.const #cir.int<3735928559> : !s32i
     // %1 will be 1 because there is 1 bit following the most significant bit
@@ -5693,7 +5693,7 @@ def CIR_BitClzOp : CIR_BitZeroCountOpBase<"clz",
 
     Example:
 
-    ```mlir
+    ```
     // %0 = 0b0000_0000_0000_0000_0000_0000_0000_1000
     %0 = cir.const #cir.int<8> : !u32i
     // %1 will be 28
@@ -5718,7 +5718,7 @@ def CIR_BitCtzOp : CIR_BitZeroCountOpBase<"ctz",
 
     Example:
 
-    ```mlir
+    ```
     // %0 = 0b1000
     %0 = cir.const #cir.int<8> : !u32i
     // %1 will be 3
@@ -5738,7 +5738,7 @@ def CIR_BitFfsOp : CIR_BitOpBase<"ffs", 
CIR_SIntOfWidths<[32, 64]>> {
 
     Example:
 
-    ```mlir
+    ```
     !s32i = !cir.int<s, 32>
 
     // %0 = 0x0010_1000
@@ -5759,7 +5759,7 @@ def CIR_BitParityOp : CIR_BitOpBase<"parity", 
CIR_UIntOfWidths<[32, 64]>> {
 
     Example:
 
-    ```mlir
+    ```
     // %0 = 0x0110_1000
     %0 = cir.const #cir.int<104> : !u32i
     // %1 will be 1 since there are three 1-bits in %0
@@ -5779,7 +5779,7 @@ def CIR_BitPopcountOp : CIR_BitOpBase<"popcount",
 
     Example:
 
-    ```mlir
+    ```
     // %0 = 0x0110_1000
     %0 = cir.const #cir.int<104> : !u32i
     // %1 will be 3 since there are 3 1-bits in %0
@@ -5798,7 +5798,7 @@ def CIR_BitReverseOp : CIR_BitOpBase<"bitreverse",
 
     Example:
 
-    ```mlir
+    ```
     %1 = cir.bitreverse %0: !u32i
     ```
   }];
@@ -5819,7 +5819,7 @@ def CIR_ByteSwapOp : CIR_BitOpBase<"byte_swap",
 
     Example:
 
-    ```mlir
+    ```
     // %0 = 0x12345678
     %0 = cir.const #cir.int<305419896> : !u32i
 
@@ -5846,7 +5846,7 @@ def CIR_RotateOp : CIR_Op<"rotate", [Pure, 
SameOperandsAndResultType]> {
 
     Example:
 
-    ```mlir
+    ```
     %r = cir.rotate left %0, %1 : !u32i
     %r = cir.rotate right %0, %1 : !u32i
     ```
@@ -5987,7 +5987,7 @@ def CIR_AssumeAlignedOp : CIR_Op<"assume_aligned", [
 
     Example:
 
-    ```mlir
+    ```
     // Assume that %0 is a CIR pointer value of type !cir.ptr<!s32i>
     %1 = cir.assume_aligned %0 alignment 16 : !cir.ptr<!s32i>
 
@@ -6081,7 +6081,7 @@ def CIR_PrefetchOp : CIR_Op<"prefetch"> {
     have no effect on the behavior of the program but can change its
     performance characteristics.
 
-    ```mlir
+    ```
     cir.prefetch(%0 : !cir.ptr<!void>) locality(1) write
     ```
 
@@ -6171,7 +6171,7 @@ def CIR_ObjSizeOp : CIR_Op<"objsize", [Pure]> {
 
     Example:
 
-    ```mlir
+    ```
     %size = cir.objsize min %ptr : !cir.ptr<i32> -> i64
     %dsize = cir.objsize max dynamic %ptr : !cir.ptr<i32> -> i64
     %nsize = cir.objsize min nullunknown %ptr : !cir.ptr<i32> -> i64
@@ -6218,7 +6218,7 @@ def CIR_PtrDiffOp : CIR_Op<"ptr_diff", [Pure, 
SameTypeOperands]> {
 
     Example:
 
-    ```mlir
+    ```
     %7 = cir.ptr_diff %0, %1 : !cir.ptr<!u64i> -> !u64i
     ```
   }];
@@ -6462,7 +6462,7 @@ def CIR_AbsOp : CIR_Op<"abs", [Pure, 
SameOperandsAndResultType]> {
 
     Example:
 
-    ```mlir
+    ```
       %0 = cir.const #cir.int<-42> : s32i
       %1 = cir.abs %0 min_is_poison : s32i
       %2 = cir.abs %3 : !cir.vector<!s32i x 4>
@@ -6489,7 +6489,7 @@ def CIR_FloorOp : CIR_UnaryFPToFPBuiltinOp<"floor", 
"FFloorOp"> {
 
     Example:
 
-    ```mlir
+    ```
     // $x : !cir.double
     %y = cir.floor %x : !cir.double
     ```
@@ -6668,7 +6668,7 @@ def CIR_VAStartOp : CIR_VAOp<"va_start"> {
 
     Example:
 
-    ```mlir
+    ```
     // %args : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>
     %p = cir.cast array_to_ptrdecay %args
           : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>)
@@ -6698,7 +6698,7 @@ def CIR_VAEndOp : CIR_VAOp<"va_end"> {
     storage.
 
     Example:
-    ```mlir
+    ```
     // %args : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>
     %p = cir.cast array_to_ptrdecay %args
           : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>
@@ -6719,7 +6719,7 @@ def CIR_VACopyOp : CIR_Op<"va_copy"> {
 
     Example:
 
-    ```mlir
+    ```
     // %args : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>
     %p = cir.cast array_to_ptrdecay %args
           : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>
@@ -6758,7 +6758,7 @@ def CIR_VAArgOp : CIR_Op<"va_arg"> {
     target representation.
 
     Example:
-    ```mlir
+    ```
     // %args : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>
     %p = cir.cast array_to_ptrdecay %args
             : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>
@@ -6799,7 +6799,7 @@ def CIR_ThrowOp : CIR_Op<"throw"> {
 
     Example:
 
-    ```mlir
+    ```
     // re-throw;
     cir.throw
 
@@ -6854,7 +6854,7 @@ def CIR_AllocExceptionOp : CIR_Op<"alloc.exception"> {
 
     Example:
 
-    ```mlir
+    ```
     // if (b == 0) {
     //   ...
     //   throw "...";
@@ -6900,7 +6900,7 @@ def CIR_TryOp : CIR_Op<"try",[
 
     Example:
 
-    ```mlir
+    ```
     cir.try {
       cir.call exception @function() : () -> ()
       cir.yield
@@ -6979,7 +6979,7 @@ def CIR_CatchParamOp : CIR_Op<"catch_param", 
[HasParent<"cir::TryOp">]> {
 
     Example:
 
-    ```mlir
+    ```
     %exception = cir.catch_param : !cir.ptr<!void>
     ```
   }];
@@ -7020,7 +7020,7 @@ def CIR_EhInflightOp : CIR_Op<"eh.inflight_exception"> {
 
     Example:
 
-    ```mlir
+    ```
     %exception_ptr, %type_id = cir.eh.inflight_exception
     %exception_ptr, %type_id = cir.eh.inflight_exception [@_ZTIi, @_ZTIPKc]
     %exception_ptr, %type_id = cir.eh.inflight_exception cleanup
@@ -7052,7 +7052,7 @@ def CIR_EhTypeIdOp : CIR_Op<"eh.typeid",
     a type.
 
     Example:
-    ```mlir
+    ```
     %type_id = cir.eh.typeid @_ZTIi
     ```
   }];
@@ -7078,7 +7078,7 @@ def CIR_EhSetjmpOp : CIR_Op<"eh.setjmp"> {
     non-zero value.
 
     Examples:
-    ```mlir
+    ```
       %0 = cir.eh.setjmp %arg0 : (!cir.ptr<!cir.void>) -> !s32i
     ```
   }];
@@ -7103,7 +7103,7 @@ def CIR_EhLongjmpOp : CIR_Op<"eh.longjmp"> {
     the information saved in `env` by setjmp().
 
     Examples:
-    ```mlir
+    ```
       cir.eh.longjmp %arg0 : !cir.ptr<!cir.void>
     ```
   }];
@@ -7136,7 +7136,7 @@ def CIR_EhInitiateOp : CIR_Op<"eh.initiate"> {
 
     Example:
 
-    ```mlir
+    ```
     ^unwind:
       %eh_token = cir.eh.initiate : !cir.eh_token
       cir.br ^dispatch(%eh_token : !cir.eh_token)
@@ -7181,7 +7181,7 @@ def CIR_EhTerminateOp : CIR_Op<"eh.terminate", [
 
     Example:
 
-    ```mlir
+    ```
     ^terminate_unwind:
       %eh_token = cir.eh.initiate : !cir.eh_token
       cir.eh.terminate %eh_token : !cir.eh_token
@@ -7223,7 +7223,7 @@ def CIR_EhDispatchOp : CIR_Op<"eh.dispatch", [
 
     Example:
 
-    ```mlir
+    ```
     cir.eh.dispatch %eh_token : !cir.eh_token [
       catch (#cir.global_view<@_ZTIi> : !cir.ptr<!u8i>) : ^catch_int,
       catch (#cir.global_view<@_ZTIPKc> : !cir.ptr<!u8i>) : ^catch_str,
@@ -7276,7 +7276,7 @@ def CIR_BeginCleanupOp : CIR_Op<"begin_cleanup"> {
 
     Example:
 
-    ```mlir
+    ```
     ^cleanup(%eh_token : !cir.eh_token):
       %cleanup_token = cir.begin_cleanup %eh_token : !cir.eh_token
                                                    -> !cir.cleanup_token
@@ -7311,7 +7311,7 @@ def CIR_EndCleanupOp : CIR_Op<"end_cleanup"> {
 
     Example:
 
-    ```mlir
+    ```
     ^cleanup(%eh_token : !cir.eh_token):
       %cleanup_token = cir.begin_cleanup %eh_token : !cir.eh_token
                                                    -> !cir.cleanup_token
@@ -7355,7 +7355,7 @@ def CIR_BeginCatchOp : CIR_Op<"begin_catch"> {
 
     Example:
 
-    ```mlir
+    ```
     // High-level form (inside cir.try catch handler region):
     } catch [type #cir.global_view<@_ZTIi> : !cir.ptr<!u8i>] (%eh_token : 
!cir.eh_token) {
       %catch_token, %exn_ptr = cir.begin_catch %eh_token
@@ -7411,7 +7411,7 @@ def CIR_EndCatchOp : CIR_Op<"end_catch"> {
 
     Example:
 
-    ```mlir
+    ```
     // High-level form (inside cir.try catch handler region):
     } catch [type #cir.global_view<@_ZTIi> : !cir.ptr<!u8i>] (%eh_token : 
!cir.eh_token) {
       %catch_token, %exn_ptr = cir.begin_catch %eh_token
@@ -7542,7 +7542,7 @@ def CIR_AtomicXchgOp : CIR_Op<"atomic.xchg", [
 
     Example:
 
-    ```mlir
+    ```
     %res = cir.atomic.xchg seq_cst %ptr, %val : !cir.ptr<!u64i> -> !u64i
     ```
   }];
@@ -7605,7 +7605,7 @@ def CIR_AtomicCmpXchgOp : CIR_Op<"atomic.cmpxchg", [
 
     Example:
 
-    ```mlir
+    ```
     %old, %success = cir.atomic.cmpxchg weak success(seq_cst) failure(acquire)
         syncscope(system) %ptr, %expected, %desired
         : (!cir.ptr<!u64i>, !u64i, !u64i) -> (!u64i, !cir.bool)
@@ -7645,7 +7645,7 @@ def CIR_AtomicTestAndSetOp : 
CIR_Op<"atomic.test_and_set"> {
     indicating whether the previous value of the integer was the "set" value.
 
     Example:
-    ```mlir
+    ```
       %res = cir.atomic.test_and_set seq_cst %ptr : !cir.ptr<!s8i> -> !cir.bool
     ```
   }];
@@ -7676,7 +7676,7 @@ def CIR_AtomicClearOp : CIR_Op<"atomic.clear"> {
     integer. The operation atomically sets the integer to zero.
 
     Example:
-    ```mlir
+    ```
       cir.atomic.clear seq_cst %ptr : !cir.ptr<!s8i>
     ```
   }];
@@ -7709,7 +7709,7 @@ def CIR_AtomicFenceOp : CIR_Op<"atomic.fence"> {
       - `__c11_atomic_signal_fence`
 
     Example:
-    ```mlir
+    ```
       cir.atomic.fence syncscope(system) seq_cst
       cir.atomic.fence syncscope(single_thread) seq_cst
     ```
@@ -7741,7 +7741,7 @@ def CIR_BlockAddressOp : CIR_Op<"block_address", [Pure]> {
     jump target (e.g., with `goto *addr;`).
 
     Example:
-    ```mlir
+    ```
     %1 = cir.alloca !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>, ["ptr", init]
                                                           {alignment = 8 : i64}
     %addr = cir.block_address <@c, "label1"> : !cir.ptr<!cir.void>
@@ -7783,7 +7783,7 @@ def CIR_CpuIdOp : CIR_Op<"cpuid"> {
 
     Example:
 
-    ```mlir
+    ```
     cir.cpuid %cpui_info, %function_id, %sub_function_id : (!cir.ptr<!s32i>,
         !s32i, !s32i)
     ```
@@ -7816,7 +7816,7 @@ def CIR_MemChrOp : CIR_Op<"libc.memchr"> {
 
     Examples:
 
-    ```mlir
+    ```
     %p = cir.libc.memchr(%src, %pattern, %len)
     ```
   }];
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRTypes.td 
b/clang/include/clang/CIR/Dialect/IR/CIRTypes.td
index 778f9bfdfd0c1..da38011c7e756 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRTypes.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRTypes.td
@@ -204,7 +204,7 @@ def CIR_ComplexType : CIR_Type<"Complex", "complex", [
     the complex number. `elementType` must be either a CIR integer type or a 
CIR
     floating-point type.
 
-    ```mlir
+    ```
     !cir.complex<!s32i>
     !cir.complex<!cir.float>
     ```
@@ -255,7 +255,7 @@ def CIR_PointerType : CIR_Type<"Pointer", "ptr", [
 
     Examples:
 
-    ```mlir
+    ```
     !cir.ptr<!cir.int<u, 8>>
     !cir.ptr<!cir.float>
     !cir.ptr<!cir.record<struct "MyStruct">>
@@ -450,7 +450,7 @@ def CIR_VectorType : CIR_Type<"Vector", "vector", [
 
     Syntax:
 
-    ```mlir
+    ```
     vector-type ::= !cir.vector<size x element-type>
     size ::= (decimal-literal | `[` decimal-literal `]`)
     element-type ::= float-type | integer-type | pointer-type
@@ -461,7 +461,7 @@ def CIR_VectorType : CIR_Type<"Vector", "vector", [
 
     Examples:
 
-    ```mlir
+    ```
     !cir.vector<4 x !cir.int<u, 8>>
     !cir.vector<2 x !cir.float>
     ```
@@ -469,7 +469,7 @@ def CIR_VectorType : CIR_Type<"Vector", "vector", [
     Scalable vectors are indicated by enclosing size in square brackets.
 
     Example:
-    ```mlir
+    ```
     !cir.vector<[4] x !cir.int<u, 8>>
     ```
   }];
@@ -512,7 +512,7 @@ def CIR_FuncType : CIR_Type<"Func", "func"> {
 
     Example:
 
-    ```mlir
+    ```
     !cir.func<()>
     !cir.func<() -> bool>
     !cir.func<(!s8i, !s8i)>
@@ -652,7 +652,7 @@ def CIR_RecordType : CIR_Type<"Record", "record", [
 
     A few examples:
 
-    ```mlir
+    ```
         !rec_complete = !cir.record<struct "complete" {!u8i}>
         !rec_incomplete = !cir.record<struct "incomplete" incomplete>
         !anonymous_struct = !cir.record<struct {!u8i}>
@@ -669,7 +669,7 @@ def CIR_RecordType : CIR_Type<"Record", "record", [
     In the example below, the `Node` record has a member that is a pointer to a
     `Node` record:
 
-    ```mlir
+    ```
         !s = !cir.record<struct "Node" {!cir.ptr<!cir.record<struct "Node">>}>
     ```
   }];
diff --git a/clang/include/clang/CIR/Dialect/IR/CMakeLists.txt 
b/clang/include/clang/CIR/Dialect/IR/CMakeLists.txt
index 870f9e3f5d052..8add2f04afaf7 100644
--- a/clang/include/clang/CIR/Dialect/IR/CMakeLists.txt
+++ b/clang/include/clang/CIR/Dialect/IR/CMakeLists.txt
@@ -14,6 +14,9 @@ mlir_tablegen(CIROpsDialect.cpp.inc -gen-dialect-defs)
 add_public_tablegen_target(MLIRCIROpsIncGen)
 add_dependencies(mlir-headers MLIRCIROpsIncGen)
 
+# Equivalent to add_mlir_doc
+add_clang_mlir_doc(CIROps CIRDialect ./ -gen-dialect-doc)
+
 mlir_tablegen(CIROpsEnums.h.inc -gen-enum-decls)
 mlir_tablegen(CIROpsEnums.cpp.inc -gen-enum-defs)
 mlir_tablegen(CIROpsAttributes.h.inc -gen-attrdef-decls)

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to