gcc:
[official-gcc.git] / gcc / ada / exp_fixd.ads
blob01207e2dc6c6fb69f987815f077258419cc644d1
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- E X P _ F I X D --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- Expand routines for fixed-point convert, divide and multiply operations
29 with Types; use Types;
31 package Exp_Fixd is
33 -- General note on universal fixed. In the routines below, a fixed-point
34 -- type is always a specific fixed-point type or universal real, never
35 -- universal fixed. Universal fixed only appears as the result type of a
36 -- division or multplication and in all such cases, the parent node, which
37 -- must be either a conversion node or a 'Round attribute reference node,
38 -- has the specific type information. In both cases, the parent node is
39 -- removed from the tree, and the appropriate routine in this package is
40 -- called with a multiply or divide node with all types (and also possibly
41 -- the Rounded_Result flag) set.
43 ----------------------------
44 -- Fixed-Point Conversion --
45 ----------------------------
47 procedure Expand_Convert_Fixed_To_Fixed (N : Node_Id);
48 -- This routine expands the conversion of one fixed-point type to another,
49 -- N is the N_Op_Conversion node with the result and expression types (and
50 -- possibly the Rounded_Result flag) set.
52 procedure Expand_Convert_Fixed_To_Float (N : Node_Id);
53 -- This routine expands the conversion from a fixed-point type to a
54 -- floating-point type. N is an N_Type_Conversion node with the result
55 -- and expression types set.
57 procedure Expand_Convert_Fixed_To_Integer (N : Node_Id);
58 -- This routine expands the conversion from a fixed-point type to an
59 -- integer type. N is an N_Type_Conversion node with the result and
60 -- operand types set.
62 procedure Expand_Convert_Float_To_Fixed (N : Node_Id);
63 -- This routine expands the conversion from a floating-point type to
64 -- a fixed-point type. N is an N_Type_Conversion node with the result
65 -- and operand types (and possibly the Rounded_Result flag) set.
67 procedure Expand_Convert_Integer_To_Fixed (N : Node_Id);
68 -- This routine expands the conversion from an integer type to a
69 -- fixed-point type. N is an N_Type_Conversion node with the result
70 -- and operand types (and possibly the Rounded_Result flag) set.
72 --------------------------
73 -- Fixed-Point Division --
74 --------------------------
76 procedure Expand_Decimal_Divide_Call (N : Node_Id);
77 -- This routine expands a call to the procedure Decimal.Divide. The
78 -- argument N is the N_Function_Call node.
80 procedure Expand_Divide_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
81 -- This routine expands the division between fixed-point types, with
82 -- a fixed-point type result. N is an N_Op_Divide node with operand
83 -- and result types (and possibly the Rounded_Result flag) set. Either
84 -- (but not both) of the operands may be universal real.
86 procedure Expand_Divide_Fixed_By_Fixed_Giving_Float (N : Node_Id);
87 -- This routine expands the division between two fixed-point types with
88 -- a floating-point result. N is an N_Op_Divide node with the result
89 -- and operand types set. Either (but not both) of the operands may be
90 -- universal real.
92 procedure Expand_Divide_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
93 -- This routine expands the division between two fixed-point types with
94 -- an integer type result. N is an N_Op_Divide node with the result and
95 -- operand types set. Either (but not both) of the operands may be
96 -- universal real.
98 procedure Expand_Divide_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
99 -- This routine expands the division between a fixed-point type and
100 -- standard integer type. The result type is the same fixed-point type
101 -- as the operand type. N is an N_Op_Divide node with the result and
102 -- left operand types being the fixed-point type, and the right operand
103 -- type being standard integer (and possibly Rounded_Result set).
105 --------------------------------
106 -- Fixed-Point Multiplication --
107 --------------------------------
109 procedure Expand_Multiply_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
110 -- This routine expands the multiplication between fixed-point types
111 -- with a fixed-point type result. N is an N_Op_Multiply node with the
112 -- result and operand types set. Either (but not both) of the operands
113 -- may be universal real.
115 procedure Expand_Multiply_Fixed_By_Fixed_Giving_Float (N : Node_Id);
116 -- This routine expands the multiplication between two fixed-point types
117 -- with a floating-point result. N is an N_Op_Multiply node with the
118 -- result and operand types set. Either (but not both) of the operands
119 -- may be universal real.
121 procedure Expand_Multiply_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
122 -- This routine expands the multiplication between two fixed-point types
123 -- with an integer result. N is an N_Op_Multiply node with the result
124 -- and operand types set. Either (but not both) of the operands may be
125 -- be universal real.
127 procedure Expand_Multiply_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
128 -- This routine expands the multiplication between a fixed-point type and
129 -- a standard integer type. The result type is the same fixed-point type
130 -- as the fixed operand type. N is an N_Op_Multiply node whose result type
131 -- and left operand types are the fixed-point type, and whose right operand
132 -- type is always standard integer.
134 procedure Expand_Multiply_Integer_By_Fixed_Giving_Fixed (N : Node_Id);
135 -- This routine expands the multiplication between standard integer and a
136 -- fixed-point type. The result type is the same fixed-point type as the
137 -- the fixed operand type. N is an N_Op_Multiply node whose result type
138 -- and right operand types are the fixed-point type, and whose left operand
139 -- type is always standard integer.
141 end Exp_Fixd;