annotate gcc/config/tilegx/tilegx-multiply.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Header for constant multiple table for TILE-Gx.
kono
parents:
diff changeset
2 Copyright (C) 2011-2017 Free Software Foundation, Inc.
kono
parents:
diff changeset
3 Contributed by Walter Lee (walt@tilera.com)
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 This file is part of GCC.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify it
kono
parents:
diff changeset
8 under the terms of the GNU General Public License as published
kono
parents:
diff changeset
9 by the Free Software Foundation; either version 3, or (at your
kono
parents:
diff changeset
10 option) any later version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful, but WITHOUT
kono
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
kono
parents:
diff changeset
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
kono
parents:
diff changeset
15 License for more details.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 #ifndef GCC_TILEGX_MULTIPLY_H
kono
parents:
diff changeset
22 #define GCC_TILEGX_MULTIPLY_H
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 /* A node of a tilegx_multiply_insn_seq, corresponding to a single
kono
parents:
diff changeset
25 machine instruction such as 'add', 's1a', or an shl by a constant. */
kono
parents:
diff changeset
26 struct tilegx_multiply_insn_seq_entry
kono
parents:
diff changeset
27 {
kono
parents:
diff changeset
28 /* Which operation this node performs (e.g. an add or sub).
kono
parents:
diff changeset
29 Don't use this directly, call get_opcode() table to get a insn_code. */
kono
parents:
diff changeset
30 unsigned char compressed_opcode;
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 /* The left-hand side of this expression tree.
kono
parents:
diff changeset
33 If equal to 0, it refers to 'zero'.
kono
parents:
diff changeset
34 If equal to 1, it refers to the original input to the multiply operation.
kono
parents:
diff changeset
35 Otherwise, subtract two and it is an index into the containing
kono
parents:
diff changeset
36 tilegx_multiply_insn_seq's 'op' array. Since it can only point to some
kono
parents:
diff changeset
37 value that has already been computed it will always point to an
kono
parents:
diff changeset
38 earlier entry in the array. */
kono
parents:
diff changeset
39 unsigned char lhs;
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 /* This is like lhs, but for the right-hand side. However, for shift
kono
parents:
diff changeset
42 opcodes this is a shift count rather than an operand index. */
kono
parents:
diff changeset
43 unsigned char rhs;
kono
parents:
diff changeset
44 };
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 /* Maximum size of op array. */
kono
parents:
diff changeset
47 #define tilegx_multiply_insn_seq_MAX_OPERATIONS 4
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 /* This defines a DAG describing how to multiply by a constant in
kono
parents:
diff changeset
50 terms of one or more machine instructions. */
kono
parents:
diff changeset
51 struct tilegx_multiply_insn_seq
kono
parents:
diff changeset
52 {
kono
parents:
diff changeset
53 /* The constant factor by which this expression tree multiplies its input. */
kono
parents:
diff changeset
54 long long multiplier;
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 /* The nodes of the parse tree. These are ordered so that instructions
kono
parents:
diff changeset
57 can be emitted in the same order that they appear in this array.
kono
parents:
diff changeset
58 Entry entry in this array can only refer to earlier entries in
kono
parents:
diff changeset
59 the array. */
kono
parents:
diff changeset
60 struct tilegx_multiply_insn_seq_entry
kono
parents:
diff changeset
61 op[tilegx_multiply_insn_seq_MAX_OPERATIONS];
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 };
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 /* A mapping from the compressed opcode to the corresponding enum
kono
parents:
diff changeset
66 insn_code. */
kono
parents:
diff changeset
67 extern const enum insn_code tilegx_multiply_insn_seq_decode_opcode[];
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 /* Table mapping constant int multipliers to an expression
kono
parents:
diff changeset
70 tree that efficiently performs that multiplication.
kono
parents:
diff changeset
71 This is sorted by its 'multiplier' field so a binary search
kono
parents:
diff changeset
72 can look for matches. */
kono
parents:
diff changeset
73 extern const struct tilegx_multiply_insn_seq tilegx_multiply_insn_seq_table[];
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 /* The number of elements in multiply_insn_seq_table. */
kono
parents:
diff changeset
76 extern const int tilegx_multiply_insn_seq_table_size;
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 #endif /* !GCC_TILEGX_MULTIPLY_H */