]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Use temporaries for address_of constants
authorGopal V <gopalv82@yahoo.com>
Thu, 15 Dec 2005 10:12:26 +0000 (10:12 +0000)
committerGopal V <gopalv82@yahoo.com>
Thu, 15 Dec 2005 10:12:26 +0000 (10:12 +0000)
ChangeLog
jit/jit-insn.c

index 019f08c4a7d784b814642bf40f309a0753eaabee..0105c7685b64110845eff620673fb91b8a7f52f4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+
+2005-12-15  Avinash Atreya  <avinashatreya@gmail.com>
+
+       * jit/jit-insn.c: Store constants to a temporary to obtain
+       address of constant values.
+
 2005-12-13  Aleksey Demakov  <ademakov@gmail.com>
 
        * configure.in: Added --enable-long-double option that forces
index 969a905e7a31d9dfc60863fb780b8067a1833434..e8e18fffc7f073934a51d876281b6ac7122fc930 100644 (file)
@@ -3948,6 +3948,7 @@ add_block:
 jit_value_t jit_insn_address_of(jit_function_t func, jit_value_t value1)
 {
        jit_type_t type;
+       jit_value_t temp;
        jit_value_t result;
        if(!value1)
        {
@@ -3958,6 +3959,17 @@ jit_value_t jit_insn_address_of(jit_function_t func, jit_value_t value1)
        {
                return 0;
        }
+       /* if it is a constant, need to create a temporary and then make that addressable */
+       if(jit_value_is_constant(value1))
+       {
+               temp = jit_value_create(func, jit_value_get_type(value1));
+               if(!temp)
+               {
+                       return 0;
+               }
+               jit_insn_store(func, temp, value1);
+               value1 = temp;
+       }
        jit_value_set_addressable(value1);
        result = apply_unary(func, JIT_OP_ADDRESS_OF, value1, type);
        jit_type_free(type);