History

x86-64: Add alloca.

Shinichiro Hamaji committed 17 years ago

Commit 8ea83051 parent 110a4ed2 files · +37 −0Browse files

Unified · Split

2 files
  1. Makefile +4 −0
  2. lib/alloca86_64.S +33 −0
Makefile+4−0
@@ -177,6 +177,10 @@ VPATH+=win32/lib · 176 unmodified lines
177endif177endif
178ifeq ($(ARCH),i386)178ifeq ($(ARCH),i386)
179LIBTCC1_OBJS+=alloca86.o alloca86-bt.o179LIBTCC1_OBJS+=alloca86.o alloca86-bt.o
180else
181ifeq ($(ARCH),x86-64)
182LIBTCC1_OBJS+=alloca86_64.o
183endif
180endif184endif
181 185
182%.o: %.c186%.o: %.c
lib/alloca86_64.S+33−0
@@ -0,0 +1,33 @@
1/* ---------------------------------------------- */
2/* alloca86_64.S */
3
4#include "../config.h"
5
6.globl alloca
7
8alloca:
9 pop %rdx
10 mov %rdi,%rax
11 add $3,%rax
12 and $-4,%rax
13 jz p3
14
15#ifdef TCC_TARGET_PE
16 /* XXX: not tested */
17p1:
18 cmp $4096,%rax
19 jle p2
20 sub $4096,%rsp
21 sub $4096,%rax
22 test %rax,(%rsp)
23 jmp p1
24p2:
25#endif
26
27 sub %rax,%rsp
28 mov %rsp,%rax
29p3:
30 push %rdx
31 ret
32
33/* ---------------------------------------------- */

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