triton-windows 3.5.1.post21__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- triton/_C/libtriton.pyd +0 -0
- triton/__init__.py +82 -0
- triton/_filecheck.py +97 -0
- triton/_internal_testing.py +255 -0
- triton/_utils.py +126 -0
- triton/backends/__init__.py +47 -0
- triton/backends/amd/__init__.py +0 -0
- triton/backends/amd/compiler.py +461 -0
- triton/backends/amd/driver.c +283 -0
- triton/backends/amd/driver.py +724 -0
- triton/backends/amd/lib/asanrtl.bc +0 -0
- triton/backends/amd/lib/ockl.bc +0 -0
- triton/backends/amd/lib/ocml.bc +0 -0
- triton/backends/compiler.py +90 -0
- triton/backends/driver.py +66 -0
- triton/backends/nvidia/__init__.py +0 -0
- triton/backends/nvidia/bin/ptxas.exe +0 -0
- triton/backends/nvidia/compiler.py +533 -0
- triton/backends/nvidia/driver.c +517 -0
- triton/backends/nvidia/driver.py +799 -0
- triton/backends/nvidia/include/cuda.h +26280 -0
- triton/backends/nvidia/lib/libdevice.10.bc +0 -0
- triton/backends/nvidia/lib/x64/cuda.lib +0 -0
- triton/compiler/__init__.py +7 -0
- triton/compiler/code_generator.py +1614 -0
- triton/compiler/compiler.py +509 -0
- triton/compiler/errors.py +51 -0
- triton/compiler/make_launcher.py +0 -0
- triton/errors.py +5 -0
- triton/experimental/__init__.py +0 -0
- triton/experimental/gluon/__init__.py +5 -0
- triton/experimental/gluon/_compiler.py +0 -0
- triton/experimental/gluon/_runtime.py +102 -0
- triton/experimental/gluon/language/__init__.py +119 -0
- triton/experimental/gluon/language/_core.py +490 -0
- triton/experimental/gluon/language/_layouts.py +583 -0
- triton/experimental/gluon/language/_math.py +20 -0
- triton/experimental/gluon/language/_semantic.py +380 -0
- triton/experimental/gluon/language/_standard.py +80 -0
- triton/experimental/gluon/language/amd/__init__.py +4 -0
- triton/experimental/gluon/language/amd/_layouts.py +96 -0
- triton/experimental/gluon/language/amd/cdna3/__init__.py +100 -0
- triton/experimental/gluon/language/amd/cdna4/__init__.py +48 -0
- triton/experimental/gluon/language/amd/cdna4/async_copy.py +151 -0
- triton/experimental/gluon/language/extra/__init__.py +3 -0
- triton/experimental/gluon/language/nvidia/__init__.py +4 -0
- triton/experimental/gluon/language/nvidia/ampere/__init__.py +3 -0
- triton/experimental/gluon/language/nvidia/ampere/async_copy.py +74 -0
- triton/experimental/gluon/language/nvidia/ampere/mbarrier.py +80 -0
- triton/experimental/gluon/language/nvidia/blackwell/__init__.py +387 -0
- triton/experimental/gluon/language/nvidia/blackwell/tma.py +52 -0
- triton/experimental/gluon/language/nvidia/hopper/__init__.py +132 -0
- triton/experimental/gluon/language/nvidia/hopper/mbarrier.py +34 -0
- triton/experimental/gluon/language/nvidia/hopper/tma.py +97 -0
- triton/experimental/gluon/nvidia/__init__.py +4 -0
- triton/experimental/gluon/nvidia/blackwell.py +3 -0
- triton/experimental/gluon/nvidia/hopper.py +45 -0
- triton/knobs.py +546 -0
- triton/language/__init__.py +342 -0
- triton/language/core.py +3405 -0
- triton/language/extra/__init__.py +26 -0
- triton/language/extra/cuda/__init__.py +16 -0
- triton/language/extra/cuda/gdc.py +42 -0
- triton/language/extra/cuda/libdevice.py +1629 -0
- triton/language/extra/cuda/utils.py +109 -0
- triton/language/extra/hip/__init__.py +5 -0
- triton/language/extra/hip/libdevice.py +491 -0
- triton/language/extra/hip/utils.py +35 -0
- triton/language/extra/libdevice.py +790 -0
- triton/language/math.py +249 -0
- triton/language/random.py +218 -0
- triton/language/semantic.py +1939 -0
- triton/language/standard.py +534 -0
- triton/language/target_info.py +54 -0
- triton/runtime/__init__.py +23 -0
- triton/runtime/_allocation.py +44 -0
- triton/runtime/_async_compile.py +55 -0
- triton/runtime/autotuner.py +476 -0
- triton/runtime/build.py +168 -0
- triton/runtime/cache.py +317 -0
- triton/runtime/driver.py +38 -0
- triton/runtime/errors.py +36 -0
- triton/runtime/interpreter.py +1414 -0
- triton/runtime/jit.py +1107 -0
- triton/runtime/tcc/include/_mingw.h +168 -0
- triton/runtime/tcc/include/assert.h +62 -0
- triton/runtime/tcc/include/conio.h +409 -0
- triton/runtime/tcc/include/ctype.h +281 -0
- triton/runtime/tcc/include/dir.h +31 -0
- triton/runtime/tcc/include/direct.h +68 -0
- triton/runtime/tcc/include/dirent.h +135 -0
- triton/runtime/tcc/include/dos.h +55 -0
- triton/runtime/tcc/include/errno.h +75 -0
- triton/runtime/tcc/include/excpt.h +123 -0
- triton/runtime/tcc/include/fcntl.h +52 -0
- triton/runtime/tcc/include/fenv.h +108 -0
- triton/runtime/tcc/include/float.h +75 -0
- triton/runtime/tcc/include/inttypes.h +297 -0
- triton/runtime/tcc/include/io.h +418 -0
- triton/runtime/tcc/include/iso646.h +36 -0
- triton/runtime/tcc/include/limits.h +116 -0
- triton/runtime/tcc/include/locale.h +91 -0
- triton/runtime/tcc/include/malloc.h +181 -0
- triton/runtime/tcc/include/math.h +497 -0
- triton/runtime/tcc/include/mem.h +13 -0
- triton/runtime/tcc/include/memory.h +40 -0
- triton/runtime/tcc/include/process.h +176 -0
- triton/runtime/tcc/include/sec_api/conio_s.h +42 -0
- triton/runtime/tcc/include/sec_api/crtdbg_s.h +19 -0
- triton/runtime/tcc/include/sec_api/io_s.h +33 -0
- triton/runtime/tcc/include/sec_api/mbstring_s.h +52 -0
- triton/runtime/tcc/include/sec_api/search_s.h +25 -0
- triton/runtime/tcc/include/sec_api/stdio_s.h +145 -0
- triton/runtime/tcc/include/sec_api/stdlib_s.h +67 -0
- triton/runtime/tcc/include/sec_api/stralign_s.h +30 -0
- triton/runtime/tcc/include/sec_api/string_s.h +41 -0
- triton/runtime/tcc/include/sec_api/sys/timeb_s.h +34 -0
- triton/runtime/tcc/include/sec_api/tchar_s.h +266 -0
- triton/runtime/tcc/include/sec_api/time_s.h +61 -0
- triton/runtime/tcc/include/sec_api/wchar_s.h +128 -0
- triton/runtime/tcc/include/setjmp.h +160 -0
- triton/runtime/tcc/include/share.h +28 -0
- triton/runtime/tcc/include/signal.h +63 -0
- triton/runtime/tcc/include/stdalign.h +16 -0
- triton/runtime/tcc/include/stdarg.h +14 -0
- triton/runtime/tcc/include/stdatomic.h +171 -0
- triton/runtime/tcc/include/stdbool.h +11 -0
- triton/runtime/tcc/include/stddef.h +42 -0
- triton/runtime/tcc/include/stdint.h +212 -0
- triton/runtime/tcc/include/stdio.h +429 -0
- triton/runtime/tcc/include/stdlib.h +591 -0
- triton/runtime/tcc/include/stdnoreturn.h +7 -0
- triton/runtime/tcc/include/string.h +164 -0
- triton/runtime/tcc/include/sys/fcntl.h +13 -0
- triton/runtime/tcc/include/sys/file.h +14 -0
- triton/runtime/tcc/include/sys/locking.h +30 -0
- triton/runtime/tcc/include/sys/stat.h +290 -0
- triton/runtime/tcc/include/sys/time.h +69 -0
- triton/runtime/tcc/include/sys/timeb.h +133 -0
- triton/runtime/tcc/include/sys/types.h +123 -0
- triton/runtime/tcc/include/sys/unistd.h +14 -0
- triton/runtime/tcc/include/sys/utime.h +146 -0
- triton/runtime/tcc/include/tcc/tcc_libm.h +618 -0
- triton/runtime/tcc/include/tccdefs.h +342 -0
- triton/runtime/tcc/include/tcclib.h +80 -0
- triton/runtime/tcc/include/tchar.h +1102 -0
- triton/runtime/tcc/include/tgmath.h +89 -0
- triton/runtime/tcc/include/time.h +287 -0
- triton/runtime/tcc/include/uchar.h +33 -0
- triton/runtime/tcc/include/unistd.h +1 -0
- triton/runtime/tcc/include/vadefs.h +11 -0
- triton/runtime/tcc/include/values.h +4 -0
- triton/runtime/tcc/include/varargs.h +12 -0
- triton/runtime/tcc/include/wchar.h +873 -0
- triton/runtime/tcc/include/wctype.h +172 -0
- triton/runtime/tcc/include/winapi/basetsd.h +149 -0
- triton/runtime/tcc/include/winapi/basetyps.h +85 -0
- triton/runtime/tcc/include/winapi/guiddef.h +156 -0
- triton/runtime/tcc/include/winapi/poppack.h +8 -0
- triton/runtime/tcc/include/winapi/pshpack1.h +8 -0
- triton/runtime/tcc/include/winapi/pshpack2.h +8 -0
- triton/runtime/tcc/include/winapi/pshpack4.h +8 -0
- triton/runtime/tcc/include/winapi/pshpack8.h +8 -0
- triton/runtime/tcc/include/winapi/qos.h +72 -0
- triton/runtime/tcc/include/winapi/shellapi.h +59 -0
- triton/runtime/tcc/include/winapi/winbase.h +2958 -0
- triton/runtime/tcc/include/winapi/wincon.h +309 -0
- triton/runtime/tcc/include/winapi/windef.h +293 -0
- triton/runtime/tcc/include/winapi/windows.h +127 -0
- triton/runtime/tcc/include/winapi/winerror.h +3166 -0
- triton/runtime/tcc/include/winapi/wingdi.h +4080 -0
- triton/runtime/tcc/include/winapi/winnls.h +778 -0
- triton/runtime/tcc/include/winapi/winnt.h +5837 -0
- triton/runtime/tcc/include/winapi/winreg.h +272 -0
- triton/runtime/tcc/include/winapi/winsock2.h +1474 -0
- triton/runtime/tcc/include/winapi/winuser.h +5651 -0
- triton/runtime/tcc/include/winapi/winver.h +160 -0
- triton/runtime/tcc/include/winapi/ws2ipdef.h +21 -0
- triton/runtime/tcc/include/winapi/ws2tcpip.h +391 -0
- triton/runtime/tcc/lib/cuda.def +697 -0
- triton/runtime/tcc/lib/gdi32.def +337 -0
- triton/runtime/tcc/lib/kernel32.def +770 -0
- triton/runtime/tcc/lib/libtcc1.a +0 -0
- triton/runtime/tcc/lib/msvcrt.def +1399 -0
- triton/runtime/tcc/lib/python3.def +810 -0
- triton/runtime/tcc/lib/python310.def +1610 -0
- triton/runtime/tcc/lib/python311.def +1633 -0
- triton/runtime/tcc/lib/python312.def +1703 -0
- triton/runtime/tcc/lib/python313.def +1651 -0
- triton/runtime/tcc/lib/python313t.def +1656 -0
- triton/runtime/tcc/lib/python314.def +1800 -0
- triton/runtime/tcc/lib/python314t.def +1809 -0
- triton/runtime/tcc/lib/python39.def +1644 -0
- triton/runtime/tcc/lib/python3t.def +905 -0
- triton/runtime/tcc/lib/user32.def +658 -0
- triton/runtime/tcc/libtcc.dll +0 -0
- triton/runtime/tcc/tcc.exe +0 -0
- triton/testing.py +543 -0
- triton/tools/__init__.py +0 -0
- triton/tools/build_extern.py +365 -0
- triton/tools/compile.py +210 -0
- triton/tools/disasm.py +143 -0
- triton/tools/extra/cuda/compile.c +70 -0
- triton/tools/extra/cuda/compile.h +14 -0
- triton/tools/extra/hip/compile.cpp +66 -0
- triton/tools/extra/hip/compile.h +13 -0
- triton/tools/link.py +322 -0
- triton/tools/mxfp.py +301 -0
- triton/tools/ragged_tma.py +92 -0
- triton/tools/tensor_descriptor.py +34 -0
- triton/windows_utils.py +405 -0
- triton_windows-3.5.1.post21.dist-info/METADATA +46 -0
- triton_windows-3.5.1.post21.dist-info/RECORD +217 -0
- triton_windows-3.5.1.post21.dist-info/WHEEL +5 -0
- triton_windows-3.5.1.post21.dist-info/entry_points.txt +3 -0
- triton_windows-3.5.1.post21.dist-info/licenses/LICENSE +23 -0
- triton_windows-3.5.1.post21.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/* tccdefs.h
|
|
2
|
+
|
|
3
|
+
Nothing is defined before this file except target machine, target os
|
|
4
|
+
and the few things related to option settings in tccpp.c:tcc_predefs().
|
|
5
|
+
|
|
6
|
+
This file is either included at runtime as is, or converted and
|
|
7
|
+
included as C-strings at compile-time (depending on CONFIG_TCC_PREDEFS).
|
|
8
|
+
|
|
9
|
+
Note that line indent matters:
|
|
10
|
+
|
|
11
|
+
- in lines starting at column 1, platform macros are replaced by
|
|
12
|
+
corresponding TCC target compile-time macros. See conftest.c for
|
|
13
|
+
the list of platform macros supported in lines starting at column 1.
|
|
14
|
+
|
|
15
|
+
- only lines indented >= 4 are actually included into the executable,
|
|
16
|
+
check tccdefs_.h.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
#if __SIZEOF_POINTER__ == 4
|
|
20
|
+
/* 32bit systems. */
|
|
21
|
+
#if defined __OpenBSD__
|
|
22
|
+
#define __SIZE_TYPE__ unsigned long
|
|
23
|
+
#define __PTRDIFF_TYPE__ long
|
|
24
|
+
#else
|
|
25
|
+
#define __SIZE_TYPE__ unsigned int
|
|
26
|
+
#define __PTRDIFF_TYPE__ int
|
|
27
|
+
#endif
|
|
28
|
+
#define __ILP32__ 1
|
|
29
|
+
#define __INT64_TYPE__ long long
|
|
30
|
+
#elif __SIZEOF_LONG__ == 4
|
|
31
|
+
/* 64bit Windows. */
|
|
32
|
+
#define __SIZE_TYPE__ unsigned long long
|
|
33
|
+
#define __PTRDIFF_TYPE__ long long
|
|
34
|
+
#define __LLP64__ 1
|
|
35
|
+
#define __INT64_TYPE__ long long
|
|
36
|
+
#else
|
|
37
|
+
/* Other 64bit systems. */
|
|
38
|
+
#define __SIZE_TYPE__ unsigned long
|
|
39
|
+
#define __PTRDIFF_TYPE__ long
|
|
40
|
+
#define __LP64__ 1
|
|
41
|
+
# if defined __linux__
|
|
42
|
+
#define __INT64_TYPE__ long
|
|
43
|
+
# else /* APPLE, BSD */
|
|
44
|
+
#define __INT64_TYPE__ long long
|
|
45
|
+
# endif
|
|
46
|
+
#endif
|
|
47
|
+
#define __SIZEOF_INT__ 4
|
|
48
|
+
#define __INT_MAX__ 0x7fffffff
|
|
49
|
+
#if __SIZEOF_LONG__ == 4
|
|
50
|
+
#define __LONG_MAX__ 0x7fffffffL
|
|
51
|
+
#else
|
|
52
|
+
#define __LONG_MAX__ 0x7fffffffffffffffL
|
|
53
|
+
#endif
|
|
54
|
+
#define __SIZEOF_LONG_LONG__ 8
|
|
55
|
+
#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
|
|
56
|
+
#define __CHAR_BIT__ 8
|
|
57
|
+
#define __ORDER_LITTLE_ENDIAN__ 1234
|
|
58
|
+
#define __ORDER_BIG_ENDIAN__ 4321
|
|
59
|
+
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
|
60
|
+
#if defined _WIN32
|
|
61
|
+
#define __WCHAR_TYPE__ unsigned short
|
|
62
|
+
#define __WINT_TYPE__ unsigned short
|
|
63
|
+
#elif defined __linux__
|
|
64
|
+
#define __WCHAR_TYPE__ int
|
|
65
|
+
#define __WINT_TYPE__ unsigned int
|
|
66
|
+
#else
|
|
67
|
+
#define __WCHAR_TYPE__ int
|
|
68
|
+
#define __WINT_TYPE__ int
|
|
69
|
+
#endif
|
|
70
|
+
|
|
71
|
+
#if __STDC_VERSION__ >= 201112L
|
|
72
|
+
# define __STDC_NO_ATOMICS__ 1
|
|
73
|
+
# define __STDC_NO_COMPLEX__ 1
|
|
74
|
+
# define __STDC_NO_THREADS__ 1
|
|
75
|
+
#if !defined _WIN32
|
|
76
|
+
# define __STDC_UTF_16__ 1
|
|
77
|
+
# define __STDC_UTF_32__ 1
|
|
78
|
+
#endif
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
#if defined _WIN32
|
|
82
|
+
#define __declspec(x) __attribute__((x))
|
|
83
|
+
#define __cdecl
|
|
84
|
+
|
|
85
|
+
#elif defined __FreeBSD__
|
|
86
|
+
#define __GNUC__ 9
|
|
87
|
+
#define __GNUC_MINOR__ 3
|
|
88
|
+
#define __GNUC_PATCHLEVEL__ 0
|
|
89
|
+
#define __GNUC_STDC_INLINE__ 1
|
|
90
|
+
#define __NO_TLS 1
|
|
91
|
+
#define __RUNETYPE_INTERNAL 1
|
|
92
|
+
# if __SIZEOF_POINTER__ == 8
|
|
93
|
+
/* FIXME, __int128_t is used by setjump */
|
|
94
|
+
#define __int128_t struct { unsigned char _dummy[16] __attribute((aligned(16))); }
|
|
95
|
+
#define __SIZEOF_SIZE_T__ 8
|
|
96
|
+
#define __SIZEOF_PTRDIFF_T__ 8
|
|
97
|
+
#else
|
|
98
|
+
#define __SIZEOF_SIZE_T__ 4
|
|
99
|
+
#define __SIZEOF_PTRDIFF_T__ 4
|
|
100
|
+
# endif
|
|
101
|
+
|
|
102
|
+
#elif defined __FreeBSD_kernel__
|
|
103
|
+
|
|
104
|
+
#elif defined __NetBSD__
|
|
105
|
+
#define __GNUC__ 4
|
|
106
|
+
#define __GNUC_MINOR__ 1
|
|
107
|
+
#define __GNUC_PATCHLEVEL__ 0
|
|
108
|
+
#define _Pragma(x)
|
|
109
|
+
#define __ELF__ 1
|
|
110
|
+
#if defined __aarch64__
|
|
111
|
+
#define _LOCORE /* avoids usage of __asm */
|
|
112
|
+
#endif
|
|
113
|
+
|
|
114
|
+
#elif defined __OpenBSD__
|
|
115
|
+
#define __GNUC__ 4
|
|
116
|
+
#define _ANSI_LIBRARY 1
|
|
117
|
+
|
|
118
|
+
#elif defined __APPLE__
|
|
119
|
+
/* emulate APPLE-GCC to make libc's headerfiles compile: */
|
|
120
|
+
#define __GNUC__ 4 /* darwin emits warning on GCC<4 */
|
|
121
|
+
#define __APPLE_CC__ 1 /* for <TargetConditionals.h> */
|
|
122
|
+
#define __LITTLE_ENDIAN__ 1
|
|
123
|
+
#define _DONT_USE_CTYPE_INLINE_ 1
|
|
124
|
+
/* avoids usage of GCC/clang specific builtins in libc-headerfiles: */
|
|
125
|
+
#define __FINITE_MATH_ONLY__ 1
|
|
126
|
+
#define _FORTIFY_SOURCE 0
|
|
127
|
+
//#define __has_builtin(x) 0
|
|
128
|
+
#define _Float16 short unsigned int /* fake type just for size & alignment (macOS Sequoia) */
|
|
129
|
+
|
|
130
|
+
#elif defined __ANDROID__
|
|
131
|
+
#define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD
|
|
132
|
+
|
|
133
|
+
#else
|
|
134
|
+
/* Linux */
|
|
135
|
+
|
|
136
|
+
#endif
|
|
137
|
+
|
|
138
|
+
/* Some derived integer types needed to get stdint.h to compile correctly on some platforms */
|
|
139
|
+
#ifndef __NetBSD__
|
|
140
|
+
#define __UINTPTR_TYPE__ unsigned __PTRDIFF_TYPE__
|
|
141
|
+
#define __INTPTR_TYPE__ __PTRDIFF_TYPE__
|
|
142
|
+
#endif
|
|
143
|
+
#define __INT32_TYPE__ int
|
|
144
|
+
|
|
145
|
+
#if defined __aarch64__
|
|
146
|
+
/* GCC's __uint128_t appears in some Linux/OSX header files. Make it a
|
|
147
|
+
synonym for long double to get the size and alignment right. */
|
|
148
|
+
#define __uint128_t long double
|
|
149
|
+
#endif
|
|
150
|
+
|
|
151
|
+
#if !defined _WIN32
|
|
152
|
+
/* glibc defines. We do not support __USER_NAME_PREFIX__ */
|
|
153
|
+
#define __REDIRECT(name, proto, alias) name proto __asm__ (#alias)
|
|
154
|
+
#define __REDIRECT_NTH(name, proto, alias) name proto __asm__ (#alias) __THROW
|
|
155
|
+
#define __REDIRECT_NTHNL(name, proto, alias) name proto __asm__ (#alias) __THROWNL
|
|
156
|
+
#endif
|
|
157
|
+
|
|
158
|
+
/* not implemented */
|
|
159
|
+
#define __PRETTY_FUNCTION__ __FUNCTION__
|
|
160
|
+
#define __has_builtin(x) 0
|
|
161
|
+
#define __has_feature(x) 0
|
|
162
|
+
#define __has_attribute(x) 0
|
|
163
|
+
/* C23 Keywords */
|
|
164
|
+
#define _Nonnull
|
|
165
|
+
#define _Nullable
|
|
166
|
+
#define _Nullable_result
|
|
167
|
+
#define _Null_unspecified
|
|
168
|
+
|
|
169
|
+
/* skip __builtin... with -E */
|
|
170
|
+
#ifndef __TCC_PP__
|
|
171
|
+
|
|
172
|
+
#define __builtin_offsetof(type, field) ((__SIZE_TYPE__)&((type*)0)->field)
|
|
173
|
+
#define __builtin_extract_return_addr(x) x
|
|
174
|
+
#if !defined __linux__ && !defined _WIN32
|
|
175
|
+
/* used by math.h */
|
|
176
|
+
#define __builtin_huge_val() 1e500
|
|
177
|
+
#define __builtin_huge_valf() 1e50f
|
|
178
|
+
#define __builtin_huge_vall() 1e5000L
|
|
179
|
+
# if defined __APPLE__
|
|
180
|
+
#define __builtin_nanf(ignored_string) (0.0F/0.0F)
|
|
181
|
+
/* used by floats.h to implement FLT_ROUNDS C99 macro. 1 == to nearest */
|
|
182
|
+
#define __builtin_flt_rounds() 1
|
|
183
|
+
/* used by _fd_def.h */
|
|
184
|
+
#define __builtin_bzero(p, ignored_size) bzero(p, sizeof(*(p)))
|
|
185
|
+
# else
|
|
186
|
+
#define __builtin_nanf(ignored_string) (0.0F/0.0F)
|
|
187
|
+
# endif
|
|
188
|
+
#endif
|
|
189
|
+
|
|
190
|
+
/* __builtin_va_list */
|
|
191
|
+
#if defined __x86_64__
|
|
192
|
+
#if !defined _WIN32
|
|
193
|
+
/* GCC compatible definition of va_list. */
|
|
194
|
+
/* This should be in sync with the declaration in our lib/libtcc1.c */
|
|
195
|
+
typedef struct {
|
|
196
|
+
unsigned gp_offset, fp_offset;
|
|
197
|
+
union {
|
|
198
|
+
unsigned overflow_offset;
|
|
199
|
+
char *overflow_arg_area;
|
|
200
|
+
};
|
|
201
|
+
char *reg_save_area;
|
|
202
|
+
} __builtin_va_list[1];
|
|
203
|
+
|
|
204
|
+
void *__va_arg(__builtin_va_list ap, int arg_type, int size, int align);
|
|
205
|
+
#define __builtin_va_start(ap, last) \
|
|
206
|
+
(*(ap) = *(__builtin_va_list)((char*)__builtin_frame_address(0) - 24))
|
|
207
|
+
#define __builtin_va_arg(ap, t) \
|
|
208
|
+
(*(t *)(__va_arg(ap, __builtin_va_arg_types(t), sizeof(t), __alignof__(t))))
|
|
209
|
+
#define __builtin_va_copy(dest, src) (*(dest) = *(src))
|
|
210
|
+
|
|
211
|
+
#else /* _WIN64 */
|
|
212
|
+
typedef char *__builtin_va_list;
|
|
213
|
+
#define __builtin_va_arg(ap, t) ((sizeof(t) > 8 || (sizeof(t) & (sizeof(t) - 1))) \
|
|
214
|
+
? **(t **)((ap += 8) - 8) : *(t *)((ap += 8) - 8))
|
|
215
|
+
#endif
|
|
216
|
+
|
|
217
|
+
#elif defined __arm__
|
|
218
|
+
typedef char *__builtin_va_list;
|
|
219
|
+
#define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x)
|
|
220
|
+
#define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \
|
|
221
|
+
& ~(_tcc_alignof(type) - 1))
|
|
222
|
+
#define __builtin_va_start(ap,last) (ap = ((char *)&(last)) + ((sizeof(last)+3)&~3))
|
|
223
|
+
#define __builtin_va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \
|
|
224
|
+
&~3), *(type *)(ap - ((sizeof(type)+3)&~3)))
|
|
225
|
+
|
|
226
|
+
#elif defined __aarch64__
|
|
227
|
+
#if defined __APPLE__
|
|
228
|
+
typedef struct {
|
|
229
|
+
void *__stack;
|
|
230
|
+
} __builtin_va_list;
|
|
231
|
+
|
|
232
|
+
#else
|
|
233
|
+
typedef struct {
|
|
234
|
+
void *__stack, *__gr_top, *__vr_top;
|
|
235
|
+
int __gr_offs, __vr_offs;
|
|
236
|
+
} __builtin_va_list;
|
|
237
|
+
|
|
238
|
+
#endif
|
|
239
|
+
#elif defined __riscv
|
|
240
|
+
typedef char *__builtin_va_list;
|
|
241
|
+
#define __va_reg_size (__riscv_xlen >> 3)
|
|
242
|
+
#define _tcc_align(addr,type) (((unsigned long)addr + __alignof__(type) - 1) \
|
|
243
|
+
& -(__alignof__(type)))
|
|
244
|
+
#define __builtin_va_arg(ap,type) (*(sizeof(type) > (2*__va_reg_size) ? *(type **)((ap += __va_reg_size) - __va_reg_size) : (ap = (va_list)(_tcc_align(ap,type) + (sizeof(type)+__va_reg_size - 1)& -__va_reg_size), (type *)(ap - ((sizeof(type)+ __va_reg_size - 1)& -__va_reg_size)))))
|
|
245
|
+
|
|
246
|
+
#else /* __i386__ */
|
|
247
|
+
typedef char *__builtin_va_list;
|
|
248
|
+
#define __builtin_va_start(ap,last) (ap = ((char *)&(last)) + ((sizeof(last)+3)&~3))
|
|
249
|
+
#define __builtin_va_arg(ap,t) (*(t*)((ap+=(sizeof(t)+3)&~3)-((sizeof(t)+3)&~3)))
|
|
250
|
+
|
|
251
|
+
#endif
|
|
252
|
+
#define __builtin_va_end(ap) (void)(ap)
|
|
253
|
+
#ifndef __builtin_va_copy
|
|
254
|
+
# define __builtin_va_copy(dest, src) (dest) = (src)
|
|
255
|
+
#endif
|
|
256
|
+
|
|
257
|
+
/* TCC BBUILTIN AND BOUNDS ALIASES */
|
|
258
|
+
#ifdef __leading_underscore
|
|
259
|
+
# define __RENAME(X) __asm__("_"X)
|
|
260
|
+
#else
|
|
261
|
+
# define __RENAME(X) __asm__(X)
|
|
262
|
+
#endif
|
|
263
|
+
|
|
264
|
+
#ifdef __TCC_BCHECK__
|
|
265
|
+
# define __BUILTINBC(ret,name,params) ret __builtin_##name params __RENAME("__bound_"#name);
|
|
266
|
+
# define __BOUND(ret,name,params) ret name params __RENAME("__bound_"#name);
|
|
267
|
+
#else
|
|
268
|
+
# define __BUILTINBC(ret,name,params) ret __builtin_##name params __RENAME(#name);
|
|
269
|
+
# define __BOUND(ret,name,params)
|
|
270
|
+
#endif
|
|
271
|
+
#ifdef _WIN32
|
|
272
|
+
#define __BOTH __BOUND
|
|
273
|
+
#define __BUILTIN(ret,name,params)
|
|
274
|
+
#else
|
|
275
|
+
#define __BOTH(ret,name,params) __BUILTINBC(ret,name,params)__BOUND(ret,name,params)
|
|
276
|
+
#define __BUILTIN(ret,name,params) ret __builtin_##name params __RENAME(#name);
|
|
277
|
+
#endif
|
|
278
|
+
|
|
279
|
+
__BOTH(void*, memcpy, (void *, const void*, __SIZE_TYPE__))
|
|
280
|
+
__BOTH(void*, memmove, (void *, const void*, __SIZE_TYPE__))
|
|
281
|
+
__BOTH(void*, memset, (void *, int, __SIZE_TYPE__))
|
|
282
|
+
__BOTH(int, memcmp, (const void *, const void*, __SIZE_TYPE__))
|
|
283
|
+
__BOTH(__SIZE_TYPE__, strlen, (const char *))
|
|
284
|
+
__BOTH(char*, strcpy, (char *, const char *))
|
|
285
|
+
__BOTH(char*, strncpy, (char *, const char*, __SIZE_TYPE__))
|
|
286
|
+
__BOTH(int, strcmp, (const char*, const char*))
|
|
287
|
+
__BOTH(int, strncmp, (const char*, const char*, __SIZE_TYPE__))
|
|
288
|
+
__BOTH(char*, strcat, (char*, const char*))
|
|
289
|
+
__BOTH(char*, strncat, (char*, const char*, __SIZE_TYPE__))
|
|
290
|
+
__BOTH(char*, strchr, (const char*, int))
|
|
291
|
+
__BOTH(char*, strrchr, (const char*, int))
|
|
292
|
+
__BOTH(char*, strdup, (const char*))
|
|
293
|
+
#if defined __ARM_EABI__
|
|
294
|
+
__BOUND(void*,__aeabi_memcpy,(void*,const void*,__SIZE_TYPE__))
|
|
295
|
+
__BOUND(void*,__aeabi_memmove,(void*,const void*,__SIZE_TYPE__))
|
|
296
|
+
__BOUND(void*,__aeabi_memmove4,(void*,const void*,__SIZE_TYPE__))
|
|
297
|
+
__BOUND(void*,__aeabi_memmove8,(void*,const void*,__SIZE_TYPE__))
|
|
298
|
+
__BOUND(void*,__aeabi_memset,(void*,int,__SIZE_TYPE__))
|
|
299
|
+
#endif
|
|
300
|
+
|
|
301
|
+
#if defined __linux__ || defined __APPLE__ // HAVE MALLOC_REDIR
|
|
302
|
+
#define __MAYBE_REDIR __BUILTIN
|
|
303
|
+
#else
|
|
304
|
+
#define __MAYBE_REDIR __BOTH
|
|
305
|
+
#endif
|
|
306
|
+
__MAYBE_REDIR(void*, malloc, (__SIZE_TYPE__))
|
|
307
|
+
__MAYBE_REDIR(void*, realloc, (void *, __SIZE_TYPE__))
|
|
308
|
+
__MAYBE_REDIR(void*, calloc, (__SIZE_TYPE__, __SIZE_TYPE__))
|
|
309
|
+
__MAYBE_REDIR(void*, memalign, (__SIZE_TYPE__, __SIZE_TYPE__))
|
|
310
|
+
__MAYBE_REDIR(void, free, (void*))
|
|
311
|
+
#if defined __i386__ || defined __x86_64__
|
|
312
|
+
__BOTH(void*, alloca, (__SIZE_TYPE__))
|
|
313
|
+
void *alloca(__SIZE_TYPE__);
|
|
314
|
+
#else
|
|
315
|
+
__BUILTIN(void*, alloca, (__SIZE_TYPE__))
|
|
316
|
+
#endif
|
|
317
|
+
__BUILTIN(void, abort, (void))
|
|
318
|
+
__BOUND(void, longjmp, ())
|
|
319
|
+
#if !defined _WIN32
|
|
320
|
+
__BOUND(void*, mmap, ())
|
|
321
|
+
__BOUND(int, munmap, ())
|
|
322
|
+
#endif
|
|
323
|
+
#undef __BUILTINBC
|
|
324
|
+
#undef __BUILTIN
|
|
325
|
+
#undef __BOUND
|
|
326
|
+
#undef __BOTH
|
|
327
|
+
#undef __MAYBE_REDIR
|
|
328
|
+
#undef __RENAME
|
|
329
|
+
|
|
330
|
+
#define __BUILTIN_EXTERN(name,u) \
|
|
331
|
+
int __builtin_##name(u int); \
|
|
332
|
+
int __builtin_##name##l(u long); \
|
|
333
|
+
int __builtin_##name##ll(u long long);
|
|
334
|
+
__BUILTIN_EXTERN(ffs,)
|
|
335
|
+
__BUILTIN_EXTERN(clz, unsigned)
|
|
336
|
+
__BUILTIN_EXTERN(ctz, unsigned)
|
|
337
|
+
__BUILTIN_EXTERN(clrsb,)
|
|
338
|
+
__BUILTIN_EXTERN(popcount, unsigned)
|
|
339
|
+
__BUILTIN_EXTERN(parity, unsigned)
|
|
340
|
+
#undef __BUILTIN_EXTERN
|
|
341
|
+
|
|
342
|
+
#endif /* ndef __TCC_PP__ */
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* Simple libc header for TCC
|
|
2
|
+
*
|
|
3
|
+
* Add any function you want from the libc there. This file is here
|
|
4
|
+
* only for your convenience so that you do not need to put the whole
|
|
5
|
+
* glibc include files on your floppy disk
|
|
6
|
+
*/
|
|
7
|
+
#ifndef _TCCLIB_H
|
|
8
|
+
#define _TCCLIB_H
|
|
9
|
+
|
|
10
|
+
#include <stddef.h>
|
|
11
|
+
#include <stdarg.h>
|
|
12
|
+
|
|
13
|
+
/* stdlib.h */
|
|
14
|
+
void *calloc(size_t nmemb, size_t size);
|
|
15
|
+
void *malloc(size_t size);
|
|
16
|
+
void free(void *ptr);
|
|
17
|
+
void *realloc(void *ptr, size_t size);
|
|
18
|
+
int atoi(const char *nptr);
|
|
19
|
+
long int strtol(const char *nptr, char **endptr, int base);
|
|
20
|
+
unsigned long int strtoul(const char *nptr, char **endptr, int base);
|
|
21
|
+
void exit(int);
|
|
22
|
+
|
|
23
|
+
/* stdio.h */
|
|
24
|
+
typedef struct __FILE FILE;
|
|
25
|
+
#define EOF (-1)
|
|
26
|
+
extern FILE *stdin;
|
|
27
|
+
extern FILE *stdout;
|
|
28
|
+
extern FILE *stderr;
|
|
29
|
+
FILE *fopen(const char *path, const char *mode);
|
|
30
|
+
FILE *fdopen(int fildes, const char *mode);
|
|
31
|
+
FILE *freopen(const char *path, const char *mode, FILE *stream);
|
|
32
|
+
int fclose(FILE *stream);
|
|
33
|
+
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
|
34
|
+
size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
|
35
|
+
int fgetc(FILE *stream);
|
|
36
|
+
char *fgets(char *s, int size, FILE *stream);
|
|
37
|
+
int getc(FILE *stream);
|
|
38
|
+
int getchar(void);
|
|
39
|
+
char *gets(char *s);
|
|
40
|
+
int ungetc(int c, FILE *stream);
|
|
41
|
+
int fflush(FILE *stream);
|
|
42
|
+
int putchar (int c);
|
|
43
|
+
|
|
44
|
+
int printf(const char *format, ...);
|
|
45
|
+
int fprintf(FILE *stream, const char *format, ...);
|
|
46
|
+
int sprintf(char *str, const char *format, ...);
|
|
47
|
+
int snprintf(char *str, size_t size, const char *format, ...);
|
|
48
|
+
int asprintf(char **strp, const char *format, ...);
|
|
49
|
+
int dprintf(int fd, const char *format, ...);
|
|
50
|
+
int vprintf(const char *format, va_list ap);
|
|
51
|
+
int vfprintf(FILE *stream, const char *format, va_list ap);
|
|
52
|
+
int vsprintf(char *str, const char *format, va_list ap);
|
|
53
|
+
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
|
54
|
+
int vasprintf(char **strp, const char *format, va_list ap);
|
|
55
|
+
int vdprintf(int fd, const char *format, va_list ap);
|
|
56
|
+
|
|
57
|
+
void perror(const char *s);
|
|
58
|
+
|
|
59
|
+
/* string.h */
|
|
60
|
+
char *strcat(char *dest, const char *src);
|
|
61
|
+
char *strchr(const char *s, int c);
|
|
62
|
+
char *strrchr(const char *s, int c);
|
|
63
|
+
char *strcpy(char *dest, const char *src);
|
|
64
|
+
void *memcpy(void *dest, const void *src, size_t n);
|
|
65
|
+
void *memmove(void *dest, const void *src, size_t n);
|
|
66
|
+
void *memset(void *s, int c, size_t n);
|
|
67
|
+
char *strdup(const char *s);
|
|
68
|
+
size_t strlen(const char *s);
|
|
69
|
+
|
|
70
|
+
/* dlfcn.h */
|
|
71
|
+
#define RTLD_LAZY 0x001
|
|
72
|
+
#define RTLD_NOW 0x002
|
|
73
|
+
#define RTLD_GLOBAL 0x100
|
|
74
|
+
|
|
75
|
+
void *dlopen(const char *filename, int flag);
|
|
76
|
+
const char *dlerror(void);
|
|
77
|
+
void *dlsym(void *handle, char *symbol);
|
|
78
|
+
int dlclose(void *handle);
|
|
79
|
+
|
|
80
|
+
#endif /* _TCCLIB_H */
|