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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [rtl-error.c] - Blame information for rev 749

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

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

powered by: WebSVN 2.1.0

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