Another solution is to add the instrumentation earlier, and use expand_call.

Thanks for your hints. Is that means doing intrumentation at the "RTL
expand" level? However, I have tried the following method, add a
defined_expand  in ia64.md, the template used in define_expand is the
same as the one which will emit a ld instruction, just like this one:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;; expand the ld operation with check code if user turns on
;; fld-checking
(define_expand "gift_load_symptr_low"
 [(set (match_operand:DI 0 "register_operand" "=r")
        (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
                   (match_operand 2 "got_symbolic_operand" "s")))]
 ""
 {
   if(flag_ld_checking)
   {
     printf("gift_load_symptr_low emits checking function call\n");
     emit_library_call(gen_rtx_SYMBOL_REF(Pmode,
\"gift_check_bitmap\"), 0,   VOIDmode, 0);
     emit_insn (gen_rtx_SET (VOIDmode,
        operands[0],
        gen_rtx_LO_SUM (DImode,
        operands[1],
        operands[2])));
   }
   DONE;
 })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUT, when I use the newly builded compiler to compile my program,
nothing matched to expand such ld instruction ...

Reply via email to