aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.3/gcc/ada/exp_fixd.ads
blob: c1dc847a2c2ca48a049570a55c4da44251e453dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
------------------------------------------------------------------------------
--                                                                          --
--                         GNAT COMPILER COMPONENTS                         --
--                                                                          --
--                             E X P _ F I X D                              --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
--          Copyright (C) 1992-2008, Free Software Foundation, Inc.         --
--                                                                          --
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
-- for  more details.  You should have  received  a copy of the GNU General --
-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license.          --
--                                                                          --
-- GNAT was originally developed  by the GNAT team at  New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
--                                                                          --
------------------------------------------------------------------------------

--  Expand routines for fixed-point convert, divide and multiply operations

with Types; use Types;

package Exp_Fixd is

   --  General note on universal fixed. In the routines below, a fixed-point
   --  type is always a specific fixed-point type or universal real, never
   --  universal fixed. Universal fixed only appears as the result type of a
   --  division or multiplication and in all such cases, the parent node, which
   --  must be either a conversion node or a 'Round attribute reference node,
   --  has the specific type information. In both cases, the parent node is
   --  removed from the tree, and the appropriate routine in this package is
   --  called with a multiply or divide node with all types (and also possibly
   --  the Rounded_Result flag) set.

   ----------------------------
   -- Fixed-Point Conversion --
   ----------------------------

   procedure Expand_Convert_Fixed_To_Fixed (N : Node_Id);
   --  This routine expands the conversion of one fixed-point type to another,
   --  N is the N_Op_Conversion node with the result and expression types (and
   --  possibly the Rounded_Result flag) set.

   procedure Expand_Convert_Fixed_To_Float (N : Node_Id);
   --  This routine expands the conversion from a fixed-point type to a
   --  floating-point type. N is an N_Type_Conversion node with the result
   --  and expression types set.

   procedure Expand_Convert_Fixed_To_Integer (N : Node_Id);
   --  This routine expands the conversion from a fixed-point type to an
   --  integer type. N is an N_Type_Conversion node with the result and
   --  operand types set.

   procedure Expand_Convert_Float_To_Fixed (N : Node_Id);
   --  This routine expands the conversion from a floating-point type to
   --  a fixed-point type. N is an N_Type_Conversion node with the result
   --  and operand types (and possibly the Rounded_Result flag) set.

   procedure Expand_Convert_Integer_To_Fixed (N : Node_Id);
   --  This routine expands the conversion from an integer type to a
   --  fixed-point type. N is an N_Type_Conversion node with the result
   --  and operand types (and possibly the Rounded_Result flag) set.

   --------------------------
   -- Fixed-Point Division --
   --------------------------

   procedure Expand_Decimal_Divide_Call (N : Node_Id);
   --  This routine expands a call to the procedure Decimal.Divide. The
   --  argument N is the N_Function_Call node.

   procedure Expand_Divide_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
   --  This routine expands the division between fixed-point types, with
   --  a fixed-point type result. N is an N_Op_Divide node with operand
   --  and result types (and possibly the Rounded_Result flag) set. Either
   --  (but not both) of the operands may be universal real.

   procedure Expand_Divide_Fixed_By_Fixed_Giving_Float (N : Node_Id);
   --  This routine expands the division between two fixed-point types with
   --  a floating-point result. N is an N_Op_Divide node with the result
   --  and operand types set. Either (but not both) of the operands may be
   --  universal real.

   procedure Expand_Divide_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
   --  This routine expands the division between two fixed-point types with
   --  an integer type result. N is an N_Op_Divide node with the result and
   --  operand types set. Either (but not both) of the operands may be
   --  universal real.

   procedure Expand_Divide_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
   --  This routine expands the division between a fixed-point type and
   --  standard integer type. The result type is the same fixed-point type
   --  as the operand type. N is an N_Op_Divide node with the result and
   --  left operand types being the fixed-point type, and the right operand
   --  type being standard integer (and possibly Rounded_Result set).

   --------------------------------
   -- Fixed-Point Multiplication --
   --------------------------------

   procedure Expand_Multiply_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
   --  This routine expands the multiplication between fixed-point types
   --  with a fixed-point type result. N is an N_Op_Multiply node with the
   --  result and operand types set. Either (but not both) of the operands
   --  may be universal real.

   procedure Expand_Multiply_Fixed_By_Fixed_Giving_Float (N : Node_Id);
   --  This routine expands the multiplication between two fixed-point types
   --  with a floating-point result. N is an N_Op_Multiply node with the
   --  result and operand types set. Either (but not both) of the operands
   --  may be universal real.

   procedure Expand_Multiply_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
   --  This routine expands the multiplication between two fixed-point types
   --  with an integer result. N is an N_Op_Multiply node with the result
   --  and operand types set. Either (but not both) of the operands may be
   --  be universal real.

   procedure Expand_Multiply_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
   --  This routine expands the multiplication between a fixed-point type and
   --  a standard integer type. The result type is the same fixed-point type
   --  as the fixed operand type. N is an N_Op_Multiply node whose result type
   --  and left operand types are the fixed-point type, and whose right operand
   --  type is always standard integer.

   procedure Expand_Multiply_Integer_By_Fixed_Giving_Fixed (N : Node_Id);
   --  This routine expands the multiplication between standard integer and a
   --  fixed-point type. The result type is the same fixed-point type as the
   --  fixed operand type. N is an N_Op_Multiply node whose result type
   --  and right operand types are the fixed-point type, and whose left operand
   --  type is always standard integer.

end Exp_Fixd;