[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-libjit] [PATCH] Enable constant folding
From: |
Alexey Galakhov |
Subject: |
[Dotgnu-libjit] [PATCH] Enable constant folding |
Date: |
Tue, 26 Feb 2013 22:19:40 +0600 |
Signed-off-by: Alexey Galakhov <address@hidden>
---
jit/jit-insn.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/jit/jit-insn.c b/jit/jit-insn.c
index bbd60b6..baf438c 100644
--- a/jit/jit-insn.c
+++ b/jit/jit-insn.c
@@ -288,6 +288,15 @@ static jit_value_t apply_unary
{
return 0;
}
+ if(value1->is_constant &&
+ !jit_context_get_meta_numeric(func->context, JIT_OPTION_DONT_FOLD))
+ {
+ dest = _jit_opcode_apply(func, (short)oper, result_type,
value1, 0);
+ if (dest)
+ {
+ return dest;
+ }
+ }
insn = _jit_block_add_insn(func->builder->current_block);
if(!insn)
{
@@ -322,6 +331,15 @@ static jit_value_t apply_binary
{
return 0;
}
+ if(value1->is_constant && value2->is_constant &&
+ !jit_context_get_meta_numeric(func->context, JIT_OPTION_DONT_FOLD))
+ {
+ dest = _jit_opcode_apply(func, (short)oper, result_type,
value1, value2);
+ if (dest)
+ {
+ return dest;
+ }
+ }
insn = _jit_block_add_insn(func->builder->current_block);
if(!insn)
{
--
1.7.10.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-libjit] [PATCH] Enable constant folding,
Alexey Galakhov <=