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: [PATCH V2 2/8] bpf: new GCC port


On Sat, 17 Aug 2019, Jose E. Marchesi wrote:

> +(define_insn "*branch_on_di"
> +  [(set (pc)
> +	(if_then_else (match_operator 3 "ordered_comparison_operator"
> +			 [(match_operand:DI 0 "register_operand" "r")
> +			  (match_operand:DI 1 "reg_or_imm_operand" "rI")])
> +		      (label_ref (match_operand 2 "" ""))
> +		      (pc)))]
> +  ""
> +{
> +  int code = GET_CODE (operands[3]);
> +
> +  switch (code)
> +  {
> +  case EQ: return "jeq\t%0,%1,%2"; break;
> +  case NE: return "jne\t%0,%1,%2"; break;
> +  case LT: return "jslt\t%0,%1,%2"; break;
> +  case LE: return "jsle\t%0,%1,%2"; break;
> +  case GT: return "jsgt\t%0,%1,%2"; break;
> +  case GE: return "jsge\t%0,%1,%2"; break;
> +  case LTU: return "jlt\t%0,%1,%2"; break;
> +  case LEU: return "jle\t%0,%1,%2"; break;
> +  case GTU: return "jgt\t%0,%1,%2"; break;
> +  case GEU: return "jge\t%0,%1,%2"; break;
> +  default:
> +    error ("unknown comparison code %d in *branch_on_di\n", code);

This error message isn't written in terms meaningful to users (that is, 
saying what is wrong with their source code).  Calls to error () should 
only be for errors meaningful to users (and shouldn't appear in .md files 
at all, because exgettext doesn't extract messages from .md files for 
translation, and any error that late in compilation is liable not to have 
a very meaningful location either).  Internal errors - errors indicating a 
bug in the compiler rather than a problem with the user's program - need 
to use other functions such as internal_error.

-- 
Joseph S. Myers
joseph@codesourcery.com


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