diff options
author | Wim Taymans <wtaymans@redhat.com> | 2014-09-18 10:21:48 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2014-09-18 10:21:48 +0200 |
commit | e65d2007f2a9fb8a6ac0e2b2527636d7afa8e914 (patch) | |
tree | d7584f609b2363c33c2fbee82340936d9c192531 | |
parent | 45957a71c26285ee097029706100e8555ff6189f (diff) |
compiler: reuse _try_get_constant in _get_constantwork-base
-rw-r--r-- | orc/orccompiler.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/orc/orccompiler.c b/orc/orccompiler.c index 1acb0ff..1b403f5 100644 --- a/orc/orccompiler.c +++ b/orc/orccompiler.c @@ -1091,36 +1091,14 @@ int orc_compiler_get_constant_long (OrcCompiler *compiler, orc_uint32 a, orc_uint32 b, orc_uint32 c, orc_uint32 d) { - int i; int tmp; - for(i=0;i<compiler->n_constants;i++){ - if (compiler->constants[i].is_long == TRUE && - compiler->constants[i].full_value[0] == a && - compiler->constants[i].full_value[1] == b && - compiler->constants[i].full_value[2] == c && - compiler->constants[i].full_value[3] == d) { - break; - } - } - if (i == compiler->n_constants) { - compiler->n_constants++; - compiler->constants[i].full_value[0] = a; - compiler->constants[i].full_value[1] = b; - compiler->constants[i].full_value[2] = c; - compiler->constants[i].full_value[3] = d; - compiler->constants[i].is_long = TRUE; - compiler->constants[i].alloc_reg = 0; - compiler->constants[i].use_count = 0; - } - - compiler->constants[i].use_count++; - - if (compiler->constants[i].alloc_reg != 0) {; - return compiler->constants[i].alloc_reg; + tmp = orc_compiler_try_get_constant_long (compiler, a, b, c, d); + if (tmp == ORC_REG_INVALID) { + tmp = orc_compiler_get_temp_reg (compiler); + orc_compiler_load_constant_long (compiler, tmp, + &compiler->constants[compiler->n_constants - 1]); } - tmp = orc_compiler_get_temp_reg (compiler); - orc_compiler_load_constant_long (compiler, tmp, &compiler->constants[i]); return tmp; } |