summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkugwa <kugwa2000@gmail.com>2016-01-03 21:57:31 +0800
committerkugwa <kugwa2000@gmail.com>2016-01-03 21:57:31 +0800
commit1b0f0c141eafffc917a5d3e367585535f78d3987 (patch)
tree1481fd5a3e137770b59a677789bf91e3c134656d
parentaac182f56b27cbdfcb924977efb74ea58d022ff8 (diff)
downloadcompiler2015-1b0f0c141eafffc917a5d3e367585535f78d3987.tar
compiler2015-1b0f0c141eafffc917a5d3e367585535f78d3987.tar.gz
compiler2015-1b0f0c141eafffc917a5d3e367585535f78d3987.tar.bz2
compiler2015-1b0f0c141eafffc917a5d3e367585535f78d3987.tar.lz
compiler2015-1b0f0c141eafffc917a5d3e367585535f78d3987.tar.xz
compiler2015-1b0f0c141eafffc917a5d3e367585535f78d3987.tar.zst
compiler2015-1b0f0c141eafffc917a5d3e367585535f78d3987.zip
Add missing ccmmc_register_lock() in store_variable()
-rw-r--r--src/code-generation.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/code-generation.c b/src/code-generation.c
index a72cb17..5d623d6 100644
--- a/src/code-generation.c
+++ b/src/code-generation.c
@@ -191,10 +191,12 @@ static void store_variable(CcmmcAst *id, CcmmcState *state, CcmmcTmp *src,
fprintf(state->asm_output, "\t/* var store, line %zu */\n", id->line_number);
if (ccmmc_symbol_attr_is_global(&var_sym->attr)) {
//TODO: global array
+ src_reg = ccmmc_register_lock(state->reg_pool, src);
fprintf(state->asm_output,
"\tadrp\t" REG_TMP ", %s\n"
"\tadd\t" REG_TMP ", " REG_TMP ", #:lo12:%s\n"
"\tstr\t%s, [" REG_TMP "]\n", var_name, var_name, src_reg);
+ ccmmc_register_unlock(state->reg_pool, src);
} else {
if (id->value_id.kind != CCMMC_KIND_ID_ARRAY) {
src_reg = ccmmc_register_lock(state->reg_pool, src);