annotate gcc/ada/exp_fixd.ads @ 138:fc828634a951

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 08 Nov 2018 14:17:14 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- E X P _ F I X D --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- Expand routines for fixed-point convert, divide and multiply operations
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 with Types; use Types;
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 package Exp_Fixd is
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- General note on universal fixed. In the routines below, a fixed-point
kono
parents:
diff changeset
33 -- type is always a specific fixed-point type or universal real, never
kono
parents:
diff changeset
34 -- universal fixed. Universal fixed only appears as the result type of a
kono
parents:
diff changeset
35 -- division or multiplication and in all such cases, the parent node, which
kono
parents:
diff changeset
36 -- must be either a conversion node or a 'Round attribute reference node,
kono
parents:
diff changeset
37 -- has the specific type information. In both cases, the parent node is
kono
parents:
diff changeset
38 -- removed from the tree, and the appropriate routine in this package is
kono
parents:
diff changeset
39 -- called with a multiply or divide node with all types (and also possibly
kono
parents:
diff changeset
40 -- the Rounded_Result flag) set.
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 ----------------------------
kono
parents:
diff changeset
43 -- Fixed-Point Conversion --
kono
parents:
diff changeset
44 ----------------------------
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 procedure Expand_Convert_Fixed_To_Fixed (N : Node_Id);
kono
parents:
diff changeset
47 -- This routine expands the conversion of one fixed-point type to another,
kono
parents:
diff changeset
48 -- N is the N_Op_Conversion node with the result and expression types (and
kono
parents:
diff changeset
49 -- possibly the Rounded_Result flag) set.
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 procedure Expand_Convert_Fixed_To_Float (N : Node_Id);
kono
parents:
diff changeset
52 -- This routine expands the conversion from a fixed-point type to a
kono
parents:
diff changeset
53 -- floating-point type. N is an N_Type_Conversion node with the result
kono
parents:
diff changeset
54 -- and expression types set.
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 procedure Expand_Convert_Fixed_To_Integer (N : Node_Id);
kono
parents:
diff changeset
57 -- This routine expands the conversion from a fixed-point type to an
kono
parents:
diff changeset
58 -- integer type. N is an N_Type_Conversion node with the result and
kono
parents:
diff changeset
59 -- operand types set.
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 procedure Expand_Convert_Float_To_Fixed (N : Node_Id);
kono
parents:
diff changeset
62 -- This routine expands the conversion from a floating-point type to
kono
parents:
diff changeset
63 -- a fixed-point type. N is an N_Type_Conversion node with the result
kono
parents:
diff changeset
64 -- and operand types (and possibly the Rounded_Result flag) set.
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 procedure Expand_Convert_Integer_To_Fixed (N : Node_Id);
kono
parents:
diff changeset
67 -- This routine expands the conversion from an integer type to a
kono
parents:
diff changeset
68 -- fixed-point type. N is an N_Type_Conversion node with the result
kono
parents:
diff changeset
69 -- and operand types (and possibly the Rounded_Result flag) set.
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 --------------------------
kono
parents:
diff changeset
72 -- Fixed-Point Division --
kono
parents:
diff changeset
73 --------------------------
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 procedure Expand_Decimal_Divide_Call (N : Node_Id);
kono
parents:
diff changeset
76 -- This routine expands a call to the procedure Decimal.Divide. The
kono
parents:
diff changeset
77 -- argument N is the N_Function_Call node.
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 procedure Expand_Divide_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
kono
parents:
diff changeset
80 -- This routine expands the division between fixed-point types, with
kono
parents:
diff changeset
81 -- a fixed-point type result. N is an N_Op_Divide node with operand
kono
parents:
diff changeset
82 -- and result types (and possibly the Rounded_Result flag) set. Either
kono
parents:
diff changeset
83 -- (but not both) of the operands may be universal real.
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 procedure Expand_Divide_Fixed_By_Fixed_Giving_Float (N : Node_Id);
kono
parents:
diff changeset
86 -- This routine expands the division between two fixed-point types with
kono
parents:
diff changeset
87 -- a floating-point result. N is an N_Op_Divide node with the result
kono
parents:
diff changeset
88 -- and operand types set. Either (but not both) of the operands may be
kono
parents:
diff changeset
89 -- universal real.
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 procedure Expand_Divide_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
kono
parents:
diff changeset
92 -- This routine expands the division between two fixed-point types with
kono
parents:
diff changeset
93 -- an integer type result. N is an N_Op_Divide node with the result and
kono
parents:
diff changeset
94 -- operand types set. Either (but not both) of the operands may be
kono
parents:
diff changeset
95 -- universal real.
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 procedure Expand_Divide_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
kono
parents:
diff changeset
98 -- This routine expands the division between a fixed-point type and
kono
parents:
diff changeset
99 -- standard integer type. The result type is the same fixed-point type
kono
parents:
diff changeset
100 -- as the operand type. N is an N_Op_Divide node with the result and
kono
parents:
diff changeset
101 -- left operand types being the fixed-point type, and the right operand
kono
parents:
diff changeset
102 -- type being standard integer (and possibly Rounded_Result set).
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 --------------------------------
kono
parents:
diff changeset
105 -- Fixed-Point Multiplication --
kono
parents:
diff changeset
106 --------------------------------
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 procedure Expand_Multiply_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
kono
parents:
diff changeset
109 -- This routine expands the multiplication between fixed-point types
kono
parents:
diff changeset
110 -- with a fixed-point type result. N is an N_Op_Multiply node with the
kono
parents:
diff changeset
111 -- result and operand types set. Either (but not both) of the operands
kono
parents:
diff changeset
112 -- may be universal real.
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 procedure Expand_Multiply_Fixed_By_Fixed_Giving_Float (N : Node_Id);
kono
parents:
diff changeset
115 -- This routine expands the multiplication between two fixed-point types
kono
parents:
diff changeset
116 -- with a floating-point result. N is an N_Op_Multiply node with the
kono
parents:
diff changeset
117 -- result and operand types set. Either (but not both) of the operands
kono
parents:
diff changeset
118 -- may be universal real.
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 procedure Expand_Multiply_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
kono
parents:
diff changeset
121 -- This routine expands the multiplication between two fixed-point types
kono
parents:
diff changeset
122 -- with an integer result. N is an N_Op_Multiply node with the result
kono
parents:
diff changeset
123 -- and operand types set. Either (but not both) of the operands may be
kono
parents:
diff changeset
124 -- be universal real.
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 procedure Expand_Multiply_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
kono
parents:
diff changeset
127 -- This routine expands the multiplication between a fixed-point type and
kono
parents:
diff changeset
128 -- a standard integer type. The result type is the same fixed-point type
kono
parents:
diff changeset
129 -- as the fixed operand type. N is an N_Op_Multiply node whose result type
kono
parents:
diff changeset
130 -- and left operand types are the fixed-point type, and whose right operand
kono
parents:
diff changeset
131 -- type is always standard integer.
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 procedure Expand_Multiply_Integer_By_Fixed_Giving_Fixed (N : Node_Id);
kono
parents:
diff changeset
134 -- This routine expands the multiplication between standard integer and a
kono
parents:
diff changeset
135 -- fixed-point type. The result type is the same fixed-point type as the
kono
parents:
diff changeset
136 -- fixed operand type. N is an N_Op_Multiply node whose result type
kono
parents:
diff changeset
137 -- and right operand types are the fixed-point type, and whose left operand
kono
parents:
diff changeset
138 -- type is always standard integer.
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 end Exp_Fixd;