This is the mail archive of the gcc-patches@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]

Re: RFA: autoincrement patches for gcc 4 - updated patch


Ian Lance Taylor wrote:

Joern RENNECKE <joern.rennecke@st.com> writes:



gen_add3_insn (rtx r0, rtx r1, rtx c)
{
  int icode = (int) add_optab->handlers[(int) GET_MODE (r0)].insn_code;
+  int mcode;
+  rtx s;

if (icode == CODE_FOR_nothing
|| !(insn_data[icode].operand[0].predicate
- (r0, insn_data[icode].operand[0].mode))
- || !(insn_data[icode].operand[1].predicate
+ (r0, insn_data[icode].operand[0].mode)))
+ return NULL_RTX;
+
+ if ((insn_data[icode].operand[1].predicate
(r1, insn_data[icode].operand[1].mode))
- || !(insn_data[icode].operand[2].predicate
+ && (insn_data[icode].operand[2].predicate
(c, insn_data[icode].operand[2].mode)))
+ return GEN_FCN (icode) (r0, r1, c);
+ + mcode = (int) mov_optab->handlers[(int) GET_MODE (r0)].insn_code;
+ if (REGNO (r0) == REGNO (r1)
+ || !(insn_data[icode].operand[1].predicate
+ (r0, insn_data[icode].operand[1].mode))
+ || !(insn_data[icode].operand[2].predicate
+ (r1, insn_data[icode].operand[2].mode))
+ || !(insn_data[mcode].operand[0].predicate
+ (r0, insn_data[mcode].operand[0].mode))
+ || !(insn_data[mcode].operand[1].predicate
+ (c, insn_data[mcode].operand[1].mode)))
return NULL_RTX;


- return GEN_FCN (icode) (r0, r1, c);
+ start_sequence ();
+ emit_insn (GEN_FCN (mcode) (r0, c));
+ emit_insn (GEN_FCN (icode) (r0, r0, r1));
+ s = get_insns ();
+ end_sequence ();
+ return s;
}



I think we need a clearer description of what gen_add3_insn is for.
In general this function is hard to use safely and easily, as it
requires checking for a NULL return even though most of the callers do
not actually check. I note that the MIPS backend uses it, and the
changes above don't seem quite right for the MIPS backend.


Could you explain in more detail how this is not right for the MIPS backend?
I don't see and code in mips.md that relies on gen_add3_insn to return NULL_RTX
when a constant is not valid as an input to the add insn.



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