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.
master
Edmund Grimley Evans 2015-10-31 11:04:52 +00:00
parent 35e715a1e3
commit f4082851ea
2 changed files with 12 additions and 5 deletions

View File

@ -1820,15 +1820,23 @@ ST_FUNC void gen_clear_cache(void)
}
ST_FUNC void gen_vla_sp_save(int addr) {
tcc_error("variable length arrays unsupported for this target");
uint32_t r = intr(get_reg(RC_INT));
o(0x910003e0 | r); // mov x(r),sp
arm64_strx(3, r, 29, addr);
}
ST_FUNC void gen_vla_sp_restore(int addr) {
tcc_error("variable length arrays unsupported for this target");
uint32_t r = intr(get_reg(RC_INT));
arm64_ldrx(0, 3, r, 29, addr);
o(0x9100001f | r << 5); // mov sp,x(r)
}
ST_FUNC void gen_vla_alloc(CType *type, int align) {
tcc_error("variable length arrays unsupported for this target");
uint32_t r = intr(gv(RC_INT));
o(0x91003c00 | r | r << 5); // add x(r),x(r),#15
o(0x927cec00 | r | r << 5); // bic x(r),x(r),#15
o(0xcb2063ff | r << 16); // sub sp,sp,x(r)
vpop();
}
/* end of A64 code generator */

View File

@ -41,8 +41,7 @@ endif
ifeq ($(TARGETOS),Darwin)
TESTS := $(filter-out hello-exe test3 $(BTESTS),$(TESTS))
endif
ifeq ($(ARCH),i386)
else ifneq ($(ARCH),x86-64)
ifeq (,$(filter arm64 i386 x86-64,$(ARCH)))
TESTS := $(filter-out vla_test-run,$(TESTS))
endif
ifeq ($(CONFIG_arm_eabi),yes)