On 09/02/2015 10:38 PM, k9119911 wrote:
Hi
I need to do some instrumentations in gimple for some operations like a = b
+ c
For such operation, I want to get the address of a, b, and c and call a
function to handle it.
However, I have some problems to do it.
The following is my instrumentation:
gimple_assign <plus_expr, a, b, c>
gimple_assign <addr_expr, op0_addr.0, &a, NULL>
gimple_assign <addr_expr, op1_addr.1, &b, NULL>
gimple_assign <addr_expr, op2_addr.2, &c, NULL>
gimple_call <foo, NULL, a, b, c, op0_addr.0, op1_addr.1, op2_addr.2>
Because I really need to get the address of those operands, I need to set
those operands addressable(i.e. TREE_ADDRESSABLE(a) = 1). Then
I use build1(ADDR_EXPR, ptr_type_node, a) to get the address.
And op0_addr.0, op1_addr.1, and op2_addr.2 are all void * type.
However, I got wired gcc_assert(0) in propagate_necessity, at
tree-ssa-dce.c:978.
If I don't set it, I need to gimplify the addr_expr before assignment.
However, the result is not what I wnat because gimplify will create an
intermediate
variable and I got the address of the intermediate variable instead of the
original one.
I use gcc-4.7.2.
This is a weird problem.
Essentially you should think of gimple as a load-store type
architecture. You can't have addressable SSA_NAMEs.
jeff