aarch64 - Set the mode for the unspec in speculation_tracker insn.
[platform/upstream/linaro-gcc.git] / gcc / read-md.h
1 /* MD reader definitions.
2    Copyright (C) 1987-2016 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3.  If not see
18 <http://www.gnu.org/licenses/>.  */
19
20 #ifndef GCC_READ_MD_H
21 #define GCC_READ_MD_H
22
23 #include "obstack.h"
24
25 /* Records a position in the file.  */
26 struct file_location {
27   file_location () {}
28   file_location (const char *, int);
29
30   const char *filename;
31   int lineno;
32 };
33
34 inline file_location::file_location (const char *filename_in, int lineno_in)
35   : filename (filename_in), lineno (lineno_in) {}
36
37 /* Holds one symbol or number in the .md file.  */
38 struct md_name {
39   /* The name as it appeared in the .md file.  Names are syntactically
40      limited to the length of this buffer.  */
41   char buffer[256];
42
43   /* The name that should actually be used by the generator programs.
44      This is an expansion of NAME, after things like constant substitution.  */
45   char *string;
46 };
47
48 /* This structure represents a constant defined by define_constant,
49    define_enum, or such-like.  */
50 struct md_constant {
51   /* The name of the constant.  */
52   char *name;
53
54   /* The string to which the constants expands.  */
55   char *value;
56
57   /* If the constant is associated with a enumeration, this field
58      points to that enumeration, otherwise it is null.  */
59   struct enum_type *parent_enum;
60 };
61
62 /* This structure represents one value in an enum_type.  */
63 struct enum_value {
64   /* The next value in the enum, or null if this is the last.  */
65   struct enum_value *next;
66
67   /* The name of the value as it appears in the .md file.  */
68   char *name;
69
70   /* The definition of the related C value.  */
71   struct md_constant *def;
72 };
73
74 /* This structure represents an enum defined by define_enum or the like.  */
75 struct enum_type {
76   /* The C name of the enumeration.  */
77   char *name;
78
79   /* True if this is an md-style enum (DEFINE_ENUM) rather than
80      a C-style enum (DEFINE_C_ENUM).  */
81   bool md_p;
82
83   /* The values of the enumeration.  There is always at least one.  */
84   struct enum_value *values;
85
86   /* A pointer to the null terminator in VALUES.  */
87   struct enum_value **tail_ptr;
88
89   /* The number of enumeration values.  */
90   unsigned int num_values;
91 };
92
93 /* A callback that handles a single .md-file directive, up to but not
94    including the closing ')'.  It takes two arguments: the file position
95    at which the directive started, and the name of the directive.  The next
96    unread character is the optional space after the directive name.  */
97 typedef void (*directive_handler_t) (file_location, const char *);
98
99 extern const char *in_fname;
100 extern FILE *read_md_file;
101 extern int read_md_lineno;
102 extern const char *read_md_filename;
103 extern struct obstack string_obstack;
104 extern void (*include_callback) (const char *);
105
106 /* Read the next character from the MD file.  */
107
108 static inline int
109 read_char (void)
110 {
111   int ch;
112
113   ch = getc (read_md_file);
114   if (ch == '\n')
115     read_md_lineno++;
116   return ch;
117 }
118
119 /* Put back CH, which was the last character read from the MD file.  */
120
121 static inline void
122 unread_char (int ch)
123 {
124   if (ch == '\n')
125     read_md_lineno--;
126   ungetc (ch, read_md_file);
127 }
128
129 extern hashval_t leading_string_hash (const void *);
130 extern int leading_string_eq_p (const void *, const void *);
131 extern void copy_md_ptr_loc (const void *, const void *);
132 extern void print_md_ptr_loc (const void *);
133 extern void fprint_md_ptr_loc (FILE *, const void *);
134 extern const char *join_c_conditions (const char *, const char *);
135 extern void print_c_condition (const char *);
136 extern void fprint_c_condition (FILE *, const char *);
137 extern void message_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2;
138 extern void error_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2;
139 extern void fatal_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2;
140 extern void fatal_with_file_and_line (const char *, ...)
141   ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
142 extern void fatal_expected_char (int, int) ATTRIBUTE_NORETURN;
143 extern int read_skip_spaces (void);
144 extern void read_name (struct md_name *);
145 extern char *read_quoted_string (void);
146 extern char *read_string (int);
147 extern int n_comma_elts (const char *);
148 extern const char *scan_comma_elt (const char **);
149 extern void upcase_string (char *);
150 extern void traverse_md_constants (htab_trav, void *);
151 extern void traverse_enum_types (htab_trav, void *);
152 extern struct enum_type *lookup_enum_type (const char *);
153 extern bool read_md_files (int, char **, bool (*) (const char *),
154                            directive_handler_t);
155
156 #endif /* GCC_READ_MD_H */