diff options
author | kugwa <kugwa2000@gmail.com> | 2016-01-21 22:12:32 +0800 |
---|---|---|
committer | kugwa <kugwa2000@gmail.com> | 2016-01-21 22:12:32 +0800 |
commit | c7a5c6b3d3fd2f5495f104892e15d784fb04a902 (patch) | |
tree | fb64652c74502a10cba9a6034c04124431c08d29 /src | |
parent | 2d49791e5e321c4462bd9655e510f392231d25cf (diff) | |
download | compiler2015-c7a5c6b3d3fd2f5495f104892e15d784fb04a902.tar compiler2015-c7a5c6b3d3fd2f5495f104892e15d784fb04a902.tar.gz compiler2015-c7a5c6b3d3fd2f5495f104892e15d784fb04a902.tar.bz2 compiler2015-c7a5c6b3d3fd2f5495f104892e15d784fb04a902.tar.lz compiler2015-c7a5c6b3d3fd2f5495f104892e15d784fb04a902.tar.xz compiler2015-c7a5c6b3d3fd2f5495f104892e15d784fb04a902.tar.zst compiler2015-c7a5c6b3d3fd2f5495f104892e15d784fb04a902.zip |
Don't output add/sub sp, sp ,0
Diffstat (limited to 'src')
-rw-r--r-- | src/register.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/register.c b/src/register.c index bfe347a..3a7554e 100644 --- a/src/register.c +++ b/src/register.c @@ -270,9 +270,13 @@ void ccmmc_register_caller_save(CcmmcRegPool *pool) fprintf(pool->asm_output, "\tstr\t%s, [sp, #-%d]\n", pool->list[i]->name, (i + 1) * REG_SIZE); - fprintf(pool->asm_output, "\tsub\tsp, sp, %d\n", bound * REG_SIZE); + if (bound > 0) + fprintf(pool->asm_output, "\tsub\tsp, sp, %d\n", bound * REG_SIZE); - sprintf(pool->print_buf, "\tadd\tsp, sp, %d\n", bound * REG_SIZE); + if (bound > 0) + sprintf(pool->print_buf, "\tadd\tsp, sp, %d\n", bound * REG_SIZE); + else + pool->print_buf[0] = '\0'; for (int i = 0; i < bound; i++) { sprintf(buf, "\tldr\t%s, [sp, #-%d]\n", pool->list[i]->name, |