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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [rtl-error.c] - Blame information for rev 178

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* RTL specific diagnostic subroutines for GCC
2
   Copyright (C) 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
3
   Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
4
 
5
This file is part of GCC.
6
 
7
GCC is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 3, or (at your option)
10
any later version.
11
 
12
GCC is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with GCC; see the file COPYING3.  If not see
19
<http://www.gnu.org/licenses/>.  */
20
 
21
#include "config.h"
22
#undef FLOAT /* This is for hpux. They should change hpux.  */
23
#undef FFS  /* Some systems define this in param.h.  */
24
#include "system.h"
25
#include "coretypes.h"
26
#include "tm.h"
27
#include "rtl.h"
28
#include "insn-attr.h"
29
#include "insn-config.h"
30
#include "input.h"
31
#include "toplev.h"
32
#include "intl.h"
33
#include "diagnostic.h"
34
 
35
static location_t location_for_asm (rtx);
36
static void diagnostic_for_asm (rtx, const char *, va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(2,0);
37
 
38
/* Figure the location of the given INSN.  */
39
static location_t
40
location_for_asm (rtx insn)
41
{
42
  rtx body = PATTERN (insn);
43
  rtx asmop;
44
  location_t loc;
45
 
46
  /* Find the (or one of the) ASM_OPERANDS in the insn.  */
47
  if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
48
    asmop = SET_SRC (body);
49
  else if (GET_CODE (body) == ASM_OPERANDS)
50
    asmop = body;
51
  else if (GET_CODE (body) == PARALLEL
52
           && GET_CODE (XVECEXP (body, 0, 0)) == SET)
53
    asmop = SET_SRC (XVECEXP (body, 0, 0));
54
  else if (GET_CODE (body) == PARALLEL
55
           && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
56
    asmop = XVECEXP (body, 0, 0);
57
  else
58
    asmop = NULL;
59
 
60
  if (asmop)
61
#ifdef USE_MAPPED_LOCATION
62
    loc = ASM_OPERANDS_SOURCE_LOCATION (asmop);
63
#else
64
    {
65
      loc.file = ASM_OPERANDS_SOURCE_FILE (asmop);
66
      loc.line = ASM_OPERANDS_SOURCE_LINE (asmop);
67
    }
68
#endif
69
  else
70
    loc = input_location;
71
  return loc;
72
}
73
 
74
/* Report a diagnostic MESSAGE (an errror or a WARNING) at the line number
75
   of the insn INSN.  This is used only when INSN is an `asm' with operands,
76
   and each ASM_OPERANDS records its own source file and line.  */
77
static void
78
diagnostic_for_asm (rtx insn, const char *msg, va_list *args_ptr,
79
                    diagnostic_t kind)
80
{
81
  diagnostic_info diagnostic;
82
 
83
  diagnostic_set_info (&diagnostic, msg, args_ptr,
84
                       location_for_asm (insn), kind);
85
  report_diagnostic (&diagnostic);
86
}
87
 
88
void
89
error_for_asm (rtx insn, const char *gmsgid, ...)
90
{
91
  va_list ap;
92
 
93
  va_start (ap, gmsgid);
94
  diagnostic_for_asm (insn, gmsgid, &ap, DK_ERROR);
95
  va_end (ap);
96
}
97
 
98
void
99
warning_for_asm (rtx insn, const char *gmsgid, ...)
100
{
101
  va_list ap;
102
 
103
  va_start (ap, gmsgid);
104
  diagnostic_for_asm (insn, gmsgid, &ap, DK_WARNING);
105
  va_end (ap);
106
}
107
 
108
void
109
_fatal_insn (const char *msgid, rtx insn, const char *file, int line,
110
             const char *function)
111
{
112
  error ("%s", _(msgid));
113
 
114
  /* The above incremented error_count, but isn't an error that we want to
115
     count, so reset it here.  */
116
  errorcount--;
117
 
118
  debug_rtx (insn);
119
  fancy_abort (file, line, function);
120
}
121
 
122
void
123
_fatal_insn_not_found (rtx insn, const char *file, int line,
124
                       const char *function)
125
{
126
  if (INSN_CODE (insn) < 0)
127
    _fatal_insn ("unrecognizable insn:", insn, file, line, function);
128
  else
129
    _fatal_insn ("insn does not satisfy its constraints:",
130
                insn, file, line, function);
131
}

powered by: WebSVN 2.1.0

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