xref: /qemu/target/hexagon/idef-parser/parser-helpers.h (revision 593aab332f048347bd19893071caf44e1fb742ff)
1c0a41ee6SAnton Johansson /*
2c0a41ee6SAnton Johansson  *  Copyright(c) 2019-2022 rev.ng Labs Srl. All Rights Reserved.
3c0a41ee6SAnton Johansson  *
4c0a41ee6SAnton Johansson  *  This program is free software; you can redistribute it and/or modify
5c0a41ee6SAnton Johansson  *  it under the terms of the GNU General Public License as published by
6c0a41ee6SAnton Johansson  *  the Free Software Foundation; either version 2 of the License, or
7c0a41ee6SAnton Johansson  *  (at your option) any later version.
8c0a41ee6SAnton Johansson  *
9c0a41ee6SAnton Johansson  *  This program is distributed in the hope that it will be useful,
10c0a41ee6SAnton Johansson  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11c0a41ee6SAnton Johansson  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12c0a41ee6SAnton Johansson  *  GNU General Public License for more details.
13c0a41ee6SAnton Johansson  *
14c0a41ee6SAnton Johansson  *  You should have received a copy of the GNU General Public License
15c0a41ee6SAnton Johansson  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
16c0a41ee6SAnton Johansson  */
17c0a41ee6SAnton Johansson 
18c0a41ee6SAnton Johansson #ifndef PARSER_HELPERS_H
19c0a41ee6SAnton Johansson #define PARSER_HELPERS_H
20c0a41ee6SAnton Johansson 
21c0a41ee6SAnton Johansson #include <assert.h>
22c0a41ee6SAnton Johansson #include <inttypes.h>
23c0a41ee6SAnton Johansson #include <stdarg.h>
24c0a41ee6SAnton Johansson #include <stdbool.h>
25c0a41ee6SAnton Johansson #include <stdint.h>
26c0a41ee6SAnton Johansson #include <stdio.h>
27c0a41ee6SAnton Johansson #include <stdlib.h>
28c0a41ee6SAnton Johansson #include <string.h>
29c0a41ee6SAnton Johansson #include <unistd.h>
30c0a41ee6SAnton Johansson 
31c0a41ee6SAnton Johansson #include "tcg/tcg-cond.h"
32c0a41ee6SAnton Johansson 
33c0a41ee6SAnton Johansson #include "idef-parser.tab.h"
34c0a41ee6SAnton Johansson #include "idef-parser.yy.h"
35c0a41ee6SAnton Johansson #include "idef-parser.h"
36c0a41ee6SAnton Johansson 
37c0a41ee6SAnton Johansson /* Decomment this to disable yyasserts */
38c0a41ee6SAnton Johansson /* #define NDEBUG */
39c0a41ee6SAnton Johansson 
40c0a41ee6SAnton Johansson #define ERR_LINE_CONTEXT 40
41c0a41ee6SAnton Johansson 
42c0a41ee6SAnton Johansson #define START_COMMENT "/" "*"
43c0a41ee6SAnton Johansson #define END_COMMENT "*" "/"
44c0a41ee6SAnton Johansson 
45c0a41ee6SAnton Johansson void yyerror(YYLTYPE *locp,
46c0a41ee6SAnton Johansson              yyscan_t scanner __attribute__((unused)),
47c0a41ee6SAnton Johansson              Context *c,
48c0a41ee6SAnton Johansson              const char *s);
49c0a41ee6SAnton Johansson 
50c0a41ee6SAnton Johansson #ifndef NDEBUG
51c0a41ee6SAnton Johansson #define yyassert(context, locp, condition, msg)              \
52c0a41ee6SAnton Johansson     if (!(condition)) {                                      \
53c0a41ee6SAnton Johansson         yyerror(locp, (context)->scanner, (context), (msg)); \
54c0a41ee6SAnton Johansson     }
55c0a41ee6SAnton Johansson #endif
56c0a41ee6SAnton Johansson 
57c0a41ee6SAnton Johansson bool is_direct_predicate(HexValue *value);
58c0a41ee6SAnton Johansson 
59c0a41ee6SAnton Johansson bool is_inside_ternary(Context *c);
60c0a41ee6SAnton Johansson 
61c0a41ee6SAnton Johansson /**
62c0a41ee6SAnton Johansson  * Print functions
63c0a41ee6SAnton Johansson  */
64c0a41ee6SAnton Johansson 
65c0a41ee6SAnton Johansson void str_print(Context *c, YYLTYPE *locp, const char *string);
66c0a41ee6SAnton Johansson 
67c0a41ee6SAnton Johansson void uint8_print(Context *c, YYLTYPE *locp, uint8_t *num);
68c0a41ee6SAnton Johansson 
69c0a41ee6SAnton Johansson void uint64_print(Context *c, YYLTYPE *locp, uint64_t *num);
70c0a41ee6SAnton Johansson 
71c0a41ee6SAnton Johansson void int_print(Context *c, YYLTYPE *locp, int *num);
72c0a41ee6SAnton Johansson 
73c0a41ee6SAnton Johansson void uint_print(Context *c, YYLTYPE *locp, unsigned *num);
74c0a41ee6SAnton Johansson 
75c0a41ee6SAnton Johansson void tmp_print(Context *c, YYLTYPE *locp, HexTmp *tmp);
76c0a41ee6SAnton Johansson 
77c0a41ee6SAnton Johansson void pred_print(Context *c, YYLTYPE *locp, HexPred *pred, bool is_dotnew);
78c0a41ee6SAnton Johansson 
79c0a41ee6SAnton Johansson void reg_compose(Context *c, YYLTYPE *locp, HexReg *reg, char reg_id[5]);
80c0a41ee6SAnton Johansson 
81c0a41ee6SAnton Johansson void reg_print(Context *c, YYLTYPE *locp, HexReg *reg);
82c0a41ee6SAnton Johansson 
83*163e5fa3STaylor Simpson void imm_print(Context *c, YYLTYPE *locp, HexValue *rvalue);
84c0a41ee6SAnton Johansson 
85c0a41ee6SAnton Johansson void var_print(Context *c, YYLTYPE *locp, HexVar *var);
86c0a41ee6SAnton Johansson 
87c0a41ee6SAnton Johansson void rvalue_print(Context *c, YYLTYPE *locp, void *pointer);
88c0a41ee6SAnton Johansson 
89c0a41ee6SAnton Johansson void out_assert(Context *c, YYLTYPE *locp, void *dummy);
90c0a41ee6SAnton Johansson 
91c0a41ee6SAnton Johansson /**
92c0a41ee6SAnton Johansson  * Copies output code buffer into stdout
93c0a41ee6SAnton Johansson  */
94c0a41ee6SAnton Johansson void commit(Context *c);
95c0a41ee6SAnton Johansson 
96c0a41ee6SAnton Johansson #define OUT_IMPL(c, locp, x)                    \
97c0a41ee6SAnton Johansson     _Generic(*(x),                              \
98c0a41ee6SAnton Johansson         char:      str_print,                   \
99c0a41ee6SAnton Johansson         uint8_t:   uint8_print,                 \
100c0a41ee6SAnton Johansson         uint64_t:  uint64_print,                \
101c0a41ee6SAnton Johansson         int:       int_print,                   \
102c0a41ee6SAnton Johansson         unsigned:  uint_print,                  \
103c0a41ee6SAnton Johansson         HexValue:  rvalue_print,                \
104c0a41ee6SAnton Johansson         default:   out_assert                   \
105c0a41ee6SAnton Johansson     )(c, locp, x);
106c0a41ee6SAnton Johansson 
107c0a41ee6SAnton Johansson /* FOREACH macro */
108c0a41ee6SAnton Johansson #define FE_1(c, locp, WHAT, X) WHAT(c, locp, X)
109c0a41ee6SAnton Johansson #define FE_2(c, locp, WHAT, X, ...) \
110c0a41ee6SAnton Johansson     WHAT(c, locp, X)FE_1(c, locp, WHAT, __VA_ARGS__)
111c0a41ee6SAnton Johansson #define FE_3(c, locp, WHAT, X, ...) \
112c0a41ee6SAnton Johansson     WHAT(c, locp, X)FE_2(c, locp, WHAT, __VA_ARGS__)
113c0a41ee6SAnton Johansson #define FE_4(c, locp, WHAT, X, ...) \
114c0a41ee6SAnton Johansson     WHAT(c, locp, X)FE_3(c, locp, WHAT, __VA_ARGS__)
115c0a41ee6SAnton Johansson #define FE_5(c, locp, WHAT, X, ...) \
116c0a41ee6SAnton Johansson     WHAT(c, locp, X)FE_4(c, locp, WHAT, __VA_ARGS__)
117c0a41ee6SAnton Johansson #define FE_6(c, locp, WHAT, X, ...) \
118c0a41ee6SAnton Johansson     WHAT(c, locp, X)FE_5(c, locp, WHAT, __VA_ARGS__)
119c0a41ee6SAnton Johansson #define FE_7(c, locp, WHAT, X, ...) \
120c0a41ee6SAnton Johansson     WHAT(c, locp, X)FE_6(c, locp, WHAT, __VA_ARGS__)
121c0a41ee6SAnton Johansson #define FE_8(c, locp, WHAT, X, ...) \
122c0a41ee6SAnton Johansson     WHAT(c, locp, X)FE_7(c, locp, WHAT, __VA_ARGS__)
123c0a41ee6SAnton Johansson #define FE_9(c, locp, WHAT, X, ...) \
124c0a41ee6SAnton Johansson     WHAT(c, locp, X)FE_8(c, locp, WHAT, __VA_ARGS__)
125c0a41ee6SAnton Johansson /* repeat as needed */
126c0a41ee6SAnton Johansson 
127c0a41ee6SAnton Johansson #define GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, NAME, ...) NAME
128c0a41ee6SAnton Johansson 
129c0a41ee6SAnton Johansson #define FOR_EACH(c, locp, action, ...)          \
130c0a41ee6SAnton Johansson   do {                                          \
131c0a41ee6SAnton Johansson     GET_MACRO(__VA_ARGS__,                      \
132c0a41ee6SAnton Johansson               FE_9,                             \
133c0a41ee6SAnton Johansson               FE_8,                             \
134c0a41ee6SAnton Johansson               FE_7,                             \
135c0a41ee6SAnton Johansson               FE_6,                             \
136c0a41ee6SAnton Johansson               FE_5,                             \
137c0a41ee6SAnton Johansson               FE_4,                             \
138c0a41ee6SAnton Johansson               FE_3,                             \
139c0a41ee6SAnton Johansson               FE_2,                             \
140c0a41ee6SAnton Johansson               FE_1)(c, locp, action,            \
141c0a41ee6SAnton Johansson                     __VA_ARGS__)                \
142c0a41ee6SAnton Johansson   } while (0)
143c0a41ee6SAnton Johansson 
144c0a41ee6SAnton Johansson #define OUT(c, locp, ...) FOR_EACH((c), (locp), OUT_IMPL, __VA_ARGS__)
145c0a41ee6SAnton Johansson 
146c0a41ee6SAnton Johansson /**
147c0a41ee6SAnton Johansson  * Temporary values creation
148c0a41ee6SAnton Johansson  */
149c0a41ee6SAnton Johansson 
150c0a41ee6SAnton Johansson HexValue gen_tmp(Context *c,
151c0a41ee6SAnton Johansson                  YYLTYPE *locp,
152c0a41ee6SAnton Johansson                  unsigned bit_width,
153c0a41ee6SAnton Johansson                  HexSignedness signedness);
154c0a41ee6SAnton Johansson 
155c0a41ee6SAnton Johansson HexValue gen_imm_value(Context *c __attribute__((unused)),
156c0a41ee6SAnton Johansson                        YYLTYPE *locp,
157c0a41ee6SAnton Johansson                        int value,
158c0a41ee6SAnton Johansson                        unsigned bit_width,
159c0a41ee6SAnton Johansson                        HexSignedness signedness);
160c0a41ee6SAnton Johansson 
161c0a41ee6SAnton Johansson HexValue gen_imm_qemu_tmp(Context *c, YYLTYPE *locp, unsigned bit_width,
162c0a41ee6SAnton Johansson                           HexSignedness signedness);
163c0a41ee6SAnton Johansson 
164c0a41ee6SAnton Johansson HexValue rvalue_materialize(Context *c, YYLTYPE *locp, HexValue *rvalue);
165c0a41ee6SAnton Johansson 
166c0a41ee6SAnton Johansson HexValue gen_rvalue_extend(Context *c, YYLTYPE *locp, HexValue *rvalue);
167c0a41ee6SAnton Johansson 
168c0a41ee6SAnton Johansson HexValue gen_rvalue_truncate(Context *c, YYLTYPE *locp, HexValue *rvalue);
169c0a41ee6SAnton Johansson 
170c0a41ee6SAnton Johansson void gen_varid_allocate(Context *c,
171c0a41ee6SAnton Johansson                         YYLTYPE *locp,
172c0a41ee6SAnton Johansson                         HexValue *varid,
173c0a41ee6SAnton Johansson                         unsigned bit_width,
174c0a41ee6SAnton Johansson                         HexSignedness signedness);
175c0a41ee6SAnton Johansson 
176c0a41ee6SAnton Johansson /**
177c0a41ee6SAnton Johansson  * Code generation functions
178c0a41ee6SAnton Johansson  */
179c0a41ee6SAnton Johansson 
180c0a41ee6SAnton Johansson HexValue gen_bin_cmp(Context *c,
181c0a41ee6SAnton Johansson                      YYLTYPE *locp,
182c0a41ee6SAnton Johansson                      TCGCond type,
183c0a41ee6SAnton Johansson                      HexValue *op1,
184c0a41ee6SAnton Johansson                      HexValue *op2);
185c0a41ee6SAnton Johansson 
186c0a41ee6SAnton Johansson HexValue gen_bin_op(Context *c,
187c0a41ee6SAnton Johansson                     YYLTYPE *locp,
188c0a41ee6SAnton Johansson                     OpType type,
189c0a41ee6SAnton Johansson                     HexValue *op1,
190c0a41ee6SAnton Johansson                     HexValue *op2);
191c0a41ee6SAnton Johansson 
192c0a41ee6SAnton Johansson HexValue gen_cast_op(Context *c,
193c0a41ee6SAnton Johansson                      YYLTYPE *locp,
194c0a41ee6SAnton Johansson                      HexValue *src,
195c0a41ee6SAnton Johansson                      unsigned target_width,
196c0a41ee6SAnton Johansson                      HexSignedness signedness);
197c0a41ee6SAnton Johansson 
198c0a41ee6SAnton Johansson /**
199c0a41ee6SAnton Johansson  * gen_extend_op extends a region of src_width_ptr bits stored in a
200c0a41ee6SAnton Johansson  * value_ptr to the size of dst_width. Note: src_width_ptr is a
201c0a41ee6SAnton Johansson  * HexValue * to handle the special case where it is unknown at
202c0a41ee6SAnton Johansson  * translation time.
203c0a41ee6SAnton Johansson  */
204c0a41ee6SAnton Johansson HexValue gen_extend_op(Context *c,
205c0a41ee6SAnton Johansson                        YYLTYPE *locp,
206c0a41ee6SAnton Johansson                        HexValue *src_width,
207c0a41ee6SAnton Johansson                        unsigned dst_width,
208c0a41ee6SAnton Johansson                        HexValue *value,
209c0a41ee6SAnton Johansson                        HexSignedness signedness);
210c0a41ee6SAnton Johansson 
211c0a41ee6SAnton Johansson void gen_rdeposit_op(Context *c,
212c0a41ee6SAnton Johansson                      YYLTYPE *locp,
213c0a41ee6SAnton Johansson                      HexValue *dst,
214c0a41ee6SAnton Johansson                      HexValue *value,
215c0a41ee6SAnton Johansson                      HexValue *begin,
216c0a41ee6SAnton Johansson                      HexValue *width);
217c0a41ee6SAnton Johansson 
218c0a41ee6SAnton Johansson void gen_deposit_op(Context *c,
219c0a41ee6SAnton Johansson                     YYLTYPE *locp,
220c0a41ee6SAnton Johansson                     HexValue *dst,
221c0a41ee6SAnton Johansson                     HexValue *value,
222c0a41ee6SAnton Johansson                     HexValue *index,
223c0a41ee6SAnton Johansson                     HexCast *cast);
224c0a41ee6SAnton Johansson 
225c0a41ee6SAnton Johansson HexValue gen_rextract_op(Context *c,
226c0a41ee6SAnton Johansson                          YYLTYPE *locp,
227c0a41ee6SAnton Johansson                          HexValue *src,
228c0a41ee6SAnton Johansson                          unsigned begin,
229c0a41ee6SAnton Johansson                          unsigned width);
230c0a41ee6SAnton Johansson 
231c0a41ee6SAnton Johansson HexValue gen_extract_op(Context *c,
232c0a41ee6SAnton Johansson                         YYLTYPE *locp,
233c0a41ee6SAnton Johansson                         HexValue *src,
234c0a41ee6SAnton Johansson                         HexValue *index,
235c0a41ee6SAnton Johansson                         HexExtract *extract);
236c0a41ee6SAnton Johansson 
237c0a41ee6SAnton Johansson void gen_write_reg(Context *c, YYLTYPE *locp, HexValue *reg, HexValue *value);
238c0a41ee6SAnton Johansson 
239c0a41ee6SAnton Johansson void gen_assign(Context *c,
240c0a41ee6SAnton Johansson                 YYLTYPE *locp,
241c0a41ee6SAnton Johansson                 HexValue *dst,
242c0a41ee6SAnton Johansson                 HexValue *value);
243c0a41ee6SAnton Johansson 
244c0a41ee6SAnton Johansson HexValue gen_convround(Context *c,
245c0a41ee6SAnton Johansson                        YYLTYPE *locp,
246c0a41ee6SAnton Johansson                        HexValue *src);
247c0a41ee6SAnton Johansson 
248c0a41ee6SAnton Johansson HexValue gen_round(Context *c,
249c0a41ee6SAnton Johansson                    YYLTYPE *locp,
250c0a41ee6SAnton Johansson                    HexValue *src,
251c0a41ee6SAnton Johansson                    HexValue *position);
252c0a41ee6SAnton Johansson 
253c0a41ee6SAnton Johansson HexValue gen_convround_n(Context *c,
254c0a41ee6SAnton Johansson                          YYLTYPE *locp,
255c0a41ee6SAnton Johansson                          HexValue *src,
256c0a41ee6SAnton Johansson                          HexValue *pos);
257c0a41ee6SAnton Johansson 
258c0a41ee6SAnton Johansson /**
259c0a41ee6SAnton Johansson  * Circular addressing mode with auto-increment
260c0a41ee6SAnton Johansson  */
261c0a41ee6SAnton Johansson void gen_circ_op(Context *c,
262c0a41ee6SAnton Johansson                  YYLTYPE *locp,
263c0a41ee6SAnton Johansson                  HexValue *addr,
264c0a41ee6SAnton Johansson                  HexValue *increment,
265c0a41ee6SAnton Johansson                  HexValue *modifier);
266c0a41ee6SAnton Johansson 
267c0a41ee6SAnton Johansson HexValue gen_locnt_op(Context *c, YYLTYPE *locp, HexValue *src);
268c0a41ee6SAnton Johansson 
269c0a41ee6SAnton Johansson HexValue gen_ctpop_op(Context *c, YYLTYPE *locp, HexValue *src);
270c0a41ee6SAnton Johansson 
271c0a41ee6SAnton Johansson HexValue gen_rotl(Context *c, YYLTYPE *locp, HexValue *src, HexValue *n);
272c0a41ee6SAnton Johansson 
273c0a41ee6SAnton Johansson HexValue gen_carry_from_add(Context *c,
274c0a41ee6SAnton Johansson                             YYLTYPE *locp,
275c0a41ee6SAnton Johansson                             HexValue *op1,
276c0a41ee6SAnton Johansson                             HexValue *op2,
277c0a41ee6SAnton Johansson                             HexValue *op3);
278c0a41ee6SAnton Johansson 
279c0a41ee6SAnton Johansson void gen_addsat64(Context *c,
280c0a41ee6SAnton Johansson                   YYLTYPE *locp,
281c0a41ee6SAnton Johansson                   HexValue *dst,
282c0a41ee6SAnton Johansson                   HexValue *op1,
283c0a41ee6SAnton Johansson                   HexValue *op2);
284c0a41ee6SAnton Johansson 
285c0a41ee6SAnton Johansson void gen_inst(Context *c, GString *iname);
286c0a41ee6SAnton Johansson 
287c0a41ee6SAnton Johansson void gen_inst_init_args(Context *c, YYLTYPE *locp);
288c0a41ee6SAnton Johansson 
289c0a41ee6SAnton Johansson void gen_inst_code(Context *c, YYLTYPE *locp);
290c0a41ee6SAnton Johansson 
291c0a41ee6SAnton Johansson void gen_pred_assign(Context *c, YYLTYPE *locp, HexValue *left_pred,
292c0a41ee6SAnton Johansson                      HexValue *right_pred);
293c0a41ee6SAnton Johansson 
294c0a41ee6SAnton Johansson void gen_cancel(Context *c, YYLTYPE *locp);
295c0a41ee6SAnton Johansson 
296c0a41ee6SAnton Johansson void gen_load_cancel(Context *c, YYLTYPE *locp);
297c0a41ee6SAnton Johansson 
298c0a41ee6SAnton Johansson void gen_load(Context *c, YYLTYPE *locp, HexValue *size,
299c0a41ee6SAnton Johansson               HexSignedness signedness, HexValue *ea, HexValue *dst);
300c0a41ee6SAnton Johansson 
301c0a41ee6SAnton Johansson void gen_store(Context *c, YYLTYPE *locp, HexValue *size, HexValue *ea,
302c0a41ee6SAnton Johansson                HexValue *src);
303c0a41ee6SAnton Johansson 
304c0a41ee6SAnton Johansson void gen_sethalf(Context *c, YYLTYPE *locp, HexCast *sh, HexValue *n,
305c0a41ee6SAnton Johansson                  HexValue *dst, HexValue *value);
306c0a41ee6SAnton Johansson 
307c0a41ee6SAnton Johansson void gen_setbits(Context *c, YYLTYPE *locp, HexValue *hi, HexValue *lo,
308c0a41ee6SAnton Johansson                  HexValue *dst, HexValue *value);
309c0a41ee6SAnton Johansson 
310c0a41ee6SAnton Johansson unsigned gen_if_cond(Context *c, YYLTYPE *locp, HexValue *cond);
311c0a41ee6SAnton Johansson 
312c0a41ee6SAnton Johansson unsigned gen_if_else(Context *c, YYLTYPE *locp, unsigned index);
313c0a41ee6SAnton Johansson 
314c0a41ee6SAnton Johansson HexValue gen_rvalue_pred(Context *c, YYLTYPE *locp, HexValue *pred);
315c0a41ee6SAnton Johansson 
316c0a41ee6SAnton Johansson HexValue gen_rvalue_var(Context *c, YYLTYPE *locp, HexValue *var);
317c0a41ee6SAnton Johansson 
318c0a41ee6SAnton Johansson HexValue gen_rvalue_mpy(Context *c, YYLTYPE *locp, HexMpy *mpy, HexValue *op1,
319c0a41ee6SAnton Johansson                         HexValue *op2);
320c0a41ee6SAnton Johansson 
321c0a41ee6SAnton Johansson HexValue gen_rvalue_not(Context *c, YYLTYPE *locp, HexValue *value);
322c0a41ee6SAnton Johansson 
323c0a41ee6SAnton Johansson HexValue gen_rvalue_notl(Context *c, YYLTYPE *locp, HexValue *value);
324c0a41ee6SAnton Johansson 
325c0a41ee6SAnton Johansson HexValue gen_rvalue_sat(Context *c, YYLTYPE *locp, HexSat *sat, HexValue *n,
326c0a41ee6SAnton Johansson                         HexValue *value);
327c0a41ee6SAnton Johansson 
328c0a41ee6SAnton Johansson HexValue gen_rvalue_fscr(Context *c, YYLTYPE *locp, HexValue *value);
329c0a41ee6SAnton Johansson 
330c0a41ee6SAnton Johansson HexValue gen_rvalue_abs(Context *c, YYLTYPE *locp, HexValue *value);
331c0a41ee6SAnton Johansson 
332c0a41ee6SAnton Johansson HexValue gen_rvalue_neg(Context *c, YYLTYPE *locp, HexValue *value);
333c0a41ee6SAnton Johansson 
334c0a41ee6SAnton Johansson HexValue gen_rvalue_brev(Context *c, YYLTYPE *locp, HexValue *value);
335c0a41ee6SAnton Johansson 
336c0a41ee6SAnton Johansson HexValue gen_rvalue_ternary(Context *c, YYLTYPE *locp, HexValue *cond,
337c0a41ee6SAnton Johansson                             HexValue *true_branch, HexValue *false_branch);
338c0a41ee6SAnton Johansson 
339c0a41ee6SAnton Johansson const char *cond_to_str(TCGCond cond);
340c0a41ee6SAnton Johansson 
341c0a41ee6SAnton Johansson void emit_arg(Context *c, YYLTYPE *locp, HexValue *arg);
342c0a41ee6SAnton Johansson 
343c0a41ee6SAnton Johansson void emit_footer(Context *c);
344c0a41ee6SAnton Johansson 
345c0a41ee6SAnton Johansson void track_string(Context *c, GString *s);
346c0a41ee6SAnton Johansson 
347c0a41ee6SAnton Johansson void free_instruction(Context *c);
348c0a41ee6SAnton Johansson 
349c0a41ee6SAnton Johansson void assert_signedness(Context *c,
350c0a41ee6SAnton Johansson                        YYLTYPE *locp,
351c0a41ee6SAnton Johansson                        HexSignedness signedness);
352c0a41ee6SAnton Johansson 
353c0a41ee6SAnton Johansson #endif /* PARSER_HELPERS_h */
354