FFmpeg
rasm_print.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2026 Ramiro Polla
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <stdarg.h>
22 
23 #include "libavutil/mem.h"
24 
25 #include "rasm.h"
26 
27 /**
28  * Static file backend for the runtime assembler. Emits GNU assembler
29  * text targeted to AArch64.
30  */
31 
32 /*********************************************************************/
33 /* Values from tools/indent_arm_assembly.pl */
34 
35 #define INSTR_INDENT 8
36 #define COMMENT_COL 56
37 
39 static int pos_fprintf(FILE *fp, int64_t *pos, const char *fmt, ...)
40 {
41  int ret;
42  va_list args;
43  va_start(args, fmt);
44  ret = vfprintf(fp, fmt, args);
45  va_end(args);
46  if (ret >= 0)
47  *pos += ret;
48  return ret;
49 }
50 
51 static void indent_to(FILE *fp, int64_t *pos, int64_t line_start, int col)
52 {
53  int cur_col = *pos - line_start;
54  pos_fprintf(fp, pos, "%*s", FFMAX(col - cur_col, 1), "");
55 }
56 
57 /*********************************************************************/
58 /* RASM_OP_IMM */
59 
60 static void print_op_imm(FILE *fp, int64_t *pos, RasmOp op)
61 {
62  pos_fprintf(fp, pos, "#%d", rasm_op_imm_val(op));
63 }
64 
65 /*********************************************************************/
66 /* RASM_OP_LABEL */
67 
68 static void print_op_label(const RasmContext *rctx,
69  FILE *fp, int64_t *pos,
70  RasmOp op, const int *local_labels)
71 {
72  int id = rasm_op_label_id(op);
73  av_assert0(id >= 0 && id < rctx->num_labels);
74  if (rctx->labels[id]) {
75  pos_fprintf(fp, pos, "%s", rctx->labels[id]);
76  } else {
77  int local_id = local_labels[id];
78  if (local_id < 0) {
79  pos_fprintf(fp, pos, "%db", -local_id);
80  } else {
81  pos_fprintf(fp, pos, "%df", local_id);
82  }
83  }
84 }
85 
86 /*********************************************************************/
87 /* AARCH64_OP_GPR */
88 
89 static void print_op_gpr(FILE *fp, int64_t *pos, RasmOp op)
90 {
91  uint8_t n = a64op_gpr_n(op);
92  uint8_t size = a64op_gpr_size(op);
93 
94  if (n == 31) {
95  pos_fprintf(fp, pos, "%s", size == sizeof(uint32_t) ? "wsp" : "sp");
96  return;
97  }
98 
99  switch (size) {
100  case sizeof(uint32_t): pos_fprintf(fp, pos, "w%d", n); break;
101  case sizeof(uint64_t): pos_fprintf(fp, pos, "x%d", n); break;
102  default:
103  av_assert0(!"Invalid GPR size!");
104  }
105 }
106 
107 /*********************************************************************/
108 /* AARCH64_OP_VEC */
109 
110 static char elem_type_char(uint8_t elem_size)
111 {
112  switch (elem_size) {
113  case 1: return 'b';
114  case 2: return 'h';
115  case 4: return 's';
116  case 8: return 'd';
117  case 16: return 'q';
118  }
119  av_assert0(!"Invalid vector element type!");
120  return '\0';
121 }
122 
123 static void print_vec_reg(FILE *fp, int64_t *pos,
124  uint8_t n, uint8_t el_count, uint8_t el_size, uint8_t idx_p1)
125 {
126  if (el_size == 0) {
127  pos_fprintf(fp, pos, "v%u", n);
128  } else if (el_count != 0) {
129  pos_fprintf(fp, pos, "v%u.%d%c", n, el_count, elem_type_char(el_size));
130  } else if (idx_p1) {
131  pos_fprintf(fp, pos, "v%u.%c[%u]", n, elem_type_char(el_size), idx_p1 - 1);
132  } else {
133  pos_fprintf(fp, pos, "%c%u", elem_type_char(el_size), n);
134  }
135 }
136 
137 static void print_op_vec(FILE *fp, int64_t *pos, RasmOp op)
138 {
139  uint8_t n = a64op_vec_n(op);
140  uint8_t el_count = a64op_vec_el_count(op);
141  uint8_t el_size = a64op_vec_el_size(op);
142  uint8_t num_regs = a64op_vec_num_regs(op);
143 
144  if (num_regs) {
145  pos_fprintf(fp, pos, "{");
146  for (int i = 0; i < num_regs; i++) {
147  if (i > 0)
148  pos_fprintf(fp, pos, ", ");
149  print_vec_reg(fp, pos, (n + i) & 0x1f, el_count, el_size, 0);
150  }
151  pos_fprintf(fp, pos, "}");
152  } else {
153  uint8_t idx_p1 = a64op_vec_idx_p1(op);
154  print_vec_reg(fp, pos, n, el_count, el_size, idx_p1);
155  }
156 }
157 
158 /*********************************************************************/
159 /* AARCH64_OP_BASE */
160 
161 static void print_base_reg(FILE *fp, int64_t *pos, uint8_t n)
162 {
163  if (n == 31)
164  pos_fprintf(fp, pos, "sp");
165  else
166  pos_fprintf(fp, pos, "x%d", n);
167 }
168 
169 static void print_op_base(FILE *fp, int64_t *pos, RasmOp op)
170 {
171  uint8_t n = a64op_base_n(op);
172  uint8_t mode = a64op_base_mode(op);
173  int16_t imm = a64op_base_imm(op);
174 
175  switch (mode) {
176  case AARCH64_BASE_OFFSET: {
177  pos_fprintf(fp, pos, "[");
178  print_base_reg(fp, pos, n);
179  if (imm)
180  pos_fprintf(fp, pos, ", #%d]", imm);
181  else
182  pos_fprintf(fp, pos, "]");
183  break;
184  }
185  case AARCH64_BASE_PRE:
186  pos_fprintf(fp, pos, "[");
187  print_base_reg(fp, pos, n);
188  pos_fprintf(fp, pos, ", #%d]!", imm);
189  break;
190  case AARCH64_BASE_POST:
191  pos_fprintf(fp, pos, "[");
192  print_base_reg(fp, pos, n);
193  pos_fprintf(fp, pos, "], #%d", imm);
194  break;
195  }
196 }
197 
198 /*********************************************************************/
199 /* AARCH64_OP_COND */
200 
201 static const char cond_names[16][4] = {
202  [AARCH64_COND_EQ] = "eq",
203  [AARCH64_COND_NE] = "ne",
204  [AARCH64_COND_HS] = "hs",
205  [AARCH64_COND_LO] = "lo",
206  [AARCH64_COND_MI] = "mi",
207  [AARCH64_COND_PL] = "pl",
208  [AARCH64_COND_VS] = "vs",
209  [AARCH64_COND_VC] = "vc",
210  [AARCH64_COND_HI] = "hi",
211  [AARCH64_COND_LS] = "ls",
212  [AARCH64_COND_GE] = "ge",
213  [AARCH64_COND_LT] = "lt",
214  [AARCH64_COND_GT] = "gt",
215  [AARCH64_COND_LE] = "le",
216  [AARCH64_COND_AL] = "al",
217  [AARCH64_COND_NV] = "nv",
218 };
219 
220 static const char *cond_name(uint8_t cond)
221 {
222  if (cond >= 16) {
223  av_assert0(!"Invalid cond type!");
224  return NULL;
225  }
226  return cond_names[cond];
227 }
228 
229 static void print_op_cond(FILE *fp, int64_t *pos, RasmOp op)
230 {
231  pos_fprintf(fp, pos, "%s", cond_name(a64op_cond_val(op)));
232 }
233 
234 /*********************************************************************/
235 /* Instruction operands */
236 
237 static void print_op(const RasmContext *rctx,
238  FILE *fp, int64_t *pos,
239  const int *local_labels, RasmOp op)
240 {
241  switch (rasm_op_type(op)) {
242  case RASM_OP_IMM:
243  print_op_imm(fp, pos, op);
244  break;
245  case RASM_OP_LABEL:
246  print_op_label(rctx, fp, pos, op, local_labels);
247  break;
248  case AARCH64_OP_GPR:
249  print_op_gpr(fp, pos, op);
250  break;
251  case AARCH64_OP_VEC:
252  print_op_vec(fp, pos, op);
253  break;
254  case AARCH64_OP_BASE:
255  print_op_base(fp, pos, op);
256  break;
257  case AARCH64_OP_COND:
258  print_op_cond(fp, pos, op);
259  break;
260  default:
261  av_assert0(0);
262  }
263 }
264 
265 /*********************************************************************/
266 /* RASM_NODE_INSN */
267 
268 static const char insn_names[AARCH64_INSN_NB][8] = {
269  [AARCH64_INSN_ADD ] = "add",
270  [AARCH64_INSN_ADDV ] = "addv",
271  [AARCH64_INSN_ADR ] = "adr",
272  [AARCH64_INSN_AND ] = "and",
273  [AARCH64_INSN_B ] = "b",
274  [AARCH64_INSN_BR ] = "br",
275  [AARCH64_INSN_CMP ] = "cmp",
276  [AARCH64_INSN_CSEL ] = "csel",
277  [AARCH64_INSN_DUP ] = "dup",
278  [AARCH64_INSN_FADD ] = "fadd",
279  [AARCH64_INSN_FCVTZU] = "fcvtzu",
280  [AARCH64_INSN_FMAX ] = "fmax",
281  [AARCH64_INSN_FMIN ] = "fmin",
282  [AARCH64_INSN_FMLA ] = "fmla",
283  [AARCH64_INSN_FMUL ] = "fmul",
284  [AARCH64_INSN_INS ] = "ins",
285  [AARCH64_INSN_LD1 ] = "ld1",
286  [AARCH64_INSN_LD1R ] = "ld1r",
287  [AARCH64_INSN_LD2 ] = "ld2",
288  [AARCH64_INSN_LD3 ] = "ld3",
289  [AARCH64_INSN_LD4 ] = "ld4",
290  [AARCH64_INSN_LDP ] = "ldp",
291  [AARCH64_INSN_LDR ] = "ldr",
292  [AARCH64_INSN_LDRB ] = "ldrb",
293  [AARCH64_INSN_LDRH ] = "ldrh",
294  [AARCH64_INSN_LSR ] = "lsr",
295  [AARCH64_INSN_MOV ] = "mov",
296  [AARCH64_INSN_MOVI ] = "movi",
297  [AARCH64_INSN_MUL ] = "mul",
298  [AARCH64_INSN_ORR ] = "orr",
299  [AARCH64_INSN_RET ] = "ret",
300  [AARCH64_INSN_REV16 ] = "rev16",
301  [AARCH64_INSN_REV32 ] = "rev32",
302  [AARCH64_INSN_SHL ] = "shl",
303  [AARCH64_INSN_ST1 ] = "st1",
304  [AARCH64_INSN_ST2 ] = "st2",
305  [AARCH64_INSN_ST3 ] = "st3",
306  [AARCH64_INSN_ST4 ] = "st4",
307  [AARCH64_INSN_STP ] = "stp",
308  [AARCH64_INSN_STR ] = "str",
309  [AARCH64_INSN_SUB ] = "sub",
310  [AARCH64_INSN_SUBS ] = "subs",
311  [AARCH64_INSN_TBL ] = "tbl",
312  [AARCH64_INSN_UBFIZ ] = "ubfiz",
313  [AARCH64_INSN_UCVTF ] = "ucvtf",
314  [AARCH64_INSN_UMAX ] = "umax",
315  [AARCH64_INSN_UMIN ] = "umin",
316  [AARCH64_INSN_UQXTN ] = "uqxtn",
317  [AARCH64_INSN_USHL ] = "ushl",
318  [AARCH64_INSN_USHLL ] = "ushll",
319  [AARCH64_INSN_USHLL2] = "ushll2",
320  [AARCH64_INSN_USHR ] = "ushr",
321  [AARCH64_INSN_UXTL ] = "uxtl",
322  [AARCH64_INSN_UXTL2 ] = "uxtl2",
323  [AARCH64_INSN_XTN ] = "xtn",
324  [AARCH64_INSN_ZIP1 ] = "zip1",
325  [AARCH64_INSN_ZIP2 ] = "zip2",
326 };
327 
328 static const char *insn_name(int id)
329 {
330  if (id == AARCH64_INSN_NONE || id >= AARCH64_INSN_NB) {
331  av_assert0(!"Invalid insn type!");
332  return NULL;
333  }
334  return insn_names[id];
335 }
336 
337 static void print_node_insn(const RasmContext *rctx,
338  FILE *fp, int64_t *pos, int64_t line_start,
339  const RasmNode *node,
340  const int *local_labels)
341 {
342  indent_to(fp, pos, line_start, INSTR_INDENT);
343 
344  int op_start = 0;
345  if (node->insn.id == AARCH64_INSN_B && rasm_op_type(node->insn.op[0]) == AARCH64_OP_COND) {
346  pos_fprintf(fp, pos, "b.%-14s", cond_name(a64op_cond_val(node->insn.op[0])));
347  op_start = 1;
348  } else if (rasm_op_type(node->insn.op[0]) == RASM_OP_NONE) {
349  pos_fprintf(fp, pos, "%s", insn_name(node->insn.id));
350  } else {
351  pos_fprintf(fp, pos, "%-16s", insn_name(node->insn.id));
352  }
353 
354  for (int j = op_start; j < 4; j++) {
355  RasmOp op = node->insn.op[j];
356  if (rasm_op_type(op) == RASM_OP_NONE)
357  break;
358  if (j != op_start)
359  pos_fprintf(fp, pos, ", ");
360  print_op(rctx, fp, pos, local_labels, op);
361  }
362 }
363 
364 /*********************************************************************/
365 /* RASM_NODE_COMMENT */
366 
367 static void print_node_comment(const RasmContext *rctx,
368  FILE *fp, int64_t *pos, int64_t line_start,
369  const RasmNode *node)
370 {
371  indent_to(fp, pos, line_start, INSTR_INDENT);
372  pos_fprintf(fp, pos, "// %s", node->comment.text);
373 }
374 
375 /*********************************************************************/
376 /* RASM_NODE_LABEL */
377 
378 static void print_node_label(const RasmContext *rctx,
379  FILE *fp, int64_t *pos, int64_t line_start,
380  const RasmNode *node,
381  int *local_labels)
382 {
383  int id = node->label.id;
384  if (rctx->labels[id]) {
385  pos_fprintf(fp, pos, "%s:", rctx->labels[id]);
386  } else {
387  /* Local label. */
388  int local_id = local_labels[id];
389  if (local_id < 0) {
390  pos_fprintf(fp, pos, "%d:", -local_id);
391  } else {
392  pos_fprintf(fp, pos, "%d:", local_id);
393  local_labels[id] = -local_id;
394  }
395  }
396 }
397 
398 /*********************************************************************/
399 /* RASM_NODE_FUNCTION */
400 
401 static void print_node_function(const RasmContext *rctx,
402  FILE *fp, int64_t *pos, int64_t line_start,
403  const RasmNode *node)
404 {
405  pos_fprintf(fp, pos, "function %s, export=%d, jumpable=%d",
406  node->func.name, node->func.export, node->func.jumpable);
407 }
408 
409 /*********************************************************************/
410 /* RASM_NODE_ENDFUNC */
411 
412 static void print_node_endfunc(const RasmContext *rctx,
413  FILE *fp, int64_t *pos, int64_t line_start,
414  const RasmNode *node)
415 {
416  pos_fprintf(fp, pos, "endfunc");
417 }
418 
419 /*********************************************************************/
420 /* RASM_NODE_DIRECTIVE */
421 
422 static void print_node_directive(const RasmContext *rctx,
423  FILE *fp, int64_t *pos, int64_t line_start,
424  const RasmNode *node)
425 {
426  pos_fprintf(fp, pos, "%s", node->directive.text);
427 }
428 
429 /*********************************************************************/
430 int rasm_print(RasmContext *rctx, FILE *fp)
431 {
432  if (rctx->error)
433  return rctx->error;
434 
435  /* Helper array to assign numbers and track position of local labels. */
436  int *local_labels = NULL;
437  if (rctx->num_labels) {
438  local_labels = av_malloc(rctx->num_labels * sizeof(*local_labels));
439  if (!local_labels)
440  return AVERROR(ENOMEM);
441  }
442 
443  int64_t pos = 0;
444  for (int i = 0; i < rctx->num_entries; i++) {
445  const RasmEntry *entry = &rctx->entries[i];
446 
447  /* Assign numbers to local labels in this entry. */
448  if (rctx->num_labels) {
449  int local_label = 1;
450  memset(local_labels, 0x00, rctx->num_labels * sizeof(*local_labels));
451  for (const RasmNode *node = entry->start; node != NULL; node = node->next) {
452  if (node->type == RASM_NODE_LABEL) {
453  int id = node->label.id;
454  if (!rctx->labels[id])
455  local_labels[id] = local_label++;
456  }
457  }
458  }
459 
460  for (const RasmNode *node = entry->start; node != NULL; node = node->next) {
461  int64_t line_start = pos;
462 
463  switch (node->type) {
464  case RASM_NODE_INSN:
465  print_node_insn(rctx, fp, &pos, line_start, node, local_labels);
466  break;
467  case RASM_NODE_COMMENT:
468  print_node_comment(rctx, fp, &pos, line_start, node);
469  break;
470  case RASM_NODE_LABEL:
471  print_node_label(rctx, fp, &pos, line_start, node, local_labels);
472  break;
473  case RASM_NODE_FUNCTION:
474  print_node_function(rctx, fp, &pos, line_start, node);
475  break;
476  case RASM_NODE_ENDFUNC:
477  print_node_endfunc(rctx, fp, &pos, line_start, node);
478  break;
479  case RASM_NODE_DIRECTIVE:
480  print_node_directive(rctx, fp, &pos, line_start, node);
481  break;
482  default:
483  break;
484  }
485 
486  if (node->inline_comment) {
487  indent_to(fp, &pos, line_start, COMMENT_COL);
488  pos_fprintf(fp, &pos, "// %s", node->inline_comment);
489  }
490  pos_fprintf(fp, &pos, "\n");
491 
492  /* Add extra line after end of functions. */
493  if (node->type == RASM_NODE_ENDFUNC)
494  pos_fprintf(fp, &pos, "\n");
495  }
496  }
497 
498  av_freep(&local_labels);
499 
500  return 0;
501 }
AARCH64_INSN_MOVI
@ AARCH64_INSN_MOVI
Definition: rasm.h:273
AARCH64_COND_NE
#define AARCH64_COND_NE
Definition: rasm.h:319
RasmNode::label
RasmNodeLabel label
Definition: rasm.h:149
entry
#define entry
Definition: aom_film_grain_template.c:66
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AARCH64_INSN_SUBS
@ AARCH64_INSN_SUBS
Definition: rasm.h:287
AARCH64_INSN_FMAX
@ AARCH64_INSN_FMAX
Definition: rasm.h:257
RASM_NODE_DIRECTIVE
@ RASM_NODE_DIRECTIVE
Definition: rasm.h:116
RasmContext::entries
RasmEntry * entries
Definition: rasm.h:185
RASM_NODE_LABEL
@ RASM_NODE_LABEL
Definition: rasm.h:113
AARCH64_INSN_STR
@ AARCH64_INSN_STR
Definition: rasm.h:285
RasmContext::error
int error
Definition: rasm.h:191
AARCH64_INSN_LDRH
@ AARCH64_INSN_LDRH
Definition: rasm.h:270
int64_t
long long int64_t
Definition: coverity.c:34
elem_type_char
static char elem_type_char(uint8_t elem_size)
Definition: rasm_print.c:110
print_node_function
static void print_node_function(const RasmContext *rctx, FILE *fp, int64_t *pos, int64_t line_start, const RasmNode *node)
Definition: rasm_print.c:401
RASM_OP_LABEL
@ RASM_OP_LABEL
Definition: rasm.h:64
mode
Definition: swscale.c:59
print_op
static void print_op(const RasmContext *rctx, FILE *fp, int64_t *pos, const int *local_labels, RasmOp op)
Definition: rasm_print.c:237
AARCH64_INSN_USHLL
@ AARCH64_INSN_USHLL
Definition: rasm.h:295
AARCH64_INSN_USHL
@ AARCH64_INSN_USHL
Definition: rasm.h:294
a64op_vec_idx_p1
static uint8_t a64op_vec_idx_p1(RasmOp op)
Definition: rasm.h:377
AARCH64_INSN_SUB
@ AARCH64_INSN_SUB
Definition: rasm.h:286
INSTR_INDENT
#define INSTR_INDENT
Static file backend for the runtime assembler.
Definition: rasm_print.c:35
AARCH64_INSN_FCVTZU
@ AARCH64_INSN_FCVTZU
Definition: rasm.h:256
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
RASM_NODE_INSN
@ RASM_NODE_INSN
Definition: rasm.h:111
RasmNode
Definition: rasm.h:144
AARCH64_INSN_LD3
@ AARCH64_INSN_LD3
Definition: rasm.h:265
AARCH64_INSN_REV32
@ AARCH64_INSN_REV32
Definition: rasm.h:278
AARCH64_INSN_FMUL
@ AARCH64_INSN_FMUL
Definition: rasm.h:260
rasm_op_type
static uint8_t rasm_op_type(RasmOp op)
Definition: rasm.h:57
print_op_imm
static void print_op_imm(FILE *fp, int64_t *pos, RasmOp op)
Definition: rasm_print.c:60
AARCH64_INSN_UMAX
@ AARCH64_INSN_UMAX
Definition: rasm.h:291
a64op_vec_n
static uint8_t a64op_vec_n(RasmOp op)
Definition: rasm.h:373
AARCH64_COND_GE
#define AARCH64_COND_GE
Definition: rasm.h:330
cond_name
static const char * cond_name(uint8_t cond)
Definition: rasm_print.c:220
AARCH64_INSN_LDP
@ AARCH64_INSN_LDP
Definition: rasm.h:267
RasmOp
Runtime assembler for AArch64.
Definition: rasm.h:43
RasmContext::labels
char ** labels
Definition: rasm.h:187
AARCH64_COND_AL
#define AARCH64_COND_AL
Definition: rasm.h:334
AARCH64_BASE_POST
#define AARCH64_BASE_POST
Definition: rasm.h:480
AARCH64_INSN_ST2
@ AARCH64_INSN_ST2
Definition: rasm.h:281
AARCH64_INSN_UXTL2
@ AARCH64_INSN_UXTL2
Definition: rasm.h:299
RasmContext::num_labels
int num_labels
Definition: rasm.h:188
RasmNode::insn
RasmNodeInsn insn
Definition: rasm.h:147
AARCH64_INSN_RET
@ AARCH64_INSN_RET
Definition: rasm.h:276
rasm_op_imm_val
static int32_t rasm_op_imm_val(RasmOp op)
Definition: rasm.h:86
AARCH64_INSN_ORR
@ AARCH64_INSN_ORR
Definition: rasm.h:275
AARCH64_COND_NV
#define AARCH64_COND_NV
Definition: rasm.h:335
AARCH64_OP_GPR
@ AARCH64_OP_GPR
Definition: rasm.h:309
print_node_label
static void print_node_label(const RasmContext *rctx, FILE *fp, int64_t *pos, int64_t line_start, const RasmNode *node, int *local_labels)
Definition: rasm_print.c:378
AARCH64_COND_LT
#define AARCH64_COND_LT
Definition: rasm.h:331
print_op_label
static void print_op_label(const RasmContext *rctx, FILE *fp, int64_t *pos, RasmOp op, const int *local_labels)
Definition: rasm_print.c:68
AARCH64_INSN_UXTL
@ AARCH64_INSN_UXTL
Definition: rasm.h:298
RASM_OP_NONE
@ RASM_OP_NONE
Definition: rasm.h:62
op
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
Definition: anm.c:76
AARCH64_INSN_STP
@ AARCH64_INSN_STP
Definition: rasm.h:284
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:42
print_node_comment
static void print_node_comment(const RasmContext *rctx, FILE *fp, int64_t *pos, int64_t line_start, const RasmNode *node)
Definition: rasm_print.c:367
print_node_insn
static void print_node_insn(const RasmContext *rctx, FILE *fp, int64_t *pos, int64_t line_start, const RasmNode *node, const int *local_labels)
Definition: rasm_print.c:337
insn_names
static const char insn_names[AARCH64_INSN_NB][8]
Definition: rasm_print.c:268
AARCH64_INSN_NONE
@ AARCH64_INSN_NONE
Definition: rasm.h:244
AARCH64_COND_HI
#define AARCH64_COND_HI
Definition: rasm.h:328
print_base_reg
static void print_base_reg(FILE *fp, int64_t *pos, uint8_t n)
Definition: rasm_print.c:161
RasmNodeDirective::text
char * text
Definition: rasm.h:140
RasmNodeInsn::op
RasmOp op[4]
Definition: rasm.h:122
AARCH64_COND_LS
#define AARCH64_COND_LS
Definition: rasm.h:329
a64op_base_imm
static int16_t a64op_base_imm(RasmOp op)
Definition: rasm.h:491
RASM_NODE_ENDFUNC
@ RASM_NODE_ENDFUNC
Definition: rasm.h:115
AARCH64_COND_LE
#define AARCH64_COND_LE
Definition: rasm.h:333
RasmNode::func
RasmNodeFunc func
Definition: rasm.h:150
AARCH64_COND_PL
#define AARCH64_COND_PL
Definition: rasm.h:325
print_node_endfunc
static void print_node_endfunc(const RasmContext *rctx, FILE *fp, int64_t *pos, int64_t line_start, const RasmNode *node)
Definition: rasm_print.c:412
AARCH64_INSN_BR
@ AARCH64_INSN_BR
Definition: rasm.h:251
rasm.h
NULL
#define NULL
Definition: coverity.c:32
print_op_gpr
static void print_op_gpr(FILE *fp, int64_t *pos, RasmOp op)
Definition: rasm_print.c:89
AARCH64_INSN_LD1R
@ AARCH64_INSN_LD1R
Definition: rasm.h:263
AARCH64_INSN_TBL
@ AARCH64_INSN_TBL
Definition: rasm.h:288
AARCH64_INSN_MUL
@ AARCH64_INSN_MUL
Definition: rasm.h:274
RasmNodeFunc::jumpable
bool jumpable
Definition: rasm.h:136
RasmNode::comment
RasmNodeComment comment
Definition: rasm.h:148
insn_name
static const char * insn_name(int id)
Definition: rasm_print.c:328
print_op_base
static void print_op_base(FILE *fp, int64_t *pos, RasmOp op)
Definition: rasm_print.c:169
RASM_NODE_FUNCTION
@ RASM_NODE_FUNCTION
Definition: rasm.h:114
AARCH64_COND_HS
#define AARCH64_COND_HS
Definition: rasm.h:320
RasmEntry
Definition: rasm.h:172
AARCH64_INSN_LD1
@ AARCH64_INSN_LD1
Definition: rasm.h:262
AARCH64_COND_EQ
#define AARCH64_COND_EQ
Definition: rasm.h:318
AARCH64_INSN_AND
@ AARCH64_INSN_AND
Definition: rasm.h:249
RASM_OP_IMM
@ RASM_OP_IMM
Definition: rasm.h:63
AARCH64_INSN_ST3
@ AARCH64_INSN_ST3
Definition: rasm.h:282
AARCH64_INSN_ZIP1
@ AARCH64_INSN_ZIP1
Definition: rasm.h:301
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
AARCH64_INSN_ADDV
@ AARCH64_INSN_ADDV
Definition: rasm.h:247
a64op_base_n
static uint8_t a64op_base_n(RasmOp op)
Definition: rasm.h:492
AARCH64_INSN_UQXTN
@ AARCH64_INSN_UQXTN
Definition: rasm.h:293
RASM_NODE_COMMENT
@ RASM_NODE_COMMENT
Definition: rasm.h:112
RasmNodeFunc::name
char * name
Definition: rasm.h:134
size
int size
Definition: twinvq_data.h:10344
AARCH64_INSN_SHL
@ AARCH64_INSN_SHL
Definition: rasm.h:279
AARCH64_INSN_FMIN
@ AARCH64_INSN_FMIN
Definition: rasm.h:258
RasmNodeLabel::id
int id
Definition: rasm.h:130
AARCH64_INSN_FMLA
@ AARCH64_INSN_FMLA
Definition: rasm.h:259
AARCH64_INSN_CMP
@ AARCH64_INSN_CMP
Definition: rasm.h:252
print_node_directive
static void print_node_directive(const RasmContext *rctx, FILE *fp, int64_t *pos, int64_t line_start, const RasmNode *node)
Definition: rasm_print.c:422
AARCH64_INSN_XTN
@ AARCH64_INSN_XTN
Definition: rasm.h:300
AARCH64_INSN_ADD
@ AARCH64_INSN_ADD
Definition: rasm.h:246
a64op_vec_num_regs
static uint8_t a64op_vec_num_regs(RasmOp op)
Definition: rasm.h:376
a64op_vec_el_count
static uint8_t a64op_vec_el_count(RasmOp op)
Definition: rasm.h:374
av_malloc
#define av_malloc(s)
Definition: ops_asmgen.c:44
AARCH64_INSN_NB
@ AARCH64_INSN_NB
Definition: rasm.h:304
RasmContext
Definition: rasm.h:184
AARCH64_INSN_DUP
@ AARCH64_INSN_DUP
Definition: rasm.h:254
AARCH64_INSN_USHLL2
@ AARCH64_INSN_USHLL2
Definition: rasm.h:296
AARCH64_BASE_PRE
#define AARCH64_BASE_PRE
Definition: rasm.h:479
AARCH64_COND_GT
#define AARCH64_COND_GT
Definition: rasm.h:332
AARCH64_INSN_UBFIZ
@ AARCH64_INSN_UBFIZ
Definition: rasm.h:289
a64op_gpr_size
static uint8_t a64op_gpr_size(RasmOp op)
Definition: rasm.h:349
AARCH64_COND_LO
#define AARCH64_COND_LO
Definition: rasm.h:322
AARCH64_INSN_ZIP2
@ AARCH64_INSN_ZIP2
Definition: rasm.h:302
RasmContext::num_entries
int num_entries
Definition: rasm.h:186
AARCH64_INSN_LD2
@ AARCH64_INSN_LD2
Definition: rasm.h:264
RasmNodeInsn::id
int id
Definition: rasm.h:121
AARCH64_INSN_ST1
@ AARCH64_INSN_ST1
Definition: rasm.h:280
AARCH64_INSN_CSEL
@ AARCH64_INSN_CSEL
Definition: rasm.h:253
a64op_cond_val
static uint8_t a64op_cond_val(RasmOp op)
Definition: rasm.h:510
a64op_base_mode
static uint8_t a64op_base_mode(RasmOp op)
Definition: rasm.h:493
indent_to
static void indent_to(FILE *fp, int64_t *pos, int64_t line_start, int col)
Definition: rasm_print.c:51
AARCH64_INSN_INS
@ AARCH64_INSN_INS
Definition: rasm.h:261
a64op_vec_el_size
static uint8_t a64op_vec_el_size(RasmOp op)
Definition: rasm.h:375
RasmNodeComment::text
char * text
Definition: rasm.h:126
ret
ret
Definition: filter_design.txt:187
AARCH64_OP_BASE
@ AARCH64_OP_BASE
Definition: rasm.h:311
pos
unsigned int pos
Definition: spdifenc.c:414
AARCH64_OP_VEC
@ AARCH64_OP_VEC
Definition: rasm.h:310
id
enum AVCodecID id
Definition: dts2pts.c:549
cond_names
static const char cond_names[16][4]
Definition: rasm_print.c:201
print_op_cond
static void print_op_cond(FILE *fp, int64_t *pos, RasmOp op)
Definition: rasm_print.c:229
av_printf_format
av_printf_format(3, 4)
Definition: rasm_print.c:38
print_vec_reg
static void print_vec_reg(FILE *fp, int64_t *pos, uint8_t n, uint8_t el_count, uint8_t el_size, uint8_t idx_p1)
Definition: rasm_print.c:123
AARCH64_INSN_B
@ AARCH64_INSN_B
Definition: rasm.h:250
AARCH64_COND_VS
#define AARCH64_COND_VS
Definition: rasm.h:326
AARCH64_COND_MI
#define AARCH64_COND_MI
Definition: rasm.h:324
RasmNode::directive
RasmNodeDirective directive
Definition: rasm.h:151
AARCH64_INSN_FADD
@ AARCH64_INSN_FADD
Definition: rasm.h:255
AARCH64_INSN_ADR
@ AARCH64_INSN_ADR
Definition: rasm.h:248
AARCH64_OP_COND
@ AARCH64_OP_COND
Definition: rasm.h:312
RasmNodeFunc::export
bool export
Definition: rasm.h:135
AARCH64_INSN_UCVTF
@ AARCH64_INSN_UCVTF
Definition: rasm.h:290
rasm_print
int rasm_print(RasmContext *rctx, FILE *fp)
Definition: rasm_print.c:430
mem.h
AARCH64_INSN_LSR
@ AARCH64_INSN_LSR
Definition: rasm.h:271
AARCH64_INSN_USHR
@ AARCH64_INSN_USHR
Definition: rasm.h:297
AARCH64_INSN_MOV
@ AARCH64_INSN_MOV
Definition: rasm.h:272
AARCH64_INSN_ST4
@ AARCH64_INSN_ST4
Definition: rasm.h:283
AARCH64_INSN_REV16
@ AARCH64_INSN_REV16
Definition: rasm.h:277
AARCH64_BASE_OFFSET
#define AARCH64_BASE_OFFSET
Definition: rasm.h:478
AARCH64_INSN_LDRB
@ AARCH64_INSN_LDRB
Definition: rasm.h:269
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
rasm_op_label_id
static int rasm_op_label_id(RasmOp op)
Definition: rasm.h:102
COMMENT_COL
#define COMMENT_COL
Definition: rasm_print.c:36
AARCH64_INSN_UMIN
@ AARCH64_INSN_UMIN
Definition: rasm.h:292
AARCH64_INSN_LDR
@ AARCH64_INSN_LDR
Definition: rasm.h:268
AARCH64_COND_VC
#define AARCH64_COND_VC
Definition: rasm.h:327
print_op_vec
static void print_op_vec(FILE *fp, int64_t *pos, RasmOp op)
Definition: rasm_print.c:137
cond
int(* cond)(enum AVPixelFormat pix_fmt)
Definition: pixdesc_query.c:28
AARCH64_INSN_LD4
@ AARCH64_INSN_LD4
Definition: rasm.h:266
a64op_gpr_n
static uint8_t a64op_gpr_n(RasmOp op)
Definition: rasm.h:348