1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- GNAT was originally developed by the GNAT team at New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
27 ------------------------------------------------------------------------------
29 -- Expand routines for fixed-point convert, divide and multiply operations
31 with Types; use Types;
35 -- General note on universal fixed. In the routines below, a fixed-point
36 -- type is always a specific fixed-point type or universal real, never
37 -- universal fixed. Universal fixed only appears as the result type of a
38 -- division or multplication and in all such cases, the parent node, which
39 -- must be either a conversion node or a 'Round attribute reference node,
40 -- has the specific type information. In both cases, the parent node is
41 -- removed from the tree, and the appropriate routine in this package is
42 -- called with a multiply or divide node with all types (and also possibly
43 -- the Rounded_Result flag) set.
45 ----------------------------
46 -- Fixed-Point Conversion --
47 ----------------------------
49 procedure Expand_Convert_Fixed_To_Fixed (N : Node_Id);
50 -- This routine expands the conversion of one fixed-point type to another,
51 -- N is the N_Op_Conversion node with the result and expression types (and
52 -- possibly the Rounded_Result flag) set.
54 procedure Expand_Convert_Fixed_To_Float (N : Node_Id);
55 -- This routine expands the conversion from a fixed-point type to a
56 -- floating-point type. N is an N_Type_Conversion node with the result
57 -- and expression types set.
59 procedure Expand_Convert_Fixed_To_Integer (N : Node_Id);
60 -- This routine expands the conversion from a fixed-point type to an
61 -- integer type. N is an N_Type_Conversion node with the result and
64 procedure Expand_Convert_Float_To_Fixed (N : Node_Id);
65 -- This routine expands the conversion from a floating-point type to
66 -- a fixed-point type. N is an N_Type_Conversion node with the result
67 -- and operand types (and possibly the Rounded_Result flag) set.
69 procedure Expand_Convert_Integer_To_Fixed (N : Node_Id);
70 -- This routine expands the conversion from an integer type to a
71 -- fixed-point type. N is an N_Type_Conversion node with the result
72 -- and operand types (and possibly the Rounded_Result flag) set.
74 --------------------------
75 -- Fixed-Point Division --
76 --------------------------
78 procedure Expand_Decimal_Divide_Call (N : Node_Id);
79 -- This routine expands a call to the procedure Decimal.Divide. The
80 -- argument N is the N_Function_Call node.
82 procedure Expand_Divide_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
83 -- This routine expands the division between fixed-point types, with
84 -- a fixed-point type result. N is an N_Op_Divide node with operand
85 -- and result types (and possibly the Rounded_Result flag) set. Either
86 -- (but not both) of the operands may be universal real.
88 procedure Expand_Divide_Fixed_By_Fixed_Giving_Float (N : Node_Id);
89 -- This routine expands the division between two fixed-point types with
90 -- a floating-point result. N is an N_Op_Divide node with the result
91 -- and operand types set. Either (but not both) of the operands may be
94 procedure Expand_Divide_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
95 -- This routine expands the division between two fixed-point types with
96 -- an integer type result. N is an N_Op_Divide node with the result and
97 -- operand types set. Either (but not both) of the operands may be
100 procedure Expand_Divide_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
101 -- This routine expands the division between a fixed-point type and
102 -- standard integer type. The result type is the same fixed-point type
103 -- as the operand type. N is an N_Op_Divide node with the result and
104 -- left operand types being the fixed-point type, and the right operand
105 -- type being standard integer (and possibly Rounded_Result set).
107 --------------------------------
108 -- Fixed-Point Multiplication --
109 --------------------------------
111 procedure Expand_Multiply_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
112 -- This routine expands the multiplication between fixed-point types
113 -- with a fixed-point type result. N is an N_Op_Multiply node with the
114 -- result and operand types set. Either (but not both) of the operands
115 -- may be universal real.
117 procedure Expand_Multiply_Fixed_By_Fixed_Giving_Float (N : Node_Id);
118 -- This routine expands the multiplication between two fixed-point types
119 -- with a floating-point result. N is an N_Op_Multiply node with the
120 -- result and operand types set. Either (but not both) of the operands
121 -- may be universal real.
123 procedure Expand_Multiply_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
124 -- This routine expands the multiplication between two fixed-point types
125 -- with an integer result. N is an N_Op_Multiply node with the result
126 -- and operand types set. Either (but not both) of the operands may be
127 -- be universal real.
129 procedure Expand_Multiply_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
130 -- This routine expands the multiplication between a fixed-point type and
131 -- a standard integer type. The result type is the same fixed-point type
132 -- as the fixed operand type. N is an N_Op_Multiply node whose result type
133 -- and left operand types are the fixed-point type, and whose right operand
134 -- type is always standard integer.
136 procedure Expand_Multiply_Integer_By_Fixed_Giving_Fixed (N : Node_Id);
137 -- This routine expands the multiplication between standard integer and a
138 -- fixed-point type. The result type is the same fixed-point type as the
139 -- the fixed operand type. N is an N_Op_Multiply node whose result type
140 -- and right operand types are the fixed-point type, and whose left operand
141 -- type is always standard integer.