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 const char *cmp_swap(Context *c, YYLTYPE *locp, const char *type); 147c0a41ee6SAnton Johansson 148c0a41ee6SAnton Johansson /** 149c0a41ee6SAnton Johansson * Temporary values creation 150c0a41ee6SAnton Johansson */ 151c0a41ee6SAnton Johansson 152c0a41ee6SAnton Johansson HexValue gen_tmp(Context *c, 153c0a41ee6SAnton Johansson YYLTYPE *locp, 154c0a41ee6SAnton Johansson unsigned bit_width, 155c0a41ee6SAnton Johansson HexSignedness signedness); 156c0a41ee6SAnton Johansson 157c0a41ee6SAnton Johansson HexValue gen_imm_value(Context *c __attribute__((unused)), 158c0a41ee6SAnton Johansson YYLTYPE *locp, 159c0a41ee6SAnton Johansson int value, 160c0a41ee6SAnton Johansson unsigned bit_width, 161c0a41ee6SAnton Johansson HexSignedness signedness); 162c0a41ee6SAnton Johansson 163c0a41ee6SAnton Johansson HexValue gen_imm_qemu_tmp(Context *c, YYLTYPE *locp, unsigned bit_width, 164c0a41ee6SAnton Johansson HexSignedness signedness); 165c0a41ee6SAnton Johansson 166c0a41ee6SAnton Johansson HexValue rvalue_materialize(Context *c, YYLTYPE *locp, HexValue *rvalue); 167c0a41ee6SAnton Johansson 168c0a41ee6SAnton Johansson HexValue gen_rvalue_extend(Context *c, YYLTYPE *locp, HexValue *rvalue); 169c0a41ee6SAnton Johansson 170c0a41ee6SAnton Johansson HexValue gen_rvalue_truncate(Context *c, YYLTYPE *locp, HexValue *rvalue); 171c0a41ee6SAnton Johansson 172c0a41ee6SAnton Johansson void gen_varid_allocate(Context *c, 173c0a41ee6SAnton Johansson YYLTYPE *locp, 174c0a41ee6SAnton Johansson HexValue *varid, 175c0a41ee6SAnton Johansson unsigned bit_width, 176c0a41ee6SAnton Johansson HexSignedness signedness); 177c0a41ee6SAnton Johansson 178c0a41ee6SAnton Johansson /** 179c0a41ee6SAnton Johansson * Code generation functions 180c0a41ee6SAnton Johansson */ 181c0a41ee6SAnton Johansson 182c0a41ee6SAnton Johansson HexValue gen_bin_cmp(Context *c, 183c0a41ee6SAnton Johansson YYLTYPE *locp, 184c0a41ee6SAnton Johansson TCGCond type, 185c0a41ee6SAnton Johansson HexValue *op1, 186c0a41ee6SAnton Johansson HexValue *op2); 187c0a41ee6SAnton Johansson 188c0a41ee6SAnton Johansson HexValue gen_bin_op(Context *c, 189c0a41ee6SAnton Johansson YYLTYPE *locp, 190c0a41ee6SAnton Johansson OpType type, 191c0a41ee6SAnton Johansson HexValue *op1, 192c0a41ee6SAnton Johansson HexValue *op2); 193c0a41ee6SAnton Johansson 194c0a41ee6SAnton Johansson HexValue gen_cast_op(Context *c, 195c0a41ee6SAnton Johansson YYLTYPE *locp, 196c0a41ee6SAnton Johansson HexValue *src, 197c0a41ee6SAnton Johansson unsigned target_width, 198c0a41ee6SAnton Johansson HexSignedness signedness); 199c0a41ee6SAnton Johansson 200c0a41ee6SAnton Johansson /** 201c0a41ee6SAnton Johansson * gen_extend_op extends a region of src_width_ptr bits stored in a 202c0a41ee6SAnton Johansson * value_ptr to the size of dst_width. Note: src_width_ptr is a 203c0a41ee6SAnton Johansson * HexValue * to handle the special case where it is unknown at 204c0a41ee6SAnton Johansson * translation time. 205c0a41ee6SAnton Johansson */ 206c0a41ee6SAnton Johansson HexValue gen_extend_op(Context *c, 207c0a41ee6SAnton Johansson YYLTYPE *locp, 208c0a41ee6SAnton Johansson HexValue *src_width, 209c0a41ee6SAnton Johansson unsigned dst_width, 210c0a41ee6SAnton Johansson HexValue *value, 211c0a41ee6SAnton Johansson HexSignedness signedness); 212c0a41ee6SAnton Johansson 213c0a41ee6SAnton Johansson void gen_rdeposit_op(Context *c, 214c0a41ee6SAnton Johansson YYLTYPE *locp, 215c0a41ee6SAnton Johansson HexValue *dst, 216c0a41ee6SAnton Johansson HexValue *value, 217c0a41ee6SAnton Johansson HexValue *begin, 218c0a41ee6SAnton Johansson HexValue *width); 219c0a41ee6SAnton Johansson 220c0a41ee6SAnton Johansson void gen_deposit_op(Context *c, 221c0a41ee6SAnton Johansson YYLTYPE *locp, 222c0a41ee6SAnton Johansson HexValue *dst, 223c0a41ee6SAnton Johansson HexValue *value, 224c0a41ee6SAnton Johansson HexValue *index, 225c0a41ee6SAnton Johansson HexCast *cast); 226c0a41ee6SAnton Johansson 227c0a41ee6SAnton Johansson HexValue gen_rextract_op(Context *c, 228c0a41ee6SAnton Johansson YYLTYPE *locp, 229c0a41ee6SAnton Johansson HexValue *src, 230c0a41ee6SAnton Johansson unsigned begin, 231c0a41ee6SAnton Johansson unsigned width); 232c0a41ee6SAnton Johansson 233c0a41ee6SAnton Johansson HexValue gen_extract_op(Context *c, 234c0a41ee6SAnton Johansson YYLTYPE *locp, 235c0a41ee6SAnton Johansson HexValue *src, 236c0a41ee6SAnton Johansson HexValue *index, 237c0a41ee6SAnton Johansson HexExtract *extract); 238c0a41ee6SAnton Johansson 239c0a41ee6SAnton Johansson HexValue gen_read_reg(Context *c, YYLTYPE *locp, HexValue *reg); 240c0a41ee6SAnton Johansson 241c0a41ee6SAnton Johansson void gen_write_reg(Context *c, YYLTYPE *locp, HexValue *reg, HexValue *value); 242c0a41ee6SAnton Johansson 243c0a41ee6SAnton Johansson void gen_assign(Context *c, 244c0a41ee6SAnton Johansson YYLTYPE *locp, 245c0a41ee6SAnton Johansson HexValue *dst, 246c0a41ee6SAnton Johansson HexValue *value); 247c0a41ee6SAnton Johansson 248c0a41ee6SAnton Johansson HexValue gen_convround(Context *c, 249c0a41ee6SAnton Johansson YYLTYPE *locp, 250c0a41ee6SAnton Johansson HexValue *src); 251c0a41ee6SAnton Johansson 252c0a41ee6SAnton Johansson HexValue gen_round(Context *c, 253c0a41ee6SAnton Johansson YYLTYPE *locp, 254c0a41ee6SAnton Johansson HexValue *src, 255c0a41ee6SAnton Johansson HexValue *position); 256c0a41ee6SAnton Johansson 257c0a41ee6SAnton Johansson HexValue gen_convround_n(Context *c, 258c0a41ee6SAnton Johansson YYLTYPE *locp, 259c0a41ee6SAnton Johansson HexValue *src, 260c0a41ee6SAnton Johansson HexValue *pos); 261c0a41ee6SAnton Johansson 262c0a41ee6SAnton Johansson /** 263c0a41ee6SAnton Johansson * Circular addressing mode with auto-increment 264c0a41ee6SAnton Johansson */ 265c0a41ee6SAnton Johansson void gen_circ_op(Context *c, 266c0a41ee6SAnton Johansson YYLTYPE *locp, 267c0a41ee6SAnton Johansson HexValue *addr, 268c0a41ee6SAnton Johansson HexValue *increment, 269c0a41ee6SAnton Johansson HexValue *modifier); 270c0a41ee6SAnton Johansson 271c0a41ee6SAnton Johansson HexValue gen_locnt_op(Context *c, YYLTYPE *locp, HexValue *src); 272c0a41ee6SAnton Johansson 273c0a41ee6SAnton Johansson HexValue gen_ctpop_op(Context *c, YYLTYPE *locp, HexValue *src); 274c0a41ee6SAnton Johansson 275c0a41ee6SAnton Johansson HexValue gen_rotl(Context *c, YYLTYPE *locp, HexValue *src, HexValue *n); 276c0a41ee6SAnton Johansson 277c0a41ee6SAnton Johansson HexValue gen_deinterleave(Context *c, YYLTYPE *locp, HexValue *mixed); 278c0a41ee6SAnton Johansson 279c0a41ee6SAnton Johansson HexValue gen_interleave(Context *c, 280c0a41ee6SAnton Johansson YYLTYPE *locp, 281c0a41ee6SAnton Johansson HexValue *odd, 282c0a41ee6SAnton Johansson HexValue *even); 283c0a41ee6SAnton Johansson 284c0a41ee6SAnton Johansson HexValue gen_carry_from_add(Context *c, 285c0a41ee6SAnton Johansson YYLTYPE *locp, 286c0a41ee6SAnton Johansson HexValue *op1, 287c0a41ee6SAnton Johansson HexValue *op2, 288c0a41ee6SAnton Johansson HexValue *op3); 289c0a41ee6SAnton Johansson 290c0a41ee6SAnton Johansson void gen_addsat64(Context *c, 291c0a41ee6SAnton Johansson YYLTYPE *locp, 292c0a41ee6SAnton Johansson HexValue *dst, 293c0a41ee6SAnton Johansson HexValue *op1, 294c0a41ee6SAnton Johansson HexValue *op2); 295c0a41ee6SAnton Johansson 296c0a41ee6SAnton Johansson void gen_inst(Context *c, GString *iname); 297c0a41ee6SAnton Johansson 298c0a41ee6SAnton Johansson void gen_inst_init_args(Context *c, YYLTYPE *locp); 299c0a41ee6SAnton Johansson 300c0a41ee6SAnton Johansson void gen_inst_code(Context *c, YYLTYPE *locp); 301c0a41ee6SAnton Johansson 302c0a41ee6SAnton Johansson void gen_pred_assign(Context *c, YYLTYPE *locp, HexValue *left_pred, 303c0a41ee6SAnton Johansson HexValue *right_pred); 304c0a41ee6SAnton Johansson 305c0a41ee6SAnton Johansson void gen_cancel(Context *c, YYLTYPE *locp); 306c0a41ee6SAnton Johansson 307c0a41ee6SAnton Johansson void gen_load_cancel(Context *c, YYLTYPE *locp); 308c0a41ee6SAnton Johansson 309c0a41ee6SAnton Johansson void gen_load(Context *c, YYLTYPE *locp, HexValue *size, 310c0a41ee6SAnton Johansson HexSignedness signedness, HexValue *ea, HexValue *dst); 311c0a41ee6SAnton Johansson 312c0a41ee6SAnton Johansson void gen_store(Context *c, YYLTYPE *locp, HexValue *size, HexValue *ea, 313c0a41ee6SAnton Johansson HexValue *src); 314c0a41ee6SAnton Johansson 315c0a41ee6SAnton Johansson void gen_sethalf(Context *c, YYLTYPE *locp, HexCast *sh, HexValue *n, 316c0a41ee6SAnton Johansson HexValue *dst, HexValue *value); 317c0a41ee6SAnton Johansson 318c0a41ee6SAnton Johansson void gen_setbits(Context *c, YYLTYPE *locp, HexValue *hi, HexValue *lo, 319c0a41ee6SAnton Johansson HexValue *dst, HexValue *value); 320c0a41ee6SAnton Johansson 321c0a41ee6SAnton Johansson unsigned gen_if_cond(Context *c, YYLTYPE *locp, HexValue *cond); 322c0a41ee6SAnton Johansson 323c0a41ee6SAnton Johansson unsigned gen_if_else(Context *c, YYLTYPE *locp, unsigned index); 324c0a41ee6SAnton Johansson 325c0a41ee6SAnton Johansson HexValue gen_rvalue_pred(Context *c, YYLTYPE *locp, HexValue *pred); 326c0a41ee6SAnton Johansson 327c0a41ee6SAnton Johansson HexValue gen_rvalue_var(Context *c, YYLTYPE *locp, HexValue *var); 328c0a41ee6SAnton Johansson 329c0a41ee6SAnton Johansson HexValue gen_rvalue_mpy(Context *c, YYLTYPE *locp, HexMpy *mpy, HexValue *op1, 330c0a41ee6SAnton Johansson HexValue *op2); 331c0a41ee6SAnton Johansson 332c0a41ee6SAnton Johansson HexValue gen_rvalue_not(Context *c, YYLTYPE *locp, HexValue *value); 333c0a41ee6SAnton Johansson 334c0a41ee6SAnton Johansson HexValue gen_rvalue_notl(Context *c, YYLTYPE *locp, HexValue *value); 335c0a41ee6SAnton Johansson 336c0a41ee6SAnton Johansson HexValue gen_rvalue_sat(Context *c, YYLTYPE *locp, HexSat *sat, HexValue *n, 337c0a41ee6SAnton Johansson HexValue *value); 338c0a41ee6SAnton Johansson 339c0a41ee6SAnton Johansson HexValue gen_rvalue_fscr(Context *c, YYLTYPE *locp, HexValue *value); 340c0a41ee6SAnton Johansson 341c0a41ee6SAnton Johansson HexValue gen_rvalue_abs(Context *c, YYLTYPE *locp, HexValue *value); 342c0a41ee6SAnton Johansson 343c0a41ee6SAnton Johansson HexValue gen_rvalue_neg(Context *c, YYLTYPE *locp, HexValue *value); 344c0a41ee6SAnton Johansson 345c0a41ee6SAnton Johansson HexValue gen_rvalue_brev(Context *c, YYLTYPE *locp, HexValue *value); 346c0a41ee6SAnton Johansson 347c0a41ee6SAnton Johansson HexValue gen_rvalue_ternary(Context *c, YYLTYPE *locp, HexValue *cond, 348c0a41ee6SAnton Johansson HexValue *true_branch, HexValue *false_branch); 349c0a41ee6SAnton Johansson 350c0a41ee6SAnton Johansson const char *cond_to_str(TCGCond cond); 351c0a41ee6SAnton Johansson 352c0a41ee6SAnton Johansson void emit_header(Context *c); 353c0a41ee6SAnton Johansson 354c0a41ee6SAnton Johansson void emit_arg(Context *c, YYLTYPE *locp, HexValue *arg); 355c0a41ee6SAnton Johansson 356c0a41ee6SAnton Johansson void emit_footer(Context *c); 357c0a41ee6SAnton Johansson 358c0a41ee6SAnton Johansson void track_string(Context *c, GString *s); 359c0a41ee6SAnton Johansson 360c0a41ee6SAnton Johansson void free_instruction(Context *c); 361c0a41ee6SAnton Johansson 362c0a41ee6SAnton Johansson void assert_signedness(Context *c, 363c0a41ee6SAnton Johansson YYLTYPE *locp, 364c0a41ee6SAnton Johansson HexSignedness signedness); 365c0a41ee6SAnton Johansson 366c0a41ee6SAnton Johansson #endif /* PARSER_HELPERS_h */ 367