History

tcc/lib: reduce number of files

271 insertions(+), 292 deletions(-), -21 lines, -5 files Also: - tccdefs.h: WIN32: less (no) __builtins - libtcc.c: simply ignore -arch

grischka committed 5 years ago

Commit 675046b1 parent e53816016 files · +271 −292Browse files

Showing the changes to lib/alloca.S (1 of 16 files). Show all

Unified · Split

lib/alloca.S+85−0
@@ -0,0 +1,85 @@
1+/* ---------------------------------------------- */
2+/* alloca.S */
3+
4+#ifdef __leading_underscore
5+# define _(s) _##s
6+#else
7+# define _(s) s
8+#endif
9+
10+/* ---------------------------------------------- */
11+#if defined __i386__
12+
13+.globl _(alloca), _(__alloca)
14+_(alloca):
15+_(__alloca):
16+ push %ebp
17+ mov %esp,%ebp
18+ mov 8(%ebp),%eax
19+ add $3,%eax
20+ and $-4,%eax
21+#ifdef _WIN32
22+ jmp .+16 #p2
23+p1:
24+ sub $4096,%esp
25+ sub $4096,%eax
26+ test %eax,(%esp)
27+p2:
28+ cmp $4096,%eax
29+ jae p1
30+#endif
31+ sub %eax,%esp
32+ mov 4(%ebp),%eax
33+ mov 0(%ebp),%ebp
34+ add $8,%esp
35+ push %eax
36+ lea 8(%esp),%eax
37+ ret
38+
39+/* ---------------------------------------------- */
40+#elif defined __x86_64__
41+
42+.globl _(alloca)
43+_(alloca):
44+ pop %rdx
45+#ifdef _WIN32
46+ mov %rcx,%rax
47+#else
48+ mov %rdi,%rax
49+#endif
50+ add $15,%rax
51+ and $-16,%rax
52+ jz p3
53+
54+#ifdef _WIN32
55+p1:
56+ cmp $4096,%rax
57+ jbe p2
58+ test %rax,-4096(%rsp)
59+ sub $4096,%rsp
60+ sub $4096,%rax
61+ jmp p1
62+p2:
63+#endif
64+ sub %rax,%rsp
65+ mov %rsp,%rax
66+p3:
67+ push %rdx
68+ ret
69+
70+/* ---------------------------------------------- */
71+#elif defined __arm__
72+
73+ .text
74+ .align 2
75+ .global alloca
76+ .type alloca, %function
77+alloca:
78+ rsb sp, r0, sp
79+ bic sp, sp, #7
80+ mov r0, sp
81+ mov pc, lr
82+ .size alloca, .-alloca
83+
84+/* ---------------------------------------------- */
85+#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t