summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkugwa <kugwa2000@gmail.com>2016-01-02 21:18:50 +0800
committerkugwa <kugwa2000@gmail.com>2016-01-02 21:20:10 +0800
commit66354c1cfd056957fc23dde8bcbc01d4918e5fb4 (patch)
tree76d34440cb8d73d62da36e4014d631fb9c8e4e33
parentbc85605c978e7e5a6d018fea069b9b2de507a108 (diff)
downloadcompiler2015-66354c1cfd056957fc23dde8bcbc01d4918e5fb4.tar
compiler2015-66354c1cfd056957fc23dde8bcbc01d4918e5fb4.tar.gz
compiler2015-66354c1cfd056957fc23dde8bcbc01d4918e5fb4.tar.bz2
compiler2015-66354c1cfd056957fc23dde8bcbc01d4918e5fb4.tar.lz
compiler2015-66354c1cfd056957fc23dde8bcbc01d4918e5fb4.tar.xz
compiler2015-66354c1cfd056957fc23dde8bcbc01d4918e5fb4.tar.zst
compiler2015-66354c1cfd056957fc23dde8bcbc01d4918e5fb4.zip
Fix output to meet asm syntax
-rw-r--r--src/register.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/register.c b/src/register.c
index 99257b0..cb5783e 100644
--- a/src/register.c
+++ b/src/register.c
@@ -90,9 +90,9 @@ const char *ccmmc_register_lock(CcmmcRegPool *pool, CcmmcTmp *tmp)
// gen code to swap the tmp in the register and the tmp on the stack
fprintf(pool->asm_output, "\tmov\t%s, %s\n", REG_RESERVED,
pool->list[i]->name);
- fprintf(pool->asm_output, "\tldr\t%s, [fp - #%" PRIu64 "]\n",
+ fprintf(pool->asm_output, "\tldr\t%s, [fp, #-%" PRIu64 "]\n",
pool->list[i]->name, tmp->addr);
- fprintf(pool->asm_output, "\tstr\t%s, [fp - #%" PRIu64 "]\n",
+ fprintf(pool->asm_output, "\tstr\t%s, [fp, #-%" PRIu64 "]\n",
REG_RESERVED, tmp->addr);
// find the index of tmp in pool->spill
@@ -158,7 +158,7 @@ void ccmmc_register_free(CcmmcRegPool *pool, CcmmcTmp *tmp, uint64_t *offset)
pool->top--;
// gen code to move the last tmp to this register
- fprintf(pool->asm_output, "\tldr\t%s, [fp - #%" PRIu64 "]\n",
+ fprintf(pool->asm_output, "\tldr\t%s, [fp, #-%" PRIu64 "]\n",
tmp->reg->name, pool->spill[pool->top - pool->num]->addr);
fprintf(pool->asm_output, "\tadd\tsp, sp, #%d\n", REG_SIZE);
@@ -185,7 +185,7 @@ void ccmmc_register_free(CcmmcRegPool *pool, CcmmcTmp *tmp, uint64_t *offset)
void ccmmc_register_caller_save(CcmmcRegPool *pool)
{
for (int i = 0; i < REG_NUM; i++)
- fprintf(pool->asm_output, "\tstr\t%s, [sp - #%d]\n",
+ fprintf(pool->asm_output, "\tstr\t%s, [sp, #-%d]\n",
reg_name[i],
(i + 1) * REG_SIZE);
fprintf(pool->asm_output, "\tsub\tsp, sp, %d\n", REG_NUM * REG_SIZE);
@@ -195,7 +195,7 @@ void ccmmc_register_caller_load(CcmmcRegPool *pool)
{
fprintf(pool->asm_output, "\tadd\tsp, sp, %d\n", REG_NUM * REG_SIZE);
for (int i = 0; i < REG_NUM; i++)
- fprintf(pool->asm_output, "\tldr\t%s, [sp - #%d]\n",
+ fprintf(pool->asm_output, "\tldr\t%s, [sp, #-%d]\n",
reg_name[i],
(i + 1) * REG_SIZE);
}