From: Gopal V Date: Thu, 15 Dec 2005 10:12:26 +0000 (+0000) Subject: Use temporaries for address_of constants X-Git-Tag: r.0.0.6~19 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=b850a12f31225df3d9ec26745132b15bc7b53f55;p=francis%2Flibjit.git Use temporaries for address_of constants --- diff --git a/ChangeLog b/ChangeLog index 019f08c..0105c76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ + +2005-12-15 Avinash Atreya + + * jit/jit-insn.c: Store constants to a temporary to obtain + address of constant values. + 2005-12-13 Aleksey Demakov * configure.in: Added --enable-long-double option that forces diff --git a/jit/jit-insn.c b/jit/jit-insn.c index 969a905..e8e18ff 100644 --- a/jit/jit-insn.c +++ b/jit/jit-insn.c @@ -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);