2014-03-25 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / config / tilepro / tilepro-multiply.h
blobb4012393ede36d797bce9e7b833f25a50a4a05c5
1 /* Header for constant multiple table for TILEPro.
2 Copyright (C) 2011-2014 Free Software Foundation, Inc.
3 Contributed by Walter Lee (walt@tilera.com)
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 3, or (at your
10 option) any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef GCC_TILEPRO_MULTIPLY_H
22 #define GCC_TILEPRO_MULTIPLY_H
24 /* A node of a tilepro_multiply_insn_seq, corresponding to a single
25 machine instruction such as 'add', 's1a', or an shl by a
26 constant. */
27 struct tilepro_multiply_insn_seq_entry
29 /* Which operation this node performs (e.g. an add or sub). Don't
30 use this directly, call get_opcode() table to get a
31 insn_code. */
32 unsigned char compressed_opcode;
34 /* The left-hand side of this expression tree.
35 If equal to 0, it refers to 'zero'.
36 If equal to 1, it refers to the original input to the multiply
37 operation.
38 Otherwise, subtract two and it is an index into the containing
39 tilepro_multiply_insn_seq's 'op' array. Since it can only point
40 to some value that has already been computed it will always point
41 to an earlier entry in the array. */
42 unsigned char lhs;
44 /* This is like lhs, but for the right-hand side. However, for shift
45 opcodes this is a shift count rather than an operand index. */
46 unsigned char rhs;
49 /* Maximum size of op array. */
50 #define tilepro_multiply_insn_seq_MAX_OPERATIONS 4
52 /* This defines a DAG describing how to multiply by a constant in
53 terms of one or more machine instructions. */
54 struct tilepro_multiply_insn_seq
56 /* The constant factor by which this expression tree multiplies its
57 input. */
58 int multiplier;
60 /* The nodes of the parse tree. These are ordered so that
61 instructions can be emitted in the same order that they appear in
62 this array. Entry entry in this array can only refer to earlier
63 entries in the array. */
64 struct tilepro_multiply_insn_seq_entry
65 op[tilepro_multiply_insn_seq_MAX_OPERATIONS];
69 /* A mapping from the compressed opcode to the corresponding enum
70 insn_code. */
71 extern const enum insn_code tilepro_multiply_insn_seq_decode_opcode[];
73 /* Table mapping constant int multipliers to an expression tree that
74 efficiently performs that multiplication. This is sorted by its
75 'multiplier' field so a binary search can look for matches. */
76 extern const struct tilepro_multiply_insn_seq
77 tilepro_multiply_insn_seq_table[];
79 /* The number of elements in multiply_insn_seq_table. */
80 extern const int tilepro_multiply_insn_seq_table_size;
82 #endif /* !GCC_TILEPRO_MULTIPLY_H */