Minor stylistic suggestions...

+  "*
+   switch (which_alternative)
+    {
+    case 0:
+      if (TARGET_A16 
+         && GET_CODE (operands[2]) == SYMBOL_REF
+         && far_data_p (operands[2])== 1
+         && near_data_p (operands[2])== 0)
+        return m32c_disp_pattern (insn, operands);
+      else 
+        return \"add.w\t%2,%0\";

This should be done by creating a constraint for the first case, and
adding it to the list of constraints.  Then we can avoid a huge switch
statement.

+/* Returns TRUE if given tree has the "far" attribute.  */
+int
+far_data_p (rtx x)
+{

This function should account for CONST and offsets, so that it need
not be done many times in the *.md files.

+/* Returns TRUE if given tree has the "far" attribute.  */
+int
+far_data_a1a0 (rtx x)
+{

These two functions should have different comments, each describing
the specifics of the two functions.

+
+static tree
+far_data_handler (tree * node, tree name,
+                  tree args ATTRIBUTE_UNUSED,
+                  int flags ATTRIBUTE_UNUSED, bool * no_add_attrs)
+{

This function should have a comment too.

+/* Returns TRUE if given tree has the "near" attribute.  */
+int
+near_data_p (rtx x)
+{

Likewise for these two.

+/* Copy the constant string from '.rodata' section in far memory to
+ 'data' section in near memory  */

"copy from" doesn't describe what this function is doing.  "Assign to"
would be better.

+/* Returns the instructions to access array elements using the
+   displacement.  */
+char *
+m32c_disp_pattern (rtx insn, rtx * operands)

This giant function is better done as a peephole optimization that
resolves to an UNSPEC pattern for the desired output.

--- /gcc/config/m32c/mov.md     2008-01-15 11:37:37.000000000 +0530
+++ /gcc/config/m32c/mov.md     2008-01-15 17:41:04.000000000 +0530
@@ -30,6 +30,159 @@
 
 ;; Match push/pop before mov.b for passing char as arg,
 ;; e.g. stdlib/efgcvt.c.
+
+;; M16C-20bit Access
+(define_insn "movqildabs_op"
+  [(set (match_operand:QI 0 "mra_nopp_operand" "=Rqi*Rmm")
+        (match_operand:QI 1 "m32c_20babsqi_operand" "Sn"))]

Can these be done with constraints in the generic mov pattern,
instead of a whole separate pattern?

+  else if (GET_CODE (XEXP (operands[1], 0)) == CONST)
+    {
+      a = far_data_p (XEXP (XEXP (XEXP (operands[1], 0), 0), 0));
+      b = near_data_p (XEXP (XEXP (XEXP (operands[1], 0), 0), 0));

Again, this should be moved to far_data_p().

Reply via email to