OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [rtl-error.c] - Diff between revs 154 and 816

Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
/* RTL specific diagnostic subroutines for GCC
/* RTL specific diagnostic subroutines for GCC
   Copyright (C) 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
   Copyright (C) 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
   Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
   Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
 
 
This file is part of GCC.
This file is part of GCC.
 
 
GCC is free software; you can redistribute it and/or modify
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
the Free Software Foundation; either version 3, or (at your option)
any later version.
any later version.
 
 
GCC is distributed in the hope that it will be useful,
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
GNU General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */
<http://www.gnu.org/licenses/>.  */
 
 
#include "config.h"
#include "config.h"
#undef FLOAT /* This is for hpux. They should change hpux.  */
#undef FLOAT /* This is for hpux. They should change hpux.  */
#undef FFS  /* Some systems define this in param.h.  */
#undef FFS  /* Some systems define this in param.h.  */
#include "system.h"
#include "system.h"
#include "coretypes.h"
#include "coretypes.h"
#include "tm.h"
#include "tm.h"
#include "rtl.h"
#include "rtl.h"
#include "insn-attr.h"
#include "insn-attr.h"
#include "insn-config.h"
#include "insn-config.h"
#include "input.h"
#include "input.h"
#include "toplev.h"
#include "toplev.h"
#include "intl.h"
#include "intl.h"
#include "diagnostic.h"
#include "diagnostic.h"
 
 
static location_t location_for_asm (rtx);
static location_t location_for_asm (rtx);
static void diagnostic_for_asm (rtx, const char *, va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(2,0);
static void diagnostic_for_asm (rtx, const char *, va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(2,0);
 
 
/* Figure the location of the given INSN.  */
/* Figure the location of the given INSN.  */
static location_t
static location_t
location_for_asm (rtx insn)
location_for_asm (rtx insn)
{
{
  rtx body = PATTERN (insn);
  rtx body = PATTERN (insn);
  rtx asmop;
  rtx asmop;
  location_t loc;
  location_t loc;
 
 
  /* Find the (or one of the) ASM_OPERANDS in the insn.  */
  /* Find the (or one of the) ASM_OPERANDS in the insn.  */
  if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
  if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
    asmop = SET_SRC (body);
    asmop = SET_SRC (body);
  else if (GET_CODE (body) == ASM_OPERANDS)
  else if (GET_CODE (body) == ASM_OPERANDS)
    asmop = body;
    asmop = body;
  else if (GET_CODE (body) == PARALLEL
  else if (GET_CODE (body) == PARALLEL
           && GET_CODE (XVECEXP (body, 0, 0)) == SET)
           && GET_CODE (XVECEXP (body, 0, 0)) == SET)
    asmop = SET_SRC (XVECEXP (body, 0, 0));
    asmop = SET_SRC (XVECEXP (body, 0, 0));
  else if (GET_CODE (body) == PARALLEL
  else if (GET_CODE (body) == PARALLEL
           && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
           && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
    asmop = XVECEXP (body, 0, 0);
    asmop = XVECEXP (body, 0, 0);
  else
  else
    asmop = NULL;
    asmop = NULL;
 
 
  if (asmop)
  if (asmop)
#ifdef USE_MAPPED_LOCATION
#ifdef USE_MAPPED_LOCATION
    loc = ASM_OPERANDS_SOURCE_LOCATION (asmop);
    loc = ASM_OPERANDS_SOURCE_LOCATION (asmop);
#else
#else
    {
    {
      loc.file = ASM_OPERANDS_SOURCE_FILE (asmop);
      loc.file = ASM_OPERANDS_SOURCE_FILE (asmop);
      loc.line = ASM_OPERANDS_SOURCE_LINE (asmop);
      loc.line = ASM_OPERANDS_SOURCE_LINE (asmop);
    }
    }
#endif
#endif
  else
  else
    loc = input_location;
    loc = input_location;
  return loc;
  return loc;
}
}
 
 
/* Report a diagnostic MESSAGE (an errror or a WARNING) at the line number
/* Report a diagnostic MESSAGE (an errror or a WARNING) at the line number
   of the insn INSN.  This is used only when INSN is an `asm' with operands,
   of the insn INSN.  This is used only when INSN is an `asm' with operands,
   and each ASM_OPERANDS records its own source file and line.  */
   and each ASM_OPERANDS records its own source file and line.  */
static void
static void
diagnostic_for_asm (rtx insn, const char *msg, va_list *args_ptr,
diagnostic_for_asm (rtx insn, const char *msg, va_list *args_ptr,
                    diagnostic_t kind)
                    diagnostic_t kind)
{
{
  diagnostic_info diagnostic;
  diagnostic_info diagnostic;
 
 
  diagnostic_set_info (&diagnostic, msg, args_ptr,
  diagnostic_set_info (&diagnostic, msg, args_ptr,
                       location_for_asm (insn), kind);
                       location_for_asm (insn), kind);
  report_diagnostic (&diagnostic);
  report_diagnostic (&diagnostic);
}
}
 
 
void
void
error_for_asm (rtx insn, const char *gmsgid, ...)
error_for_asm (rtx insn, const char *gmsgid, ...)
{
{
  va_list ap;
  va_list ap;
 
 
  va_start (ap, gmsgid);
  va_start (ap, gmsgid);
  diagnostic_for_asm (insn, gmsgid, &ap, DK_ERROR);
  diagnostic_for_asm (insn, gmsgid, &ap, DK_ERROR);
  va_end (ap);
  va_end (ap);
}
}
 
 
void
void
warning_for_asm (rtx insn, const char *gmsgid, ...)
warning_for_asm (rtx insn, const char *gmsgid, ...)
{
{
  va_list ap;
  va_list ap;
 
 
  va_start (ap, gmsgid);
  va_start (ap, gmsgid);
  diagnostic_for_asm (insn, gmsgid, &ap, DK_WARNING);
  diagnostic_for_asm (insn, gmsgid, &ap, DK_WARNING);
  va_end (ap);
  va_end (ap);
}
}
 
 
void
void
_fatal_insn (const char *msgid, rtx insn, const char *file, int line,
_fatal_insn (const char *msgid, rtx insn, const char *file, int line,
             const char *function)
             const char *function)
{
{
  error ("%s", _(msgid));
  error ("%s", _(msgid));
 
 
  /* The above incremented error_count, but isn't an error that we want to
  /* The above incremented error_count, but isn't an error that we want to
     count, so reset it here.  */
     count, so reset it here.  */
  errorcount--;
  errorcount--;
 
 
  debug_rtx (insn);
  debug_rtx (insn);
  fancy_abort (file, line, function);
  fancy_abort (file, line, function);
}
}
 
 
void
void
_fatal_insn_not_found (rtx insn, const char *file, int line,
_fatal_insn_not_found (rtx insn, const char *file, int line,
                       const char *function)
                       const char *function)
{
{
  if (INSN_CODE (insn) < 0)
  if (INSN_CODE (insn) < 0)
    _fatal_insn ("unrecognizable insn:", insn, file, line, function);
    _fatal_insn ("unrecognizable insn:", insn, file, line, function);
  else
  else
    _fatal_insn ("insn does not satisfy its constraints:",
    _fatal_insn ("insn does not satisfy its constraints:",
                insn, file, line, function);
                insn, file, line, function);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.