This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

instruction splitting and preserving register notes


Hi,

I currently have a problem of how to best preserve a register note across 
an instruction split, e.g. I had to change a define_split like this (from 
m68k.md):

 (define_split
   [(set (match_operand 0 "register_operand" "")
        (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
   "!TARGET_CFV4 && reload_completed"
-  [(set (match_dup 0)
-       (const_int 0))
-   (set (strict_low_part (match_dup 2))
-       (match_dup 1))]
+  [(const_int 0)]
 {
-  operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
+  rtx x, note;
+  emit_move_insn (operands[0], GEN_INT (0));
+  x = gen_lowpart (GET_MODE (operands[1]), operands[0]);
+  x = gen_rtx_STRICT_LOW_PART (VOIDmode, x);
+  x = emit_insn (gen_rtx_SET (VOIDmode, x, operands[1]));
+  note = find_reg_note (curr_insn, REG_INC, NULL);
+  if (note)
+    REG_NOTES (x) = gen_rtx_EXPR_LIST (REG_INC, XEXP (note, 0), NULL_RTX);
+  DONE;
 })

My problem is now, fixing all splits like this, which may involve an auto 
increment, is rather awkward and error prone, so I'm looking for a way to 
make this simpler.
In the preparation statement one has no access to the instruction which 
are generated by the pattern, so I hope it would be possible, to annotate 
the pattern somehow, so genemit.c could generate the code to copy the note 
automatically. The other possibility is to add a hook after the 
instruction has been splitted.
Anyway, I appreciate any ideas on how to solve this, which would keep the 
maintainance overhead as low as possible.

bye, Roman


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]