Rewrote the comments in the libraries under 'includes' in English (excluding those inside folders)

This commit is contained in:
2026-07-29 23:34:36 +08:00
parent 3633be1995
commit a2cc28a6ab
54 changed files with 7091 additions and 899 deletions

View File

@@ -1,10 +1,10 @@
# GCC/Clang 内建函数声明
# 所有函数均为仅声明t.State 等价于 CExtern | CExport由编译器/运行时提供实现
# GCC/Clang Built-in Function Declarations
# All functions are declared only (t.State equivalent to CExtern | CExport); implementations are provided by compiler/runtime
import t
# ============================================================
# 随机数生成 (RDRAND / RDSEED)
# Random Number Generation (RDRAND / RDSEED)
# ============================================================
def __builtin_ia32_rdrand16_step(p: t.CUInt16T | t.CPtr) -> t.CInt | t.State: pass
@@ -16,7 +16,7 @@ def __builtin_ia32_rdseed64_step(p: t.CUInt64T | t.CPtr) -> t.CInt | t.State: pa
# ============================================================
# 时间戳计数器 (RDTSC / RDTSCP)
# Time-Stamp Counter (RDTSC / RDTSCP)
# ============================================================
def __builtin_ia32_rdtsc() -> t.CUInt64T | t.State: pass
@@ -33,7 +33,7 @@ def __builtin_ia32_cpuid_count(level: t.CUInt32T, count: t.CUInt32T, a: t.CUInt3
# ============================================================
# 内存屏障 (Fence)
# Memory Barriers (Fence)
# ============================================================
def __builtin_ia32_lfence() -> t.State: pass
@@ -43,7 +43,7 @@ def __builtin_ia32_pause() -> t.State: pass
# ============================================================
# 位操作 (POPCNT / BSF / BSR / TZCNT / LZCNT / BEXTR / PDEP / PEXT / ANDN)
# Bit Manipulation (POPCNT / BSF / BSR / TZCNT / LZCNT / BEXTR / PDEP / PEXT / ANDN)
# ============================================================
def __builtin_ia32_popcntsi(x: t.CUInt32T) -> t.CInt | t.State: pass
@@ -73,7 +73,7 @@ def __builtin_ia32_andn_di(a: t.CUInt64T, b: t.CUInt64T) -> t.CUInt64T | t.State
# ============================================================
# 字节序交换 (BSWAP)
# Byte Swap (BSWAP)
# ============================================================
def __builtin_bswap16(x: t.CUInt16T) -> t.CUInt16T | t.State: pass
@@ -82,7 +82,7 @@ def __builtin_bswap64(x: t.CUInt64T) -> t.CUInt64T | t.State: pass
# ============================================================
# 缓存操作 (Cache)
# Cache Operations
# ============================================================
def __builtin_ia32_clflush(p: t.CConst | t.CPtr) -> t.State: pass
@@ -92,7 +92,7 @@ def __builtin_ia32_clzero() -> t.State: pass
# ============================================================
# 预取 (Prefetch)
# Prefetch
# ============================================================
def __builtin_prefetch(addr: t.CConst | t.CPtr, rw: t.CInt = 0, locality: t.CInt = 3) -> t.State: pass
@@ -103,7 +103,7 @@ def __builtin_ia32_prefetchnta(p: t.CChar | t.CConst | t.CPtr) -> t.State: pass
# ============================================================
# 非临时存储 (Non-Temporal Store)
# Non-Temporal Stores
# ============================================================
def __builtin_ia32_movnti(p: t.CUInt32T | t.CPtr, val: t.CUInt32T) -> t.State: pass
@@ -114,7 +114,7 @@ def __builtin_ia32_movntpd(p: t.CDouble | t.CPtr, val: t.CDouble) -> t.State: pa
# ============================================================
# I/O 端口操作 (Port I/O)
# I/O Port Operations
# ============================================================
def __builtin_ia32_inb(port: t.CUInt16T) -> t.CUInt8T | t.State: pass
@@ -126,7 +126,7 @@ def __builtin_ia32_outl(val: t.CUInt32T, port: t.CUInt16T) -> t.State: pass
# ============================================================
# 模型特定寄存器 (MSR)
# Model-Specific Registers (MSR)
# ============================================================
def __builtin_ia32_rdmsr(msr: t.CUInt32T, val: t.CUInt64T | t.CPtr) -> t.State: pass
@@ -134,7 +134,7 @@ def __builtin_ia32_wrmsr(msr: t.CUInt32T, val: t.CUInt64T) -> t.State: pass
# ============================================================
# 系统指令 (System)
# System Instructions
# ============================================================
def __builtin_ia32_hlt() -> t.State: pass
@@ -150,7 +150,7 @@ def __builtin_ia32_ud2() -> t.State: pass
# ============================================================
# 描述符表 (GDT / IDT / LDT / TR)
# Descriptor Tables (GDT / IDT / LDT / TR)
# ============================================================
def __builtin_ia32_lgdt(p: t.CPtr) -> t.State: pass
@@ -164,7 +164,7 @@ def __builtin_ia32_str(p: t.CPtr) -> t.State: pass
# ============================================================
# 控制寄存器 (CR / MSW)
# Control Registers (CR / MSW)
# ============================================================
def __builtin_ia32_lmsw(val: t.CUInt32T) -> t.State: pass
@@ -172,7 +172,7 @@ def __builtin_ia32_smsw(p: t.CPtr) -> t.State: pass
# ============================================================
# 监控等待 (MONITOR / MWAIT)
# Monitor / MWAIT
# ============================================================
def __builtin_ia32_monitor(p: t.CPtr, extensions: t.CUInt32T, hints: t.CUInt32T) -> t.State: pass
@@ -180,7 +180,7 @@ def __builtin_ia32_mwait(extensions: t.CUInt32T, hints: t.CUInt32T) -> t.State:
# ============================================================
# XSAVE 状态操作
# XSAVE State Operations
# ============================================================
def __builtin_ia32_xsave(p: t.CPtr, mask: t.CUInt64T) -> t.State: pass
@@ -192,7 +192,7 @@ def __builtin_ia32_xsaves(p: t.CPtr, mask: t.CUInt64T) -> t.State: pass
# ============================================================
# 通用内建函数 (Generic Builtins)
# Generic Built-in Functions
# ============================================================
def __builtin_expect(exp: t.CLong, c: t.CLong) -> t.CLong | t.State: pass
@@ -208,7 +208,7 @@ def __builtin_function_start(func: t.CPtr) -> t.CPtr | t.State: pass
# ============================================================
# 可变参数 (VaList)
# Variable Arguments (VaList)
# ============================================================
def __builtin_va_start(va: t.CPtr, *args) -> t.State: pass
@@ -218,7 +218,7 @@ def __builtin_va_copy(dst: t.CPtr, src: t.CConst | t.CPtr) -> t.State: pass
# ============================================================
# 栈与调用信息 (Stack / Frame)
# Stack & Call Information
# ============================================================
def __builtin_return_address(level: t.CUInt32T) -> t.CPtr | t.State: pass
@@ -228,7 +228,7 @@ def __builtin_alloca_with_align(size: t.CSizeT, alignment: t.CSizeT) -> t.CPtr |
# ============================================================
# 内存操作 (Memory)
# Memory Operations
# ============================================================
def __builtin_memcpy(dst: t.CPtr, src: t.CConst | t.CPtr, n: t.CSizeT) -> t.CPtr | t.State: pass
@@ -240,7 +240,7 @@ def __builtin_memchr(s: t.CConst | t.CPtr, c: t.CInt, n: t.CSizeT) -> t.CPtr | t
# ============================================================
# 字符串操作 (String)
# String Operations
# ============================================================
def __builtin_strcpy(dst: t.CChar | t.CPtr, src: t.CChar | t.CConst | t.CPtr) -> t.CChar | t.CPtr | t.State: pass
@@ -256,7 +256,7 @@ def __builtin_strstr(haystack: t.CChar | t.CConst | t.CPtr, needle: t.CChar | t.
# ============================================================
# 数学内建函数 (Math)
# Math Built-in Functions
# ============================================================
def __builtin_sqrt(x: t.CDouble) -> t.CDouble | t.State: pass
@@ -292,7 +292,7 @@ def __builtin_rint(x: t.CDouble) -> t.CDouble | t.State: pass
# ============================================================
# 位计数内建函数 (Bit Counting)
# Bit Counting Builtins
# ============================================================
def __builtin_ffs(x: t.CUInt32T) -> t.CInt | t.State: pass
@@ -315,7 +315,7 @@ def __builtin_parityll(x: t.CUInt64T) -> t.CInt | t.State: pass
# ============================================================
# 对象大小检查 (Object size check)
# Object Size Checking
# ============================================================
def __builtin_object_size(ptr: t.CConst | t.CPtr, typ: t.CInt) -> t.CSizeT | t.State: pass
@@ -334,7 +334,7 @@ def __builtin___sprintf_chk(s: t.CChar | t.CPtr, flag: t.CInt, slen: t.CSizeT, f
# ============================================================
# 浮点分类 (FP Classification)
# Floating-Point Classification
# ============================================================
def __builtin_isnan(x: t.CDouble) -> t.CInt | t.State: pass
@@ -352,7 +352,7 @@ def __builtin_isunordered(x: t.CDouble, y: t.CDouble) -> t.CInt | t.State: pass
# ============================================================
# 特殊值 (Special Values)
# Special Floating-Point Values
# ============================================================
def __builtin_nan(s: t.CChar | t.CConst | t.CPtr) -> t.CDouble | t.State: pass
@@ -370,7 +370,7 @@ def __builtin_inf_sign() -> t.CInt | t.State: pass
# ============================================================
# 类型转换与溢出检查 (Overflow)
# Type Conversion & Overflow Checking
# ============================================================
def __builtin_add_overflow(a: t.CUInt64T, b: t.CUInt64T, res: t.CUInt64T | t.CPtr) -> t.CBool | t.State: pass
@@ -385,7 +385,7 @@ def __builtin_umul_overflow(a: t.CUInt64T, b: t.CUInt64T, res: t.CUInt64T | t.CP
# ============================================================
# MMX / SSE 状态
# MMX / SSE State Management
# ============================================================
def __builtin_ia32_emms() -> t.State: pass
@@ -393,7 +393,7 @@ def __builtin_ia32_femms() -> t.State: pass
# ============================================================
# 排队指令 (ENQCMD)
# Enqueue Commands (ENQCMD)
# ============================================================
def __builtin_ia32_enqcmd(dst: t.CPtr, src: t.CConst | t.CPtr) -> t.CBool | t.State: pass
@@ -401,7 +401,7 @@ def __builtin_ia32_enqcmds(dst: t.CPtr, src: t.CConst | t.CPtr) -> t.CBool | t.S
# ============================================================
# 用户级等待 (UMWAIT / UMONITOR / TPAUSE)
# User-Level Monitor & Wait (UMWAIT / UMONITOR / TPAUSE)
# ============================================================
def __builtin_ia32_umonitor(p: t.CPtr) -> t.State: pass
@@ -410,7 +410,7 @@ def __builtin_ia32_tpause(extensions: t.CUInt32T, counter: t.CUInt64T) -> t.CUIn
# ============================================================
# 访问控制 (CLAC / STAC)
# Access Control (CLAC / STAC)
# ============================================================
def __builtin_ia32_clac() -> t.State: pass
@@ -418,8 +418,8 @@ def __builtin_ia32_stac() -> t.State: pass
# ============================================================
# TLB 无效化 (INVLPG 变体)
# TLB Invalidation (INVLPG Variants)
# ============================================================
def __builtin_ia32_invlpgb(aux: t.CUInt64T, pcid: t.CUInt64T) -> t.State: pass
def __builtin_ia32_tlbsync() -> t.State: pass
def __builtin_ia32_tlbsync() -> t.State: pass