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: RFC: define_predicate



On Aug 2, 2004, at 11:51 AM, Joern Rennecke wrote:


if genpreds.c would put an additional switch statement before the user
code. Well, maybe in this case it is not that much more readable (maybe
the opposite is true), but in many predicates the third argument to
define_predicate would be superfluous, as in


+;; Return 1 if OP refers to a symbol.
+(define_predicate "symbolic_operand" "symbol_ref,const,label_ref"
+{
+  switch (GET_CODE (op))
+    {
+    case CONST:
+    case SYMBOL_REF:
+    case LABEL_REF:
+      return 1;
+
+    default:
+      break;
+    }
+  return 0;
+})

and that argument could be made optional (defaulting to "return 1;").
Does this make sense?

It's very hard to optimize that switch statement away if it is not needed.

Are you sure about that any more?


Andrew


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