History

Enable variable-length arrays on arm64.

arm64-gen.c: Implement gen_vla_sp_save, gen_vla_sp_restore, gen_vla_alloc. tests/Makefile: Run vla_test on arm64.

Edmund Grimley Evans committed 11 years ago

Commit f4082851 parent 35e715a2 files · +12 −5Browse files

Unified · Split

2 files
  1. arm64-gen.c +11 −3
  2. tests/Makefile +1 −2
arm64-gen.c+11−3
@@ -1820,15 +1820,23 @@ ST_FUNC void gen_clear_cache(void) · 1819 unmodified lines
1820}1820}
1821 1821
1822ST_FUNC void gen_vla_sp_save(int addr) {1822ST_FUNC void gen_vla_sp_save(int addr) {
1823 tcc_error("variable length arrays unsupported for this target");1823 uint32_t r = intr(get_reg(RC_INT));
1824 o(0x910003e0 | r); // mov x(r),sp
1825 arm64_strx(3, r, 29, addr);
1824}1826}
1825 1827
1826ST_FUNC void gen_vla_sp_restore(int addr) {1828ST_FUNC void gen_vla_sp_restore(int addr) {
1827 tcc_error("variable length arrays unsupported for this target");1829 uint32_t r = intr(get_reg(RC_INT));
1830 arm64_ldrx(0, 3, r, 29, addr);
1831 o(0x9100001f | r << 5); // mov sp,x(r)
1828}1832}
1829 1833
1830ST_FUNC void gen_vla_alloc(CType *type, int align) {1834ST_FUNC void gen_vla_alloc(CType *type, int align) {
1831 tcc_error("variable length arrays unsupported for this target");1835 uint32_t r = intr(gv(RC_INT));
1836 o(0x91003c00 | r | r << 5); // add x(r),x(r),#15
1837 o(0x927cec00 | r | r << 5); // bic x(r),x(r),#15
1838 o(0xcb2063ff | r << 16); // sub sp,sp,x(r)
1839 vpop();
1832}1840}
1833 1841
1834/* end of A64 code generator */1842/* end of A64 code generator */
tests/Makefile+1−2
@@ -41,8 +41,7 @@ endif · 40 unmodified lines
41ifeq ($(TARGETOS),Darwin)41ifeq ($(TARGETOS),Darwin)
42 TESTS := $(filter-out hello-exe test3 $(BTESTS),$(TESTS))42 TESTS := $(filter-out hello-exe test3 $(BTESTS),$(TESTS))
43endif43endif
44ifeq ($(ARCH),i386)44ifeq (,$(filter arm64 i386 x86-64,$(ARCH)))
45else ifneq ($(ARCH),x86-64)
46 TESTS := $(filter-out vla_test-run,$(TESTS))45 TESTS := $(filter-out vla_test-run,$(TESTS))
47endif46endif
48ifeq ($(CONFIG_arm_eabi),yes)47ifeq ($(CONFIG_arm_eabi),yes)

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