Well I found another way to solve the problem by updating the dce for
not taking out my instructions.
I inserted "setallocate" as a native operator in the back-end which
comes from a GIMPLE node and map to the RTL pattern. Earlier in the
discussion, it's been discussed that the dce was taking out the
instruction when flag -O1 was engaged. To solve that, in
'tree-ssa-dce.c', I flagged this node with the function,
"mark_stmt_necessary". And it works fine so far. The instruction is not
omitted anymore by the dce :-)
Thanks for your help guys.
Thomas
Ian Lance Taylor wrote:
"Thomas A.M. Bernard" <[EMAIL PROTECTED]> writes:
Ian Lance Taylor wrote:
"Thomas A.M. Bernard" <[EMAIL PROTECTED]> writes:
I guess I am missing something here. I've tried the following as Paolo
suggested,
(define_insn "setallocate"
[(unspec_volatile:DI [(match_operand:DI 0 "general_operand" "r")]
UNSPEC_ALLOCATE)]
""
"allocate %0\t\t#TCB_INSTRUCTIONS" [(set_attr "type" "multi")])
When flag -O0 is on, everything's fine. But when flag -O1 is engaged,
the instruction is still omitted. Something missing ?
The only that gcc will remove an unspec_volatile instruction is if it
is on a code path which is never executed.
Look at the RTL dump files (from, e.g., -fdump-rtl-all), see where
it
is disappearing, and why.
With this pattern for setallocate, when the flag -O1 is engaged, the
instruction is already omitted just at the expansion. As Ian
mentioned, I suspect the problem comes from the fact that the compiler
thinks this code path won't be executed. I presume this should be done
at the CFG level. I added in CFG a "node" which describes
setallocate' Any clue to say explicitly this will be executed in any
case ?
The conventional way to get a special purpose instruction through the
tree code is to use a builtin function. For example, look at the
calls to __builtin_XXX in config/i386/mmintrin.h (a header file
included by target programs) and the associated code in
config/i386/i386.c.
Ian